From f4926f7ab1fa9d1f7d1a0d6b1183ebf66e9b8699 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Thu, 25 Jun 2020 17:10:06 +0900 Subject: [PATCH] Add comments to exclude in coverage Change-Id: I7872dc2669154e77c43d522e04259b434bcad2a1 Signed-off-by: lokilee73 --- src/battery.c | 4 ++++ src/booting-internal.c | 2 ++ src/callback.c | 18 ++++++++++++------ src/common.c | 18 ++++++++++++++++++ src/dbus.c | 11 +++++++---- src/display.c | 10 ++++++---- src/ir.c | 4 +++- src/pmqos.c | 3 ++- src/power.c | 4 ++++ src/temperature.c | 6 +++++- src/touchscreen-internal.c | 2 ++ 11 files changed, 65 insertions(+), 17 deletions(-) diff --git a/src/battery.c b/src/battery.c index 1ce8139..de0d687 100644 --- a/src/battery.c +++ b/src/battery.c @@ -39,11 +39,15 @@ static int is_battery_supported(void) ret = system_info_get_platform_bool(BATTERY_FEATURE, &battery_avail); if (ret < 0) { +//LCOV_EXCL_START System Error _E("Failed to get value of battery feature"); return false; +//LCOV_EXCL_STOP } else if (ret == 0 && !battery_avail) { +//LCOV_EXCL_START System Error _D("Battery is not supported"); return false; +//LCOV_EXCL_STOP } else return true; } diff --git a/src/booting-internal.c b/src/booting-internal.c index a8a8afe..8aefed4 100644 --- a/src/booting-internal.c +++ b/src/booting-internal.c @@ -22,6 +22,7 @@ #define BOOT_SO_PATH "/usr/lib/deviced/boot.so" +//LCOV_EXCL_START Not used function int device_get_reboot_mode(void) { int (*get_reboot_mode) (void); @@ -48,3 +49,4 @@ int device_get_reboot_mode(void) return ret; } +//LCOV_EXCL_STOP diff --git a/src/callback.c b/src/callback.c index f4d7d45..71d821e 100644 --- a/src/callback.c +++ b/src/callback.c @@ -175,9 +175,11 @@ static int register_signal(const char *bus_name, conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (!conn) { - _E("fail to get dbus connection : %s", err->message); //LCOV_EXCL_LINE - g_clear_error(&err); //LCOV_EXCL_LINE System Error +//LCOV_EXCL_START System Error + _E("fail to get dbus connection : %s", err->message); + g_clear_error(&err); return -EPERM; +//LCOV_EXCL_STOP } /* subscribe signal */ @@ -192,8 +194,10 @@ static int register_signal(const char *bus_name, NULL, NULL); if (id == 0) { - _E("fail to connect %s signal", signal); //LCOV_EXCL_LINE +//LCOV_EXCL_START System Error + _E("fail to connect %s signal", signal); return -EPERM; +//LCOV_EXCL_STOP } if (sig_id) @@ -212,9 +216,11 @@ static int unregister_signal(int *sig_id) conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (!conn) { - _E("fail to get dbus connection : %s", err->message); //LCOV_EXCL_LINE - g_clear_error(&err); //LCOV_EXCL_LINE System Error +//LCOV_EXCL_START System Error + _E("fail to get dbus connection : %s", err->message); + g_clear_error(&err); return -EPERM; +//LCOV_EXCL_STOP } /* unsubscribe signal */ @@ -355,7 +361,7 @@ int device_remove_callback(device_callback_e type, device_changed_cb cb) if (n == 0) { ret = release_request(type); if (ret < 0) - return DEVICE_ERROR_OPERATION_FAILED; + return DEVICE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } return DEVICE_ERROR_NONE; diff --git a/src/common.c b/src/common.c index b455fef..c503bb2 100644 --- a/src/common.c +++ b/src/common.c @@ -59,8 +59,10 @@ int config_parse(const char *file_name, int cb(struct parse_result *result, int lineno = 0, ret = 0; if (!file_name || !cb) { +//LCOV_EXCL_START System Error ret = -EINVAL; goto error; +//LCOV_EXCL_STOP } /* open conf file */ @@ -94,8 +96,10 @@ int config_parse(const char *file_name, int cb(struct parse_result *result, /* parse section */ end = strchr(start, ']'); if (!end || *end != ']') { +//LCOV_EXCL_START System Error ret = -EBADMSG; goto error; +//LCOV_EXCL_STOP } *end = '\0'; @@ -105,8 +109,10 @@ int config_parse(const char *file_name, int cb(struct parse_result *result, /* parse name & value */ end = strchr(start, '='); if (!end || *end != '=') { +//LCOV_EXCL_START System Error ret = -EBADMSG; goto error; +//LCOV_EXCL_STOP } *end = '\0'; name = trim_str(start); @@ -123,8 +129,10 @@ int config_parse(const char *file_name, int cb(struct parse_result *result, /* callback with parse result */ ret = cb(&result, user_data); if (ret < 0) { +//LCOV_EXCL_START System Error ret = -EBADMSG; goto error; +//LCOV_EXCL_STOP } } } @@ -217,6 +225,7 @@ int check_async_call_rate(void) return 0; } +//LCOV_EXCL_START Not used function bool is_emulator(void) { int ret; @@ -241,6 +250,7 @@ bool is_emulator(void) return emul; } +//LCOV_EXCL_STOP int is_display_supported(void) { @@ -249,11 +259,15 @@ int is_display_supported(void) ret = system_info_get_platform_bool(DISPLAY_FEATURE, &display_avail); if (ret < 0) { +//LCOV_EXCL_START System Error _E("Failed to get value of display feature"); return false; +//LCOV_EXCL_STOP } else if (ret == 0 && !display_avail) { +//LCOV_EXCL_START System Error _D("Display feature is not supported"); return false; +//LCOV_EXCL_STOP } else return true; } @@ -265,11 +279,15 @@ int is_display_state_supported(void) ret = system_info_get_platform_bool(DISPLAY_STATE_FEATURE, &display_state_avail); if (ret < 0) { +//LCOV_EXCL_START System Error _E("Failed to get value of display state feature"); return false; +//LCOV_EXCL_STOP } else if (ret == 0 && !display_state_avail) { +//LCOV_EXCL_START System Error _D("Display state feature is not supported"); return false; +//LCOV_EXCL_STOP } else return true; } diff --git a/src/dbus.c b/src/dbus.c index 08869af..1a28ffb 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -185,8 +185,8 @@ static GDBusProxy *get_proxy_from_proxy_pool(const char *dest, g_set_error(err, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "Cannot determine destination address"); -//LCOV_EXCL_STOP return NULL; +//LCOV_EXCL_STOP } /* find matched proxy node in proxy pool */ @@ -432,9 +432,10 @@ int dbus_method_async_with_reply_var(const char *dest, const char *path, pdata = malloc(sizeof(struct pending_call_data)); if (!pdata) { pthread_mutex_unlock(&dmutex); - _E("malloc error : %s.%s", //LCOV_EXCL_LINE - interface, method); +//LCOV_EXCL_START System Error + _E("malloc error : %s.%s", interface, method); return -ENOMEM; +//LCOV_EXCL_STOP } pdata->func = cb; @@ -526,8 +527,10 @@ int register_signal_handler(void) g_object_unref(conn); if (haptic_id == 0) { - _E("Failed to subscrive bus signal"); //LCOV_EXCL_LINE System Error +//LCOV_EXCL_START System Error + _E("Failed to subscrive bus signal"); return -EPERM; +//LCOV_EXCL_STOP } return 0; diff --git a/src/display.c b/src/display.c index 6be39bb..a5e1267 100644 --- a/src/display.c +++ b/src/display.c @@ -77,7 +77,7 @@ int device_display_get_numbers(int *device_number) DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, METHOD_GET_DISPLAY_COUNT, NULL); if (ret < 0) - return errno_to_device_error(ret); + return errno_to_device_error(ret); //LCOV_EXCL_LINE display_cnt = ret; alloc_display(); } @@ -115,7 +115,7 @@ int device_display_get_max_brightness(int display_index, int *max_brightness) DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, METHOD_GET_MAX_BRIGHTNESS, g_variant_new("(i)", (int)DISPLAY_STATE_NORMAL)); if (ret < 0) - return errno_to_device_error(ret); + return errno_to_device_error(ret); //LCOV_EXCL_LINE display_arr[display_index].normal_max = ret; } @@ -147,7 +147,7 @@ int device_display_get_brightness(int display_index, int *brightness) DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, METHOD_GET_BRIGHTNESS, g_variant_new("(i)", (int)DISPLAY_STATE_NORMAL)); if (ret < 0) - return errno_to_device_error(ret); + return errno_to_device_error(ret); //LCOV_EXCL_LINE *brightness = ret; return DEVICE_ERROR_NONE; @@ -180,7 +180,7 @@ int device_display_set_brightness(int display_index, int brightness) DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, METHOD_SET_BRIGHTNESS, g_variant_new("(ii)", (int)DISPLAY_STATE_NORMAL, brightness)); if (ret < 0) - return errno_to_device_error(ret); + return errno_to_device_error(ret); //LCOV_EXCL_LINE return DEVICE_ERROR_NONE; } @@ -253,9 +253,11 @@ int device_display_change_state(display_state_e state) return DEVICE_ERROR_NOT_SUPPORTED; if (check_async_call_rate() < 0) { +//LCOV_EXCL_START System Error _E("Rejected by too frequent calls; %d (calls per sec.) limit is violated." , CHECK_RATE_THRESHOLD); return DEVICE_ERROR_OPERATION_FAILED; +//LCOV_EXCL_STOP } if (state < DISPLAY_STATE_NORMAL || state > DISPLAY_STATE_SCREEN_OFF) diff --git a/src/ir.c b/src/ir.c index 71b9db7..eb90724 100644 --- a/src/ir.c +++ b/src/ir.c @@ -76,8 +76,10 @@ int device_ir_transmit(int carrier_frequency, int *pattern, int size) _E("IR is not supported or IR operation failed"); return ret; } - _E("IR is not supported"); //LCOV_EXCL_LINE +//LCOV_EXCL_START System Error + _E("IR is not supported"); return DEVICE_ERROR_OPERATION_FAILED; +//LCOV_EXCL_STOP } //LCOV_EXCL_START System Error if (!pattern) diff --git a/src/pmqos.c b/src/pmqos.c index d73be51..e1651a7 100644 --- a/src/pmqos.c +++ b/src/pmqos.c @@ -22,6 +22,7 @@ #define METHOD_APP_LAUNCH_HOME "AppLaunchHome" #define METHOD_HOMESCREEN "HomeScreen" +//LCOV_EXCL_START Not used function int device_pmqos_app_launch_home(int timeout) { int ret; @@ -57,4 +58,4 @@ int device_pmqos_homescreen(int timeout) return DEVICE_ERROR_NONE; } - +//LCOV_EXCL_STOP diff --git a/src/power.c b/src/power.c index f4c6fe7..1cbe732 100644 --- a/src/power.c +++ b/src/power.c @@ -440,9 +440,11 @@ int device_power_request_lock(power_lock_e type, int timeout_ms) _I("power_lock_e = %d", type); if (check_async_call_rate() < 0) { +//LCOV_EXCL_START System Error _E("Rejected by too frequent calls; %d (calls per sec.) limit is violated." , CHECK_RATE_THRESHOLD); return DEVICE_ERROR_OPERATION_FAILED; +//LCOV_EXCL_STOP } if (timeout_ms < 0) @@ -470,9 +472,11 @@ int device_power_release_lock(power_lock_e type) _I("power_lock_e = %d", type); if (check_async_call_rate() < 0) { +//LCOV_EXCL_START System Error _E("Rejected by too frequent calls; %d (calls per sec.) limit is violated." , CHECK_RATE_THRESHOLD); return DEVICE_ERROR_OPERATION_FAILED; +//LCOV_EXCL_STOP } if (type == POWER_LOCK_CPU) { diff --git a/src/temperature.c b/src/temperature.c index 9064517..16c84f9 100644 --- a/src/temperature.c +++ b/src/temperature.c @@ -43,11 +43,15 @@ static int is_temperature_supported(device_thermal_e type) else ret = system_info_get_platform_bool(THERMAL_BATTERY_FEATURE, &thermal_avail); if (ret < 0) { +//LCOV_EXCL_START System Error _E("Failed to get value of temp feature : %d", ret); return false; +//LCOV_EXCL_STOP } else if (ret == 0 && !thermal_avail) { +//LCOV_EXCL_START System Error _D("Temperature is not supported"); return false; +//LCOV_EXCL_STOP } else return true; } @@ -68,7 +72,7 @@ int device_thermal_get_temperature(device_thermal_e type, int *temp) DEVICED_INTERFACE_TEMPERATURE, METHOD_GET_TEMPERATURE, g_variant_new("(i)", type)); if (ret < 0) - return errno_to_device_error(ret); + return errno_to_device_error(ret); //LCOV_EXCL_LINE *temp = ret; return DEVICE_ERROR_NONE; diff --git a/src/touchscreen-internal.c b/src/touchscreen-internal.c index 6160c8d..e7bdf35 100644 --- a/src/touchscreen-internal.c +++ b/src/touchscreen-internal.c @@ -21,6 +21,7 @@ #define METHOD_TOUCHSCREEN_ENABLE "Enable" #define METHOD_TOUCHSCREEN_DISABLE "Disable" +//LCOV_EXCL_START Not used function int device_touchscreen_enable(dbus_pending_cb cb) { int ret; @@ -40,3 +41,4 @@ int device_touchscreen_disable(dbus_pending_cb cb) return errno_to_device_error(ret); } +//LCOV_EXCL_STOP -- 2.7.4