From 9a814e550e146d6f020adf1ba7a4a18241543fe8 Mon Sep 17 00:00:00 2001 From: "SukHyung, Kang" Date: Tue, 12 Jul 2016 20:18:13 +0900 Subject: [PATCH] exclude code from coverage measurement Change-Id: I90ec1db233374d1623d213a74bf7598a6d3d8608 Signed-off-by: SukHyung, Kang --- app_common/app_event.c | 2 ++ app_control/app_control.c | 10 ++++++++ preference/preference.c | 54 +++++++++++++++++++++++++++++++++++++++++++ preference/preference_inoti.c | 16 +++++++++++++ src/app_main.c | 15 +++++++++++- 5 files changed, 96 insertions(+), 1 deletion(-) mode change 100644 => 100755 app_common/app_event.c mode change 100644 => 100755 app_control/app_control.c mode change 100644 => 100755 preference/preference.c mode change 100644 => 100755 src/app_main.c diff --git a/app_common/app_event.c b/app_common/app_event.c old mode 100644 new mode 100755 index c3676b5..12f0387 --- a/app_common/app_event.c +++ b/app_common/app_event.c @@ -20,6 +20,7 @@ #include #include +/* LCOV_EXCL_START */ app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm) { app_device_orientation_e dev_orientation; @@ -44,6 +45,7 @@ app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm) return dev_orientation; } +/* LCOV_EXCL_STOP */ static int _app_convert_low_memory(void *val) { diff --git a/app_control/app_control.c b/app_control/app_control.c old mode 100644 new mode 100755 index b01bca9..447348e --- a/app_control/app_control.c +++ b/app_control/app_control.c @@ -156,6 +156,7 @@ int app_control_validate_internal_key(const char *key) return 0; } +/* LCOV_EXCL_START */ static void app_control_request_result_broker(bundle *appsvc_bundle, int appsvc_request_code, appsvc_result_val appsvc_result, void *appsvc_data) { app_control_request_context_h request_context; @@ -208,6 +209,7 @@ static void app_control_request_result_broker(bundle *appsvc_bundle, int appsvc_ free(request_context); } +/* LCOV_EXCL_STOP */ int app_control_create_request(bundle *data, app_control_h *app_control) { @@ -271,6 +273,7 @@ int app_control_create_event(bundle *data, struct app_control_s **app_control) return APP_CONTROL_ERROR_NONE; } +/* LCOV_EXCL_START */ static int app_control_create_reply(bundle *data, struct app_control_s **app_control) { struct app_control_s *app_control_reply; @@ -290,6 +293,7 @@ static int app_control_create_reply(bundle *data, struct app_control_s **app_con return APP_CONTROL_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int app_control_destroy(app_control_h app_control) { @@ -628,6 +632,7 @@ int app_control_unset_defapp(const char *app_id) return APP_CONTROL_ERROR_NONE; } +/* LCOV_EXCL_START */ static void __update_launch_pid(int launched_pid, void *data) { app_control_h app_control; @@ -639,6 +644,7 @@ static void __update_launch_pid(int launched_pid, void *data) app_control->launch_pid = launched_pid; } +/* LCOV_EXCL_STOP */ static void __handle_launch_result(int launched_pid, void *data) { @@ -793,6 +799,7 @@ int app_control_send_terminate_request(app_control_h app_control) return APP_CONTROL_ERROR_NONE; } +/* LCOV_EXCL_START */ static bool app_control_copy_reply_data_cb(app_control_h app_control, const char *key, void *user_data) { bundle *reply_data = user_data; @@ -822,6 +829,7 @@ static bool app_control_copy_reply_data_cb(app_control_h app_control, const char return true; } +/* LCOV_EXCL_STOP */ int app_control_reply_to_launch_request(app_control_h reply, app_control_h request, app_control_result_e result) { @@ -1059,6 +1067,7 @@ typedef struct { bool foreach_break; } foreach_context_launchable_app_t; +/* LCOV_EXCL_START */ int app_control_cb_broker_foreach_app_matched(const char *package, void *data) { foreach_context_launchable_app_t *foreach_context; @@ -1084,6 +1093,7 @@ int app_control_cb_broker_foreach_app_matched(const char *package, void *data) return 0; } +/* LCOV_EXCL_STOP */ int app_control_foreach_app_matched(app_control_h app_control, app_control_app_matched_cb callback, void *user_data) { diff --git a/preference/preference.c b/preference/preference.c old mode 100644 new mode 100755 index fa96f87..4e26dca --- a/preference/preference.c +++ b/preference/preference.c @@ -92,10 +92,12 @@ char *_preference_get_pref_dir_path() g_pref_dir_path = (char *)malloc(PREFERENCE_KEY_PATH_LEN + 1); if ((app_data_path = app_get_data_path()) == NULL) { + /* LCOV_EXCL_START */ ERR("IO_ERROR(0x%08x) : fail to get data directory", PREFERENCE_ERROR_IO_ERROR); free(g_pref_dir_path); g_pref_dir_path = NULL; return NULL; + /* LCOV_EXCL_STOP */ } snprintf(g_pref_dir_path, PREFERENCE_KEY_PATH_LEN, "%s%s", app_data_path, PREF_DIR); @@ -283,6 +285,7 @@ static int _preference_set_file_lock(int fd, short type) return fcntl(fd, F_SETLK, &l); } +/* LCOV_EXCL_START */ static int _preference_get_pid_of_file_lock_owner(int fd, short type) { struct flock l; @@ -302,6 +305,7 @@ static int _preference_get_pid_of_file_lock_owner(int fd, short type) else return l.l_pid; } +/* LCOV_EXCL_STOP */ static int _preference_set_read_lock(int fd) { @@ -318,6 +322,7 @@ static int _preference_set_unlock(int fd) return _preference_set_file_lock(fd, F_UNLCK); } +/* LCOV_EXCL_START */ static void _preference_log_subject_label(void) { int fd; @@ -348,6 +353,7 @@ static void _preference_log_subject_label(void) close(fd); } +/* LCOV_EXCL_STOP */ static int _preference_check_retry_err(keynode_t *keynode, int preference_errno, int io_errno, int op_type) { @@ -362,23 +368,29 @@ static int _preference_check_retry_err(keynode_t *keynode, int preference_errno, if (op_type == PREFERENCE_OP_SET) { rc = _preference_get_key_path(keynode, path); if (rc != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("_preference_get_key_path error"); _preference_log_subject_label(); break; + /* LCOV_EXCL_STOP */ } rc = _preference_set_key_check_pref_dir(); if (rc != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("_preference_set_key_check_pref_dir() failed."); _preference_log_subject_label(); break; + /* LCOV_EXCL_STOP */ } rc = _preference_set_key_creation(path); if (rc != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("_preference_set_key_creation error : %s", path); _preference_log_subject_label(); break; + /* LCOV_EXCL_STOP */ } INFO("%s key is created", keynode->keyname); @@ -469,12 +481,14 @@ retry: ret = _preference_set_write_lock(fileno(fp)); if (ret == -1) { + /* LCOV_EXCL_START */ func_ret = PREFERENCE_ERROR_FILE_LOCK; err_no = errno; ERR("file(%s) lock owner(%d)", keynode->keyname, _preference_get_pid_of_file_lock_owner(fileno(fp), F_WRLCK)); goto out_return; + /* LCOV_EXCL_STOP */ } /* write keyname and size */ @@ -482,6 +496,7 @@ retry: ret = fwrite((void *)&keyname_len, sizeof(int), 1, fp); if (ret <= 0) { + /* LCOV_EXCL_START */ if (!errno) { LOGW("number of written items is 0. try again"); errno = EAGAIN; @@ -489,10 +504,12 @@ retry: err_no = errno; func_ret = PREFERENCE_ERROR_FILE_WRITE; goto out_unlock; + /* LCOV_EXCL_STOP */ } ret = fwrite((void *)keynode->keyname, keyname_len, 1, fp); if (ret <= 0) { + /* LCOV_EXCL_START */ if (!errno) { LOGW("number of written items is 0. try again"); errno = EAGAIN; @@ -500,11 +517,13 @@ retry: err_no = errno; func_ret = PREFERENCE_ERROR_FILE_WRITE; goto out_unlock; + /* LCOV_EXCL_STOP */ } /* write key type */ ret = fwrite((void *)&(keynode->type), sizeof(int), 1, fp); if (ret <= 0) { + /* LCOV_EXCL_START */ if (!errno) { LOGW("number of written items is 0. try again"); errno = EAGAIN; @@ -512,6 +531,7 @@ retry: err_no = errno; func_ret = PREFERENCE_ERROR_FILE_WRITE; goto out_unlock; + /* LCOV_EXCL_STOP */ } /* write key value */ @@ -541,6 +561,7 @@ retry: } if (is_write_error) { + /* LCOV_EXCL_START */ if (!errno) { LOGW("number of written items is 0. try again"); errno = EAGAIN; @@ -548,6 +569,7 @@ retry: err_no = errno; func_ret = PREFERENCE_ERROR_FILE_WRITE; goto out_unlock; + /* LCOV_EXCL_STOP */ } fflush(fp); @@ -610,10 +632,12 @@ static int _preference_set_key(keynode_t *keynode) g_posix_errno = PREFERENCE_ERROR_NONE; g_preference_errno = PREFERENCE_ERROR_NONE; } else { + /* LCOV_EXCL_START */ strerror_r(io_errno, err_buf, 100); ERR("_preference_set_key(%s) step(%d) failed(%d / %s)", keynode->keyname, ret, io_errno, err_buf); g_posix_errno = io_errno; g_preference_errno = ret; + /* LCOV_EXCL_STOP */ } return ret; @@ -640,9 +664,11 @@ API int preference_set_int(const char *key, int intval) func_ret = _preference_keynode_set_keyname(pKeyNode, key); if (func_ret != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("set key name error"); _preference_keynode_free(pKeyNode); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } _preference_keynode_set_value_int(pKeyNode, intval); @@ -681,9 +707,11 @@ API int preference_set_boolean(const char *key, bool boolval) func_ret = _preference_keynode_set_keyname(pKeyNode, key); if (func_ret != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("set key name error"); _preference_keynode_free(pKeyNode); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } _preference_keynode_set_value_boolean(pKeyNode, boolval); @@ -721,9 +749,11 @@ API int preference_set_double(const char *key, double dblval) func_ret = _preference_keynode_set_keyname(pKeyNode, key); if (func_ret != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("set key name error"); _preference_keynode_free(pKeyNode); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } _preference_keynode_set_value_double(pKeyNode, dblval); @@ -762,9 +792,11 @@ API int preference_set_string(const char *key, const char *strval) func_ret = _preference_keynode_set_keyname(pKeyNode, key); if (func_ret != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("set key name error"); _preference_keynode_free(pKeyNode); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } _preference_keynode_set_value_string(pKeyNode, strval); @@ -819,39 +851,47 @@ retry: ret = _preference_set_read_lock(fileno(fp)); if (ret == -1) { + /* LCOV_EXCL_START */ func_ret = PREFERENCE_ERROR_FILE_LOCK; err_no = errno; goto out_return; + /* LCOV_EXCL_STOP */ } read_size = fread((void *)&keyname_len, sizeof(int), 1, fp); if ((read_size <= 0) || (read_size > sizeof(int))) { + /* LCOV_EXCL_START */ if (!ferror(fp)) errno = ENODATA; err_no = errno; func_ret = PREFERENCE_ERROR_FILE_FREAD; goto out_unlock; + /* LCOV_EXCL_STOP */ } ret = fseek(fp, keyname_len, SEEK_CUR); if (ret) { + /* LCOV_EXCL_START */ if (!ferror(fp)) errno = ENODATA; err_no = errno; func_ret = PREFERENCE_ERROR_FILE_FREAD; goto out_unlock; + /* LCOV_EXCL_STOP */ } read_size = fread((void *)&type, sizeof(int), 1, fp); if (read_size <= 0) { + /* LCOV_EXCL_START */ if (!ferror(fp)) errno = ENODATA; err_no = errno; func_ret = PREFERENCE_ERROR_FILE_FREAD; goto out_unlock; + /* LCOV_EXCL_STOP */ } /* read data value */ @@ -859,12 +899,14 @@ retry: case PREFERENCE_TYPE_INT: read_size = fread((void *)&value_int, sizeof(int), 1, fp); if ((read_size <= 0) || (read_size > sizeof(int))) { + /* LCOV_EXCL_START */ if (!ferror(fp)) LOGW("number of read items for value is wrong. err : %d", errno); err_no = errno; func_ret = PREFERENCE_ERROR_FILE_FREAD; goto out_unlock; + /* LCOV_EXCL_STOP */ } else { _preference_keynode_set_value_int(keynode, value_int); } @@ -873,12 +915,14 @@ retry: case PREFERENCE_TYPE_DOUBLE: read_size = fread((void *)&value_dbl, sizeof(double), 1, fp); if ((read_size <= 0) || (read_size > sizeof(double))) { + /* LCOV_EXCL_START */ if (!ferror(fp)) LOGW("number of read items for value is wrong. err : %d", errno); err_no = errno; func_ret = PREFERENCE_ERROR_FILE_FREAD; goto out_unlock; + /* LCOV_EXCL_STOP */ } else { _preference_keynode_set_value_double(keynode, value_dbl); } @@ -887,12 +931,14 @@ retry: case PREFERENCE_TYPE_BOOLEAN: read_size = fread((void *)&value_int, sizeof(int), 1, fp); if ((read_size <= 0) || (read_size > sizeof(int))) { + /* LCOV_EXCL_START */ if (!ferror(fp)) LOGW("number of read items for value is wrong. err : %d", errno); err_no = errno; func_ret = PREFERENCE_ERROR_FILE_FREAD; goto out_unlock; + /* LCOV_EXCL_STOP */ } else { _preference_keynode_set_value_boolean(keynode, value_int); } @@ -951,6 +997,7 @@ out_return: strerror_r(err_no, err_buf, 100); if (_preference_check_retry_err(keynode, func_ret, err_no, PREFERENCE_OP_GET)) { + /* LCOV_EXCL_START */ if (retry_cnt < PREFERENCE_ERROR_RETRY_CNT) { retry_cnt++; usleep((retry_cnt)*PREFERENCE_ERROR_RETRY_SLEEP_UTIME); @@ -963,6 +1010,7 @@ out_return: ERR("_preference_get_key_filesys(%s) step(%d) faild(%d / %s) over the retry count.", keynode->keyname, func_ret, err_no, err_buf); } + /* LCOV_EXCL_STOP */ } } @@ -1298,14 +1346,17 @@ API int preference_remove_all(void) ret = _preference_get_key_name(path, &keyname); if (ret != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("_preference_get_key_name() failed(%d)", ret); _preference_keynode_free(pKeyNode); closedir(dir); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } ret = preference_unset_changed_cb(keyname); if (ret != PREFERENCE_ERROR_NONE) { + /* LCOV_EXCL_START */ if (ret == PREFERENCE_ERROR_NO_KEY) { ERR("can't find %s's cb()", keyname); } else { @@ -1315,14 +1366,17 @@ API int preference_remove_all(void) free(keyname); return PREFERENCE_ERROR_IO_ERROR; } + /* LCOV_EXCL_STOP */ } do { ret = remove(path); if (ret == -1) { + /* LCOV_EXCL_START */ strerror_r(errno, err_buf, sizeof(err_buf)); ERR("preference_remove_all error: %d(%s)", errno, err_buf); func_ret = PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } else { func_ret = PREFERENCE_ERROR_NONE; break; diff --git a/preference/preference_inoti.c b/preference/preference_inoti.c index 83cdecf..77bccda 100755 --- a/preference/preference_inoti.c +++ b/preference/preference_inoti.c @@ -95,10 +95,12 @@ static GList *_preference_copy_noti_list(GList *orig_notilist) n->keyname = strndup(t->keyname, PREFERENCE_KEY_PATH_LEN); if (n->keyname == NULL) { + /* LCOV_EXCL_START */ strerror_r(errno, err_buf, sizeof(err_buf)); ERR("The memory is insufficient, errno: %d (%s)", errno, err_buf); free(n); break; + /* LCOV_EXCL_STOP */ } n->wd = t->wd; n->cb_data = t->cb_data; @@ -206,32 +208,40 @@ static int _preference_kdb_noti_init(void) pthread_mutex_lock(&_kdb_inoti_fd_mutex); if (0 < _kdb_inoti_fd) { + /* LCOV_EXCL_START */ ERR("Error: invalid _kdb_inoti_fd"); pthread_mutex_unlock(&_kdb_inoti_fd_mutex); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } _kdb_inoti_fd = inotify_init(); if (_kdb_inoti_fd == -1) { + /* LCOV_EXCL_START */ strerror_r(errno, err_buf, sizeof(err_buf)); ERR("inotify init: %s", err_buf); pthread_mutex_unlock(&_kdb_inoti_fd_mutex); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } ret = fcntl(_kdb_inoti_fd, F_SETFD, FD_CLOEXEC); if (ret < 0) { + /* LCOV_EXCL_START */ strerror_r(errno, err_buf, sizeof(err_buf)); ERR("inotify init: %s", err_buf); pthread_mutex_unlock(&_kdb_inoti_fd_mutex); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } ret = fcntl(_kdb_inoti_fd, F_SETFL, O_NONBLOCK); if (ret < 0) { + /* LCOV_EXCL_START */ strerror_r(errno, err_buf, sizeof(err_buf)); ERR("inotify init: %s", err_buf); pthread_mutex_unlock(&_kdb_inoti_fd_mutex); return PREFERENCE_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } pthread_mutex_unlock(&_kdb_inoti_fd_mutex); @@ -295,6 +305,7 @@ int _preference_kdb_add_notify(keynode_t *keynode, preference_changed_cb cb, voi list = g_list_find_custom(g_notilist, &t, (GCompareFunc)_preference_inoti_comp_with_wd); if (list) { + /* LCOV_EXCL_START */ WARN("_preference_kdb_add_notify : key(%s) change callback(%p)", keyname, cb); node = list->data; @@ -303,22 +314,27 @@ int _preference_kdb_add_notify(keynode_t *keynode, preference_changed_cb cb, voi node->cb = cb; goto out_func; + /* LCOV_EXCL_STOP */ } n = calloc(1, sizeof(noti_node_s)); if (n == NULL) { + /* LCOV_EXCL_START */ strerror_r(errno, err_buf, sizeof(err_buf)); ERR("_preference_kdb_add_notify : add noti(%s)", err_buf); func_ret = PREFERENCE_ERROR_IO_ERROR; goto out_func; + /* LCOV_EXCL_STOP */ } n->keyname = strndup(keyname, PREFERENCE_KEY_PATH_LEN); if (n->keyname == NULL) { + /* LCOV_EXCL_START */ strerror_r(errno, err_buf, sizeof(err_buf)); ERR("The memory is insufficient, errno: %d (%s)", errno, err_buf); free(n); goto out_func; + /* LCOV_EXCL_STOP */ } n->wd = wd; n->cb_data = data; diff --git a/src/app_main.c b/src/app_main.c old mode 100644 new mode 100755 index ccc1bd8..8037e32 --- a/src/app_main.c +++ b/src/app_main.c @@ -195,6 +195,7 @@ int app_appcore_terminate(void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_START */ int app_appcore_pause(void *data) { app_context_h app_context = data; @@ -209,7 +210,9 @@ int app_appcore_pause(void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ int app_appcore_resume(void *data) { app_context_h app_context = data; @@ -224,6 +227,7 @@ int app_appcore_resume(void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int app_appcore_reset(bundle *appcore_bundle, void *data) { @@ -276,6 +280,7 @@ int app_appcore_low_battery(void *event_info, void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_START */ int app_appcore_rotation_event(void *event_info, enum appcore_rm rm, void *data) { app_context_h app_context = data; @@ -295,6 +300,7 @@ int app_appcore_rotation_event(void *event_info, enum appcore_rm rm, void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int app_appcore_lang_changed(void *event_info, void *data) { @@ -403,6 +409,7 @@ static int _ui_app_appcore_low_battery(void *event_info, void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_START */ static int _ui_app_appcore_rotation_event(void *event_info, enum appcore_rm rm, void *data) { Eina_List *l; @@ -420,6 +427,7 @@ static int _ui_app_appcore_rotation_event(void *event_info, enum appcore_rm rm, return APP_ERROR_NONE; } +/* LCOV_EXCL_STOP */ static int _ui_app_appcore_lang_changed(void *event_info, void *data) { @@ -462,6 +470,7 @@ static int _ui_app_appcore_region_changed(void *event_info, void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_START */ static int _ui_app_appcore_suspended_state_changed(void *event_info, void *data) { Eina_List *l; @@ -480,6 +489,7 @@ static int _ui_app_appcore_suspended_state_changed(void *event_info, void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_STOP */ static void _ui_app_appcore_set_event_cb(app_event_type_e event_type) { @@ -611,6 +621,7 @@ static int _ui_app_appcore_terminate(void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_START */ static int _ui_app_appcore_pause(void *data) { LOGI("app_appcore_pause"); @@ -627,7 +638,9 @@ static int _ui_app_appcore_pause(void *data) return APP_ERROR_NONE; } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static int _ui_app_appcore_resume(void *data) { LOGI("app_appcore_resume"); @@ -644,7 +657,7 @@ static int _ui_app_appcore_resume(void *data) return APP_ERROR_NONE; } - +/* LCOV_EXCL_STOP */ static int _ui_app_appcore_reset(bundle *appcore_bundle, void *data) { -- 2.7.4