Apply macro for excluding lines to increase TC coverage result 40/156340/1 accepted/tizen/unified/20171020.091637 accepted/tizen/unified/20180313.061039 submit/tizen/20171018.063752 submit/tizen/20171019.095903 submit/tizen/20180313.012734
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 17 Oct 2017 09:10:03 +0000 (18:10 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 18 Oct 2017 06:12:53 +0000 (06:12 +0000)
[Version] 0.4.24
[Issue Type] TC Coverage

Change-Id: I4186d7ee5be18ef7dcd5014fa4cd7a07934cc70f
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-sound-manager.spec
src/sound_manager.c
src/sound_manager_internal.c
src/sound_manager_private.c

index cb68ac9..c52ad98 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.4.23
+Version:    0.4.24
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 34f3103..6f35600 100644 (file)
@@ -801,9 +801,11 @@ int sound_manager_add_focus_state_watch_cb(sound_stream_focus_mask_e focus_mask,
                if (focus_watch_info_arr[i].id == 0)
                        break;
        if (i == SOUND_STREAM_INFO_ARR_MAX) {
+               //LCOV_EXCL_START
                LOGE("focus watch info array is full");
                ret = MM_ERROR_SOUND_INTERNAL;
                goto LEAVE;
+               //LCOV_EXCL_STOP
        }
 
        ret = mm_sound_set_focus_watch_callback((mm_sound_focus_type_e)focus_mask, _focus_watch_callback, &focus_watch_info_arr[i], id);
index 68a4185..357d12c 100644 (file)
@@ -323,6 +323,7 @@ static int _convert_filter(sound_filter_e filter, char **filter_str, char **filt
                *filter_str = "ladspa-sink";
                *filter_params_str = "plugin=delay label=delay_5s control=0,0";
                break;
+       //LCOV_EXCL_START
        case SOUND_FILTER_SOUNDALIVE:
                *filter_str = "ladspa-sink";
                *filter_params_str = "plugin=audiofilters-sec-ladspa label=audiofiltersec_stereo control=1,0";
@@ -330,6 +331,7 @@ static int _convert_filter(sound_filter_e filter, char **filter_str, char **filt
        default:
                LOGE("could not find filter[%d]", filter);
                return MM_ERROR_SOUND_INTERNAL;
+       //LCOV_EXCL_STOP
        }
        LOGI("filter[%s], param[%s]", *filter_str, *filter_params_str);
 
@@ -371,6 +373,7 @@ static int _convert_filter_preset(sound_filter_preset_e preset, char **control)
        case SOUND_FILTER_PRESET_DELAY_2SEC:
                *control = "2,0.5";
                break;
+       //LCOV_EXCL_START
        case SOUND_FILTER_PRESET_SOUNDALIVE_NORMAL:
                *control = "1,0";
                break;
@@ -389,6 +392,7 @@ static int _convert_filter_preset(sound_filter_preset_e preset, char **control)
        case SOUND_FILTER_PRESET_SOUNDALIVE_CONCERT_HALL:
                *control = "1,5";
                break;
+       //LCOV_EXCL_STOP
        default:
                LOGE("could not find the preset[%d]", preset);
                ret = MM_ERROR_SOUND_INTERNAL;
@@ -420,12 +424,14 @@ static int _check_valid_filter_preset(sound_filter_e filter, sound_filter_preset
                        goto ERROR_INVALID_ARGS;
                }
                break;
+       //LCOV_EXCL_START
        case SOUND_FILTER_SOUNDALIVE:
                if (preset < SOUND_FILTER_PRESET_SOUNDALIVE_NORMAL || preset > SOUND_FILTER_PRESET_SOUNDALIVE_CONCERT_HALL) {
                        LOGE("invalid preset(%d) for soundAlive filter", preset);
                        goto ERROR_INVALID_ARGS;
                }
                break;
+       //LCOV_EXCL_STOP
        default:
                LOGE("invalid filter(%d)", filter);
                return MM_ERROR_INVALID_ARGUMENT;
index 12ed9f6..220ae46 100644 (file)
@@ -80,9 +80,11 @@ int _convert_sound_manager_error_code(const char *func, int code)
                errorstr = "INVALID_PARAMETER";
                break;
        case MM_ERROR_SOUND_PERMISSION_DENIED:
+               //LCOV_EXCL_START
                ret = SOUND_MANAGER_ERROR_PERMISSION_DENIED;
                errorstr = "PERMISSION_DENIED";
                break;
+               //LCOV_EXCL_STOP
        case MM_ERROR_SOUND_NO_DATA:
                ret = SOUND_MANAGER_ERROR_NO_DATA;
                errorstr = "NO_DATA";
@@ -112,10 +114,12 @@ int _convert_sound_manager_error_code(const char *func, int code)
                errorstr = "INVALID_STATE";
                break;
        default:
+               //LCOV_EXCL_START
                LOGW("it should not be reached here, this error(0x%x) should be defined.", code);
                ret = SOUND_MANAGER_ERROR_INTERNAL;
                errorstr = "INTERNAL";
                break;
+               //LCOV_EXCL_STOP
        }
        if (ret)
                LOGE("[%s] >> leave : %s(0x%08x), mm_error(0x%08x)", func, errorstr, ret, code);
@@ -224,8 +228,10 @@ int _convert_stream_type_for_internal(sound_stream_type_internal_e stream_type_e
 void _set_focus_availability(sound_stream_info_s *stream_info)
 {
        if (stream_info == NULL || stream_info->stream_type == NULL) {
+               //LCOV_EXCL_START
                LOGE("invalid argument");
                return;
+               //LCOV_EXCL_STOP
        }
        if (!strncmp(stream_info->stream_type, "solo", SOUND_STREAM_TYPE_LEN) ||
                !strncmp(stream_info->stream_type, "radio", SOUND_STREAM_TYPE_LEN) ||
@@ -283,13 +289,16 @@ int _convert_stream_type_to_change_reason(const char *stream_type, sound_stream_
                *change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA_EXTERNAL_ONLY;
 
        } else {
+               //LCOV_EXCL_START
                LOGE("not supported stream_type(%s)", stream_type);
                return MM_ERROR_INVALID_ARGUMENT;
+               //LCOV_EXCL_STOP
        }
 
        return MM_ERROR_NONE;
 }
 
+//LCOV_EXCL_START
 static int _convert_stream_type_to_interrupt_reason(const char *stream_type, sound_session_interrupted_code_e *change_reason)
 {
        SM_NULL_ARG_CHECK_FOR_PRIV(stream_type);
@@ -328,6 +337,7 @@ static int _convert_stream_type_to_interrupt_reason(const char *stream_type, sou
 
        return MM_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
 static int __get_dbus_connection(GDBusConnection **conn)
 {
@@ -335,12 +345,14 @@ static int __get_dbus_connection(GDBusConnection **conn)
 
        *conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!(*conn) || err) {
+               //LCOV_EXCL_START
                if (err)
                        LOGE("g_bus_get_sync() error (%s)", err->message);
                else
                        LOGE("g_bus_get_sync() error");
                g_error_free(err);
                return MM_ERROR_SOUND_INTERNAL;
+               //LCOV_EXCL_STOP
        }
 
        return MM_ERROR_NONE;
@@ -403,8 +415,10 @@ int _convert_sound_type_to_enum(const char *sound_type, sound_type_e *sound_type
        } else if (!strncmp(sound_type, "voice", strlen(sound_type))) {
                *sound_type_enum = SOUND_TYPE_VOICE;
        } else {
+               //LCOV_EXCL_START
                LOGE("not supported sound_type(%s)", sound_type);
                return MM_ERROR_INVALID_ARGUMENT;
+               //LCOV_EXCL_STOP
        }
 
        return MM_ERROR_NONE;
@@ -424,6 +438,7 @@ int _convert_device_type_enum_to_str(sound_device_type_e device_type, char **dev
        case SOUND_DEVICE_BUILTIN_MIC:
                *device_type_str = "builtin-mic";
                break;
+       //LCOV_EXCL_START
        case SOUND_DEVICE_AUDIO_JACK:
                *device_type_str = "audio-jack";
                break;
@@ -445,6 +460,7 @@ int _convert_device_type_enum_to_str(sound_device_type_e device_type, char **dev
        default:
                LOGE("could not find the device_type[%d] in this switch case statement", device_type);
                return MM_ERROR_SOUND_INTERNAL;
+       //LCOV_EXCL_STOP
        }
 
        LOGI("device_type[%s]", *device_type_str);
@@ -459,7 +475,7 @@ int _convert_device_type_str_to_enum(const char *device_type_str, sound_device_t
 
        if (!strncmp(device_type_str, "builtin-speaker", SOUND_DEVICE_TYPE_LEN)) {
                *device_type = SOUND_DEVICE_BUILTIN_SPEAKER;
-
+       //LCOV_EXCL_START
        } else if (!strncmp(device_type_str, "builtin-receiver", SOUND_DEVICE_TYPE_LEN)) {
                *device_type = SOUND_DEVICE_BUILTIN_RECEIVER;
 
@@ -468,7 +484,6 @@ int _convert_device_type_str_to_enum(const char *device_type_str, sound_device_t
 
        } else if (!strncmp(device_type_str, "audio-jack", SOUND_DEVICE_TYPE_LEN)) {
                *device_type = SOUND_DEVICE_AUDIO_JACK;
-
        } else if (!strncmp(device_type_str, "hdmi", SOUND_DEVICE_TYPE_LEN)) {
                *device_type = SOUND_DEVICE_HDMI;
 
@@ -485,6 +500,7 @@ int _convert_device_type_str_to_enum(const char *device_type_str, sound_device_t
                LOGE("not supported device_type(%s)", device_type_str);
                return MM_ERROR_INVALID_ARGUMENT;
        }
+       //LCOV_EXCL_STOP
 
        return MM_ERROR_NONE;
 }
@@ -501,6 +517,7 @@ int _convert_device_type(mm_sound_device_type_e device_type, sound_device_type_e
        case MM_SOUND_DEVICE_TYPE_BUILTIN_MIC:
                *sound_device_type = SOUND_DEVICE_BUILTIN_MIC;
                break;
+       //LCOV_EXCL_START
        case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
                *sound_device_type = SOUND_DEVICE_AUDIO_JACK;
                break;
@@ -522,6 +539,7 @@ int _convert_device_type(mm_sound_device_type_e device_type, sound_device_type_e
        default:
                LOGE("not supported device_type(%d)", device_type);
                return MM_ERROR_INVALID_ARGUMENT;
+       //LCOV_EXCL_STOP
        }
 
        return MM_ERROR_NONE;
@@ -574,6 +592,7 @@ const char* _convert_api_name(native_api_e api_name)
        return name;
 }
 
+//LCOV_EXCL_START
 void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason, int option, const char *extra_info, void *user_data)
 {
        int ret = MM_ERROR_NONE;
@@ -659,6 +678,7 @@ LEAVE:
        LOGI("<< leave");
        return;
 }
+//LCOV_EXCL_STOP
 
 void _pa_context_state_cb(pa_context *c, void *userdata)
 {
@@ -1251,6 +1271,7 @@ LEAVE:
        return;
 }
 
+//LCOV_EXCL_START
 static int _check_media_stream_exist_by_pid(unsigned int pid, const char *direction, bool *exist)
 {
        int ret = MM_ERROR_NONE;
@@ -1419,6 +1440,7 @@ void _voip_focus_state_change_callback(sound_stream_info_h stream_info,
 
        return;
 }
+//LCOV_EXCL_STOP
 
 int _set_session_mode(_session_mode_e mode)
 {
@@ -1505,6 +1527,7 @@ int _set_session_mode(_session_mode_e mode)
                                if (type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER || type == MM_SOUND_DEVICE_TYPE_BUILTIN_MIC)
                                        CHECK_AND_SET_DEVICE(proper_device, proper_device2, tmp_device);
                                break;
+                       //LCOV_EXCL_START
                        case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:
                                if (type == MM_SOUND_DEVICE_TYPE_BUILTIN_MIC)
                                        proper_device_builtin_mic = tmp_device;
@@ -1528,6 +1551,7 @@ int _set_session_mode(_session_mode_e mode)
                                if (type == MM_SOUND_DEVICE_TYPE_BLUETOOTH_SCO)
                                        CHECK_AND_SET_DEVICE(proper_device, proper_device2, tmp_device);
                                break;
+                       //LCOV_EXCL_STOP
                        default:
                                break;
                        }
@@ -1627,7 +1651,7 @@ int _set_session_mode(_session_mode_e mode)
        g_cached_session_mode = mode;
 
        return ret;
-
+//LCOV_EXCL_START
 ERROR_CASE_RINGTONE:
        if (g_voip_ringtone_vstream_h) {
                _destroy_virtual_stream(g_voip_ringtone_vstream_h);
@@ -1652,6 +1676,7 @@ ERROR_CASE_NO_DESTROY:
                mm_sound_free_device_list(device_list);
        ret = MM_ERROR_SOUND_INTERNAL;
        return ret;
+//LCOV_EXCL_STOP
 }
 
 int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, bool is_for_session, sound_stream_focus_state_changed_cb callback, void *user_data)
@@ -1726,7 +1751,7 @@ int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, bool i
                }
        }
        goto SUCCESS;
-
+//LCOV_EXCL_START
 PA_ERROR_WITH_UNLOCK:
        pa_threaded_mainloop_unlock(stream_h->pa_mainloop);
 
@@ -1751,7 +1776,7 @@ PA_ERROR:
        }
        ret = MM_ERROR_SOUND_INTERNAL;
        LOGE("pa_ret(%d), ret(0x%x)", pa_ret, ret);
-
+//LCOV_EXCL_STOP
 SUCCESS:
        return ret;
 }
@@ -2255,7 +2280,7 @@ int _start_virtual_stream(virtual_sound_stream_info_s *virtual_stream)
        pa_threaded_mainloop_unlock(virtual_stream->pa_mainloop);
 
        return ret;
-
+//LCOV_EXCL_START
 ERROR_WITH_UNLOCK:
        /* UNLOCK the pa_threaded_mainloop */
        pa_threaded_mainloop_unlock(virtual_stream->pa_mainloop);
@@ -2267,7 +2292,7 @@ ERROR_WITH_UNLOCK:
                }
        }
        LOGE("pa_ret(%d)", pa_ret);
-
+//LCOV_EXCL_STOP
 ERROR:
        return ret;
 }
@@ -2317,9 +2342,9 @@ int _make_progress_virtual_stream(sound_stream_info_s *stream_info, virtual_soun
        SM_INSTANCE_CHECK_FOR_PRIV(virtual_stream);
 
        if ((ret = _create_virtual_stream(stream_info, virtual_stream)))
-               LOGE("failed to _create_virtual_stream(), ret(0x%x)", ret);
+               LOGE("failed to _create_virtual_stream(), ret(0x%x)", ret); //LCOV_EXCL_LINE
        else if ((ret = _start_virtual_stream(*virtual_stream)))
-               LOGE("failed to _start_virtual_stream(), ret(0x%x)", ret);
+               LOGE("failed to _start_virtual_stream(), ret(0x%x)", ret); //LCOV_EXCL_LINE
 
        return ret;
 }
@@ -2331,9 +2356,9 @@ int _stop_progress_virtual_stream(virtual_sound_stream_info_s *virtual_stream)
        SM_INSTANCE_CHECK_FOR_PRIV(virtual_stream);
 
        if ((ret = _stop_virtual_stream(virtual_stream)))
-               LOGE("failed to _stop_virtual_stream(), ret(0x%x)", ret);
+               LOGE("failed to _stop_virtual_stream(), ret(0x%x)", ret); //LCOV_EXCL_LINE
        else if ((ret = _destroy_virtual_stream(virtual_stream)))
-               LOGE("failed to _destroy_virtual_stream(), ret(0x%x)", ret);
+               LOGE("failed to _destroy_virtual_stream(), ret(0x%x)", ret); //LCOV_EXCL_LINE
 
        return ret;
 }