Add line coverage exception to below cases.
1. Internal API and functions used only in internal functions.
2. Profile specific functions that are not common profile.(ex - mobile/wearable)
3. Error handling code section.
Change-Id: If2efe1239e0738adaad09db2a2b2e8c479549709
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
prof = get_profile();
+//LCOV_EXCL_START
if (prof == PROFILE_MOBILE)
size = ARR_SIZE(mobile_str_standard);
-//LCOV_EXCL_START
else if (prof == PROFILE_WEARABLE)
size = ARR_SIZE(wearable_str_standard);
else
prof = get_profile();
+//LCOV_EXCL_START
if (prof == PROFILE_MOBILE) {
for (i = 0; i < profile_get_num_of_pattern(); i++) {
if (pattern == mobile_str_pattern[i].id)
if (pattern == mobile_str_standard[i].id)
return mobile_str_standard[i].string;
}
-//LCOV_EXCL_START
} else if (prof == PROFILE_WEARABLE) {
for (i = 0; i < profile_get_num_of_pattern(); i++) {
if (pattern == wearable_str_pattern[i].id)
return wearable_str_standard[i].string;
}
} else {
+//LCOV_EXCL_STOP
for (i = 0; i < profile_get_num_of_pattern(); i++) {
if (pattern == common_str_pattern[i].id)
return common_str_pattern[i].string;
}
}
-//LCOV_EXCL_STOP
return "";
}
prof = get_profile();
len = strlen(pattern);
+//LCOV_EXCL_START
if (prof == PROFILE_MOBILE) {
for (i = 0; i < profile_get_num_of_pattern(); i++) {
if (!strncmp(pattern, mobile_str_pattern[i].string, len))
return mobile_str_pattern[i].id;
}
-//LCOV_EXCL_START
for (i = 0; i < profile_get_num_of_standard(); i++) {
if (!strncmp(pattern, mobile_str_standard[i].string, len))
return mobile_str_standard[i].id;
if (prof == PROFILE_COMMON)
return; //LCOV_EXCL_LINE
+ //LCOV_EXCL_START
else if (prof == PROFILE_MOBILE) {
if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &lock_sndstatus) < 0)
_W("VCONFKEY_SETAPPL_SOUND_LOCK_BOOL ==> FAIL!!"); //LCOV_EXCL_LINE
ret_val = vconf_notify_key_changed(VCONFKEY_SETAPPL_DISCONNECT_ALERT_TYPE_INT, feedback_disconnect_alert_mode_cb, NULL);
if (ret_val != 0)
_W("Add watch for VCONFKEY_SETAPPL_DISCONNECT_ALERT_TYPE_INT failed"); //LCOV_EXCL_LINE
+ //LCOV_EXCL_STOP
}
static void profile_exit(void)
if (prof == PROFILE_COMMON)
return;
+ //LCOV_EXCL_START
else if (prof == PROFILE_MOBILE) {
ret_val = vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, feedback_lock_sndstatus_cb);
if (ret_val != 0)
ret_val = vconf_ignore_key_changed(VCONFKEY_SETAPPL_DISCONNECT_ALERT_TYPE_INT, feedback_disconnect_alert_mode_cb);
if (ret_val != 0)
_W("Remove watch for VCONFKEY_SETAPPL_DISCONNECT_ALERT_TYPE_INT failed"); //LCOV_EXCL_LINE
+ //LCOV_EXCL_STOP
}
//LCOV_EXCL_START
}
//LCOV_EXCL_STOP
+//LCOV_EXCL_START
static int mobile_get_switched_pattern(int pattern)
{
int changed_pattern = pattern;
return changed_pattern;
}
-
+//LCOV_EXCL_STOP
static bool profile_get_switched_pattern(int pattern, int *switched)
{
//LCOV_EXCL_START
if (prof == PROFILE_WEARABLE)
changed_pattern = wearable_get_switched_pattern(changed_pattern);
- //LCOV_EXCL_STOP
else
changed_pattern = mobile_get_switched_pattern(changed_pattern);
*switched = changed_pattern;
return true;
}
+ //LCOV_EXCL_STOP
return false;
}
+//LCOV_EXCL_START
static bool mobile_is_notification_type(int pattern)
{
switch (pattern) {
}
return false;
}
+//LCOV_EXCL_STOP
//LCOV_EXCL_START
static bool wearable_is_notification_type(int pattern)
prof = get_profile();
+//LCOV_EXCL_START
if (prof == PROFILE_MOBILE)
return mobile_is_notification_type(pattern);
-//LCOV_EXCL_START
else if (prof == PROFILE_WEARABLE)
return wearable_is_notification_type(pattern);
else
//LCOV_EXCL_STOP
}
+//LCOV_EXCL_START
static int mobile_get_priority(int pattern)
{
switch (pattern) {
return PRIORITY_MIDDLE;
}
+//LCOV_EXCL_STOP
//LCOV_EXCL_START
static int wearable_get_priority(int pattern)
prof = get_profile();
+//LCOV_EXCL_START
if (prof == PROFILE_MOBILE)
return mobile_get_priority(pattern);
-//LCOV_EXCL_START
else if (prof == PROFILE_WEARABLE)
return wearable_get_priority(pattern);
else
//LCOV_EXCL_STOP
}
+//LCOV_EXCL_START
static bool mobile_get_always_alert_case(int type, int pattern)
{
int ret_val;
}
return false;
}
+//LCOV_EXCL_STOP
//LCOV_EXCL_START
static bool wearable_is_system_type(int pattern)
prof = get_profile();
+//LCOV_EXCL_START
if (prof == PROFILE_MOBILE)
return mobile_get_always_alert_case(type, pattern);
-//LCOV_EXCL_START
else if (prof == PROFILE_WEARABLE)
return wearable_get_always_alert_case(type, pattern);
else
//LCOV_EXCL_STOP
}
+//LCOV_EXCL_START
static bool mobile_get_always_off_case(int type, int pattern)
{
int ret_val;
}
return false;
}
+//LCOV_EXCL_STOP
//LCOV_EXCL_START
static bool wearable_get_always_off_case(int type, int pattern)
return pattern;
}
+//LCOV_EXCL_START
static int mobile_get_strength_type(int type, int pattern)
{
if (CHECK_SOUND(type)) {
return -EINVAL;
}
+//LCOV_EXCL_STOP
//LCOV_EXCL_START
static int wearable_get_strength_type(int type, int pattern)
return prev;
}
+//LCOV_EXCL_START
int devices_play_soundpath(int pattern, const char *soundpath, bool always)
{
GList *elem;
return prev;
}
+//LCOV_EXCL_STOP
int devices_stop(void)
{
/* check initialize */
pthread_mutex_lock(&fmutex);
if (!init_cnt) {
- _E("Not initialized"); //LCOV_EXCL_LINE
+ //LCOV_EXCL_START
+ _E("Not initialized");
pthread_mutex_unlock(&fmutex);
return FEEDBACK_ERROR_NOT_INITIALIZED;
+ //LCOV_EXCL_STOP
}
pthread_mutex_unlock(&fmutex);
* It means if to play anything is successful,
* this function regards as success.
*/
+ //LCOV_EXCL_START
if (err == -ENOTSUP)
return FEEDBACK_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
else if (err < 0)
return FEEDBACK_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ //LCOV_EXCL_STOP
return FEEDBACK_ERROR_NONE;
}
}
/* Internal APIs */
+//LCOV_EXCL_START
API int feedback_play_type_by_name(char *type, char *pattern)
{
feedback_type_e etype;
return feedback_play_type(etype, epattern);
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
API int feedback_play_internal(feedback_pattern_internal_e internal_pattern)
{
int err;
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
API int feedback_play_type_internal(feedback_type_e type, feedback_pattern_internal_e internal_pattern)
{
const struct device_ops *dev;
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
API int feedback_play_soundpath_internal(feedback_pattern_internal_e internal_pattern, const char *soundpath)
{
int err;
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
API int feedback_play_type_soundpath_internal(feedback_type_e type, feedback_pattern_internal_e internal_pattern, const char *soundpath)
{
const struct device_ops *dev;
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
API int feedback_get_count_of_theme_internal(feedback_type_e feedback_type, unsigned int *count_of_theme)
{
const struct device_ops *dev = NULL;
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
API int feedback_get_theme_index_internal(feedback_type_e feedback_type, unsigned int *index_of_theme)
{
const struct device_ops *dev = NULL;
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
API int feedback_set_theme_index_internal(feedback_type_e feedback_type, unsigned int index_of_theme)
{
const struct device_ops *dev = NULL;
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_STOP
}
//LCOV_EXCL_STOP
+//LCOV_EXCL_START
static void feedback_sound_theme_changed_cb(keynode_t *key, void* data)
{
int vconf_sound_theme_index = vconf_keynode_get_int(key);
current_theme_index = vconf_keynode_get_int(key) - 1;
}
+//LCOV_EXCL_STOP
static int feedback_parse_sound_multi_theme_section(const struct parse_result *result, void *data)
{
if (!MATCH("SoundMultiTheme", result->section))
return 0;
+ //LCOV_EXCL_START
SYS_G_LIST_FOREACH(result->props, temp_glist, extracted_section_prop) {
if (MATCH("number_of_theme", extracted_section_prop->key)) {
sscanf(extracted_section_prop->value, "%d", &number_of_theme);
default theme number cannot be greater then the number of theme");
return -EINVAL;
}
+ //LCOV_EXCL_STOP
return 0;
}
return false;
}
+//LCOV_EXCL_START
static int feedback_parse_multi_theme_conf_path_section(const struct parse_result *result, void *data)
{
struct section_property *extracted_section_prop = NULL;
return 0;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
static int feedback_multi_theme_load_config(const char *path)
{
int ret = 0;
return ret;
}
+//LCOV_EXCL_STOP
static int sound_get_config(void)
{
sound_info = (struct feedback_config_info*)calloc(number_of_theme, sizeof(struct feedback_config_info));
if (!sound_info) {
+ //LCOV_EXCL_START
_E("Failed to allocate memory for sound_info.");
return -ENOMEM;
+ //LCOV_EXCL_STOP
}
for (int i = 0; i < number_of_theme; i++)
current_theme_index = 0;
if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME, ¤t_theme_index) < 0)
- _W("Failed to get VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME");
+ _W("Failed to get VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME"); //LCOV_EXCL_LINE
ret = sound_get_config();
if (ret < 0)
- _W("Failed to load configuration file(%s): %d", SOUND_CONF_FILE, ret);
+ _W("Failed to load configuration file(%s): %d", SOUND_CONF_FILE, ret); //LCOV_EXCL_LINE
/* check sound status */
if (vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &touch_sndstatus) < 0)
_W("Add watch for VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL failed"); //LCOV_EXCL_LINE
ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME, feedback_sound_theme_changed_cb, NULL);
if (ret != 0)
- _W("Add watch for VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME failed");
+ _W("Add watch for VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME failed"); //LCOV_EXCL_LINE
}
static void sound_put_config(void)
_W("Remove watch for VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL failed"); //LCOV_EXCL_LINE
ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME, feedback_sound_theme_changed_cb);
if (ret != 0)
- _W("Remove watch for VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME failed");
+ _W("Remove watch for VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME failed"); //LCOV_EXCL_LINE
sound_put_config();
}
/* get sound file path */
path = get_data(pattern);
if (!path || stat(path, &buf)) {
+ //LCOV_EXCL_START
_E("Not supported sound pattern(pattern %d)", pattern); //LCOV_EXCL_LINE
return -ENOTSUP;
+ //LCOV_EXCL_STOP
}
/* play sound file */
ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_NOTIFICATION,
NULL, NULL, &stream_info);
if (ret != SOUND_MANAGER_ERROR_NONE) {
- _E("Failed to set session to play sound(%d)", ret); //LCOV_EXCL_LINE
- return -ENOENT; //LCOV_EXCL_LINE
+ //LCOV_EXCL_START
+ _E("Failed to set session to play sound(%d)", ret);
+ return -ENOENT;
+ //LCOV_EXCL_STOP
}
do {
ret = wav_player_start_new(path, stream_info, play_completed, stream_info, NULL);
return -EPERM;
}
+//LCOV_EXCL_START
static int sound_play_path(feedback_pattern_e pattern, const char *soundpath, bool always)
{
struct stat buf;
}
return -EPERM;
}
+//LCOV_EXCL_STOP
static int sound_is_supported(feedback_pattern_e pattern, bool *supported)
{
}
//LCOV_EXCL_STOP
+//LCOV_EXCL_START
static int sound_get_count_of_theme(unsigned int *count_of_theme)
{
if (!count_of_theme)
return 0;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
static int sound_get_theme_index(unsigned int *index_of_theme)
{
if (!index_of_theme)
return 0;
}
+//LCOV_EXCL_STOP
+//LCOV_EXCL_START
static int sound_set_theme_index(unsigned int index_of_theme)
{
int ret = 0;
return 0;
}
+//LCOV_EXCL_STOP
static const struct device_ops sound_device_ops = {
.type = FEEDBACK_TYPE_SOUND,
extern char *program_invocation_name;
+//LCOV_EXCL_START
bool is_privilege_supported(const char *privilege_name)
{
cynara *cynara = NULL;
return true;
}
+//LCOV_EXCL_STOP
\ No newline at end of file