From c354b744e1b7472ad6b3650a0b2f1278dfdadee2 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Fri, 16 Jun 2017 17:24:22 +0900 Subject: [PATCH] Add LCOV comment for line coverage Change-Id: I25ace7ed4f5b7b39a85c9188a4baed99fd07993a Signed-off-by: Seonah Moon --- CMakeLists.txt | 1 + packaging/capi-network-tethering.spec | 2 +- src/tethering.c | 151 +++++++++++++++++--------- 3 files changed, 102 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 671bbe8..358e2ec 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ 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") IF("${ARCH}" STREQUAL "arm") diff --git a/packaging/capi-network-tethering.spec b/packaging/capi-network-tethering.spec index 03873ae..4ebf191 100644 --- a/packaging/capi-network-tethering.spec +++ b/packaging/capi-network-tethering.spec @@ -1,6 +1,6 @@ Name: capi-network-tethering Summary: Tethering Framework -Version: 1.0.50 +Version: 1.0.51 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/tethering.c b/src/tethering.c index d159e5a..7d93058 100755 --- a/src/tethering.c +++ b/src/tethering.c @@ -164,12 +164,12 @@ static tethering_error_e __set_security_type(const tethering_wifi_security_type_ if (security_type != TETHERING_WIFI_SECURITY_TYPE_NONE && security_type != TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK && security_type != TETHERING_WIFI_SECURITY_TYPE_WPS) { - ERR("Invalid param\n"); + ERR("Invalid param\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_INVALID_PARAMETER; } if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_SECURITY, security_type) < 0) { - ERR("vconf_set_int is failed\n"); + ERR("vconf_set_int is failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OPERATION_FAILED; } @@ -179,13 +179,13 @@ static tethering_error_e __set_security_type(const tethering_wifi_security_type_ static tethering_error_e __get_security_type(tethering_wifi_security_type_e *security_type) { if (security_type == NULL) { - ERR("Invalid param\n"); + ERR("Invalid param\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_INVALID_PARAMETER; } if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_SECURITY, (int *)security_type) < 0) { - ERR("vconf_get_int is failed\n"); + ERR("vconf_get_int is failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OPERATION_FAILED; } @@ -216,7 +216,7 @@ static bool __get_ssid_from_vconf(const char *path, char *ssid, unsigned int siz static tethering_error_e __set_visible(const bool visible) { if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_HIDE, visible ? 0 : 1) < 0) { - ERR("vconf_set_int is failed\n"); + ERR("vconf_set_int is failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OPERATION_FAILED; } @@ -226,14 +226,14 @@ static tethering_error_e __set_visible(const bool visible) static tethering_error_e __get_visible(bool *visible) { if (visible == NULL) { - ERR("Invalid param\n"); + ERR("Invalid param\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_INVALID_PARAMETER; } int hide = 0; if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_HIDE, &hide) < 0) { - ERR("vconf_get_int is failed\n"); + ERR("vconf_get_int is failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OPERATION_FAILED; } @@ -285,6 +285,7 @@ static tethering_error_e __get_error(int agent_error) err = TETHERING_ERROR_INVALID_PARAMETER; break; + //LCOV_EXCL_START case MOBILE_AP_ERROR_ALREADY_ENABLED: err = TETHERING_ERROR_OPERATION_FAILED; break; @@ -309,7 +310,6 @@ static tethering_error_e __get_error(int agent_error) err = TETHERING_ERROR_OPERATION_FAILED; break; - //LCOV_EXCL_START case MOBILE_AP_ERROR_NOT_PERMITTED: err = TETHERING_ERROR_NOT_PERMITTED; break; @@ -393,9 +393,7 @@ DONE: g_free(name); DBG("-\n"); } -//LCOV_EXCL_STOP -//LCOV_EXCL_START static void __handle_net_closed(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data) @@ -690,7 +688,7 @@ static void __handle_security_type_changed(GDBusConnection *connection, const gc else if (g_strcmp0(buf, TETHERING_WIFI_SECURITY_TYPE_WPS_STR) == 0) security_type = TETHERING_WIFI_SECURITY_TYPE_WPS; else { - SERR("Unknown type : %s\n", buf); + SERR("Unknown type : %s\n", buf); //LCOV_EXCL_LINE g_free(buf); return; } @@ -704,7 +702,7 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data) { - DBG("+\n"); + DBG("+\n"); //LCOV_EXCL_LINE _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); __tethering_h *th = (__tethering_h *)user_data; @@ -716,7 +714,7 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const scb = th->ssid_visibility_changed_cb; if (scb == NULL) { - DBG("-\n"); + DBG("-\n"); //LCOV_EXCL_LINE return; } g_variant_get(parameters, "(s)", &buf); @@ -726,14 +724,14 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const scb(visible, data); g_free(buf); - DBG("-\n"); + DBG("-\n"); //LCOV_EXCL_LINE } static void __handle_passphrase_changed(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data) { - DBG("+\n"); + DBG("+\n"); //LCOV_EXCL_LINE _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); __tethering_h *th = (__tethering_h *)user_data; @@ -748,13 +746,13 @@ static void __handle_passphrase_changed(GDBusConnection *connection, const gchar data = th->passphrase_user_data; pcb(data); - DBG("-\n"); + DBG("-\n"); //LCOV_EXCL_LINE } static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { - INFO("+\n"); + INFO("+\n"); //LCOV_EXCL_LINE _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); GError *g_error = NULL; @@ -789,7 +787,7 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, } retry = 0; - INFO("cfm event : wifi tethering enable info : %d\n", error); + INFO("cfm event : wifi tethering enable info : %d\n", error); //LCOV_EXCL_LINE sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id = g_dbus_connection_signal_subscribe(th->client_bus, NULL, TETHERING_SERVICE_INTERFACE, sigs[E_SIGNAL_WIFI_TETHER_ON].name, @@ -797,18 +795,18 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, sigs[E_SIGNAL_WIFI_TETHER_ON].cb, (gpointer)th, NULL); if (!ecb) { - INFO("-\n"); + INFO("-\n"); //LCOV_EXCL_LINE return; } ecb(error, TETHERING_TYPE_WIFI, true, data); g_variant_unref(g_var); - INFO("-\n"); + INFO("-\n"); //LCOV_EXCL_LINE } static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { - DBG("+\n"); + DBG("+\n"); //LCOV_EXCL_LINE _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); GError *g_error = NULL; GVariant *g_var; @@ -852,7 +850,7 @@ static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, sigs[E_SIGNAL_BT_TETHER_ON].cb, (gpointer)th, NULL); if (!ecb) { - DBG("-\n"); + DBG("-\n"); //LCOV_EXCL_LINE return; } @@ -913,7 +911,6 @@ static void __usb_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, ecb(error, TETHERING_TYPE_USB, true, data); DBG("-\n"); } -//LCOV_EXCL_STOP static void __p2p_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) @@ -962,11 +959,12 @@ static void __p2p_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, ecb(error, TETHERING_TYPE_P2P, true, data); DBG("-\n"); } +//LCOV_EXCL_STOP static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { - INFO("+\n"); + INFO("+\n"); //LCOV_EXCL_LINE _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); GError *g_error = NULL; @@ -1036,7 +1034,6 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res, if (dcb) dcb(error, type, code, data); break; - //LCOV_EXCL_STOP case MOBILE_AP_DISABLE_P2P_TETHERING_CFM: type = TETHERING_TYPE_P2P; @@ -1074,8 +1071,9 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res, default: ERR("Invalid event\n"); break; + //LCOV_EXCL_STOP } - INFO("-\n"); + INFO("-\n"); //LCOV_EXCL_LINE } static void __get_data_usage_cb(GObject *source_object, GAsyncResult *res, @@ -1106,7 +1104,7 @@ static void __get_data_usage_cb(GObject *source_object, GAsyncResult *res, //LCOV_EXCL_STOP } if (th->data_usage_cb == NULL) { - ERR("There is no data_usage_cb\n"); + ERR("There is no data_usage_cb\n"); //LCOV_EXCL_LINE return; } if (flag) { @@ -1137,7 +1135,7 @@ static void __settings_reloaded_cb(GObject *source_object, GAsyncResult *res, g_var = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error); if (g_error) { - ERR("DBus fail [%s]\n", g_error->message); + ERR("DBus fail [%s]\n", g_error->message); //LCOV_EXCL_LINE if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED) tethering_error = TETHERING_ERROR_PERMISSION_DENIED; else @@ -1214,9 +1212,11 @@ static bool __get_intf_name(tethering_type_e type, char *buf, unsigned int len) g_strlcpy(buf, TETHERING_BT_IF, len); break; + //LCOV_EXCL_START default: ERR("Not supported type : %d\n", type); return false; + //LCOV_EXCL_STOP } return true; } @@ -1226,10 +1226,11 @@ static bool __get_gateway_addr(tethering_type_e type, char *buf, unsigned int le _retvm_if(buf == NULL, false, "parameter(buf) is NULL\n"); switch (type) { + //LCOV_EXCL_START case TETHERING_TYPE_USB: g_strlcpy(buf, TETHERING_USB_GATEWAY, len); break; - + //LCOV_EXCL_STOP case TETHERING_TYPE_WIFI: g_strlcpy(buf, TETHERING_WIFI_GATEWAY, len); break; @@ -1237,10 +1238,11 @@ static bool __get_gateway_addr(tethering_type_e type, char *buf, unsigned int le case TETHERING_TYPE_BT: g_strlcpy(buf, TETHERING_BT_GATEWAY, len); break; - + //LCOV_EXCL_START default: ERR("Not supported type : %d\n", type); return false; + //LCOV_EXCL_STOP } return true; } @@ -1303,7 +1305,7 @@ static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *se char *ptr = NULL; if (th == NULL || set == NULL) { - ERR("null parameter\n-\n"); + ERR("null parameter\n-\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_INVALID_PARAMETER; } @@ -1394,13 +1396,16 @@ static bool __check_precondition(tethering_type_e type) return TRUE; } #else + //LCOV_EXCL_LINE vconf_get_int(VCONFKEY_DNET_STATE, &dnet_state); if (dnet_state > VCONFKEY_DNET_OFF) { INFO("Data Network is connected"); return TRUE; } + //LCOV_EXCL_STOP #endif/*TIZEN_TV_EXT*/ + //LCOV_EXCL_START /* data network through wifi */ if (type != TETHERING_TYPE_WIFI) { vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state); @@ -1411,6 +1416,7 @@ static bool __check_precondition(tethering_type_e type) } ERR("Network is not available!"); + //LCOV_EXCL_STOP return FALSE; } @@ -1454,15 +1460,19 @@ API int tethering_create(tethering_h *tethering) if (__generate_initial_passphrase(th->passphrase, sizeof(th->passphrase)) == 0) { - ERR("random passphrase generation failed\n"); //LCOV_EXCL_LINE + //LCOV_EXCL_START + ERR("random passphrase generation failed\n"); free(th); return TETHERING_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } if (__get_common_ssid(ssid, sizeof(ssid)) != TETHERING_ERROR_NONE) { - ERR("common ssid get failed\n"); //LCOV_EXCL_LINE + //LCOV_EXCL_START + ERR("common ssid get failed\n"); free(th); return TETHERING_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } #if !GLIB_CHECK_VERSION(2, 36, 0) @@ -1530,6 +1540,7 @@ API int tethering_destroy(tethering_h tethering) INFO("Tethering Handle : 0x%X\n", th); __disconnect_signals(tethering); + _tethering_remove_handle(th); if (th->ssid) free(th->ssid); @@ -1539,7 +1550,6 @@ API int tethering_destroy(tethering_h tethering) g_object_unref(th->client_bus); memset(th, 0x00, sizeof(__tethering_h)); - _tethering_remove_handle(th); free(th); INFO("-\n"); @@ -1603,9 +1613,11 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type) ret = __prepare_wifi_settings(tethering, &set); if (ret != TETHERING_ERROR_NONE) { + //LCOV_EXCL_START ERR("softap settings initialization failed\n"); DBG("-\n"); return TETHERING_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } g_dbus_connection_signal_unsubscribe(connection, sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id); @@ -1628,6 +1640,7 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type) break; + //LCOV_EXCL_START case TETHERING_TYPE_P2P: { _softap_settings_t p2p_set = {"", "", "", 0, false}; ret = __prepare_wifi_settings(tethering, &p2p_set); @@ -1681,7 +1694,6 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type) G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable, (GAsyncReadyCallback) __bt_enabled_cfm_cb, (gpointer)tethering); break; - //LCOV_EXCL_STOP } default: ERR("Unknown type : %d\n", type); @@ -1691,6 +1703,7 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type) DBG("-\n"); return TETHERING_ERROR_INVALID_PARAMETER; } + //LCOV_EXCL_STOP g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_USE_DEFAULT); INFO("-\n"); @@ -1723,7 +1736,6 @@ API int tethering_ipv6_enable(tethering_h tethering, tethering_type_e type) } switch (type) { - //LCOV_EXCL_START case TETHERING_TYPE_WIFI: { _softap_settings_t set = {"", "", "", 0, false, false, 0, 0}; @@ -1843,6 +1855,7 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type) GDBusConnection *connection = th->client_bus; switch (type) { + //LCOV_EXCL_START case TETHERING_TYPE_USB: g_dbus_connection_signal_unsubscribe(connection, sigs[E_SIGNAL_USB_TETHER_OFF].sig_id); @@ -1852,6 +1865,7 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type) (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering); break; + //LCOV_EXCL_STOP case TETHERING_TYPE_WIFI: @@ -1875,6 +1889,7 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type) (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering); break; + //LCOV_EXCL_START case TETHERING_TYPE_P2P: g_dbus_proxy_call(proxy, "disable_p2p_tethering", NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable, @@ -1910,6 +1925,7 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type) ERR("Not supported tethering type [%d]\n", type); DBG("-\n"); return TETHERING_ERROR_INVALID_PARAMETER; + //LCOV_EXCL_STOP } INFO("-\n"); return TETHERING_ERROR_NONE; @@ -1984,9 +2000,9 @@ API bool tethering_is_enabled(tethering_h tethering, tethering_type_e type) API int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address) { CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE); - if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); + if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); //LCOV_EXCL_LINE else if (type == TETHERING_TYPE_WIFI) CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE); - else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); + else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); //LCOV_EXCL_LINE _retvm_if(tethering_is_enabled(tethering, type) == false, TETHERING_ERROR_NOT_ENABLED, @@ -2008,9 +2024,11 @@ API int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, _retvm_if(s < 0, TETHERING_ERROR_OPERATION_FAILED, "getting socket is failed\n"); if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) { + //LCOV_EXCL_START ERR("getting mac is failed\n"); close(s); return TETHERING_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } close(s); @@ -2101,9 +2119,9 @@ API int tethering_get_network_interface_name(tethering_h tethering, tethering_ty API int tethering_get_ip_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **ip_address) { CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE); - if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); + if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); //LCOV_EXCL_LINE else if (type == TETHERING_TYPE_WIFI) CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE); - else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); + else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); //LCOV_EXCL_LINE _retvm_if(tethering_is_enabled(tethering, type) == false, TETHERING_ERROR_NOT_ENABLED, @@ -2323,8 +2341,9 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable, &error); if (error) - ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message); + ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message); //LCOV_EXCL_LINE g_variant_get(result, "(a(a{sv}))", &outer_iter); + //LCOV_EXCL_START while (g_variant_iter_loop(outer_iter, "(@a{sv})", &station)) { g_variant_get(station, "a{sv}", &inner_iter); while (g_variant_iter_loop(inner_iter, "{sv}", &key, &value)) { @@ -2384,6 +2403,7 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ } g_free(client.hostname); } + //LCOV_EXCL_STOP g_variant_iter_free(outer_iter); g_variant_unref(station); g_variant_unref(result); @@ -2997,7 +3017,7 @@ API int tethering_wifi_get_ssid(tethering_h tethering, char **ssid) } if (*ssid == NULL) { - ERR("strdup is failed\n"); + ERR("strdup is failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OUT_OF_MEMORY; } @@ -3033,7 +3053,6 @@ API int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible) ret = __set_visible(visible); if (ret == TETHERING_ERROR_NONE) { - __send_dbus_signal(th->client_bus, SIGNAL_NAME_SSID_VISIBILITY_CHANGED, visible ? SIGNAL_MSG_SSID_VISIBLE : @@ -3292,13 +3311,13 @@ API int tethering_wifi_reload_settings(tethering_h tethering, tethering_wifi_set DBG("+\n"); if (th->settings_reloaded_cb) { - ERR("Operation in progress\n"); + ERR("Operation in progress\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OPERATION_FAILED; } ret = __prepare_wifi_settings(tethering, &set); if (ret != TETHERING_ERROR_NONE) { - ERR("softap settings initialization failed\n"); + ERR("softap settings initialization failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OPERATION_FAILED; } @@ -3352,19 +3371,19 @@ static int __add_mac_to_file(const char *filepath, const char *mac) p_mac = strdup(mac); if (p_mac == NULL) { - ERR("strdup failed\n"); + ERR("strdup failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OUT_OF_MEMORY; } fp = fopen(filepath, "a+"); if (!fp) { - ERR("fopen is failed\n"); + ERR("fopen is failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OPERATION_FAILED; } while (fgets(line, MAX_BUF_SIZE, fp) != NULL) { if (strncmp(mac, line, 17) == 0) { - DBG("MAC %s already exist in the list\n", mac); + DBG("MAC %s already exist in the list\n", mac); //LCOV_EXCL_LINE mac_exist = true; break; } @@ -3539,6 +3558,7 @@ API int tethering_wifi_enable_dhcp(tethering_h tethering, bool enable) 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 = TETHERING_ERROR_PERMISSION_DENIED; @@ -3549,6 +3569,7 @@ API int tethering_wifi_enable_dhcp(tethering_h tethering, bool enable) th->dhcp_enabled = false; return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -3586,6 +3607,7 @@ API int tethering_wifi_set_dhcp_range(tethering_h tethering, char *rangestart, c 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) @@ -3597,6 +3619,7 @@ API int tethering_wifi_set_dhcp_range(tethering_h tethering, char *rangestart, c th->dhcp_enabled = false; return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -3642,9 +3665,11 @@ API int tethering_wifi_set_txpower(tethering_h tethering, unsigned int txpower) G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable, &error); if (error) { + //LCOV_EXCL_START ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message); g_clear_error(&error); return TETHERING_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } return TETHERING_ERROR_NONE; } @@ -3674,10 +3699,12 @@ API int tethering_wifi_get_txpower(tethering_h tethering, unsigned int *txpower) g_variant_get(result, "(u)", txpower); g_variant_unref(result); } else { + //LCOV_EXCL_START if (error) ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message); g_clear_error(&error); return TETHERING_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } g_clear_error(&error); return TETHERING_ERROR_NONE; @@ -3703,6 +3730,7 @@ API int tethering_wifi_set_mtu(tethering_h tethering, unsigned int mtu) g_variant_new("(u)", mtu), 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) @@ -3712,6 +3740,7 @@ API int tethering_wifi_set_mtu(tethering_h tethering, unsigned int mtu) g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -3743,6 +3772,7 @@ API int tethering_wifi_change_mac(tethering_h tethering, char *mac) g_variant_new("(s)", mac), 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) @@ -3752,6 +3782,7 @@ API int tethering_wifi_change_mac(tethering_h tethering, char *mac) g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -3814,6 +3845,7 @@ API int tethering_wifi_enable_port_forwarding(tethering_h tethering, bool enable g_variant_new("(b)", enable), 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) @@ -3823,6 +3855,7 @@ API int tethering_wifi_enable_port_forwarding(tethering_h tethering, bool enable g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -3857,6 +3890,7 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn g_variant_new("(sssisi)", ifname, protocol, org_ip, org_port, final_ip, final_port), 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) @@ -3866,6 +3900,7 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -3875,7 +3910,7 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn list = strdup(cmd); if (list == NULL) { - ERR("strdup failed\n"); + ERR("strdup failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OUT_OF_MEMORY; } @@ -3903,6 +3938,7 @@ API int tethering_wifi_reset_port_forwarding_rule(tethering_h tethering) parameters = g_dbus_proxy_call_sync(proxy, "reset_port_forwarding_rule", 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) @@ -3912,6 +3948,7 @@ API int tethering_wifi_reset_port_forwarding_rule(tethering_h tethering) g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -3972,6 +4009,7 @@ API int tethering_wifi_enable_port_filtering(tethering_h tethering, bool enable) g_variant_new("(b)", enable), 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) @@ -3981,6 +4019,7 @@ API int tethering_wifi_enable_port_filtering(tethering_h tethering, bool enable) g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -4015,6 +4054,7 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port, g_variant_new("(isb)", port, protocol, allow), 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) @@ -4024,6 +4064,7 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port, g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -4038,7 +4079,7 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port, list = strdup(cmd); if (list == NULL) { - ERR("strdup failed\n"); + ERR("strdup failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OUT_OF_MEMORY; } @@ -4071,6 +4112,7 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int g_variant_new("(iisb)", port1, port2, protocol, allow), 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) @@ -4080,6 +4122,7 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -4094,7 +4137,7 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int list = strdup(cmd); if (list == NULL) { - ERR("strdup failed\n"); + ERR("strdup failed\n"); //LCOV_EXCL_LINE return TETHERING_ERROR_OUT_OF_MEMORY; } @@ -4168,6 +4211,7 @@ API int tethering_wifi_set_vpn_passthrough_rule(tethering_h tethering, tethering g_variant_new("(ib)", type, enable), 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) @@ -4177,6 +4221,7 @@ API int tethering_wifi_set_vpn_passthrough_rule(tethering_h tethering, tethering g_error_free(error); return result; + //LCOV_EXCL_STOP } g_variant_get(parameters, "(u)", &result); @@ -4203,6 +4248,7 @@ API int tethering_wifi_push_wps_button(tethering_h tethering) 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) @@ -4212,6 +4258,7 @@ API int tethering_wifi_push_wps_button(tethering_h tethering) g_error_free(error); return ret; + //LCOV_EXCL_STOP } if (parameters != NULL) { @@ -4239,6 +4286,7 @@ API int tethering_wifi_set_wps_pin(tethering_h tethering, 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) @@ -4248,6 +4296,7 @@ API int tethering_wifi_set_wps_pin(tethering_h tethering, const char *wps_pin) g_error_free(error); return ret; + //LCOV_EXCL_STOP } if (parameters != NULL) { -- 2.34.1