From: Jihoon Kim Date: Sun, 19 Jul 2020 06:30:54 +0000 (+0900) Subject: Add exclude section for impossible lines to be executed in TCT X-Git-Tag: submit/tizen_5.5/20200805.044926~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e89babb374b32b2644dd2b7d33c1635fab42eeca;p=platform%2Fcore%2Fuifw%2Fcapi-ui-sticker.git Add exclude section for impossible lines to be executed in TCT Change-Id: I12fd296bbc832d2083d24800f162514f70018cc4 Signed-off-by: Jihoon Kim --- diff --git a/client/sticker_data.c b/client/sticker_data.c index cb5c427..c0a5869 100644 --- a/client/sticker_data.c +++ b/client/sticker_data.c @@ -39,21 +39,21 @@ static char* _make_absolute_path(const char *relative_path) ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { - LOGE("Failed to get app_id : %d", ret); + LOGE("Failed to get app_id : %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } ret = package_info_create(app_id, &package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE || package_info == NULL) { - LOGE("failed to create package_info. ret: %d", ret); + LOGE("failed to create package_info. ret: %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } ret = package_info_get_root_path(package_info, &app_path); if (ret != PACKAGE_MANAGER_ERROR_NONE || app_path == NULL) { - LOGE("failed to create package_info. ret: %d", ret); + LOGE("failed to create package_info. ret: %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -61,7 +61,7 @@ static char* _make_absolute_path(const char *relative_path) int path_len = strlen(app_path) + strlen(relative_path) + 2; file_path = (char *)calloc(path_len, sizeof(char)); if (!file_path) { - LOGE("failed to alloc memory"); + LOGE("failed to alloc memory"); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -69,7 +69,7 @@ static char* _make_absolute_path(const char *relative_path) if(relative_path[0] == '/') snprintf(file_path, path_len, "%s%s",app_path, relative_path); else - snprintf(file_path, path_len, "%s%s%s",app_path, "/", relative_path); + snprintf(file_path, path_len, "%s%s%s",app_path, "/", relative_path); //LCOV_EXCL_LINE if (access(file_path, F_OK) != 0) { LOGE("%s does not exist", file_path); @@ -152,10 +152,12 @@ EXPORT_API int sticker_data_create(sticker_data_h *data_handle) char *app_id = NULL; int ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to get app_id : %d", ret); free(data_struct); ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; + //LCOV_EXCL_STOP } data_struct->app_id = strdup(app_id); diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index a3c9cfa..2b653da 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -49,10 +49,12 @@ static int _dbus_init(GDBusConnection **gdbus_connection) GDBusConnection *conn = NULL; conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (conn == NULL) { + //LCOV_EXCL_START if (error != NULL) { LOGE("g_bus_get_sync error message = %s", error->message); g_error_free(error); } + //LCOV_EXCL_STOP return STICKER_CLIENT_ERROR_IO_ERROR; } *gdbus_connection = conn; @@ -68,7 +70,7 @@ static int _dbus_init(GDBusConnection **gdbus_connection) LOGD("watch_id : %d", watch_id); if (watch_id == 0) { - LOGE("Failed to get identifier"); + LOGE("Failed to get identifier"); //LCOV_EXCL_LINE return STICKER_CLIENT_ERROR_IO_ERROR; } @@ -352,8 +354,10 @@ static int _dbus_signal_init(GDBusConnection *gdbus_connection, int *monitor_id, NULL); LOGD("id : %d", id); if (id == 0) { + //LCOV_EXCL_START ret = STICKER_CLIENT_ERROR_IO_ERROR; LOGE("g_dbus_connection_signal_subscribe() failed"); + //LCOV_EXCL_STOP } else { *monitor_id = id; } @@ -372,9 +376,11 @@ static GDBusMessage *_get_gbus_message(GVariant *body, const char *cmd) cmd); if (!message) { + //LCOV_EXCL_START LOGE("Failed to create a new gdbus message"); if (body) g_variant_unref(body); + //LCOV_EXCL_STOP return NULL; } @@ -399,6 +405,7 @@ static int _send_gdbus_sync_message(GDBusConnection *gdbus_connection, GDBusMess &err); if (!*reply) { + //LCOV_EXCL_START ret = STICKER_CLIENT_ERROR_SERVICE_NOT_READY; if (err != NULL) { LOGE("Error occurred when sending message(%s) : %s", cmd, err->message); @@ -406,16 +413,19 @@ static int _send_gdbus_sync_message(GDBusConnection *gdbus_connection, GDBusMess ret = STICKER_CLIENT_ERROR_PERMISSION_DENIED; g_error_free(err); } + //LCOV_EXCL_STOP return ret; } if (g_dbus_message_to_gerror(*reply, &err)) { + //LCOV_EXCL_START LOGE("error message = %s, code = %d", err->message, err->code); if (err->code == G_DBUS_ERROR_ACCESS_DENIED) ret = STICKER_CLIENT_ERROR_PERMISSION_DENIED; else ret = err->code; g_error_free(err); + //LCOV_EXCL_STOP return ret; } @@ -456,6 +466,7 @@ static int _send_async_message(GDBusConnection *gdbus_connection, GVariant *body g_object_unref(msg); if (err != NULL) { + //LCOV_EXCL_START ret = STICKER_CLIENT_ERROR_SERVICE_NOT_READY; LOGE("Error occurred when sending message(%s) : %s", cmd, err->message); @@ -464,6 +475,7 @@ static int _send_async_message(GDBusConnection *gdbus_connection, GVariant *body g_error_free(err); return ret; + //LCOV_EXCL_STOP } return ret; @@ -519,20 +531,26 @@ int sticker_dbus_init(GDBusConnection **gdbus_connection, int *server_watcher_id ret = _dbus_init(gdbus_connection); if (ret != STICKER_CLIENT_ERROR_NONE) { + //LCOV_EXCL_START LOGE("_dbus_init() failed : %d", ret); return ret; + //LCOV_EXCL_STOP } ret = _dbus_signal_init(*gdbus_connection, monitor_id, lib, data); if (ret != STICKER_CLIENT_ERROR_NONE) { + //LCOV_EXCL_START LOGE("_dbus_signal_init() failed : %d", ret); return ret; + //LCOV_EXCL_STOP } ret = _monitor_register(*gdbus_connection, server_watcher_id, lib); if (ret != STICKER_CLIENT_ERROR_NONE) { + //LCOV_EXCL_START LOGE("_monitor_register() failed : %d", ret); return ret; + //LCOV_EXCL_STOP } if (*server_monitor_id == 0) { @@ -545,10 +563,12 @@ int sticker_dbus_init(GDBusConnection **gdbus_connection, int *server_watcher_id server_watcher_id, NULL); if (*server_monitor_id == 0) { + //LCOV_EXCL_START g_dbus_connection_signal_unsubscribe(*gdbus_connection, *monitor_id); *monitor_id = 0; LOGE("Failed to get identifier"); return STICKER_CLIENT_ERROR_IO_ERROR; + //LCOV_EXCL_STOP } } diff --git a/consumer/sticker_consumer.c b/consumer/sticker_consumer.c index 1c11f19..4f51fb5 100644 --- a/consumer/sticker_consumer.c +++ b/consumer/sticker_consumer.c @@ -78,7 +78,7 @@ static int _cynara_initialize() { int ret = cynara_initialize(&p_cynara, NULL); if (ret != CYNARA_API_SUCCESS) - LOGE("Failed to cynara initialize"); + LOGE("Failed to cynara initialize"); //LCOV_EXCL_LINE return ret; } @@ -110,7 +110,7 @@ static int _check_privilege(const char *uid, const char *privilege) free(session); if (ret != CYNARA_API_ACCESS_ALLOWED) { - LOGE("Access denied. The result of cynara_check() : %d.", ret); + LOGE("Access denied. The result of cynara_check() : %d.", ret); //LCOV_EXCL_LINE return -1; } @@ -134,7 +134,7 @@ static int _sticker_check_privilege() { snprintf(uid, 16, "%d", getuid()); if (_check_privilege(uid, STICKER_PRIVILEGE_MEDIASTORAGE) < 0) { - LOGE("Permission is denied"); + LOGE("Permission is denied"); //LCOV_EXCL_LINE ret = STICKER_ERROR_PERMISSION_DENIED; } @@ -161,17 +161,21 @@ EXPORT_API int sticker_consumer_create(sticker_consumer_h *consumer_handle) ret = app_get_id(&consumer_struct->app_id); if (ret != APP_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to get app_id : %d", ret); free(consumer_struct); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } ret = sticker_dbus_init(&consumer_struct->gdbus_connection, &consumer_struct->server_watcher_id, &consumer_struct->monitor_id, &consumer_struct->server_monitor_id, STICKER_CLIENT_LIB_CONSUMER, (void *)consumer_struct); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to initialize dbus : %d", ret); free(consumer_struct); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } *consumer_handle = consumer_struct; @@ -191,9 +195,11 @@ EXPORT_API int sticker_consumer_destroy(sticker_consumer_h consumer_handle) ret = sticker_dbus_shutdown(consumer_handle->gdbus_connection, &consumer_handle->server_watcher_id, &consumer_handle->server_monitor_id, &consumer_handle->monitor_id, STICKER_CLIENT_LIB_CONSUMER); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to finalize dbus : %d", ret); free(consumer_handle); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } if (consumer_handle->gdbus_connection) diff --git a/provider/sticker_provider.c b/provider/sticker_provider.c index b16db5e..82e32c8 100644 --- a/provider/sticker_provider.c +++ b/provider/sticker_provider.c @@ -87,9 +87,11 @@ EXPORT_API int sticker_provider_create(sticker_provider_h *provider_handle) ret = sticker_dbus_init(&provider_struct->gdbus_connection, &provider_struct->server_watcher_id, &provider_struct->monitor_id, &provider_struct->server_monitor_id, STICKER_CLIENT_LIB_PROVIDER, (void *)provider_struct); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to initialize dbus : %d", ret); free(provider_struct); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } *provider_handle = provider_struct; @@ -109,9 +111,11 @@ EXPORT_API int sticker_provider_destroy(sticker_provider_h provider_handle) ret = sticker_dbus_shutdown(provider_handle->gdbus_connection, &provider_handle->server_watcher_id, &provider_handle->server_monitor_id, &provider_handle->monitor_id, STICKER_CLIENT_LIB_PROVIDER); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to finalize dbus : %d", ret); free(provider_handle); return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } if (provider_handle->gdbus_connection) @@ -169,7 +173,7 @@ EXPORT_API int sticker_provider_insert_data_by_json_file(sticker_provider_h prov ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { - LOGE("Failed to get app_id : %d", ret); + LOGE("Failed to get app_id : %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -177,14 +181,14 @@ EXPORT_API int sticker_provider_insert_data_by_json_file(sticker_provider_h prov if (access(json_path, F_OK) != 0) { ret = package_info_create(app_id, &package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE || package_info == NULL) { - LOGE("failed to create package_info. ret: %d", ret); + LOGE("failed to create package_info. ret: %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } ret = package_info_get_root_path(package_info, &app_path); if (ret != PACKAGE_MANAGER_ERROR_NONE || app_path == NULL) { - LOGE("failed to create package_info. ret: %d", ret); + LOGE("failed to create package_info. ret: %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -192,7 +196,7 @@ EXPORT_API int sticker_provider_insert_data_by_json_file(sticker_provider_h prov int path_len = strlen(app_path) + strlen(json_path) + 2; file_path = (char *)calloc(path_len, sizeof(char)); if (!file_path) { - LOGE("failed to alloc memory"); + LOGE("failed to alloc memory"); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -247,6 +251,7 @@ EXPORT_API int sticker_provider_update_data(sticker_provider_h provider_handle, ret = sticker_dbus_update_sticker_info(provider_handle->gdbus_connection, data_handle); if (ret != STICKER_ERROR_NONE) { + //LCOV_EXCL_START LOGE("Failed to update sticker information : %d", ret); if (ret == STICKER_CLIENT_ERROR_FILE_EXISTS) return STICKER_ERROR_FILE_EXISTS; @@ -254,6 +259,7 @@ EXPORT_API int sticker_provider_update_data(sticker_provider_h provider_handle, return STICKER_ERROR_NO_SUCH_FILE; else return STICKER_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } return STICKER_ERROR_NONE; @@ -288,7 +294,7 @@ EXPORT_API int sticker_provider_get_sticker_count(sticker_provider_h provider_ha ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { - LOGE("Failed to get app_id : %d", ret); + LOGE("Failed to get app_id : %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; } @@ -321,7 +327,7 @@ EXPORT_API int sticker_provider_data_foreach_all(sticker_provider_h provider_han ret = app_get_id(&app_id); if (ret != APP_ERROR_NONE) { - LOGE("Failed to get app_id : %d", ret); + LOGE("Failed to get app_id : %d", ret); //LCOV_EXCL_LINE ret = STICKER_ERROR_OPERATION_FAILED; goto cleanup; }