coverage: add comments to exclude from the coverage test 65/78265/1 accepted/tizen/common/20160706.141842 accepted/tizen/ivi/20160706.014011 accepted/tizen/mobile/20160706.013854 accepted/tizen/tv/20160706.013916 accepted/tizen/wearable/20160706.013955 submit/tizen/20160705.090208
authortaeyoung <ty317.kim@samsung.com>
Tue, 5 Jul 2016 02:51:14 +0000 (11:51 +0900)
committertaeyoung <ty317.kim@samsung.com>
Tue, 5 Jul 2016 02:51:14 +0000 (11:51 +0900)
- Error exception routines can be excluded since they
  could not be occurred.
- Plugin handling routines can be excluded since Platform
  does not have the plugin.

Change-Id: Ib88b0175007e18df7e19e7d5e5ee75cce86cc8f6
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/system_info.c
src/system_info_external.c
src/system_info_file.c

index 7933740d0d3ab57fc4bfdc6f111dad4cc60527b4..e2176c9d054bbe448734e4fdd609e3bd00f6543d 100644 (file)
@@ -74,7 +74,7 @@ static int db_get_value(enum tag_type tag, const char *key,
        int cache_size = GDBM_CACHE_SIZE;
 
        if (!key || !type || !value)
-               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        switch (tag) {
        case TAG_TYPE_PLATFORM:
@@ -89,13 +89,13 @@ static int db_get_value(enum tag_type tag, const char *key,
 
        db = gdbm_open(SYSTEM_INFO_DB_PATH, 0, GDBM_READER, S_IRUSR | S_IRGRP | S_IROTH, NULL);
        if (!db) {
-               _E("Failed to open db (%d, %s)", gdbm_errno, gdbm_strerror(gdbm_errno));
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+               _E("Failed to open db (%d, %s)", gdbm_errno, gdbm_strerror(gdbm_errno)); //LCOV_EXCL_LINE
+               return SYSTEM_INFO_ERROR_IO_ERROR; //LCOV_EXCL_LINE
        }
 
        ret = gdbm_setopt(db, GDBM_CACHESIZE, &cache_size, sizeof(cache_size));
        if (ret < 0)
-               _E("Failed to set cache size to (%d) (ret:%d)", cache_size, gdbm_errno);
+               _E("Failed to set cache size to (%d) (ret:%d)", cache_size, gdbm_errno); //LCOV_EXCL_LINE
 
        if (strstr(key, KEY_PREFIX) == key)
                snprintf(key_internal, sizeof(key_internal),
@@ -145,7 +145,7 @@ static int system_info_get_type(enum tag_type tag, const char *key,
        int cache_size = GDBM_CACHE_SIZE;
 
        if (!key || !type)
-               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        switch (tag) {
        case TAG_TYPE_PLATFORM:
@@ -160,13 +160,13 @@ static int system_info_get_type(enum tag_type tag, const char *key,
 
        db = gdbm_open(SYSTEM_INFO_DB_PATH, 0, GDBM_READER, S_IRUSR | S_IRGRP | S_IROTH, NULL);
        if (!db) {
-               _E("Failed to open db (%d, %s)", gdbm_errno, gdbm_strerror(gdbm_errno));
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+               _E("Failed to open db (%d, %s)", gdbm_errno, gdbm_strerror(gdbm_errno)); //LCOV_EXCL_LINE
+               return SYSTEM_INFO_ERROR_IO_ERROR; //LCOV_EXCL_LINE
        }
 
        ret = gdbm_setopt(db, GDBM_CACHESIZE, &cache_size, sizeof(cache_size));
        if (ret < 0)
-               _E("Failed to set cache size to (%d) (ret:%d)", cache_size, gdbm_errno);
+               _E("Failed to set cache size to (%d) (ret:%d)", cache_size, gdbm_errno); //LCOV_EXCL_LINE
 
        for (i = 0 ; i < ARRAY_SIZE(info_type); i++) {
                if (strstr(key, KEY_PREFIX) == key)
@@ -206,7 +206,7 @@ static int system_info_get_bool(enum tag_type tag, const char *key, bool *value)
        size_t len;
 
        if (!key || !value)
-               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        ret = db_get_value(tag, key, BOOL_TYPE, val, sizeof(val));
        if (ret == SYSTEM_INFO_ERROR_NONE)
@@ -215,9 +215,9 @@ static int system_info_get_bool(enum tag_type tag, const char *key, bool *value)
        if (tag == TAG_TYPE_CUSTOM) {
                ret = external_get_value(TAG_TYPE_CUSTOM_STR, key, BOOL_TYPE, &valp);
                if (ret == SYSTEM_INFO_ERROR_NONE) {
-                       snprintf(val, sizeof(val), "%s", valp);
-                       free(valp);
-                       goto out;
+                       snprintf(val, sizeof(val), "%s", valp); //LCOV_EXCL_LINE
+                       free(valp); //LCOV_EXCL_LINE
+                       goto out; //LCOV_EXCL_LINE
                }
        }
 
@@ -242,7 +242,7 @@ static int system_info_get_int(enum tag_type tag, const char *key, int *value)
        char *valp;
 
        if (!key || !value)
-               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        ret = db_get_value(tag, key, INT_TYPE, val, sizeof(val));
        if (ret == SYSTEM_INFO_ERROR_NONE)
@@ -251,9 +251,9 @@ static int system_info_get_int(enum tag_type tag, const char *key, int *value)
        if (tag == TAG_TYPE_CUSTOM) {
                ret = external_get_value(TAG_TYPE_CUSTOM_STR, key, INT_TYPE, &valp);
                if (ret == SYSTEM_INFO_ERROR_NONE) {
-                       snprintf(val, sizeof(val), "%s", valp);
-                       free(valp);
-                       goto out;
+                       snprintf(val, sizeof(val), "%s", valp); //LCOV_EXCL_LINE
+                       free(valp); //LCOV_EXCL_LINE
+                       goto out; //LCOV_EXCL_LINE
                }
        }
 
@@ -283,9 +283,9 @@ static int system_info_get_double(enum tag_type tag, const char *key, double *va
        if (tag == TAG_TYPE_CUSTOM) {
                ret = external_get_value(TAG_TYPE_CUSTOM_STR, key, DBL_TYPE, &valp);
                if (ret == SYSTEM_INFO_ERROR_NONE) {
-                       snprintf(val, sizeof(val), "%s", valp);
-                       free(valp);
-                       goto out;
+                       snprintf(val, sizeof(val), "%s", valp); //LCOV_EXCL_LINE
+                       free(valp); //LCOV_EXCL_LINE
+                       goto out; //LCOV_EXCL_LINE
                }
        }
 
@@ -307,7 +307,7 @@ static int system_info_get_string(enum tag_type tag, const char *key, char **val
        char *valp;
 
        if (!key || !value)
-               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        ret = db_get_value(tag, key, STR_TYPE, val, sizeof(val));
        if (ret == SYSTEM_INFO_ERROR_NONE)
@@ -322,9 +322,9 @@ static int system_info_get_string(enum tag_type tag, const char *key, char **val
        if (tag == TAG_TYPE_CUSTOM) {
                ret = external_get_value(TAG_TYPE_CUSTOM_STR, key, DBL_TYPE, &valp);
                if (ret == SYSTEM_INFO_ERROR_NONE) {
-                       snprintf(val, sizeof(val), "%s", valp);
-                       free(valp);
-                       goto out;
+                       snprintf(val, sizeof(val), "%s", valp); //LCOV_EXCL_LINE
+                       free(valp); //LCOV_EXCL_LINE
+                       goto out; //LCOV_EXCL_LINE
                }
        }
 
@@ -335,8 +335,8 @@ static int system_info_get_string(enum tag_type tag, const char *key, char **val
 out:
        string = strdup(val);
        if (!string) {
-               _E("malloc failed");
-               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
+               _E("malloc failed"); //LCOV_EXCL_LINE
+               return SYSTEM_INFO_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
        }
 
        *value = string;
@@ -405,6 +405,7 @@ API int system_info_get_custom_type(const char *key, system_info_type_e *type)
                return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
        }
 
+       //LCOV_EXCL_START
        len = strlen(val) + 1;
        if (!strncmp(BOOL_TYPE, val, len))
                *type = SYSTEM_INFO_BOOL;
@@ -420,4 +421,5 @@ API int system_info_get_custom_type(const char *key, system_info_type_e *type)
        }
 
        return SYSTEM_INFO_ERROR_NONE;
+       //LCOV_EXCL_STOP
 }
index 5e506afc96861d4e8128e6f8461e2f87ce2c33b9..414380c4d7efaac753a844934813c6c16e65e33b 100644 (file)
@@ -28,6 +28,8 @@
 
 #define EXTERNAL_SYSTEM_INFO "/usr/lib/libsystem-info-external-plugin.so"
 
+
+//LCOV_EXCL_START
 int external_get_value(const char *tag, const char *key,
                const char *type, char **val)
 {
@@ -156,3 +158,4 @@ out:
 
        return ret;
 }
+//LCOV_EXCL_STOP
index 9f4f5e1a39610b57e4a4a041fc0daee636ff07ac..8a83233ee114999b4f3b528f611b89e29da9a4a5 100644 (file)
@@ -39,21 +39,21 @@ static int get_tizenid(char *val, size_t len)
 
        fp = fopen(TIZEN_ID_PATH, "r");
        if (!fp) {
-               _E("Failed to open file (%s)", TIZEN_ID_PATH);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+               _E("Failed to open file (%s)", TIZEN_ID_PATH); //LCOV_EXCL_LINE
+               return SYSTEM_INFO_ERROR_IO_ERROR; //LCOV_EXCL_LINE
        }
 
        if (fgets(id, sizeof(id), fp) == NULL) {
-               _E("Failed to get string (errno:%d)", errno);
-               fclose(fp);
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+               _E("Failed to get string (errno:%d)", errno); //LCOV_EXCL_LINE
+               fclose(fp); //LCOV_EXCL_LINE
+               return SYSTEM_INFO_ERROR_IO_ERROR; //LCOV_EXCL_LINE
        }
 
        fclose(fp);
 
        if (strlen(id) == 0) {
-               _E("String length of id is 0");
-               return SYSTEM_INFO_ERROR_IO_ERROR;
+               _E("String length of id is 0"); //LCOV_EXCL_LINE
+               return SYSTEM_INFO_ERROR_IO_ERROR; //LCOV_EXCL_LINE
        }
 
        snprintf(val, len, "%s", id);
@@ -75,7 +75,7 @@ int system_info_get_file(const char *key, char *value, size_t len)
        size_t p_len;
 
        if (!key || !value)
-               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        if (strstr(key, KEY_PREFIX) == key)
                snprintf(p_key, sizeof(p_key), "%s", key);
@@ -96,7 +96,7 @@ int system_info_get_type_file(const char *key, system_info_type_e *type)
        int i, len;
 
        if (!key)
-               return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
+               return SYSTEM_INFO_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        if (strstr(key, KEY_PREFIX) == key)
                snprintf(p_key, sizeof(p_key), "%s", key);