From: Ji-hoon Lee Date: Tue, 12 May 2020 11:08:06 +0000 (+0900) Subject: Exclude unnecessary code segments from coverage report X-Git-Tag: submit/tizen/20200528.071502~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4da2f3dca80161611f604f32e81849de888ce44;p=platform%2Fcore%2Fuifw%2Fmulti-assistant.git Exclude unnecessary code segments from coverage report Two types of code segments are being excluded: 1. Code that are executed only on certain events such as user's utterance. 2. Code that are executed only on failures in underlying infrastructure such as dbus. Change-Id: Ice90965c44621e8fa325ada9fb871d9f6572c18a --- diff --git a/client/ma.c b/client/ma.c index 361d2d9..ffa9514 100644 --- a/client/ma.c +++ b/client/ma.c @@ -1056,6 +1056,7 @@ int ma_get_recording_audio_format(int *rate, ma_audio_channel_e *channel, ma_aud do { ret = ma_dbus_get_recording_audio_format(pid, rate, channel, audio_type); if (0 != ret) { + //LCOV_EXCL_START if (MA_ERROR_TIMED_OUT != ret) { MA_SLOGE("[ERROR] Fail to get audio format"); //LCOV_EXCL_LINE break; @@ -1068,6 +1069,7 @@ int ma_get_recording_audio_format(int *rate, ma_audio_channel_e *channel, ma_aud break; } } + //LCOV_EXCL_STOP } } while (0 != ret); @@ -1820,6 +1822,7 @@ int ma_get_recording_audio_source_type(char** type) { do { ret = ma_dbus_get_recording_audio_source_type(pid, type); if (0 != ret) { + //LCOV_EXCL_START if (MA_ERROR_TIMED_OUT != ret) { MA_SLOGE("[ERROR] Fail to get audio source type"); //LCOV_EXCL_LINE break; @@ -1832,6 +1835,7 @@ int ma_get_recording_audio_source_type(char** type) { break; } } + //LCOV_EXCL_STOP } } while (0 != ret); diff --git a/client/ma_dbus.c b/client/ma_dbus.c index dda4238..8b05283 100644 --- a/client/ma_dbus.c +++ b/client/ma_dbus.c @@ -66,6 +66,7 @@ typedef struct { const char *message_port = "ma_streaming_port"; static int g_local_port_id = -1; +//LCOV_EXCL_START static void message_port_cb(int local_port_id, const char *remote_app_id, const char *remote_port, bool trusted_remote_port, bundle *message, void *user_data) @@ -95,10 +96,8 @@ static void message_port_cb(int local_port_id, if (pending_buffer_size >= header.streaming_data_size) { static int last_serial = 0; if (header.streaming_data_serial != last_serial + 1) { - //LCOV_EXCL_START MA_SLOGE("[ERROR] SERIAL MISMATCH in [%d] : %d => %d", header.streaming_data_type, last_serial, header.streaming_data_serial); - //LCOV_EXCL_STOP } last_serial = header.streaming_data_serial; @@ -134,6 +133,7 @@ static void message_port_cb(int local_port_id, } } } +//LCOV_EXCL_STOP static int streaming_ipc_initialize() { @@ -435,6 +435,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle } /* MAS_METHOD_ERROR */ else if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) { + //LCOV_EXCL_START MA_SLOGD("[DEBUG] Owner Changed"); //LCOV_EXCL_LINE DBusError err; dbus_error_init(&err); @@ -445,13 +446,12 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle dbus_connection_flush(g_conn_listener); if (dbus_error_is_set(&err)) { - //LCOV_EXCL_START MA_SLOGE("Match Error (%s)", err.message); dbus_error_free(&err); - //LCOV_EXCL_STOP } __ma_cb_error(MA_ERROR_SERVICE_RESET, "Daemon Reset"); + //LCOV_EXCL_STOP } /* NameOwnerChanged */ else { @@ -532,9 +532,11 @@ int ma_dbus_open_connection() } if (NULL == g_conn_listener) { + //LCOV_EXCL_START MA_SLOGE("Fail to get dbus connection "); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_connection_set_exit_on_disconnect(g_conn_listener, false); @@ -558,15 +560,19 @@ int ma_dbus_open_connection() } if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { + //LCOV_EXCL_START MA_SLOGE("fail dbus_bus_request_name()"); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return -2; + //LCOV_EXCL_STOP } if (NULL != g_fd_handler) { + //LCOV_EXCL_START MA_SLOGW("The handler already exists."); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return 0; + //LCOV_EXCL_STOP } /* Flush messages which are received before fd event handler registration */ @@ -591,9 +597,11 @@ int ma_dbus_open_connection() int fd = 0; if (1 != dbus_connection_get_unix_fd(g_conn_listener, &fd)) { + //LCOV_EXCL_START MA_SLOGE("fail to get fd from dbus "); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } else { MA_SLOGD("Get fd from dbus : %d", fd); //LCOV_EXCL_LINE } @@ -601,8 +609,10 @@ int ma_dbus_open_connection() g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn_listener, NULL, NULL); if (NULL == g_fd_handler) { MA_SLOGE("fail to get fd handler from ecore "); //LCOV_EXCL_LINE + //LCOV_EXCL_START __ma_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } streaming_ipc_initialize(); @@ -661,10 +671,8 @@ int ma_dbus_reconnect() bool sender_connected = dbus_connection_get_is_connected(g_conn_sender); bool listener_connected = dbus_connection_get_is_connected(g_conn_listener); - //LCOV_EXCL_START MA_SLOGW("[DBUS] Sender(%s) Listener(%s)", sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected"); - //LCOV_EXCL_STOP if (false == sender_connected || false == listener_connected) { ma_dbus_close_connection(); @@ -869,9 +877,11 @@ int ma_dbus_request_deinitialize(int pid) MA_SLOGE("@@ multi-assistant finalize : result = %d", result); //LCOV_EXCL_LINE } } else { + //LCOV_EXCL_START MA_SLOGE("@@ Result message is NULL "); //LCOV_EXCL_LINE ma_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; + //LCOV_EXCL_STOP } return result; @@ -949,9 +959,11 @@ int ma_dbus_get_recording_audio_format(int pid, int *rate, ma_audio_channel_e *c MA_SLOGE("@@ multi-assistant get recording audio format : result = %d", result); //LCOV_EXCL_LINE } } else { + //LCOV_EXCL_START MA_SLOGE("@@ Result message is NULL"); //LCOV_EXCL_LINE ma_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; + //LCOV_EXCL_STOP } return result; @@ -1022,9 +1034,11 @@ int ma_dbus_get_recording_audio_source_type(int pid, char** type) MA_SLOGE("@@ multi-assistant get recording audio source type : result = %d, type(%p)", result, type); //LCOV_EXCL_LINE } } else { + //LCOV_EXCL_START MA_SLOGE("@@ Result message is NULL"); //LCOV_EXCL_LINE ma_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; + //LCOV_EXCL_STOP } return result;