Exclude un-testable codes from line coverage analysis 13/278913/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Wed, 13 Jul 2022 07:24:34 +0000 (16:24 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 28 Jul 2022 02:51:20 +0000 (11:51 +0900)
- Issue:
Some codes can not be tested in automatic test enviroment. Those code
are effected by the behavior of engine or configuration.

- Solution:
This patch excludes some codes that are not tested by automatic test
enviroment from line coverage analysis. To excludes those codes, this
patch adds special comments that indicate that codes are excluded from
line coverage analysis.

Change-Id: I6201bbd7b341dcede7400565a6b106f5d1228cd6
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/tts.c
client/tts_client.c
client/tts_core.c
client/tts_ipc.c
client/tts_tidl.c

index 9ce0353..1745727 100644 (file)
@@ -61,6 +61,7 @@ static int __tts_get_feature_enabled()
 }
 
 // TODO: move into tts_core to make common function
+//LCOV_EXCL_START
 static int __tts_convert_config_error_code(tts_config_error_e code)
 {
        if (code == TTS_CONFIG_ERROR_NONE)                      return TTS_ERROR_NONE;
@@ -76,7 +77,6 @@ static int __tts_convert_config_error_code(tts_config_error_e code)
        return code;
 }
 
-//LCOV_EXCL_START
 static void __tts_config_voice_changed_cb(const char* before_lang, int before_voice_type, const char* language, int voice_type, bool auto_voice, void* user_data)
 {
        SLOG(LOG_DEBUG, TAG_TTSC, "Voice changed : Before lang(%s) type(%d) , Current lang(%s), type(%d)",
@@ -184,6 +184,7 @@ static void __tts_config_engine_changed_cb(const char* engine_id, const char* se
        tts_core_notify_engine_changed(client, engine_id, language, voice_type, need_credential);
        return;
 }
+//LCOV_EXCL_STOP
 
 static void __tts_config_screen_reader_changed_cb(bool value, void* user_data)
 {
@@ -198,8 +199,6 @@ static void __tts_config_screen_reader_changed_cb(bool value, void* user_data)
        tts_core_notify_screen_reader_changed(client, value);
 }
 
-//LCOV_EXCL_STOP
-
 int tts_create(tts_h* tts)
 {
        if (0 != __tts_get_feature_enabled()) {
@@ -437,7 +436,6 @@ int tts_set_credential(tts_h tts, const char* credential)
        return TTS_ERROR_NONE;
 }
 
-//LCOV_EXCL_START
 int tts_set_server_tts(tts_h tts, const char* credential)
 {
        if (0 != __tts_get_feature_enabled()) {
@@ -492,7 +490,6 @@ int tts_set_server_tts(tts_h tts, const char* credential)
        SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
        return TTS_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 int tts_prepare(tts_h tts)
 {
@@ -907,8 +904,8 @@ int tts_stop(tts_h tts)
        SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
        return TTS_ERROR_NONE;
 }
-//LCOV_EXCL_START
 
+//LCOV_EXCL_START
 static void __tts_pause_async(void *data)
 {
        tts_h tts = (tts_h)data;
@@ -1309,8 +1306,6 @@ int tts_unset_screen_reader_changed_cb(tts_h tts)
        return 0;
 }
 
-
-//LCOV_EXCL_START
 int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size, int audio_type, int rate)
 {
        if (0 != __tts_get_feature_enabled()) {
@@ -1388,7 +1383,6 @@ int tts_stop_pcm(tts_h tts)
        SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
        return TTS_ERROR_NONE;
 }
-//LCOV_EXCL_STOP
 
 int tts_repeat(tts_h tts, char** text_repeat, int* utt_id)
 {
index 7fa9678..21a8f8b 100644 (file)
@@ -368,6 +368,7 @@ int tts_client_get_mode_client_count(tts_mode_e mode)
        pthread_mutex_unlock(&g_client_list_mutex);
        return number;
 }
+//LCOV_EXCL_STOP
 
 GList* tts_client_get_client_list()
 {
@@ -378,7 +379,6 @@ GList* tts_client_get_client_list()
 
        return copy_list;
 }
-//LCOV_EXCL_STOP
 
 unsigned int tts_client_get_uid(tts_client_s* client)
 {
@@ -695,6 +695,7 @@ void* tts_client_get_error_user_data(tts_client_s* client)
        return client->error_user_data;
 }
 
+//LCOV_EXCL_START
 tts_default_voice_changed_cb tts_client_get_default_voice_changed_cb(tts_client_s* client)
 {
        if (false == tts_client_is_valid_client(client)) {
@@ -726,6 +727,7 @@ void* tts_client_get_engine_changed_user_data(tts_client_s* client)
        }
        return client->engine_changed_user_data;
 }
+//LCOV_EXCL_STOP
 
 tts_screen_reader_changed_cb tts_client_get_screen_reader_changed_cb(tts_client_s* client)
 {
index 7a8ba75..070d540 100644 (file)
@@ -187,6 +187,7 @@ static bool __is_engine_launched()
        return is_running;
 }
 
+//LCOV_EXCL_START
 static int __pkgmgr_status_cb(uid_t target_uid, int req_id, const char *type, const char *pkgname, const char *key, const char *val, const void *pmsg, void *data)
 {
        // type (the type of the pkgname)
@@ -236,6 +237,7 @@ static int __pkgmgr_status_cb(uid_t target_uid, int req_id, const char *type, co
 
        return 0;
 }
+//LCOV_EXCL_STOP
 
 static void __create_pkgmgr_thread(void* data, Ecore_Thread* thread)
 {
@@ -290,12 +292,14 @@ static void __finish_pkgmgr_thread(void* data, Ecore_Thread* thread)
        g_pkgmgr_thread = NULL;
 }
 
+//LCOV_EXCL_START
 static void __cancel_pkgmgr_thread(void* data, Ecore_Thread* thread)
 {
        SLOG(LOG_INFO, TAG_TTSC, "[DEBUG] Cancel pkgmgr thread");
        g_is_thread_canceled = false;
        g_pkgmgr_thread = NULL;
 }
+//LCOV_EXCL_STOP
 
 static void __pkgmgr_thread(void* data)
 {
@@ -308,6 +312,7 @@ static void __pkgmgr_thread(void* data)
        return;
 }
 
+//LCOV_EXCL_START
 static void __start_reprepare_thread(void* data, Ecore_Thread* thread)
 {
        SLOG(LOG_INFO, TAG_TTSC, "[DEBUG] start reprepare thread. engine update status(%d)", g_engine_update_status);
@@ -349,6 +354,7 @@ static void __start_reprepare_thread(void* data, Ecore_Thread* thread)
 
        return;
 }
+//LCOV_EXCL_STOP
 
 static void __end_reprepare_thread(void* data, Ecore_Thread* thread)
 {
@@ -381,12 +387,14 @@ static void __end_reprepare_thread(void* data, Ecore_Thread* thread)
        g_reprepare_thread = NULL;
 }
 
+//LCOV_EXCL_START
 static void __cancel_reprepare_thread(void* data, Ecore_Thread* thread)
 {
        SLOG(LOG_INFO, TAG_TTSC, "[INFO] cancel reprepare thread");
        g_is_engine_name_changed = false;
        g_reprepare_thread = NULL;
 }
+//LCOV_EXCL_STOP
 
 static inline void __run_client_reprepare_thread()
 {
@@ -812,6 +820,7 @@ int tts_core_notify_error_async(tts_client_s* client, tts_error_e reason, int ut
        return TTS_ERROR_NONE;
 }
 
+//LCOV_EXCL_START
 int tts_core_notify_default_voice_changed(tts_client_s* client, const char* before_lang, int before_voice_type, const char* language, int voice_type)
 {
        if (false == tts_client_is_valid_client(client)) {
@@ -861,6 +870,7 @@ int tts_core_notify_engine_changed(tts_client_s* client, const char* engine_id,
 
        return TTS_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
 int tts_core_notify_screen_reader_changed(tts_client_s* client, bool value)
 {
@@ -958,6 +968,7 @@ bool tts_core_check_credential(tts_client_s* client)
        return true;
 }
 
+//LCOV_EXCL_START
 const char* tts_core_covert_error_code(tts_error_e err)
 {
        switch (err) {
@@ -981,6 +992,7 @@ const char* tts_core_covert_error_code(tts_error_e err)
        }
        return NULL;
 }
+//LCOV_EXCL_STOP
 
 int tts_core_receive_hello(unsigned int uid, int ret, int credential_needed)
 {
index 15484f0..ff9b2aa 100644 (file)
@@ -319,7 +319,6 @@ int tts_ipc_request_pause(unsigned int uid)
        return g_vtable[REQUEST_PAUSE](uid);
 }
 
-//LCOV_EXCL_START
 int tts_ipc_request_play_pcm(unsigned int uid)
 {
        SLOG(LOG_INFO, TAG_TTSC, "[IPC] tts_ipc_request_play_pcm");
@@ -373,7 +372,6 @@ int tts_ipc_request_add_pcm(unsigned int uid, int event, const char* data, int d
 
        return g_vtable[REQUEST_ADD_PCM](uid, event, data, data_size, audio_type, rate);
 }
-// LCOV_EXCL_STOP
 
 int tts_ipc_request_set_mode(unsigned int uid, tts_mode_e mode)
 {
index 40247cb..83b6293 100644 (file)
@@ -156,6 +156,7 @@ static void __on_disconnected(rpc_port_proxy_tts_h h, void *user_data)
        }
 }
 
+//LCOV_EXCL_START
 static void __on_rejected(rpc_port_proxy_tts_h h, void *user_data)
 {
        unsigned int uid = (uintptr_t)user_data;
@@ -169,6 +170,7 @@ static void __on_rejected(rpc_port_proxy_tts_h h, void *user_data)
 
        SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Rejected from server(%d)", uid);
 }
+//LCOV_EXCL_STOP
 
 static void __get_engine_app_id(int size, char* app_id)
 {
@@ -642,7 +644,6 @@ int tts_tidl_request_pause(unsigned int uid)
        return TTS_ERROR_NONE;
 }
 
-//LCOV_EXCL_START
 int tts_tidl_request_play_pcm(unsigned int uid)
 {
        SLOG(LOG_DEBUG, TAG_TTSC, "[TIDL] tts_tidl_request_play_pcm");
@@ -725,7 +726,6 @@ int tts_tidl_request_add_pcm(unsigned int uid, int event, const char* data, int
 
        return TTS_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 int tts_tidl_request_set_mode(unsigned int uid, tts_mode_e mode)
 {