Add comments for line coverage 54/241954/5 accepted/tizen/unified/20200825.142849 submit/tizen/20200824.103034 submit/tizen/20200825.014022
authorlokilee73 <changjoo.lee@samsung.com>
Fri, 21 Aug 2020 05:37:11 +0000 (14:37 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Fri, 21 Aug 2020 09:04:19 +0000 (18:04 +0900)
Change-Id: Ie2eddae2cf4dd0b29680756528777f6e061e9ec5
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
12 files changed:
src/battery.c
src/booting-internal.c
src/callback.c
src/common.c
src/dbus.c
src/display.c
src/haptic.c
src/led.c
src/pmqos.c
src/power.c
src/temperature.c
src/touchscreen-internal.c

index 7d1d28c..463576e 100644 (file)
@@ -215,8 +215,6 @@ out:
        return ret;
 }
 
-//LCOV_EXCL_START unused function
-
 static int load_battery_plugin()
 {
        if (plugin_battery_get_info)
@@ -225,15 +223,19 @@ static int load_battery_plugin()
        if (!handle) {
                handle = dlopen(BATTERY_PLUGIN, RTLD_NOW);
                if (!handle) {
+//LCOV_EXCL_START System Error
                        _E("Failed to open '%s' : %s", BATTERY_PLUGIN, dlerror());
                        return -1;
+//LCOV_EXCL_STOP
                }
        }
 
        plugin_battery_get_info = (int (*)(void *))dlsym(handle, GET_INFO_FUNC);
        if (!plugin_battery_get_info) {
+//LCOV_EXCL_START System Error
                _E("Failed to get symbol '%s' : %s", GET_INFO_FUNC, dlerror());
                return -1;
+//LCOV_EXCL_STOP
        }
 
        return 0;
@@ -255,13 +257,14 @@ int device_battery_get_info_direct(struct device_battery_info *info)
 
        ret = plugin_battery_get_info(info);
        if (ret < 0) {
+//LCOV_EXCL_START System Error
                _E("Failed to get battery info: %d", ret);
                return DEVICE_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
        }
 
        return DEVICE_ERROR_NONE;
 }
-//LCOV_EXCL_STOP
 
 int device_battery_get_health(device_battery_health_e *health)
 {
@@ -278,8 +281,10 @@ int device_battery_get_health(device_battery_health_e *health)
 
        ret = device_battery_get_info(&info);
        if (ret != DEVICE_ERROR_NONE) {
-               _E("Failed to get battery info (%d)", ret); //LCOV_EXCL_LINE Logs
+//LCOV_EXCL_START System Error
+               _E("Failed to get battery info (%d)", ret);
                return ret;
+//LCOV_EXCL_STOP
        }
 
        len = strlen(info.health);
@@ -314,8 +319,10 @@ int device_battery_get_power_source(device_battery_power_source_e *source)
 
        ret = device_battery_get_info(&info);
        if (ret != DEVICE_ERROR_NONE) {
-               _E("Failed to get battery info (%d)", ret); //LCOV_EXCL_LINE Logs
+//LCOV_EXCL_START System Error
+               _E("Failed to get battery info (%d)", ret);
                return ret;
+//LCOV_EXCL_STOP
        }
 
        len = strlen(info.power_source);
@@ -345,8 +352,10 @@ int device_battery_get_property(device_battery_property_e property, int *val)
 
        ret = device_battery_get_info(&info);
        if (ret != DEVICE_ERROR_NONE) {
-               _E("Failed to get battery info (%d)", ret); //LCOV_EXCL_LINE Logs
+//LCOV_EXCL_START System Error
+               _E("Failed to get battery info (%d)", ret);
                return ret;
+//LCOV_EXCL_STOP
        }
 
        switch (property) {
@@ -391,8 +400,10 @@ int device_battery_get_status(device_battery_status_e *status)
 
        ret = device_battery_get_info(&info);
        if (ret != DEVICE_ERROR_NONE) {
-               _E("Failed to get battery info (%d)", ret); //LCOV_EXCL_LINE Logs
+//LCOV_EXCL_START System Error
+               _E("Failed to get battery info (%d)", ret);
                return ret;
+//LCOV_EXCL_STOP
        }
 
        len = strlen(info.status);
index e558fce..42682bb 100644 (file)
@@ -22,7 +22,6 @@
 
 #define BOOT_SO_PATH   "/usr/lib/deviced/bootmode.so"
 
-//LCOV_EXCL_START Not used function
 int device_get_reboot_mode(void)
 {
        int (*get_reboot_mode) (void);
@@ -32,15 +31,19 @@ int device_get_reboot_mode(void)
        handle = dlopen(BOOT_SO_PATH, RTLD_NOW|RTLD_GLOBAL);
 
        if (!handle) {
+//LCOV_EXCL_START System Error
                _E("Failed to open module: %s", dlerror());
                return NORMAL_BOOT;
+//LCOV_EXCL_STOP
        }
 
        get_reboot_mode = dlsym(handle, "get_reboot_mode");
        if (!get_reboot_mode) {
+//LCOV_EXCL_START System Error
                _E("Failed to get address of get_reboot_mode().");
                dlclose(handle);
                return NORMAL_BOOT;
+//LCOV_EXCL_STOP
        }
 
        ret = get_reboot_mode();
@@ -49,4 +52,3 @@ int device_get_reboot_mode(void)
 
        return ret;
 }
-//LCOV_EXCL_STOP
index 71d821e..ff96a74 100644 (file)
@@ -361,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; //LCOV_EXCL_LINE
+                       return DEVICE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE System Error
        }
 
        return DEVICE_ERROR_NONE;
index c503bb2..39b5944 100644 (file)
@@ -71,8 +71,8 @@ int config_parse(const char *file_name, int cb(struct parse_result *result,
 //LCOV_EXCL_START System Error
                if (errno == ENOENT) {
                        _I("There is no power config file");
-//LCOV_EXCL_STOP
                        return 0;
+//LCOV_EXCL_STOP
                }
 
 //LCOV_EXCL_START System Error
@@ -140,8 +140,8 @@ int config_parse(const char *file_name, int cb(struct parse_result *result,
        fclose(f);
        return 0;
 
-error:
 //LCOV_EXCL_START System Error
+error:
        if (f)
                fclose(f);
        _E("Failed to read %s:%d!", file_name, lineno);
index 9562547..91c8efa 100644 (file)
@@ -298,6 +298,7 @@ int dbus_method_sync_var(const char *dest, const char *path,
        return result;
 }
 
+//LCOV_EXCL_START Not used function
 int dbus_method_sync(const char *dest, const char *path,
                const char *interface, const char *method,
                const char *sig, const char *param[])
@@ -308,6 +309,7 @@ int dbus_method_sync(const char *dest, const char *path,
                                method,
                                append_g_variant(sig, param));
 }
+//LCOV_EXCL_STOP
 
 int dbus_method_sync_with_reply_var(const char *dest,
                const char *path, const char *interface,
@@ -362,6 +364,7 @@ int dbus_method_sync_with_reply_var(const char *dest,
        return DEVICE_ERROR_NONE;
 }
 
+//LCOV_EXCL_START Not used function
 int dbus_method_sync_with_reply(const char *dest,
                const char *path, const char *interface,
                const char *method, const char *sig,
@@ -374,6 +377,7 @@ int dbus_method_sync_with_reply(const char *dest,
                                append_g_variant(sig, param),
                                info);
 }
+//LCOV_EXCL_STOP
 
 static void cb_pending(GDBusProxy *proxy,
                GAsyncResult *res,
@@ -387,7 +391,7 @@ static void cb_pending(GDBusProxy *proxy,
                        res, /* GAsyncResult */
                        &err);
        if (!output)
-               _E("g_dbus_proxy_call_finish error : %d-%s", //LCOV_EXCL_LINE
+               _E("g_dbus_proxy_call_finish error : %d-%s", //LCOV_EXCL_LINE Logs
                                err?err->code:0, err?err->message:"NULL");
 
        if (data && data->func)
index cc63847..80f6465 100644 (file)
@@ -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); //LCOV_EXCL_LINE
+                       return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
                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); //LCOV_EXCL_LINE
+                       return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
                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); //LCOV_EXCL_LINE
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        *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); //LCOV_EXCL_LINE
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        return DEVICE_ERROR_NONE;
 }
@@ -284,7 +284,6 @@ int device_display_change_state(display_state_e state)
                        METHOD_CHANGE_STATE, g_variant_new("(s)", str), change_cb, -1, NULL);
 }
 
-//LCOV_EXCL_START Not used function
 int device_display_get_max_brightness_state(int display_index, display_state_e state, int *brightness)
 {
        int ret;
@@ -315,7 +314,7 @@ int device_display_get_max_brightness_state(int display_index, display_state_e s
                                DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY,
                                METHOD_GET_MAX_BRIGHTNESS, g_variant_new("(i)", (int)state));
        if (ret < 0)
-               return errno_to_device_error(ret);
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        if (state == DISPLAY_STATE_NORMAL) {
                display_arr[display_index].normal_max = ret;
@@ -329,7 +328,6 @@ int device_display_get_max_brightness_state(int display_index, display_state_e s
 }
 //LCOV_EXCL_STOP
 
-//LCOV_EXCL_START Not used function
 int device_display_get_brightness_state(int display_index, display_state_e state, int *brightness)
 {
        int ret;
@@ -357,15 +355,13 @@ int device_display_get_brightness_state(int display_index, display_state_e state
                        DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY,
                        METHOD_GET_BRIGHTNESS, g_variant_new("(i)", (int)state));
        if (ret < 0)
-               return errno_to_device_error(ret);
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        *brightness = ret;
 
        return DEVICE_ERROR_NONE;
 }
-//LCOV_EXCL_STOP
 
-//LCOV_EXCL_START Not used function
 int device_display_set_brightness_state(int display_index, display_state_e state, int brightness)
 {
        int ret, max;
@@ -407,7 +403,7 @@ int device_display_set_brightness_state(int display_index, display_state_e state
                        DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY,
                        METHOD_SET_BRIGHTNESS, g_variant_new("(ii)", (int)state, brightness));
        if (ret < 0)
-               return errno_to_device_error(ret);
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        return DEVICE_ERROR_NONE;
 }
@@ -422,5 +418,3 @@ int device_display_change_state_by_reason(display_state_e type, const char *reas
 
        return errno_to_device_error(ret);
 }
-
-//LCOV_EXCL_STOP
index 62d7a45..2f339dd 100644 (file)
@@ -60,11 +60,15 @@ static int is_haptic_supported(void)
 
        ret = system_info_get_platform_bool(VIBRATION_FEATURE, &haptic_avail);
        if (ret < 0) {
+//LCOV_EXCL_START System Error
                _E("Failed to get value of haptic feature");
                return false;
+//LCOV_EXCL_STOP
        } else if (ret == 0 && !haptic_avail) {
+//LCOV_EXCL_START System Error
                _D("Haptic is not supported");
                return false;
+//LCOV_EXCL_STOP
        } else
                return true;
 }
@@ -158,8 +162,10 @@ int device_haptic_open(int device_index, haptic_device_h *device_handle)
        if (!found) {
                handle = (struct haptic_handle *)malloc(sizeof(struct haptic_handle));
                if (!handle) {
-                       _E("Failed to malloc"); //LCOV_EXCL_LINE System Error
+//LCOV_EXCL_START System Error
+                       _E("Failed to malloc");
                        return DEVICE_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
                }
 
                handle->handle = ret;
@@ -170,7 +176,7 @@ int device_haptic_open(int device_index, haptic_device_h *device_handle)
        if (DD_LIST_LENGTH(handle_list) == 1) {
                ret = register_signal_handler();
                if (ret < 0)
-                       _E("Faild to register signal handler"); //LCOV_EXCL_LINE
+                       _E("Faild to register signal handler"); //LCOV_EXCL_LINE Logs
        }
 
        return DEVICE_ERROR_NONE;
@@ -215,7 +221,7 @@ int device_haptic_close(haptic_device_h device_handle)
        if (DD_LIST_LENGTH(handle_list) == 0) {
                ret = unregister_signal_handler();
                if (ret < 0)
-                       _E("Failed to unregister signal handler"); //LCOV_EXCL_LINE
+                       _E("Failed to unregister signal handler"); //LCOV_EXCL_LINE Logs
        }
 
        return DEVICE_ERROR_NONE;
index 3f65144..832ed26 100644 (file)
--- a/src/led.c
+++ b/src/led.c
@@ -135,6 +135,7 @@ int device_led_play_custom(int on, int off, unsigned int color, unsigned int fla
        if (ret < 0)
                return errno_to_device_error(ret);
 //LCOV_EXCL_STOP
+
        return DEVICE_ERROR_NONE;
 }
 
@@ -156,7 +157,6 @@ int device_led_stop_custom(void)
        return DEVICE_ERROR_NONE;
 }
 
-//LCOV_EXCL_START Not used function
 int device_multi_led_get_number(int *num_of_leds)
 {
        int ret;
@@ -209,4 +209,3 @@ int device_multi_led_control(unsigned int color[])
        return dbus_method_sync_var(DEVICED_BUS_NAME, DEVICED_PATH_LED,
                                DEVICED_INTERFACE_LED, METHOD_MULTI_LED_CONTROL, var);
 }
-//LCOV_EXCL_STOP
index e1651a7..a860b52 100644 (file)
@@ -22,7 +22,6 @@
 #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;
@@ -36,7 +35,7 @@ int device_pmqos_app_launch_home(int timeout)
                        METHOD_APP_LAUNCH_HOME,
                        g_variant_new("(i)", timeout));;
        if (ret < 0)
-               return errno_to_device_error(ret);
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        return DEVICE_ERROR_NONE;
 }
@@ -54,8 +53,7 @@ int device_pmqos_homescreen(int timeout)
                        METHOD_HOMESCREEN,
                        g_variant_new("(i)", timeout));;
        if (ret < 0)
-               return errno_to_device_error(ret);
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        return DEVICE_ERROR_NONE;
 }
-//LCOV_EXCL_STOP
index 1cbe732..feb9431 100644 (file)
@@ -563,5 +563,5 @@ static void __CONSTRUCTOR__ power_init(void)
 
        ret = config_parse(POWER_CONF, power_load_config, NULL);
        if (ret < 0)
-               _E("Failed to load config file (%d)", ret); //LCOV_EXCL_LINE
+               _E("Failed to load config file (%d)", ret); //LCOV_EXCL_LINE Logs
 }
index 16c84f9..36e3cb9 100644 (file)
@@ -72,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); //LCOV_EXCL_LINE
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        *temp = ret;
        return DEVICE_ERROR_NONE;
index f653420..c0939f3 100644 (file)
 #define METHOD_TOUCHSCREEN_ENABLE  "Enable"
 #define METHOD_TOUCHSCREEN_DISABLE "Disable"
 
-//LCOV_EXCL_START Not used function
 int device_touchscreen_enable(device_dbus_pending_cb cb)
 {
        int ret;
+
        ret = dbus_method_async_with_reply(DEVICED_BUS_NAME,
                        DEVICED_PATH_TOUCH, DEVICED_INTERFACE_TOUCH,
                        METHOD_TOUCHSCREEN_ENABLE, NULL, NULL, cb, -1, NULL);
@@ -35,10 +35,10 @@ int device_touchscreen_enable(device_dbus_pending_cb cb)
 int device_touchscreen_disable(device_dbus_pending_cb cb)
 {
        int ret;
+
        ret = dbus_method_async_with_reply(DEVICED_BUS_NAME,
                        DEVICED_PATH_TOUCH, DEVICED_INTERFACE_TOUCH,
                        METHOD_TOUCHSCREEN_DISABLE, NULL, NULL, cb, -1, NULL);
 
        return errno_to_device_error(ret);
 }
-//LCOV_EXCL_STOP