Add lcov comment 62/154262/1
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 10 Oct 2017 02:45:20 +0000 (11:45 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Tue, 10 Oct 2017 02:46:46 +0000 (11:46 +0900)
- out of memeory related codes
- some widget service api should be checked in manual test

Change-Id: I23dc2be796f58206017d2f4e86ba857a0d6c723a
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
src/widget_instance.c
src/widget_service.c

index 300d6a1..f396a15 100644 (file)
@@ -674,6 +674,7 @@ static int __check_valid_sender(char *widget_id, int pid)
        return -1;
 }
 
+/* LCOV_EXCL_START */
 static int __check_valid_sender_v2(const char *sender_pkgid)
 {
        char pkgid[256] = {0, };
@@ -702,6 +703,7 @@ static int __check_valid_sender_v2(const char *sender_pkgid)
 
        return -1;
 }
+/* LCOV_EXCL_STOP */
 
 static int __status_handler(const char *endpoint, aul_app_com_result_e e, bundle *envelope, void *user_data)
 {
@@ -1011,8 +1013,8 @@ EAPI int widget_instance_change_period(const char *widget_id, const char *instan
 
        b = bundle_create();
        if (!b) {
-               _E("out of memory");
-               return -1;
+               _E("out of memory"); /* LCOV_EXCL_LINE */
+               return -1; /* LCOV_EXCL_LINE */
        }
 
        bundle_add_byte(b, WIDGET_K_PERIOD, &period, sizeof(double));
@@ -1040,8 +1042,8 @@ EAPI int widget_instance_trigger_update_v2(const char *widget_id,
 
        kb = bundle_create();
        if (!kb) {
-               _E("out of memory");
-               return -1;
+               _E("out of memory"); /* LCOV_EXCL_LINE */
+               return -1; /* LCOV_EXCL_LINE */
        }
 
        bundle_add_str(kb, WIDGET_K_OPERATION, "update");
@@ -1150,8 +1152,8 @@ EAPI int widget_instance_listen_event(widget_instance_event_cb cb, void *data)
 
        cb_info = (struct event_cb_s *)malloc(sizeof(struct event_cb_s));
        if (!cb_info) {
-               _E("out of memory");
-               return -1;
+               _E("out of memory"); /* LCOV_EXCL_LINE */
+               return -1; /* LCOV_EXCL_LINE */
        }
 
        cb_info->cb = cb;
@@ -1159,8 +1161,8 @@ EAPI int widget_instance_listen_event(widget_instance_event_cb cb, void *data)
 
        event_cbs = g_list_append(event_cbs, cb_info);
        if (!event_cbs) {
-               _E("out of memory");
-               return -1;
+               _E("out of memory"); /* LCOV_EXCL_LINE */
+               return -1; /* LCOV_EXCL_LINE */
        }
 
        return 0;
@@ -1213,8 +1215,8 @@ EAPI int widget_instance_listen_status(const char *widget_id, widget_instance_ev
 
        cb_info = (struct lifecycle_local_s *)malloc(sizeof(struct lifecycle_local_s));
        if (!cb_info) {
-               _E("out of memory");
-               return -1;
+               _E("out of memory"); /* LCOV_EXCL_LINE */
+               return -1; /* LCOV_EXCL_LINE */
        }
 
        cb_info->widget_id = strdup(widget_id);
@@ -1299,8 +1301,8 @@ EAPI int widget_service_set_sdk_util(bundle *data)
 
        sdk_util.name = strdup(util);
        if (sdk_util.name == NULL) {
-               _E("out of memory");
-               return -1;
+               _E("out of memory"); /* LCOV_EXCL_LINE */
+               return -1; /* LCOV_EXCL_LINE */
        }
 
        if (strcmp(util, SDK_DEBUG) == 0) {
@@ -1333,17 +1335,17 @@ EAPI int widget_service_set_sdk_util(bundle *data)
                sdk_util.argc = len;
                sdk_util.args = calloc(len + 1, sizeof(char *));
                if (sdk_util.args == NULL) {
-                       _E("out of memory");
-                       __free_sdk_util();
-                       return -1;
+                       _E("out of memory"); /* LCOV_EXCL_LINE */
+                       __free_sdk_util(); /* LCOV_EXCL_LINE */
+                       return -1; /* LCOV_EXCL_LINE */
                }
 
                for (i = 0; i < len; i++) {
                        sdk_util.args[i] = strdup(util_arg_array[i]);
                        if (sdk_util.args[i] == NULL) {
-                               _E("out of memory");
-                               __free_sdk_util();
-                               return -1;
+                               _E("out of memory"); /* LCOV_EXCL_LINE */
+                               __free_sdk_util(); /* LCOV_EXCL_LINE */
+                               return -1; /* LCOV_EXCL_LINE */
                        }
                }
        }
@@ -1351,9 +1353,9 @@ EAPI int widget_service_set_sdk_util(bundle *data)
        if (caller_pid) {
                sdk_util.caller = strdup(caller_pid);
                if (sdk_util.caller == NULL) {
-                       _E("out of memory");
-                       __free_sdk_util();
-                       return -1;
+                       _E("out of memory"); /* LCOV_EXCL_LINE */
+                       __free_sdk_util(); /* LCOV_EXCL_LINE */
+                       return -1; /* LCOV_EXCL_LINE */
                }
        }
 
index 60331b5..406518a 100644 (file)
@@ -613,6 +613,7 @@ static int _get_widget_supported_info(const char *widget_id, uid_t uid,
        return WIDGET_ERROR_NONE;
 }
 
+/* LCOV_EXCL_START */
 static int _instance_cb(const char *widget_id, const char *instance_id, void *data)
 {
        int ret;
@@ -627,6 +628,7 @@ static int _instance_cb(const char *widget_id, const char *instance_id, void *da
        }
        return WIDGET_ERROR_NONE;
 }
+/* LCOV_EXCL_STOP */
 
 EAPI int widget_service_change_period(const char *pkgname, const char *id, double period)
 {
@@ -1418,10 +1420,12 @@ EAPI char *widget_service_get_preview_image_path(const char *widget_id,
        buf_len = strlen(path) + strlen(_iso3lang) + strlen(_country) + 3; /* '/' '-' '/' */
        lang_path = malloc(buf_len + 1);
        if (!lang_path) {
+               /* LCOV_EXCL_START */
                set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
                _E("Heap: %d", errno);
                free(path);
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        for (i = strlen(path); i >= 0 && path[i] != '/'; i--);
@@ -1706,9 +1710,11 @@ EAPI char *widget_service_get_name(const char *widget_id, const char *lang)
                language = strdup(lang);
 
        if (!language) {
+               /* LCOV_EXCL_START */
                _E("Out-of-memory");
                set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
                return NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        name = _get_name(widget_id, language, getuid());
@@ -1836,8 +1842,8 @@ static char *__get_widget_main_appid_from_pkgid_or_appid(const char *id)
                new_pkgid = strdup(pkgid);
                pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
                if (new_pkgid == NULL) {
-                       _E("out of memory");
-                       return NULL;
+                       _E("out of memory"); /* LCOV_EXCL_LINE */
+                       return NULL; /* LCOV_EXCL_LINE */
                }
                id = new_pkgid;
        }
@@ -2095,6 +2101,7 @@ struct instance_cb {
        int cnt;
 };
 
+/* LCOV_EXCL_START */
 static void __instance_list_cb(const char *instance_id, void *user_data)
 {
        struct instance_cb *cb_data = (struct instance_cb *)user_data;
@@ -2108,6 +2115,7 @@ static void __instance_list_cb(const char *instance_id, void *user_data)
        if (cb_data->cb)
                cb_data->cb(cb_data->widget_id, instance_id, cb_data->data);
 }
+/* LCOV_EXCL_STOP */
 
 EAPI int widget_service_get_widget_instance_list(const char *widget_id, widget_instance_list_cb cb, void *data)
 {