Exclude some lines for line coverage 46/178346/2 accepted/tizen/unified/20180510.070850 submit/tizen/20180509.224345
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 9 May 2018 11:38:13 +0000 (20:38 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 9 May 2018 11:39:14 +0000 (20:39 +0900)
Change-Id: I955698ae06ec1f7478a001157bbdd7fd4d11c9f1

CMakeLists.txt
packaging/capi-network-softap.spec
src/softap.c
src/softap_private.c

index ab4e432622eb17d07b700bb1de9a28a16f1cf780..be11558f61ca9867c1a83b2f3d3bae64a5342791 100755 (executable)
@@ -21,6 +21,8 @@ FOREACH(flag ${${fw_name}_CFLAGS})
 ENDFOREACH(flag)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
+#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden -fprofile-arcs -ftest-coverage")
+
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
index 8ef87f73672a235144e705e305c389d8a7d67b71..08a5956c250c5cb83ffcee3830c71349e8140013 100644 (file)
@@ -1,6 +1,6 @@
 Name:          capi-network-softap
 Summary:       Softap Framework
-Version:       0.0.21
+Version:       0.0.22
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index b2b2e495e69596040c0622e74787eccf4e620e92..a067fc365b77577bfb4edf4713a1e528c730c4f7 100755 (executable)
@@ -90,8 +90,10 @@ static void __send_dbus_signal(GDBusConnection *conn, const char *signal_name, c
        g_dbus_connection_emit_signal(conn, NULL, SOFTAP_SERVICE_OBJECT_PATH,
                                        SOFTAP_SERVICE_INTERFACE, signal_name, message, &error);
        if (error) {
+//LCOV_EXCL_START
                ERR("g_dbus_connection_emit_signal is failed because  %s\n", error->message);
                g_error_free(error);
+//LCOV_EXCL_END
        }
 }
 
@@ -286,6 +288,7 @@ static softap_error_e __get_error(int agent_error)
        return err;
 }
 
+//LCOV_EXCL_START
 static void __handle_dhcp(GDBusConnection *connection, const gchar *sender_name,
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                GVariant *parameters, gpointer user_data)
@@ -337,6 +340,7 @@ DONE:
        g_free(name);
        DBG("-");
 }
+//LCOV_EXCL_STOP
 
 static void __handle_softap_on(GDBusConnection *connection, const gchar *sender_name,
                        const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
@@ -359,6 +363,7 @@ static void __handle_softap_on(GDBusConnection *connection, const gchar *sender_
        DBG("-");
 }
 
+//LCOV_EXCL_START
 static void __handle_softap_off(GDBusConnection *connection, const gchar *sender_name,
                        const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                        GVariant *parameters, gpointer user_data)
@@ -389,6 +394,7 @@ static void __handle_softap_off(GDBusConnection *connection, const gchar *sender
        DBG("-");
 }
 
+
 static void __handle_low_battery_mode(GDBusConnection *connection, const gchar *sender_name,
                        const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                        GVariant *parameters, gpointer user_data)
@@ -522,6 +528,7 @@ static void __handle_passphrase_changed(GDBusConnection *connection, const gchar
        pcb(data);
        DBG("-");
 }
+//LCOV_EXCL_STOP
 
 static void __enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                gpointer user_data)
@@ -542,6 +549,7 @@ static void __enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
 
        g_var = g_dbus_proxy_call_finish(sa->client_bus_proxy, res, &g_error);
        if (g_error) {
+//LCOV_EXCL_START
                ERR("DBus error [%s]", g_error->message);
                if (g_error->code == G_DBUS_ERROR_NO_REPLY &&
                                ++retry < SOFTAP_ERROR_RECOVERY_MAX) {
@@ -556,6 +564,7 @@ static void __enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                else
                        error = SOFTAP_ERROR_OPERATION_FAILED;
                g_error_free(g_error);
+//LCOV_EXCL_STOP
        } else {
                g_variant_get(g_var, "(u)", &info);
                g_variant_unref(g_var);
@@ -597,10 +606,12 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
 
        g_var = g_dbus_proxy_call_finish(sa->client_bus_proxy, res, &g_error);
        if (g_error) {
+//LCOV_EXCL_START
                ERR("DBus error [%s]", g_error->message);
                g_error_free(g_error);
                DBG("-");
                return;
+//LCOV_EXCL_STOP
        } else {
                g_variant_get(g_var, "(u)", &info);
                g_variant_unref(g_var);
@@ -636,12 +647,14 @@ static void __settings_reloaded_cb(GObject *source_object, GAsyncResult *res,
 
        g_var  = g_dbus_proxy_call_finish(sa->client_bus_proxy, res, &g_error);
        if (g_error) {
+//LCOV_EXCL_START
                ERR("DBus fail [%s]\n", g_error->message);
                if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        softap_error = SOFTAP_ERROR_PERMISSION_DENIED;
                else
                        softap_error = SOFTAP_ERROR_OPERATION_FAILED;
                g_error_free(g_error);
+//LCOV_EXCL_STOP
        } else {
                g_variant_get(g_var, "(u)", &info);
                g_variant_unref(g_var);
@@ -795,23 +808,29 @@ API int softap_create(softap_h *softap)
        sa->sec_type = SOFTAP_SECURITY_TYPE_WPA2_PSK;
 
        if (__get_common_ssid(ssid, sizeof(ssid)) != SOFTAP_ERROR_NONE) {
+//LCOV_EXCL_START
                ERR("Fail to get default ssid!!");
                free(sa);
                return SOFTAP_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
        }
 
        sa->ssid = g_strdup(ssid);
        if (sa->ssid == NULL) {
+//LCOV_EXCL_START
                ERR("Fail to get default ssid!!");
                free(sa);
                return SOFTAP_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
        }
 
        if (__get_initial_passphrase(sa->passphrase, sizeof(sa->passphrase)) == 0) {
+//LCOV_EXCL_START
                ERR("Fail to generate random passphrase!!");
                g_free(sa->ssid);
                free(sa);
                return SOFTAP_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
        }
 
        if (__get_channel(&channel) != SOFTAP_ERROR_NONE)
@@ -831,6 +850,7 @@ API int softap_create(softap_h *softap)
        GCancellable *cancellable = g_cancellable_new();
        sa->client_bus = g_bus_get_sync(DBUS_BUS_SYSTEM, cancellable, &error);
        if (error) {
+//LCOV_EXCL_START
                ERR("Couldn't connect to the System bus[%s]", error->message);
                g_error_free(error);
                g_cancellable_cancel(cancellable);
@@ -838,6 +858,7 @@ API int softap_create(softap_h *softap)
                g_free(sa->ssid);
                free(sa);
                return SOFTAP_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
        }
        sa->cancellable = cancellable;
 
@@ -845,6 +866,7 @@ API int softap_create(softap_h *softap)
                        NULL, SOFTAP_SERVICE_NAME, SOFTAP_SERVICE_OBJECT_PATH,
                        SOFTAP_SERVICE_INTERFACE, sa->cancellable, &error);
        if (!sa->client_bus_proxy) {
+//LCOV_EXCL_START
                if (error) {
                        ERR("Fail to create the proxy object because of %s", error->message);
                        g_error_free(error);
@@ -854,6 +876,7 @@ API int softap_create(softap_h *softap)
                g_free(sa->ssid);
                free(sa);
                return SOFTAP_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
        }
 
         __connect_signals((softap_h)sa);
@@ -1221,6 +1244,7 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien
        g_variant_get(result, "(a(a{sv}))", &outer_iter);
 
        while (g_variant_iter_loop(outer_iter, "(@a{sv})", &station)) {
+//LCOV_EXCL_START
                g_variant_get(station, "a{sv}", &inner_iter);
 
                while (g_variant_iter_loop(inner_iter, "{sv}", &key, &value)) {
@@ -1273,6 +1297,7 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien
                }
                g_free(client.hostname);
                client.hostname = NULL;
+//LCOV_EXCL_STOP
        }
        g_variant_iter_free(outer_iter);
        g_variant_unref(station);
@@ -1676,6 +1701,7 @@ API int softap_push_wps_button(softap_h softap)
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
+//LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -1685,6 +1711,7 @@ API int softap_push_wps_button(softap_h softap)
 
                g_error_free(error);
                return ret;
+//LCOV_EXCL_STOP
        }
 
        if (parameters != NULL) {
@@ -1719,6 +1746,7 @@ API int softap_set_wps_pin(softap_h softap, const char *wps_pin)
                        g_variant_new("(s)", wps_pin), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
+//LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -1728,6 +1756,7 @@ API int softap_set_wps_pin(softap_h softap, const char *wps_pin)
 
                g_error_free(error);
                return ret;
+//LCOV_EXCL_STOP
        }
 
        if (parameters != NULL) {
@@ -1855,6 +1884,7 @@ API int softap_enable_dhcp(softap_h softap)
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
+//LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        result = SOFTAP_ERROR_PERMISSION_DENIED;
@@ -1865,6 +1895,7 @@ API int softap_enable_dhcp(softap_h softap)
                sa->dhcp_enabled = false;
 
                return result;
+//LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -1891,6 +1922,7 @@ API int softap_disable_dhcp(softap_h softap)
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
+//LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        result = SOFTAP_ERROR_PERMISSION_DENIED;
@@ -1899,6 +1931,7 @@ API int softap_disable_dhcp(softap_h softap)
 
                g_error_free(error);
                return result;
+//LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -1928,12 +1961,14 @@ API int softap_is_dhcp_enabled(softap_h softap, bool *dhcp_enabled)
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
+//LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed becuase %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        ret = SOFTAP_ERROR_PERMISSION_DENIED;
                else
                        ret = SOFTAP_ERROR_OPERATION_FAILED;
+//LCOV_EXCL_STOP
        }
 
        if (parameters != NULL) {
@@ -1969,6 +2004,7 @@ API int softap_enable_dhcp_with_range(softap_h softap, char *rangestart, char *r
                        g_variant_new("(ss)", rangestart, rangestop),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+//LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -1980,6 +2016,7 @@ API int softap_enable_dhcp_with_range(softap_h softap, char *rangestart, char *r
                sa->dhcp_enabled = false;
 
                return result;
+//LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
index 2c9d02cb65ccbfb9a3acf6a085e9b0355993cbad..4c93f3f3fd9609eee18df794c46dbd47016cb549 100755 (executable)
@@ -28,15 +28,19 @@ int _softap_check_feature_supported(const char *key)
 {
        if (!is_feature_checked) {
                if (system_info_get_platform_bool(key, &feature_supported) < 0) {
+//LCOV_EXCL_START
                        ERR("Get feature is failed");
                        return SOFTAP_ERROR_NOT_SUPPORTED;
+//LCOV_EXCL_STOP
                }
                is_feature_checked = true;
        }
 
        if (!feature_supported) {
+//LCOV_EXCL_START
                ERR("Not supported feature");
                return SOFTAP_ERROR_NOT_SUPPORTED;
+//LCOV_EXCL_STOP
        }
 
        return SOFTAP_ERROR_NONE;