Exclude unnecessary code segments from coverage report 35/233135/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 12 May 2020 11:08:06 +0000 (20:08 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 12 May 2020 11:09:03 +0000 (20:09 +0900)
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

client/ma.c
client/ma_dbus.c

index 361d2d924793544d445eb0a95b0b411aa7cd914a..ffa9514591548d682127515d2b61204e0b1c8b5f 100644 (file)
@@ -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);
 
index dda4238807da004a7d1174314780440770c25090..8b05283bb5550681c53eef43bbda4cb24454b170 100644 (file)
@@ -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;