Modify for line coverage 44/179344/2
authorlokilee73 <changjoo.lee@samsung.com>
Thu, 17 May 2018 07:35:49 +0000 (16:35 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Thu, 17 May 2018 07:45:33 +0000 (16:45 +0900)
Change-Id: I83543cb9eb3de1cb43b659b7b3b63c056302b231
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/battery.c
src/common.c [changed mode: 0644->0755]
src/dbus.c [changed mode: 0644->0755]
src/display.c
src/ir.c [changed mode: 0644->0755]
src/led.c
src/power.c

index 2134eb1..31c0d40 100755 (executable)
@@ -71,7 +71,7 @@ int device_battery_is_charging(bool *charging)
        ret = vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, &val);
        /* regard not supported as disconnected */
        if (val == -ENOTSUP)
-               val = 0;
+               val = 0; //LCOV_EXCL_LINE System Error
        else if (ret < 0 || val < 0 || val > 1)
                return DEVICE_ERROR_OPERATION_FAILED;
 
@@ -100,9 +100,11 @@ int device_battery_get_level_status(device_battery_level_e *status)
                *status = DEVICE_BATTERY_LEVEL_HIGH;
        else if (val == VCONFKEY_SYSMAN_BAT_LEVEL_FULL)
                *status = DEVICE_BATTERY_LEVEL_FULL;
+//LCOV_EXCL_START System Error
        /* regard not supported as disconnected */
        else if (val == -ENOTSUP)
                *status = DEVICE_BATTERY_LEVEL_EMPTY;
+//LCOV_EXCL_STOP
        else
                return DEVICE_ERROR_OPERATION_FAILED;
 
@@ -130,9 +132,9 @@ static int device_battery_get_info(struct battery_info *info)
                        METHOD_GET_INFO, NULL, NULL, &output);
        /* regard not suppoted as disconnected */
        if (ret == -ENOTSUP)
-               ret = 0;
+               ret = 0; //LCOV_EXCL_LINE System Error
        else if (ret < 0)
-               return errno_to_device_error(ret);
+               return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error
 
        g_variant_get(output, "(isssiiiii)", &ret,
                        &status, &health, &power_source,
@@ -140,8 +142,10 @@ static int device_battery_get_info(struct battery_info *info)
                        &current_now, &current_average);
 
        if (ret < 0) {
+//LCOV_EXCL_START System Error
                ret = errno_to_device_error(ret);
                goto out;
+//LCOV_EXCL_STOP
        }
 
        snprintf(info->status, sizeof(info->status), "%s", status);
@@ -175,7 +179,7 @@ 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);
+               _E("Failed to get battery info (%d)", ret); //LCOV_EXCL_LINE Logs
                return ret;
        }
 
@@ -207,7 +211,7 @@ 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);
+               _E("Failed to get battery info (%d)", ret); //LCOV_EXCL_LINE Logs
                return ret;
        }
 
@@ -234,7 +238,7 @@ 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);
+               _E("Failed to get battery info (%d)", ret); //LCOV_EXCL_LINE Logs
                return ret;
        }
 
@@ -266,7 +270,7 @@ 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);
+               _E("Failed to get battery info (%d)", ret); //LCOV_EXCL_LINE Logs
                return ret;
        }
 
old mode 100644 (file)
new mode 100755 (executable)
index c73c9c9..f663111
@@ -60,8 +60,10 @@ int config_parse(const char *file_name, int cb(struct parse_result *result,
        /* open conf file */
        f = fopen(file_name, "r");
        if (!f) {
+//LCOV_EXCL_START System Error
                if (errno == ENOENT) {
                        _I("There is no power config file");
+//LCOV_EXCL_STOP
                        return 0;
                }
 
@@ -125,9 +127,11 @@ int config_parse(const char *file_name, int cb(struct parse_result *result,
        return 0;
 
 error:
+//LCOV_EXCL_START System Error
        if (f)
                fclose(f);
        _E("Failed to read %s:%d!", file_name, lineno);
+//LCOV_EXCL_STOP
        return ret;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 8934432..c584ff1
@@ -180,10 +180,12 @@ static GDBusProxy *get_proxy_from_proxy_pool(const char *dest,
        struct proxy_node *node;
 
        if (!dest || !path || !interface) {
+//LCOV_EXCL_START System Error
                if (err)
                        g_set_error(err, G_IO_ERROR,
                                        G_IO_ERROR_INVALID_ARGUMENT,
                                        "Cannot determine destination address");
+//LCOV_EXCL_STOP
                return NULL;
        }
 
@@ -312,17 +314,16 @@ int dbus_method_sync_var(const char *dest, const char *path,
 
        pthread_mutex_lock(&dmutex);
        proxy = get_proxy_from_proxy_pool(dest, path, interface, &err);
-       if (!proxy) {
 //LCOV_EXCL_START System Error
+       if (!proxy) {
                pthread_mutex_unlock(&dmutex);
                _E("fail to get proxy from proxy pool : %s-%s (%d-%s)",
                                interface, method, err->code, err->message);
                result = g_dbus_error_to_errno(err->code);
                g_clear_error(&err);
                return result;
-//LCOV_EXCL_STOP
        }
-
+//LCOV_EXCL_STOP
        output = g_dbus_proxy_call_sync(proxy,
                        method,                       /* method name */
                        var, /* parameters */
@@ -332,8 +333,8 @@ int dbus_method_sync_var(const char *dest, const char *path,
                        &err);
        pthread_mutex_unlock(&dmutex);
 
-       if (!output) {
 //LCOV_EXCL_START System Error
+       if (!output) {
                if (!err) {
                        _E("g_dbus_proxy_call_sync error : %s-%s",
                                        interface, method);
@@ -391,8 +392,8 @@ int dbus_method_sync_with_reply(const char *dest,
                        &err);
        pthread_mutex_unlock(&dmutex);
        if (!output) {
-               if (!err) {
 //LCOV_EXCL_START System Error
+               if (!err) {
                        _E("g_dbus_proxy_call_sync error : %s-%s",
                                        interface, method);
                        return -EPERM;
index 40817b0..883132d 100755 (executable)
@@ -247,6 +247,7 @@ int device_display_change_state(display_state_e state)
        return DEVICE_ERROR_NONE;
 }
 
+//LCOV_EXCL_START Not used function
 int device_display_get_max_brightness_state(int display_index, display_state_e state, int *brightness)
 {
        char *arr[1];
@@ -293,7 +294,9 @@ int device_display_get_max_brightness_state(int display_index, display_state_e s
 
        return DEVICE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Not used function
 int device_display_get_brightness_state(int display_index, display_state_e state, int *brightness)
 {
        char *arr[1];
@@ -331,7 +334,9 @@ int device_display_get_brightness_state(int display_index, display_state_e state
 
        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)
 {
        char *arr[2];
@@ -384,3 +389,4 @@ int device_display_set_brightness_state(int display_index, display_state_e state
 
        return DEVICE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
old mode 100644 (file)
new mode 100755 (executable)
index 4e802c1..3377e78
--- a/src/ir.c
+++ b/src/ir.c
@@ -37,8 +37,10 @@ int device_ir_is_available(bool *available)
        ret = system_info_get_platform_bool(IR_FEATURE, &ir_avail);
 
        if (ret < 0) {
+//LCOV_EXCL_START System Error
                *available = false;
                return DEVICE_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
        } else if (ret == 0 && !ir_avail) {
                *available = false;
                return DEVICE_ERROR_NOT_SUPPORTED;
@@ -79,14 +81,14 @@ int device_ir_transmit(int carrier_frequency, int *pattern, int size)
                _E("IR is not supported"); //LCOV_EXCL_LINE
                return DEVICE_ERROR_OPERATION_FAILED;
        }
-
+//LCOV_EXCL_START System Error
        if (!pattern)
                return DEVICE_ERROR_INVALID_PARAMETER;
        if (size <= 0) {
-               _E("IR pattern size is invalid"); //LCOV_EXCL_LINE
+               _E("IR pattern size is invalid");
                return DEVICE_ERROR_INVALID_PARAMETER;
        }
-
+//LCOV_EXCL_STOP
        freq_pattern[0] = carrier_frequency;
        for (i = 1; i <= size; i++)
                freq_pattern[i] = pattern[i-1];
index c72691b..bc4596f 100755 (executable)
--- a/src/led.c
+++ b/src/led.c
@@ -152,9 +152,10 @@ int device_led_play_custom(int on, int off, unsigned int color, unsigned int fla
        ret = dbus_method_sync(DEVICED_BUS_NAME,
                        DEVICED_PATH_LED, DEVICED_INTERFACE_LED,
                        METHOD_PLAY_CUSTOM, "iiuu", arr);
+//LCOV_EXCL_START System Error
        if (ret < 0)
                return errno_to_device_error(ret);
-
+//LCOV_EXCL_STOP
        return DEVICE_ERROR_NONE;
 }
 
@@ -176,6 +177,7 @@ 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;
@@ -219,3 +221,4 @@ int device_multi_led_play_custom(unsigned int color[])
        return dbus_method_sync_var(DEVICED_BUS_NAME, DEVICED_PATH_LED,
                                DEVICED_INTERFACE_LED, METHOD_MULTI_PLAY_CUSTOM, var);
 }
+//LCOV_EXCL_STOP
index a7fd936..a23a974 100755 (executable)
@@ -108,7 +108,7 @@ static void remove_off_lock_timeout(void)
        if (!TIZEN_FEATURE_TRACKER)
                return;
        if (off_lock_timeout) {
-               _I("Power lock timeout handler removed");
+               _I("Power lock timeout handler removed"); //LCOV_EXCL_LINE Logs
                g_source_remove(off_lock_timeout);
                off_lock_timeout = 0;
        }
@@ -119,7 +119,7 @@ static void remove_padding_timeout(void)
        if (!TIZEN_FEATURE_TRACKER)
                return;
        if (padding_timeout) {
-               _I("Padding timeout handler removed");
+               _I("Padding timeout handler removed"); //LCOV_EXCL_LINE Logs
                g_source_remove(padding_timeout);
                padding_timeout = 0;
        }
@@ -313,14 +313,14 @@ static void add_off_lock_timeout(void)
        remove_off_lock_timeout();
        remove_padding_timeout();
 
-       _I("Power lock timeout handler added");
+       _I("Power lock timeout handler added"); //LCOV_EXCL_LINE Logs
 
        id = g_timeout_add(lock_timeout.release,
                        off_lock_timeout_expired, NULL);
        if (id)
                off_lock_timeout = id;
        else
-               _E("Failed to add Power Lock timeout handler");
+               _E("Failed to add Power Lock timeout handler"); //LCOV_EXCL_LINE Logs
 }
 
 static void lock_cb(void *data, GVariant *result, GError *err)
@@ -328,8 +328,10 @@ static void lock_cb(void *data, GVariant *result, GError *err)
        int ret;
 
        if (!result) {
-               _E("no message : %s", err->message); //LCOV_EXCL_LINE
+//LCOV_EXCL_START System Error
+               _E("no message : %s", err->message);
                return;
+//LCOV_EXCL_STOP
        }
 
        g_variant_get(result, "(i)", &ret);
@@ -371,7 +373,7 @@ static int lock_state(display_state_e state, unsigned int flag, int timeout_ms)
                                METHOD_LOCK_STATE, "sssi", arr);
                if (ret == -EACCES || ret == -ECOMM || ret == -EPERM) {
                        privilege = 0;
-                       return -EACCES;
+                       return -EACCES; //LCOV_EXCL_LINE System Error
                } else
                        privilege = 1;
        }
@@ -390,8 +392,10 @@ static void unlock_cb(void *data, GVariant *result, GError *err)
        int ret;
 
        if (!result) {
-               _E("no message : %s", err->message); //LCOV_EXCL_LINE
+//LCOV_EXCL_START System Error
+               _E("no message : %s", err->message);
                return;
+//LCOV_EXCL_STOP
        }
 
        g_variant_get(result, "(i)", &ret);
@@ -421,9 +425,11 @@ static int unlock_state(display_state_e state, unsigned int flag)
                ret = dbus_method_sync(DEVICED_BUS_NAME,
                                DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY,
                                METHOD_UNLOCK_STATE, "ss", arr);
+//LCOV_EXCL_START System Error
                if (ret == -EACCES || ret == -ECOMM || ret == -EPERM) {
                        privilege = 0;
                        return -EACCES;
+//LCOV_EXCL_STOP
                } else
                        privilege = 1;
        }