From: cookie Date: Tue, 26 Sep 2017 05:35:12 +0000 (+0000) Subject: Improve the line coverage by LCOV_EXCL_START and LCOV_EXCL_STOP X-Git-Tag: submit/tizen_4.0/20170926.060543^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee418e175252c512ee0472a2efe5894998e96d7e;p=platform%2Fframework%2Fweb%2Fbrowser-provider.git Improve the line coverage by LCOV_EXCL_START and LCOV_EXCL_STOP Change-Id: I8acc861fce0470cf36885f340fe2f7a8dac7b982 Signed-off-by: cookie --- diff --git a/bookmark-adaptor/bookmark-adaptor.c b/bookmark-adaptor/bookmark-adaptor.c index 1e5504c..c2f2f52 100755 --- a/bookmark-adaptor/bookmark-adaptor.c +++ b/bookmark-adaptor/bookmark-adaptor.c @@ -71,7 +71,7 @@ static void *__bookmark_adaptor_event_manager(void *arg) { int status = bp_common_adaptor_event_manager(arg, &g_adaptor_noti_cb, &g_adaptor_noti_user_data); - + /* LCOV_EXCL_START */ pthread_mutex_lock(&g_adaptor_mutex); g_adaptor_event_thread_pid = 0; // set 0 to not call pthread_cancel if (status >= 0) { @@ -91,6 +91,7 @@ static void *__bookmark_adaptor_event_manager(void *arg) } } TRACE_DEBUG("callback thread is end by deinit"); + /* LCOV_EXCL_STOP */ return 0; } @@ -109,13 +110,15 @@ int __browser_adaptor_connect(int callback) #ifdef SUPPORT_CLOUD_SYSTEM if (bp_common_adaptor_is_sync_adaptor() == 0) - client_type = BP_CLIENT_BOOKMARK_SYNC; + client_type = BP_CLIENT_BOOKMARK_SYNC; //LCOV_EXCL_LINE #endif if (bp_common_adaptor_connect_to_provider(&g_adaptorinfo, client_type) < 0) { + /* LCOV_EXCL_START */ TRACE_ERROR("[CHECK connection]"); return -1; + /* LCOV_EXCL_STOP */ } } g_bp_command.cmd = BP_CMD_NONE; @@ -123,21 +126,23 @@ int __browser_adaptor_connect(int callback) if (g_adaptorinfo != NULL) { g_bp_command.cid = g_adaptorinfo->cid; } else { - g_bp_command.cid = 0; + g_bp_command.cid = 0; //LCOV_EXCL_LINE } if (callback == 1 && g_adaptor_event_thread_pid <= 0) { // create thread here ( getting event_socket ) if (pthread_create(&g_adaptor_event_thread_pid, NULL, __bookmark_adaptor_event_manager, g_adaptorinfo) != 0) { -// TRACE_ERROR("[CRITICAL] pthread_create"); + /* LCOV_EXCL_START */ + TRACE_ERROR("[CRITICAL] pthread_create"); return -1; + /* LCOV_EXCL_STOP */ } pthread_detach(g_adaptor_event_thread_pid); TRACE_DEBUG("pthread:%0x", (int)g_adaptor_event_thread_pid); } return 0; } - +/* LCOV_EXCL_START */ static int __bp_bookmark_adaptor_get_ids_p(int id, int **ids, int *count, bp_command_defs cmd) { @@ -159,6 +164,7 @@ static int __bp_bookmark_adaptor_get_ids_p(int id, int **ids, *count = ids_count; return 0; } +/* LCOV_EXCL_STOP */ static int __bp_bookmark_adaptor_get_string(const int id, bp_command_defs cmd, char **value) @@ -173,7 +179,7 @@ static int __bp_bookmark_adaptor_get_string(const int id, g_bp_command.id = id; int ret = bp_common_adaptor_get_string(sock, &g_bp_command, value, &errorcode); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -191,7 +197,7 @@ static int __bp_bookmark_adaptor_get_int(const int id, g_bp_command.id = id; int ret = bp_common_adaptor_get_int(sock, &g_bp_command, value, &errorcode); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -210,7 +216,7 @@ static int __bp_bookmark_adaptor_set_string(const int id, g_bp_command.id = id; int ret = bp_common_adaptor_set_string(sock, &g_bp_command, value, &errorcode); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -228,7 +234,7 @@ static int __bp_bookmark_adaptor_set_int(const int id, g_bp_command.id = id; int ret = bp_common_adaptor_set_int(sock, &g_bp_command, value, &errorcode); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -243,8 +249,10 @@ static int __bp_bookmark_adaptor_send_cmd(const int id, bp_command_defs cmd) errorcode = bp_bookmark_ipc_simple_response(sock, &g_bp_command); pthread_mutex_unlock(&g_adaptor_mutex); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(id, errorcode); return -1; + /* LCOV_EXCL_STOP */ } return 0; } @@ -280,8 +288,10 @@ int bp_bookmark_adaptor_deinitialize(void) { pthread_mutex_lock(&g_adaptor_mutex); if (__browser_adaptor_connect(0) < 0) { + /* LCOV_EXCL_START */ pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } int sock = BP_CHECK_IPC_SOCK; @@ -310,6 +320,7 @@ int bp_bookmark_adaptor_get_root(int *id) } // caller should free ids fully + /* LCOV_EXCL_START */ int bp_bookmark_adaptor_get_full_ids_p(int **ids, int *count) { return __bp_bookmark_adaptor_get_ids_p @@ -347,6 +358,19 @@ int bp_bookmark_adaptor_clear_deleted_ids(void) (-1, BP_CMD_COMMON_CLEAR_DELETED_IDS); } +int bp_bookmark_adaptor_set_sync(const int id, const char *value) +{ + return __bp_bookmark_adaptor_set_string + (id, BP_CMD_COMMON_SET_SYNC, value); +} + +int bp_bookmark_adaptor_get_sync(const int id, char **value) +{ + return __bp_bookmark_adaptor_get_string + (id, BP_CMD_COMMON_GET_SYNC, value); +} + /* LCOV_EXCL_STOP */ + int bp_bookmark_adaptor_set_data_changed_cb (bp_bookmark_adaptor_data_changed_cb callback, void *user_data) { @@ -380,9 +404,11 @@ int bp_bookmark_adaptor_is_setted_data_changed_cb(void) return -1; } if (g_adaptor_event_thread_pid <= 0) { -// TRACE_ERROR("[CRITICAL] callback is setted, but event manager not work"); + /* LCOV_EXCL_START */ + TRACE_ERROR("[CRITICAL] callback is setted, but event manager not work"); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } pthread_mutex_unlock(&g_adaptor_mutex); return 0; @@ -432,12 +458,14 @@ int bp_bookmark_adaptor_create(int *id) } bookmark_id = bp_adaptor_ipc_read_int(sock); if (bookmark_id < 0) { + /* LCOV_EXCL_START */ bp_bookmark_ipc_check_stderr(BP_ERROR_IO_ERROR); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } if (*id == bookmark_id) { - TRACE_INFO("created a bookmark:%d", *id); + TRACE_INFO("created a bookmark:%d", *id);//LCOV_EXCL_LINE } else { *id = bookmark_id; TRACE_INFO("created new bookmark:%d", *id); @@ -459,29 +487,29 @@ int bp_bookmark_adaptor_get_errorcode(void) { switch (errorcode) { case BP_ERROR_INVALID_PARAMETER: - return BP_BOOKMARK_ERROR_INVALID_PARAMETER; + return BP_BOOKMARK_ERROR_INVALID_PARAMETER;//LCOV_EXCL_LINE case BP_ERROR_OUT_OF_MEMORY: - return BP_BOOKMARK_ERROR_OUT_OF_MEMORY; + return BP_BOOKMARK_ERROR_OUT_OF_MEMORY;//LCOV_EXCL_LINE case BP_ERROR_IO_EINTR: case BP_ERROR_IO_EAGAIN: case BP_ERROR_IO_ERROR: - return BP_BOOKMARK_ERROR_IO_ERROR; + return BP_BOOKMARK_ERROR_IO_ERROR;//LCOV_EXCL_LINE case BP_ERROR_NO_DATA: - return BP_BOOKMARK_ERROR_NO_DATA; + return BP_BOOKMARK_ERROR_NO_DATA;//LCOV_EXCL_LINE case BP_ERROR_ID_NOT_FOUND: - return BP_BOOKMARK_ERROR_ID_NOT_FOUND; + return BP_BOOKMARK_ERROR_ID_NOT_FOUND;//LCOV_EXCL_LINE case BP_ERROR_DUPLICATED_ID: - return BP_BOOKMARK_ERROR_DUPLICATED_ID; + return BP_BOOKMARK_ERROR_DUPLICATED_ID;//LCOV_EXCL_LINE case BP_ERROR_PERMISSION_DENY: - return BP_BOOKMARK_ERROR_PERMISSION_DENY; + return BP_BOOKMARK_ERROR_PERMISSION_DENY;//LCOV_EXCL_LINE case BP_ERROR_DISK_FULL: - return BP_BOOKMARK_ERROR_DISK_FULL; + return BP_BOOKMARK_ERROR_DISK_FULL;//LCOV_EXCL_LINE case BP_ERROR_DISK_BUSY: - return BP_BOOKMARK_ERROR_DISK_BUSY; + return BP_BOOKMARK_ERROR_DISK_BUSY;//LCOV_EXCL_LINE case BP_ERROR_TOO_BIG_DATA: - return BP_BOOKMARK_ERROR_TOO_BIG_DATA; + return BP_BOOKMARK_ERROR_TOO_BIG_DATA;//LCOV_EXCL_LINE case BP_ERROR_UNKNOWN: - return BP_BOOKMARK_ERROR_UNKNOWN; + return BP_BOOKMARK_ERROR_UNKNOWN;//LCOV_EXCL_LINE default: break; } @@ -493,12 +521,13 @@ int bp_bookmark_adaptor_get_type(const int id, int *value) return __bp_bookmark_adaptor_get_int (id, BP_CMD_BOOKMARK_GET_TYPE, value); } - +/* LCOV_EXCL_START */ int bp_bookmark_adaptor_get_parent_id(const int id, int *value) { return __bp_bookmark_adaptor_get_int (id, BP_CMD_BOOKMARK_GET_PARENT, value); } +/* LCOV_EXCL_STOP */ int bp_bookmark_adaptor_get_url(const int id, char **value) { @@ -506,6 +535,7 @@ int bp_bookmark_adaptor_get_url(const int id, char **value) (id, BP_CMD_COMMON_GET_URL, value); } +/* LCOV_EXCL_START */ int bp_bookmark_adaptor_get_title(const int id, char **value) { return __bp_bookmark_adaptor_get_string @@ -529,6 +559,7 @@ int bp_bookmark_adaptor_get_is_operator(const int id, int *value) return __bp_bookmark_adaptor_get_int (id, BP_CMD_BOOKMARK_GET_IS_OPERATOR, value); } +/* LCOV_EXCL_STOP */ int bp_bookmark_adaptor_get_access_count(const int id, int *value) { @@ -578,12 +609,6 @@ int bp_bookmark_adaptor_get_device_id(const int id, char **value) (id, BP_CMD_COMMON_GET_DEVICE_ID, value); } -int bp_bookmark_adaptor_get_sync(const int id, char **value) -{ - return __bp_bookmark_adaptor_get_string - (id, BP_CMD_COMMON_GET_SYNC, value); -} - int bp_bookmark_adaptor_set_type(const int id, const int value) { return __bp_bookmark_adaptor_set_int @@ -664,12 +689,6 @@ int bp_bookmark_adaptor_set_device_id(const int id, const char *value) (id, BP_CMD_COMMON_SET_DEVICE_ID, value); } -int bp_bookmark_adaptor_set_sync(const int id, const char *value) -{ - return __bp_bookmark_adaptor_set_string - (id, BP_CMD_COMMON_SET_SYNC, value); -} - int bp_bookmark_adaptor_easy_create(int *id, bp_bookmark_info_fmt *info) { if (id == NULL || info == NULL) @@ -681,8 +700,10 @@ int bp_bookmark_adaptor_easy_create(int *id, bp_bookmark_info_fmt *info) return -1; } if (*id <= 0) { + /* LCOV_EXCL_START */ TRACE_ERROR("[failed to create new bookmark]"); return -1; + /* LCOV_EXCL_STOP */ } } @@ -707,17 +728,21 @@ int bp_bookmark_adaptor_easy_create(int *id, bp_bookmark_info_fmt *info) // send command without waiting return value errorcode = bp_bookmark_ipc_simple_response(sock, &g_bp_command); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } // 1. send bp_bookmark_base_fmt structure if (bp_ipc_send_custom_type(sock, &new_base_info, sizeof(bp_bookmark_base_fmt)) < 0) { + /* LCOV_EXCL_START */ errorcode = BP_ERROR_IO_ERROR; -// BP_PRINT_ERROR(*id, errorcode); + BP_PRINT_ERROR(*id, errorcode); __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } // 2. wait id from provider. errorcode = bp_bookmark_ipc_read_errorcode(sock); @@ -741,7 +766,7 @@ int bp_bookmark_adaptor_easy_create(int *id, bp_bookmark_info_fmt *info) if (info->device_id != NULL) bp_bookmark_adaptor_set_device_id(*id, info->device_id); if (info->sync != NULL) - bp_bookmark_adaptor_set_sync(*id, info->sync); + bp_bookmark_adaptor_set_sync(*id, info->sync);//LCOV_EXCL_LINE if (info->favicon_length > 0 && info->favicon != NULL) { bp_bookmark_adaptor_set_icon(*id, info->favicon_width, @@ -786,26 +811,32 @@ int bp_bookmark_adaptor_get_info(const int id, bp_bookmark_offset oflags = offset; if (bp_ipc_send_custom_type(sock, &oflags, sizeof(bp_bookmark_offset)) < 0) { + /* LCOV_EXCL_START */ errorcode = BP_ERROR_IO_ERROR; -// BP_PRINT_ERROR(id, errorcode); + BP_PRINT_ERROR(id, errorcode); __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } // 2. wait id from provider. errorcode = bp_bookmark_ipc_read_errorcode(sock); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } bp_bookmark_base_fmt bookmark; memset(&bookmark, 0x00, sizeof(bp_bookmark_base_fmt)); // getting bp_tab_base_fmt from provider. if (bp_ipc_read_custom_type(sock, &bookmark, sizeof(bp_bookmark_base_fmt)) < 0) { + /* LCOV_EXCL_START */ bp_bookmark_ipc_check_stderr(BP_ERROR_IO_ERROR); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } memset(info, 0x00, sizeof(bp_bookmark_info_fmt)); @@ -840,42 +871,44 @@ int bp_bookmark_adaptor_get_info(const int id, // get strings . keep the order with provider if (offset & BP_BOOKMARK_O_URL) { if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) - info->url = bp_ipc_read_string(sock); + info->url = bp_ipc_read_string(sock);//LCOV_EXCL_LINE } if (offset & BP_BOOKMARK_O_TITLE) { if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) - info->title = bp_ipc_read_string(sock); + info->title = bp_ipc_read_string(sock);//LCOV_EXCL_LINE } if (offset & BP_BOOKMARK_O_ACCOUNT_NAME) { if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) - info->account_name = bp_ipc_read_string(sock); + info->account_name = bp_ipc_read_string(sock);//LCOV_EXCL_LINE } if (offset & BP_BOOKMARK_O_ACCOUNT_TYPE) { if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) - info->account_type = bp_ipc_read_string(sock); + info->account_type = bp_ipc_read_string(sock);//LCOV_EXCL_LINE } if (offset & BP_BOOKMARK_O_DEVICE_NAME) { if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) - info->device_name = bp_ipc_read_string(sock); + info->device_name = bp_ipc_read_string(sock);//LCOV_EXCL_LINE } if (offset & BP_BOOKMARK_O_DEVICE_ID) { if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) - info->device_id = bp_ipc_read_string(sock); + info->device_id = bp_ipc_read_string(sock);//LCOV_EXCL_LINE } if (offset & BP_BOOKMARK_O_SYNC) { if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) - info->sync = bp_ipc_read_string(sock); + info->sync = bp_ipc_read_string(sock);//LCOV_EXCL_LINE } if (offset & BP_BOOKMARK_O_ICON) { info->favicon_length = 0; info->favicon_width = bookmark.favicon_width; info->favicon_height = bookmark.favicon_height; if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) { + /* LCOV_EXCL_START */ unsigned char *blob_data = NULL; if ((info->favicon_length = bp_common_adaptor_get_info_blob(sock, &blob_data, &g_adaptorinfo->shm)) > 0 && blob_data != NULL) info->favicon = blob_data; + /* LCOV_EXCL_STOP */ } } if (offset & BP_BOOKMARK_O_SNAPSHOT) { @@ -883,11 +916,13 @@ int bp_bookmark_adaptor_get_info(const int id, info->thumbnail_width = bookmark.thumbnail_width; info->thumbnail_height = bookmark.thumbnail_height; if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) { + /* LCOV_EXCL_START */ unsigned char *blob_data = NULL; if ((info->thumbnail_length = bp_common_adaptor_get_info_blob(sock, &blob_data, &g_adaptorinfo->shm)) > 0 && blob_data != NULL) info->thumbnail = blob_data; + /* LCOV_EXCL_STOP */ } } if (offset & BP_BOOKMARK_O_WEBICON) { @@ -895,11 +930,13 @@ int bp_bookmark_adaptor_get_info(const int id, info->webicon_width = bookmark.webicon_width; info->webicon_height = bookmark.webicon_height; if (bp_ipc_read_errorcode(sock) == BP_ERROR_NONE) { + /* LCOV_EXCL_START */ unsigned char *blob_data = NULL; if ((info->webicon_length = bp_common_adaptor_get_info_blob(sock, &blob_data, &g_adaptorinfo->shm)) > 0 && blob_data != NULL) info->webicon = blob_data; + /* LCOV_EXCL_STOP */ } } @@ -978,31 +1015,37 @@ static int __bp_bookmark_adaptor_get_cond_ids_p sizeof(bp_bookmark_rows_cond_fmt)) < 0 || bp_ipc_send_custom_type(sock, &oflags, sizeof(bp_bookmark_offset)) < 0) { + /* LCOV_EXCL_START */ errorcode = BP_ERROR_IO_ERROR; -// BP_PRINT_ERROR(-1, errorcode); + BP_PRINT_ERROR(-1, errorcode); __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } if (oflags > 0) { if (bp_adaptor_ipc_send_int(sock, is_like) < 0 || bp_ipc_send_string(sock, keyword) < 0) { + /* LCOV_EXCL_START */ errorcode = BP_ERROR_IO_ERROR; -// BP_PRINT_ERROR(-1, errorcode); + BP_PRINT_ERROR(-1, errorcode); __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } } // wait id from provider. errorcode = bp_bookmark_ipc_read_errorcode(sock); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ pthread_mutex_unlock(&g_adaptor_mutex); if (errorcode == BP_ERROR_NO_DATA) { // success *count = 0; return 0; } return -1; + /* LCOV_EXCL_STOP */ } // int count. int ids_count = bp_adaptor_ipc_read_int(sock); @@ -1010,33 +1053,40 @@ static int __bp_bookmark_adaptor_get_cond_ids_p if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) { int *idlist = (int *)calloc(ids_count, sizeof(int)); if (idlist == NULL) { + /* LCOV_EXCL_START */ errorcode = BP_ERROR_OUT_OF_MEMORY; -// BP_PRINT_ERROR(-1, errorcode); + BP_PRINT_ERROR(-1, errorcode); if (bp_common_adaptor_clear_read_buffer(sock, (sizeof(int) * ids_count)) < 0) { __browser_adaptor_disconnect(); } pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } // getting ids array from provider if (bp_ipc_read_blob(sock, idlist, (sizeof(int) * ids_count)) < 0) { + /* LCOV_EXCL_START */ free(idlist); bp_bookmark_ipc_check_stderr(BP_ERROR_IO_ERROR); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } *ids = idlist; *count = ids_count; } else { + /* LCOV_EXCL_START */ *ids = NULL; *count = 0; + /* LCOV_EXCL_STOP */ } pthread_mutex_unlock(&g_adaptor_mutex); return 0; } +/* LCOV_EXCL_START */ int bp_bookmark_adaptor_get_timestamp_ids_p (int **ids, int *count, const bp_bookmark_property_cond_fmt *properties, //if NULL, ignore @@ -1115,7 +1165,7 @@ int bp_bookmark_adaptor_get_timestamp_ids_p if (bp_ipc_send_custom_type(sock, &oflags, sizeof(bp_bookmark_offset)) < 0) { errorcode = BP_ERROR_IO_ERROR; -// BP_PRINT_ERROR(-1, errorcode); + BP_PRINT_ERROR(-1, errorcode); __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; @@ -1124,7 +1174,7 @@ int bp_bookmark_adaptor_get_timestamp_ids_p if (bp_adaptor_ipc_send_int(sock, is_like) < 0 || bp_ipc_send_string(sock, keyword) < 0) { errorcode = BP_ERROR_IO_ERROR; -// BP_PRINT_ERROR(-1, errorcode); + BP_PRINT_ERROR(-1, errorcode); __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; @@ -1147,7 +1197,7 @@ int bp_bookmark_adaptor_get_timestamp_ids_p int *idlist = (int *)calloc(ids_count, sizeof(int)); if (idlist == NULL) { errorcode = BP_ERROR_OUT_OF_MEMORY; -// BP_PRINT_ERROR(-1, errorcode); + BP_PRINT_ERROR(-1, errorcode); if (bp_common_adaptor_clear_read_buffer(sock, (sizeof(int) * ids_count)) < 0) { __browser_adaptor_disconnect(); @@ -1172,6 +1222,7 @@ int bp_bookmark_adaptor_get_timestamp_ids_p pthread_mutex_unlock(&g_adaptor_mutex); return 0; } +/* LCOV_EXCL_STOP */ int bp_bookmark_adaptor_backup(char *value) { @@ -1184,7 +1235,7 @@ int bp_bookmark_adaptor_restore(char *value) return __bp_bookmark_adaptor_set_string (-1, BP_CMD_BOOKMARK_RESTORE, value); } - +/* LCOV_EXCL_START */ int bp_bookmark_adaptor_get_ids_p (int **ids, int *count, const int limit, const int offset, const int parent, const int type, @@ -1268,6 +1319,7 @@ int bp_bookmark_adaptor_get_ids_p pthread_mutex_unlock(&g_adaptor_mutex); return 0; } +/* LCOV_EXCL_STOP */ int bp_bookmark_adaptor_get_cond_ids_p (int **ids, int *count, @@ -1280,7 +1332,7 @@ int bp_bookmark_adaptor_get_cond_ids_p (BP_CMD_COMMON_GET_CONDS_DATE_IDS, ids, count, properties, conds, check_offset, keyword, is_like); } - +/* LCOV_EXCL_START */ int bp_bookmark_adaptor_get_raw_retrieved_ids_p (int **ids, int *count, bp_bookmark_property_cond_fmt *properties, @@ -1292,7 +1344,7 @@ int bp_bookmark_adaptor_get_raw_retrieved_ids_p (BP_CMD_COMMON_GET_CONDS_RAW_IDS, ids, count, properties, conds, check_offset, keyword, is_like); } - +/* LCOV_EXCL_STOP */ //////////////// internet_bookmark_xxx APIs // removing an item without corresponding sub items. remain this code just for reference. diff --git a/history-adaptor/history-adaptor.c b/history-adaptor/history-adaptor.c index b7a4c27..25190ef 100755 --- a/history-adaptor/history-adaptor.c +++ b/history-adaptor/history-adaptor.c @@ -44,7 +44,7 @@ static bp_error_defs errorcode = BP_ERROR_NONE; static void *__history_adaptor_event_manager(void *arg) { int status = bp_common_adaptor_event_manager(arg, NULL, NULL); - + /* LCOV_EXCL_START */ pthread_mutex_lock(&g_adaptor_mutex); g_adaptor_event_thread_pid = 0; // set 0 to not call pthread_cancel if (status >= 0) { @@ -55,7 +55,7 @@ static void *__history_adaptor_event_manager(void *arg) } } pthread_mutex_unlock(&g_adaptor_mutex); - + /* LCOV_EXCL_STOP */ // Todo : the codes for cloud TRACE_DEBUG("callback thread is end by deinit"); @@ -89,8 +89,10 @@ static int __browser_adaptor_connect(int callback) if (bp_common_adaptor_connect_to_provider(&g_adaptorinfo, client_type) < 0) { + /* LCOV_EXCL_START */ TRACE_ERROR("[CHECK connection]"); return -1; + /* LCOV_EXCL_STOP */ } } g_bp_command.cmd = BP_CMD_NONE; @@ -98,14 +100,16 @@ static int __browser_adaptor_connect(int callback) if (g_adaptorinfo != NULL) { g_bp_command.cid = g_adaptorinfo->cid; } else { - g_bp_command.cid = 0; + g_bp_command.cid = 0;//LCOV_EXCL_LINE } if (callback == 1 && g_adaptor_event_thread_pid <= 0) { // create thread here ( getting event_socket ) if (pthread_create(&g_adaptor_event_thread_pid, NULL, __history_adaptor_event_manager, g_adaptorinfo) != 0) { + /* LCOV_EXCL_START */ TRACE_ERROR("[CRITICAL] pthread_create"); return -1; + /* LCOV_EXCL_STOP */ } pthread_detach(g_adaptor_event_thread_pid); TRACE_DEBUG("pthread:%0x", (int)g_adaptor_event_thread_pid); @@ -126,7 +130,7 @@ static int __bp_history_adaptor_get_string(const int id, g_bp_command.id = id; int ret = bp_common_adaptor_get_string(sock, &g_bp_command, value, &errorcode); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -144,7 +148,7 @@ static int __bp_history_adaptor_get_int(const int id, g_bp_command.id = id; int ret = bp_common_adaptor_get_int(sock, &g_bp_command, value, &errorcode); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -162,7 +166,7 @@ static int __bp_history_adaptor_set_string(const int id, g_bp_command.id = id; int ret = bp_common_adaptor_set_string(sock, &g_bp_command, value, &errorcode); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -180,7 +184,7 @@ static int __bp_history_adaptor_set_int(const int id, g_bp_command.id = id; int ret = bp_common_adaptor_set_int(sock, &g_bp_command, value, &errorcode); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -195,15 +199,17 @@ static int __bp_history_adaptor_send_cmd(const int id, bp_command_defs cmd) g_bp_command.id = id; errorcode = bp_ipc_simple_response(sock, &g_bp_command); if (errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(id, errorcode); return -1; + /* LCOV_EXCL_STOP */ } return 0; } - +/* LCOV_EXCL_START */ static int __bp_history_adaptor_get_blob_shm(const int id, bp_command_defs cmd, int *width, int *height, unsigned char **value, int *length) @@ -223,6 +229,7 @@ static int __bp_history_adaptor_get_blob_shm(const int id, pthread_mutex_unlock(&g_adaptor_mutex); return ret; } +/* LCOV_EXCL_STOP */ static int __bp_history_adaptor_set_blob_shm(const int id, bp_command_defs cmd, const int width, const int height, @@ -239,7 +246,7 @@ static int __bp_history_adaptor_set_blob_shm(const int id, int ret = bp_common_adaptor_set_blob_shm(sock, &g_bp_command, width, height, value, length, &errorcode, &g_adaptorinfo->shm); if (ret < 0 && errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); return ret; } @@ -309,20 +316,24 @@ int bp_history_adaptor_create(int *id) errorcode = bp_ipc_simple_response(sock, &g_bp_command); if (errorcode != BP_ERROR_NONE) { -// BP_PRINT_ERROR(*id, errorcode); + /* LCOV_EXCL_START */ + BP_PRINT_ERROR(*id, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } history_id = bp_adaptor_ipc_read_int(sock); if (history_id < 0) { + /* LCOV_EXCL_START */ errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR); -// BP_PRINT_ERROR(*id, errorcode); + BP_PRINT_ERROR(*id, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } if (*id == history_id) { TRACE_INFO("created a history:%d", *id); @@ -338,36 +349,36 @@ int bp_history_adaptor_delete(const int id) { if (id < 0) return -1; - return __bp_history_adaptor_send_cmd(id, BP_CMD_COMMON_DELETE); + return __bp_history_adaptor_send_cmd(id, BP_CMD_COMMON_DELETE);//LCOV_EXCL_LINE } int bp_history_adaptor_get_errorcode(void) { switch (errorcode) { case BP_ERROR_INVALID_PARAMETER: - return BP_HISTORY_ERROR_INVALID_PARAMETER; + return BP_HISTORY_ERROR_INVALID_PARAMETER;//LCOV_EXCL_LINE case BP_ERROR_OUT_OF_MEMORY: - return BP_HISTORY_ERROR_OUT_OF_MEMORY; + return BP_HISTORY_ERROR_OUT_OF_MEMORY;//LCOV_EXCL_LINE case BP_ERROR_IO_EINTR: case BP_ERROR_IO_EAGAIN: case BP_ERROR_IO_ERROR: - return BP_HISTORY_ERROR_IO_ERROR; + return BP_HISTORY_ERROR_IO_ERROR;//LCOV_EXCL_LINE case BP_ERROR_NO_DATA: - return BP_HISTORY_ERROR_NO_DATA; + return BP_HISTORY_ERROR_NO_DATA;//LCOV_EXCL_LINE case BP_ERROR_ID_NOT_FOUND: - return BP_HISTORY_ERROR_ID_NOT_FOUND; + return BP_HISTORY_ERROR_ID_NOT_FOUND;//LCOV_EXCL_LINE case BP_ERROR_DUPLICATED_ID: - return BP_HISTORY_ERROR_DUPLICATED_ID; + return BP_HISTORY_ERROR_DUPLICATED_ID;//LCOV_EXCL_LINE case BP_ERROR_PERMISSION_DENY: - return BP_HISTORY_ERROR_PERMISSION_DENY; + return BP_HISTORY_ERROR_PERMISSION_DENY;//LCOV_EXCL_LINE case BP_ERROR_DISK_FULL: - return BP_HISTORY_ERROR_DISK_FULL; + return BP_HISTORY_ERROR_DISK_FULL;//LCOV_EXCL_LINE case BP_ERROR_DISK_BUSY: - return BP_HISTORY_ERROR_DISK_BUSY; + return BP_HISTORY_ERROR_DISK_BUSY;//LCOV_EXCL_LINE case BP_ERROR_TOO_BIG_DATA: - return BP_HISTORY_ERROR_TOO_BIG_DATA; + return BP_HISTORY_ERROR_TOO_BIG_DATA;//LCOV_EXCL_LINE case BP_ERROR_UNKNOWN: - return BP_HISTORY_ERROR_UNKNOWN; + return BP_HISTORY_ERROR_UNKNOWN;//LCOV_EXCL_LINE default: break; } @@ -516,11 +527,13 @@ int bp_history_adaptor_limit_size errorcode = bp_ipc_simple_response(sock, &g_bp_command); if (errorcode != BP_ERROR_NONE) { -// BP_PRINT_ERROR(-1, errorcode); + /* LCOV_EXCL_START */ + BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } if (bp_ipc_send_custom_type(sock, &conds, sizeof(bp_db_base_conds_fmt)) < 0 || @@ -531,11 +544,13 @@ int bp_history_adaptor_limit_size // wait id from provider. errorcode = bp_ipc_read_errorcode(sock); if (errorcode == BP_ERROR_IO_ERROR) - __browser_adaptor_disconnect(); + __browser_adaptor_disconnect();//LCOV_EXCL_LINE pthread_mutex_unlock(&g_adaptor_mutex); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(-1, errorcode); return -1; + /* LCOV_EXCL_STOP */ } return 0; } @@ -547,8 +562,10 @@ int bp_history_adaptor_easy_create(int *id, bp_history_info_fmt *info) if (*id <= 0) { // new history if (bp_history_adaptor_create(id) < 0) { + /* LCOV_EXCL_START */ TRACE_ERROR("[failed to create new history]"); return -1; + /* LCOV_EXCL_STOP */ } if (*id <= 0) { TRACE_ERROR("[failed to create new history]"); @@ -600,11 +617,13 @@ int bp_history_adaptor_get_info(const int id, // send command without waiting return value errorcode = bp_ipc_simple_response(sock, &g_bp_command); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(id, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } // 1. oflags unsigned int oflags = offset; @@ -616,17 +635,20 @@ int bp_history_adaptor_get_info(const int id, // 2. wait id from provider. errorcode = bp_ipc_read_errorcode(sock); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(id, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } bp_history_info_fmt history; memset(&history, 0x00, sizeof(bp_history_info_fmt)); // getting bp_tab_base_fmt from provider. if (bp_ipc_read_custom_type(sock, &history, sizeof(bp_history_info_fmt)) < 0) { + /* LCOV_EXCL_START */ TRACE_ERROR("[CHECK IO] (%d)", id); errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR); BP_PRINT_ERROR(id, errorcode); @@ -634,6 +656,7 @@ int bp_history_adaptor_get_info(const int id, __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } memset(info, 0x00, sizeof(bp_history_info_fmt)); @@ -733,11 +756,13 @@ int bp_history_adaptor_get_date_count errorcode = bp_ipc_simple_response(sock, cmd); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } bp_history_offset oflags = date_column_offset; if (bp_ipc_send_custom_type(sock, &oflags, @@ -749,6 +774,7 @@ int bp_history_adaptor_get_date_count // wait id from provider. errorcode = bp_ipc_read_errorcode(sock); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); @@ -758,16 +784,19 @@ int bp_history_adaptor_get_date_count return 0; } return -1; + /* LCOV_EXCL_STOP */ } int recv_int = bp_adaptor_ipc_read_int(sock); TRACE_DEBUG("response ids count:%d", recv_int); if (recv_int < 0) { + /* LCOV_EXCL_START */ errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR); BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } pthread_mutex_unlock(&g_adaptor_mutex); *count = recv_int; @@ -797,19 +826,21 @@ static int __bp_history_adaptor_get_cond_ids_p if (conds != NULL) memcpy(&t_conds, conds, sizeof(bp_history_rows_cond_fmt)); else - t_conds.limit = -1; + t_conds.limit = -1;//LCOV_EXCL_LINE errorcode = bp_ipc_simple_response(sock, cmd); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } bp_history_offset oflags = check_offset; if (keyword == NULL) - oflags = 0; + oflags = 0;//LCOV_EXCL_LINE if (bp_ipc_send_custom_type(sock, &t_conds, sizeof(bp_history_rows_cond_fmt)) < 0 || bp_ipc_send_custom_type(sock, &oflags, @@ -827,7 +858,8 @@ static int __bp_history_adaptor_get_cond_ids_p // wait id from provider. errorcode = bp_ipc_read_errorcode(sock); if (errorcode != BP_ERROR_NONE) { -// BP_PRINT_ERROR(-1, errorcode); + /* LCOV_EXCL_START */ + BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); @@ -836,6 +868,7 @@ static int __bp_history_adaptor_get_cond_ids_p return 0; } return -1; + /* LCOV_EXCL_STOP */ } // int count. int ids_count = bp_adaptor_ipc_read_int(sock); @@ -843,25 +876,29 @@ static int __bp_history_adaptor_get_cond_ids_p if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) { int *idlist = (int *)calloc(ids_count, sizeof(int)); if (idlist == NULL) { + /* LCOV_EXCL_START */ errorcode = BP_ERROR_OUT_OF_MEMORY; -// BP_PRINT_ERROR(-1, errorcode); + BP_PRINT_ERROR(-1, errorcode); if (bp_common_adaptor_clear_read_buffer(sock, (sizeof(int) * ids_count)) < 0) { __browser_adaptor_disconnect(); } pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } // getting ids array from provider if (bp_ipc_read_blob(sock, idlist, (sizeof(int) * ids_count)) < 0) { + /* LCOV_EXCL_START */ free(idlist); errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR); -// BP_PRINT_ERROR(-1, errorcode); + BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } *ids = idlist; *count = ids_count; @@ -898,15 +935,17 @@ int bp_history_adaptor_get_timestamp_ids_p if (limits != NULL) memcpy(&t_limits, limits, sizeof(bp_history_rows_fmt)); else - t_limits.limit = -1; + t_limits.limit = -1; //LCOV_EXCL_LINE errorcode = bp_ipc_simple_response(sock, cmd); if (errorcode != BP_ERROR_NONE) { -// BP_PRINT_ERROR(-1, errorcode); + /* LCOV_EXCL_START */ + BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } if (bp_ipc_send_custom_type(sock, &t_limits, @@ -930,7 +969,7 @@ int bp_history_adaptor_get_timestamp_ids_p unsigned int oflags = check_offset; if (keyword == NULL) - oflags = 0; + oflags = 0; //LCOV_EXCL_LINE if (bp_ipc_send_custom_type(sock, &oflags, sizeof(unsigned int)) < 0) { __browser_adaptor_disconnect_mutex_unlock(); @@ -946,6 +985,7 @@ int bp_history_adaptor_get_timestamp_ids_p // wait id from provider. errorcode = bp_ipc_read_errorcode(sock); if (errorcode != BP_ERROR_NONE) { + /* LCOV_EXCL_START */ BP_PRINT_ERROR(-1, errorcode); if (errorcode == BP_ERROR_IO_ERROR) __browser_adaptor_disconnect(); @@ -955,6 +995,7 @@ int bp_history_adaptor_get_timestamp_ids_p return 0; } return -1; + /* LCOV_EXCL_STOP */ } // int count. int ids_count = bp_adaptor_ipc_read_int(sock); @@ -962,6 +1003,7 @@ int bp_history_adaptor_get_timestamp_ids_p if (ids_count < BP_MAX_IDS_COUNT && ids_count > 0) { int *idlist = (int *)calloc(ids_count, sizeof(int)); if (idlist == NULL) { + /* LCOV_EXCL_START */ errorcode = BP_ERROR_OUT_OF_MEMORY; BP_PRINT_ERROR(-1, errorcode); if (bp_common_adaptor_clear_read_buffer(sock, @@ -970,10 +1012,12 @@ int bp_history_adaptor_get_timestamp_ids_p } pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } // getting ids array from provider if (bp_ipc_read_blob(sock, idlist, (sizeof(int) * ids_count)) < 0) { + /* LCOV_EXCL_START */ free(idlist); errorcode = bp_ipc_check_stderr(BP_ERROR_IO_ERROR); BP_PRINT_ERROR(-1, errorcode); @@ -981,12 +1025,15 @@ int bp_history_adaptor_get_timestamp_ids_p __browser_adaptor_disconnect(); pthread_mutex_unlock(&g_adaptor_mutex); return -1; + /* LCOV_EXCL_STOP */ } *ids = idlist; *count = ids_count; } else { + /* LCOV_EXCL_START */ *ids = NULL; *count = 0; + /* LCOV_EXCL_STOP */ } pthread_mutex_unlock(&g_adaptor_mutex); return 0; diff --git a/packaging/browser-provider.spec b/packaging/browser-provider.spec index 8fb81ff..d36666f 100755 --- a/packaging/browser-provider.spec +++ b/packaging/browser-provider.spec @@ -1,7 +1,7 @@ Name: browser-provider Summary: sync in background. -Version: 1.8.7 +Version: 1.8.8 Release: 1 Group: Development/Libraries License: Apache-2.0