Increase line coverage using LCOV_EXCL 00/298000/6 accepted/tizen/unified/20230831.081041
authorUnsung Lee <unsung.lee@samsung.com>
Wed, 30 Aug 2023 01:27:56 +0000 (10:27 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Wed, 30 Aug 2023 04:07:10 +0000 (13:07 +0900)
Increase line coverage using LCOV_EXCL_LINE
and a pair of LCOV_EXCL_START and LCOV_EXCL_STOP in error handling code and
internal API function.

Policy to user LCOV_EXCL
1. Exclude error handling code from line coverage except invalid parameter.
2. Exclude entire internal API function using LCOV_EXCL_START and LCOV_EXCL_STOP.

Change-Id: I5fad3b2ccc311d8abf211e245cf0dae834f0515c
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/statvfs.c
src/storage-external-dbus.c
src/storage-external.c
src/storage-inhouse.c
src/storage.c

index 6e9f841..7e7ef02 100644 (file)
@@ -157,7 +157,7 @@ API int storage_get_internal_memory_size64(struct statvfs *buf)
        int ret_val;
 
        if (!buf) {
-               _E("input param error"); //LCOV_EXCL_LINE
+               _E("input param error");
                return STORAGE_ERROR_INVALID_PARAMETER;
        }
 
@@ -224,8 +224,8 @@ int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf)
                snprintf(ext_path, sizeof(ext_path), "%s", path);
        else {
                if (!storage_ext_is_supported()) {
-                       _D("Block module is not enabled");
-                       return STORAGE_ERROR_NOT_SUPPORTED;
+                       _D("Block module is not enabled"); //LCOV_EXCL_LINE
+                       return STORAGE_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
                }
                ret_val = get_external_path(ext_path, sizeof(ext_path));
                if (ret_val == -ENODEV)
@@ -269,14 +269,14 @@ int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf
                snprintf(ext_path, sizeof(ext_path), "%s", path);
        else {
                if (!storage_ext_is_supported()) {
-                       _D("Block module is not enabled");
-                       return STORAGE_ERROR_NOT_SUPPORTED;
+                       _D("Block module is not enabled"); //LCOV_EXCL_LINE
+                       return STORAGE_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
                }
                ret_val = get_external_path(ext_path, sizeof(ext_path));
                if (ret_val == -ENODEV)
                        goto out_nodev;
                if (ret_val < 0) {
-                       _E("Failed to get external path(%d)", ret_val);
+                       _E("Failed to get external path(%d)", ret_val); //LCOV_EXCL_LINE
                        return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
                }
        }
index de90ace..5a23bc6 100755 (executable)
@@ -129,13 +129,15 @@ int storage_ext_get_list(GList **list)
 
        if (ret_dbus < 0) {
                _E("Failed to get storage_ext device info"); //LCOV_EXCL_LINE
-               return -EIO;
+               return -EIO; //LCOV_EXCL_LINE
        }
 
        if (!g_variant_get_safe(reply, "(a(issssssisibii))", &iter)) {
+               //LCOV_EXCL_START Dbus type error
                _E("Failed to get params from gvariant.");
                g_variant_unref(reply);
                return -EIO;
+               //LCOV_EXCL_STOP
        }
 
        while (g_variant_iter_loop(iter, "(issssssisibii)",
@@ -148,9 +150,11 @@ int storage_ext_get_list(GList **list)
 
                elem = (storage_ext_device *)malloc(sizeof(storage_ext_device));
                if (!elem) {
-                       _E("malloc() failed"); //LCOV_EXCL_LINE
+                       //LCOV_EXCL_START System error
+                       _E("malloc() failed");
                        ret = -ENOMEM;
                        goto out;
+                       //LCOV_EXCL_STOP
                }
 
                elem->type = info.type;
@@ -204,7 +208,7 @@ int storage_ext_get_statvfs(char *path, struct statvfs_32 *buf)
 
        if (ret_dbus < 0) {
                _E("Failed to get storage_ext device info"); //LCOV_EXCL_LINE
-               return -EIO;
+               return -EIO; //LCOV_EXCL_LINE
        }
 
        if (!g_variant_get_safe(reply, "(ttttttttttt)",
@@ -257,7 +261,7 @@ int storage_ext_get_statvfs_size64(char *path, struct statvfs *buf)
 
        if (ret_dbus < 0) {
                _E("Failed to get storage_ext device info"); //LCOV_EXCL_LINE
-               return -EIO;
+               return -EIO; //LCOV_EXCL_LINE
        }
 
        if (!g_variant_get_safe(reply, "(ttttttttttt)",
@@ -265,9 +269,11 @@ int storage_ext_get_statvfs_size64(char *path, struct statvfs *buf)
                        &(buf->f_bfree), &(buf->f_bavail), &(buf->f_files),
                        &(buf->f_ffree), &(buf->f_favail), &(buf->f_fsid),
                        &(buf->f_flag), &(buf->f_namemax))) {
+               //LCOV_EXCL_START Dbus type error
                _E("Failed to get params from gvariant.");
                g_variant_unref(reply);
                return -EIO;
+               //LCOV_EXCL_STOP
        }
 
 //     %lu buf->f_bsize, buf->f_frsize, buf->f_fsid, buf->f_flag, buf->f_namemax
@@ -308,14 +314,18 @@ int storage_ext_get_storage_level(const char *path, char **level)
        gdbus_free_connection(dbus_handle);
 
        if (ret_dbus < 0) {
+               //LCOV_EXCL_START Dbus error
                _E("Failed to get %d level", id);
                return -EIO;
+               //LCOV_EXCL_STOP
        }
 
        if (!g_variant_get_safe(reply, "(s)", &reply_val)) {
+               //LCOV_EXCL_START Dbus type error
                _E("Failed to get params from gvariant.");
                g_variant_unref(reply);
                return -EIO;
+               //LCOV_EXCL_STOP
        }
 
        *level = strdup(reply_val);
@@ -323,7 +333,7 @@ int storage_ext_get_storage_level(const char *path, char **level)
        g_variant_unref(reply);
 
        if (*level == NULL)
-               return -ENOMEM;
+               return -ENOMEM; //LCOV_EXCL_LINE
 
        return 0;
 }
@@ -505,7 +515,7 @@ int storage_ext_get_device_info(int storage_id, storage_ext_device *info)
 
        if (ret_dbus < 0) {
                _E("There is no storage with the storage id (%d)", storage_id); //LCOV_EXCL_LINE
-               return -ENODEV;
+               return -ENODEV; //LCOV_EXCL_LINE
        }
 
        if (!g_variant_get_safe(reply, "(issssssisibii)",
@@ -515,15 +525,19 @@ int storage_ext_get_device_info(int storage_id, storage_ext_device *info)
                                &info->readonly, &info->mount_point,
                                &info->state, &info->primary,
                                &info->flags, &info->storage_id)) {
-               _E("No storage with the storage id (%d)", storage_id); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START Dbus error
+               _E("No storage with the storage id (%d)", storage_id);
                ret_dbus = -ENODEV;
                goto out;
+               //LCOV_EXCL_STOP
        }
 
        if (info->storage_id < 0) {
-               _E("No storage with the storage id (%d)", storage_id); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START Dbus error
+               _E("No storage with the storage id (%d)", storage_id);
                ret_dbus = -ENODEV;
                goto out;
+               //LCOV_EXCL_STOP
        }
 
 out:
index 3ffcf4a..65719d4 100755 (executable)
@@ -95,13 +95,13 @@ int storage_ext_get_space(int storage_id,
        ret = storage_ext_get_device_info(storage_id, dev);
        if (ret < 0) {
                _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
-               goto out;
+               goto out; //LCOV_EXCL_LINE
        }
 
        ret = storage_ext_get_dev_state(dev, STORAGE_EXT_CHANGED, &state);
        if (ret < 0) {
                _E("Failed to get state of storage (id:%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
-               goto out;
+               goto out; //LCOV_EXCL_LINE
        }
 
        if (state >= STORAGE_STATE_MOUNTED) {
@@ -112,7 +112,7 @@ int storage_ext_get_space(int storage_id,
 #endif
                if (ret < 0) {
                        _E("Failed to get external memory size of (%s)(ret:%d)", dev->mount_point, ret); //LCOV_EXCL_LINE
-                       goto out;
+                       goto out; //LCOV_EXCL_LINE
                }
 
                t = (unsigned long long)s.f_frsize*s.f_blocks;
@@ -144,14 +144,14 @@ int storage_ext_foreach_device_list(storage_device_supported_cb callback, void *
        ret_val = storage_ext_get_list(&list);
        if (ret_val < 0) {
                _E("Failed to get external storage list from deviced (%d)", errno); //LCOV_EXCL_LINE
-               return ret_val;
+               return ret_val; //LCOV_EXCL_LINE
        }
 
        SYS_G_LIST_FOREACH(list, elem, dev) {
                ret_val = storage_ext_get_dev_state(dev, STORAGE_EXT_CHANGED, &state);
                if (ret_val < 0) {
                        _E("Failed to get storage state (devnode:%s, ret_val:%d)", dev->devnode, ret_val); //LCOV_EXCL_LINE
-                       continue;
+                       continue; //LCOV_EXCL_LINE
                }
 
                if (dev->type == STORAGE_EXT_MMC_EXTENDED_INTERNAL)
@@ -326,7 +326,7 @@ int storage_ext_register_cb(enum storage_cb_type type, struct storage_cb_info *i
        /* add device changed callback to list (local) */
        cb_info = malloc(sizeof(struct storage_cb_info));
        if (!cb_info)
-               return -errno;
+               return -errno; //LCOV_EXCL_LINE
 
        memcpy(cb_info, info, sizeof(struct storage_cb_info));
        SYS_G_LIST_APPEND(cb_list[type], cb_info);
@@ -356,8 +356,10 @@ int storage_ext_unregister_cb(enum storage_cb_type type, struct storage_cb_info
        }
 
        if (!check_if_callback_exist(type, info, &cb_info)) {
+               //LCOV_EXCL_START Callbacked is not registered case
                _E("The callback is not registered");
                return 0;
+               //LCOV_EXCL_STOP
        }
 
        /* remove device callback from list (local) */
@@ -399,33 +401,41 @@ int storage_ext_get_root(int storage_id, char *path, size_t len, bool *extendedi
        if (access(file_name, R_OK) == 0) {
                fp = fopen(file_name, "r");
                if (!fp) {
-                       _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
+                       //LCOV_EXCL_START File operation error
+                       _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret);
                        ret = -ENODEV;
                        goto out;
+                       //LCOV_EXCL_STOP
                }
 
                tmp = fgets(path, len, fp);
                fclose(fp);
                if (!tmp) {
+                       //LCOV_EXCL_START File operation error
                        ret = -ENODEV;
                        _D("Failed to get path");
                        goto out;
+                       //LCOV_EXCL_STOP
                }
                *extendedinternal = false;
        } else if (access(file_name2, R_OK) == 0) {
                fp = fopen(file_name2, "r");
                if (!fp) {
-                       _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
+                       //LCOV_EXCL_START File operation error
+                       _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret);
                        ret = -ENODEV;
                        goto out;
+                       //LCOV_EXCL_STOP
                }
 
                tmp = fgets(path, len, fp);
                fclose(fp);
                if (!tmp) {
+                       //LCOV_EXCL_START File operation error
                        ret = -ENODEV;
                        _D("Failed to get path");
                        goto out;
+                       //LCOV_EXCL_STOP
                }
                *extendedinternal = true;
        } else {
@@ -439,9 +449,11 @@ int storage_ext_get_root(int storage_id, char *path, size_t len, bool *extendedi
 
                ret = storage_ext_get_device_info(storage_id, dev);
                if (ret < 0) {
-                       _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
+                       //LCOV_EXCL_START
+                       _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret);
                        storage_ext_release_device(&dev);
                        goto out;
+                       //LCOV_EXCL_STOP
                }
 
                snprintf(path, len, "%s", dev->mount_point);
@@ -479,8 +491,10 @@ int storage_ext_get_state(int storage_id, storage_state_e *state)
 
        ret = storage_ext_get_device_info(storage_id, dev);
        if (ret < 0) {
-               _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START
+               _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret);
                goto out;
+               //LCOV_EXCL_STOP
        }
 
        ret = storage_ext_get_dev_state(dev, STORAGE_EXT_CHANGED, state);
@@ -500,8 +514,10 @@ int storage_ext_get_primary_mmc_path(char *path, size_t len)
 
        ret = storage_ext_get_list(&list);
        if (ret < 0) {
-               _E("Failed to get external storage list from deviced (%d)", errno); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START
+               _E("Failed to get external storage list from deviced (%d)", errno);
                return ret;
+               //LCOV_EXCL_STOP
        }
 
        SYS_G_LIST_FOREACH(list, elem, dev) {
index e0dedc8..b6513af 100755 (executable)
@@ -178,8 +178,10 @@ API int storage_get_primary_sdcard(int *storage_id, char **path)
 
        dbus_handle_h dbus_handle = gdbus_get_connection(G_BUS_TYPE_SYSTEM, true);
        if (dbus_handle == NULL) {
+               //LCOV_EXCL_START Dbus error
                _E("Failed to get dbus connection");
                return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        ret_dbus = gdbus_priv_call_sync_with_reply(dbus_handle,
@@ -206,8 +208,10 @@ API int storage_get_primary_sdcard(int *storage_id, char **path)
                        NULL, &reply_mount_point,
                        NULL, NULL,
                        NULL, &reply_id)) {
+               //LCOV_EXCL_START Dbus error
                g_variant_unref(reply);
                return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_unref(reply);
@@ -220,7 +224,7 @@ API int storage_get_primary_sdcard(int *storage_id, char **path)
        *path = strdup(reply_mount_point);
        if (*path == NULL) {
                ret = STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
-               goto out;
+               goto out; //LCOV_EXCL_LINE System Error
        }
 
        *storage_id = reply_id;
@@ -232,6 +236,7 @@ out:
        return ret;
 }
 
+//LCOV_EXCL_START Internal API
 API int storage_get_storage_level(const char *path, char **level)
 {
        int ret_level;
@@ -249,6 +254,7 @@ API int storage_get_storage_level(const char *path, char **level)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP Internal API
 
 //LCOV_EXCL_START Not called callback
 static void mount_mmc_cb(GVariant *var, void *user_data, GError *err)
@@ -275,6 +281,7 @@ exit:
 }
 //LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
 {
        void (*mount_cb)(GVariant *, void *, GError *) = NULL;
@@ -292,10 +299,8 @@ API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
        ret_val = storage_get_primary_sdcard(&id, &path);
        if (ret_val != STORAGE_ERROR_NONE)
                return ret_val;
-//LCOV_EXCL_START System Error
        if (path)
                free(path);
-//LCOV_EXCL_STOP
 
        ret_val = gdbus_call_async_with_reply(STORAGE_EXT_BUS_NAME,
                        STORAGE_EXT_PATH_MANAGER,
@@ -315,6 +320,7 @@ API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP Internal API
 
 //LCOV_EXCL_START Not called callback
 static void unmount_mmc_cb(GVariant *var, void *user_data, GError *err)
@@ -341,6 +347,7 @@ exit:
 }
 //LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
 {
        void (*unmount_cb)(GVariant *, void *, GError *) = NULL;
@@ -361,10 +368,8 @@ API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
        ret_val = storage_get_primary_sdcard(&id, &path);
        if (ret_val != STORAGE_ERROR_NONE)
                return ret_val;
-//LCOV_EXCL_START System Error
        if (path)
                free(path);
-//LCOV_EXCL_STOP
 
        ret_val = gdbus_call_async_with_reply(STORAGE_EXT_BUS_NAME,
                        STORAGE_EXT_PATH_MANAGER,
@@ -384,6 +389,7 @@ API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
 //LCOV_EXCL_START Not called callback
 static void format_mmc_cb(GVariant *var, void *user_data, GError *err)
@@ -410,11 +416,14 @@ exit:
 }
 //LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_request_format_mmc(struct mmc_contents *mmc_data)
 {
        return storage_format_mmc(mmc_data, 1);
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
 {
        void (*format_cb)(GVariant *, void *, GError *) = NULL;
@@ -435,10 +444,8 @@ API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
        ret_val = storage_get_primary_sdcard(&id, &path);
        if (ret_val != STORAGE_ERROR_NONE)
                return ret_val;
-//LCOV_EXCL_START System Error
        if (path)
                free(path);
-//LCOV_EXCL_STOP
 
        ret_val = gdbus_call_async_with_reply(STORAGE_EXT_BUS_NAME,
                        STORAGE_EXT_PATH_MANAGER,
@@ -458,7 +465,9 @@ API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Internal API
 API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
 {
        blkid_cache cache = NULL;
@@ -535,3 +544,4 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
 
        return STORAGE_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
index c5e7a6f..01ec1fb 100644 (file)
@@ -84,14 +84,16 @@ API int storage_foreach_device_supported(storage_device_supported_cb callback, v
        }
 
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NONE;
+               //LCOV_EXCL_STOP
        }
 
        ret_val = storage_ext_foreach_device_list(callback, user_data);
        if (ret_val < 0) {
                _E("Failed to iterate external devices (%d)", ret_val); //LCOV_EXCL_LINE
-               return STORAGE_ERROR_OPERATION_FAILED;
+               return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
        return STORAGE_ERROR_NONE;
@@ -139,25 +141,31 @@ API int storage_get_root_directory(int storage_id, char **path)
 
        /* external storage */
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        ret_val = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
        if (ret_val < 0) {
-               _E("Failed to get root path of external storage(%d, %d", storage_id, ret_val); //LCOV_EXCL_LINE
+               _E("Failed to get root path of external storage(%d, %d", storage_id, ret_val);
                if (ret_val == -ENODEV || ret_val == -EINVAL)
                        return STORAGE_ERROR_INVALID_PARAMETER;
+               //LCOV_EXCL_START
                else if (ret_val == -ENOMEM)
                        return STORAGE_ERROR_OUT_OF_MEMORY;
                else
                        return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        *path = strdup(root);
        if (!*path) {
-               _E("Failed to copy the root string : %d", errno); //LCOV_EXCL_LINE System Error
+               //LCOV_EXCL_START System error
+               _E("Failed to copy the root string : %d", errno);
                return STORAGE_ERROR_OUT_OF_MEMORY;
+               //LCOV_EXCL_STOP
        }
 
        return STORAGE_ERROR_NONE;
@@ -220,8 +228,10 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
                        free(temp2);
                } else {
                        if ((ret_val = snprintf(temp, PATH_MAX, "%s/%s", root, dir_path[type])) > PATH_MAX - 1) {
+                               //LCOV_EXCL_START
                                _E("Path is longer than buffer. Need %d size of buffer.", ret_val + 1);
                                return STORAGE_ERROR_OUT_OF_MEMORY;
+                               //LCOV_EXCL_STOP
                        }
                }
 
@@ -230,39 +240,47 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
 
        /* external storage */
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        if (type == STORAGE_DIRECTORY_SYSTEM_RINGTONES) {
-               _E("Not support directory : id(%d) type(%d)", storage_id, type); //LCOV_EXCL_LINE
+               _E("Not support directory : id(%d) type(%d)", storage_id, type);
                return STORAGE_ERROR_INVALID_PARAMETER;
        }
 
        ret_val = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
        if (ret_val < 0) {
-               _E("Failed to get root dir for external storage(id:%d, ret:%d)", storage_id, ret_val); //LCOV_EXCL_LINE
+               _E("Failed to get root dir for external storage(id:%d, ret:%d)", storage_id, ret_val);
                if (ret_val == -ENODEV || ret_val == -EINVAL)
                        return STORAGE_ERROR_INVALID_PARAMETER;
+               //LCOV_EXCL_START
                else if (ret_val == -ENOMEM)
                        return STORAGE_ERROR_OUT_OF_MEMORY;
                else
                        return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
        /* The operation is not decided */
        if (extendedint)
                return STORAGE_ERROR_INVALID_PARAMETER;
 
        if ((ret_val = snprintf(temp, sizeof(temp), "%s/%s", root, dir_path[type])) > sizeof(temp) - 1) {
+               //LCOV_EXCL_START
                _E("Path is longer than buffer. Need %d size of buffer.", ret_val + 1);
                return STORAGE_ERROR_OUT_OF_MEMORY;
+               //LCOV_EXCL_STOP
        }
 
 out:
        *path = strdup(temp);
        if (!*path) {
-               _E("Failed to copy the directory(%d) string : %d", type, errno); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START System error
+               _E("Failed to copy the directory(%d) string : %d", type, errno);
                return STORAGE_ERROR_OUT_OF_MEMORY;
+               //LCOV_EXCL_STOP
        }
 
        return STORAGE_ERROR_NONE;
@@ -294,8 +312,10 @@ API int storage_get_type(int storage_id, storage_type_e *type)
 
        /* external storage */
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        ret_val = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
@@ -303,10 +323,12 @@ API int storage_get_type(int storage_id, storage_type_e *type)
                _E("Failed to get type of external storage");
                if (ret_val == -ENODEV || ret_val == -EINVAL)
                        return STORAGE_ERROR_INVALID_PARAMETER;
+               //LCOV_EXCL_START
                else if (ret_val == -ENOMEM)
                        return STORAGE_ERROR_OUT_OF_MEMORY;
                else
                        return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
        if (extendedint)
                *type = STORAGE_TYPE_EXTENDED_INTERNAL;
@@ -341,19 +363,23 @@ API int storage_get_state(int storage_id, storage_state_e *state)
 
        /* external storage */
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        ret_val = storage_ext_get_state(storage_id, &st);
        if (ret_val < 0) {
-               _E("Failed to get state (storage id(%d), ret_val(%d))", storage_id, ret_val); //LCOV_EXCL_LINE
+               _E("Failed to get state (storage id(%d), ret_val(%d))", storage_id, ret_val);
                if (ret_val == -ENODEV || ret_val == -EINVAL)
                        return STORAGE_ERROR_INVALID_PARAMETER;
+               //LCOV_EXCL_START
                else if (ret_val == -ENOMEM)
                        return STORAGE_ERROR_OUT_OF_MEMORY;
                else
                        return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        *state = st;
@@ -396,8 +422,10 @@ API int storage_set_state_changed_cb(int storage_id, storage_state_changed_cb ca
        /* For backward compatability */
        if (storage_id == STORAGE_TYPE_EXTERNAL) {
                if (!storage_ext_is_supported()) {
+                       //LCOV_EXCL_START
                        _D("Block module is not enabled");
                        return STORAGE_ERROR_NOT_SUPPORTED;
+                       //LCOV_EXCL_STOP
                }
 
                if (!compat_cb_init) {
@@ -425,8 +453,10 @@ API int storage_set_state_changed_cb(int storage_id, storage_state_changed_cb ca
 
        /* external storage */
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        info.id = storage_id;
@@ -435,8 +465,10 @@ API int storage_set_state_changed_cb(int storage_id, storage_state_changed_cb ca
 
        ret = storage_ext_register_cb(STORAGE_CALLBACK_ID, &info);
        if (ret < 0) {
-               _E("Failed to register callback : id(%d)", storage_id); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START
+               _E("Failed to register callback : id(%d)", storage_id);
                return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        return STORAGE_ERROR_NONE;
@@ -460,8 +492,10 @@ API int storage_unset_state_changed_cb(int storage_id, storage_state_changed_cb
        /* For backward compatability */
        if (storage_id == STORAGE_TYPE_EXTERNAL) {
                if (!storage_ext_is_supported()) {
+                       //LCOV_EXCL_START
                        _D("Block module is not enabled");
                        return STORAGE_ERROR_NOT_SUPPORTED;
+                       //LCOV_EXCL_STOP
                }
 
                GList *elem_n;
@@ -484,8 +518,10 @@ API int storage_unset_state_changed_cb(int storage_id, storage_state_changed_cb
 
        /* external storage */
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        info.id = storage_id;
@@ -493,8 +529,10 @@ API int storage_unset_state_changed_cb(int storage_id, storage_state_changed_cb
 
        ret_val = storage_ext_unregister_cb(STORAGE_CALLBACK_ID, &info);
        if (ret_val < 0) {
-               _E("Failed to unregister callback : id(%d)", storage_id); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START
+               _E("Failed to unregister callback : id(%d)", storage_id);
                return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        return STORAGE_ERROR_NONE;
@@ -525,21 +563,25 @@ API int storage_get_total_space(int storage_id, unsigned long long *bytes)
 
        /* external storage */
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        ret_val = storage_ext_get_space(storage_id, &total, NULL);
 
 out:
        if (ret_val < 0) {
-               _E("Failed to get total memory : id(%d)", storage_id); //LCOV_EXCL_LINE
+               _E("Failed to get total memory : id(%d)", storage_id);
                if (ret_val == -ENODEV || ret_val == -EINVAL)
                        return STORAGE_ERROR_INVALID_PARAMETER;
+               //LCOV_EXCL_START
                else if (ret_val == -ENOMEM)
                        return STORAGE_ERROR_OUT_OF_MEMORY;
                else
                        return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        *bytes = total;
@@ -571,21 +613,25 @@ API int storage_get_available_space(int storage_id, unsigned long long *bytes)
 
        /* external storage */
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        ret_val = storage_ext_get_space(storage_id, NULL, &avail);
 
 out:
        if (ret_val < 0) {
-               _E("Failed to get available memory : id(%d)", storage_id); //LCOV_EXCL_LINE
+               _E("Failed to get available memory : id(%d)", storage_id);
                if (ret_val == -ENODEV || ret_val == -EINVAL)
                        return STORAGE_ERROR_INVALID_PARAMETER;
+               //LCOV_EXCL_START
                else if (ret_val == -ENOMEM)
                        return STORAGE_ERROR_OUT_OF_MEMORY;
                else
                        return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        *bytes = avail;
@@ -613,8 +659,10 @@ API int storage_set_changed_cb(storage_type_e type, storage_changed_cb callback,
        }
 
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _E("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        /* external storage */
@@ -624,8 +672,10 @@ API int storage_set_changed_cb(storage_type_e type, storage_changed_cb callback,
 
        ret_val = storage_ext_register_cb(STORAGE_CALLBACK_TYPE, &info);
        if (ret_val < 0) {
-               _E("Failed to register storage callback(ret:%d)", ret_val); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START
+               _E("Failed to register storage callback(ret:%d)", ret_val);
                return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        return STORAGE_ERROR_NONE;
@@ -652,8 +702,10 @@ API int storage_unset_changed_cb(storage_type_e type, storage_changed_cb callbac
        }
 
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _E("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        /* external storage */
@@ -662,8 +714,10 @@ API int storage_unset_changed_cb(storage_type_e type, storage_changed_cb callbac
 
        ret_val = storage_ext_unregister_cb(STORAGE_CALLBACK_TYPE, &info);
        if (ret_val < 0) {
-               _E("Failed to unregister storage callback(ret:%d)", ret_val); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START
+               _E("Failed to unregister storage callback(ret:%d)", ret_val);
                return STORAGE_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        return STORAGE_ERROR_NONE;
@@ -681,15 +735,19 @@ API int storage_get_type_dev(int storage_id, storage_type_e *type, storage_dev_e
 
        ret = storage_get_type(storage_id, type);
        if (ret != STORAGE_ERROR_NONE) {
+               //LCOV_EXCL_START
                _E("Failed to get storage type: %d", ret);
                return ret;
+               //LCOV_EXCL_STOP
        }
        if (*type == STORAGE_TYPE_INTERNAL || *type == STORAGE_TYPE_EXTENDED_INTERNAL)
                return STORAGE_ERROR_INVALID_PARAMETER;
 
        if (!storage_ext_is_supported()) {
+               //LCOV_EXCL_START
                _D("Block module is not enabled");
                return STORAGE_ERROR_NOT_SUPPORTED;
+               //LCOV_EXCL_STOP
        }
 
        ext_dev = calloc(1, sizeof(storage_ext_device));
@@ -707,8 +765,10 @@ API int storage_get_type_dev(int storage_id, storage_type_e *type, storage_dev_e
                        ret =  STORAGE_ERROR_INVALID_PARAMETER;
                        goto out;
                }
+               //LCOV_EXCL_START
                ret = STORAGE_ERROR_OPERATION_FAILED;
                goto out;
+               //LCOV_EXCL_STOP
        }
 
        if (ext_dev->type == STORAGE_EXT_SCSI)