From 687eea2062338837393ef3d5e065ab9c601e3d19 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 3 Sep 2015 18:15:46 +0200 Subject: [PATCH] test: fix duplicate test names New glib complains. --- libnm-core/tests/test-general.c | 20 +-- src/devices/wifi/tests/test-wifi-ap-utils.c | 137 +++++++-------------- .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 14 +-- 3 files changed, 62 insertions(+), 109 deletions(-) diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 86751df..d8bfef4 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -4821,18 +4821,18 @@ int main (int argc, char **argv) g_test_add_func ("/core/general/test_setting_to_dbus_enum", test_setting_to_dbus_enum); g_test_add_func ("/core/general/test_setting_compare_id", test_setting_compare_id); g_test_add_func ("/core/general/test_setting_compare_timestamp", test_setting_compare_timestamp); -#define ADD_FUNC(func, secret_flags, comp_flags, remove_secret) \ - g_test_add_data_func_full ("/core/general/" G_STRINGIFY (func), \ +#define ADD_FUNC(name, func, secret_flags, comp_flags, remove_secret) \ + g_test_add_data_func_full ("/core/general/" G_STRINGIFY (func) "_" name, \ test_data_compare_secrets_new (secret_flags, comp_flags, remove_secret), \ func, g_free) - ADD_FUNC (test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE); - ADD_FUNC (test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE); - ADD_FUNC (test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE); - ADD_FUNC (test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE); - ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE); - ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE); - ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE); - ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE); + ADD_FUNC ("agent_owned", test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE); + ADD_FUNC ("not_saved", test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE); + ADD_FUNC ("secrets", test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE); + ADD_FUNC ("exact", test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE); + ADD_FUNC ("agent_owned", test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE); + ADD_FUNC ("not_saved", test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE); + ADD_FUNC ("secrets", test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE); + ADD_FUNC ("exact", test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE); g_test_add_func ("/core/general/test_setting_old_uuid", test_setting_old_uuid); g_test_add_func ("/core/general/test_connection_to_dbus_setting_name", test_connection_to_dbus_setting_name); diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-wifi-ap-utils.c index fa0aec0..5552ca4 100644 --- a/src/devices/wifi/tests/test-wifi-ap-utils.c +++ b/src/devices/wifi/tests/test-wifi-ap-utils.c @@ -1363,10 +1363,10 @@ main (int argc, char **argv) test_open_ap_leap_connection_1); g_test_add_func ("/wifi/open_ap/leap_connection/2", test_open_ap_leap_connection_2); - g_test_add_data_func ("/wifi/open_ap/wep_connection", + g_test_add_data_func ("/wifi/open_ap/wep_connection_true", (gconstpointer) TRUE, test_open_ap_wep_connection); - g_test_add_data_func ("/wifi/open_ap/wep_connection", + g_test_add_data_func ("/wifi/open_ap/wep_connection_false", (gconstpointer) FALSE, test_open_ap_wep_connection); @@ -1440,104 +1440,57 @@ main (int argc, char **argv) (gconstpointer) IDX_PRIV, test_ap_wpa_eap_connection_5); +#define ADD_FUNC(func) do { \ + gchar *name_idx = g_strdup_printf ("/wifi/wpa_psk/" G_STRINGIFY (func) "/%ld", i); \ + g_test_add_data_func (name_idx, (gconstpointer) i, func); \ + g_free (name_idx); \ + } while (0) + /* WPA-PSK tests */ for (i = IDX_WPA_PSK_PTKIP_GTKIP; i <= IDX_WPA_RSN_PSK_PCCMP_GCCMP; i++) { - g_test_add_data_func ("/wifi/wpa_psk/empty_connection", - (gconstpointer) i, - test_wpa_ap_empty_connection); - g_test_add_data_func ("/wifi/wpa_psk/leap_connection/1", - (gconstpointer) i, - test_wpa_ap_leap_connection_1); - g_test_add_data_func ("/wifi/wpa_psk/leap_connection/2", - (gconstpointer) i, - test_wpa_ap_leap_connection_2); - - g_test_add_data_func ("/wifi/wpa_psk/dynamic_wep_connection", - (gconstpointer) i, - test_wpa_ap_dynamic_wep_connection); - - g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/1", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_1); - g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/2", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_2); - g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/3", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_3); - g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/4", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_4); - g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/5", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_5); - - g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/1", - (gconstpointer) i, - test_ap_wpa_eap_connection_1); - g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/2", - (gconstpointer) i, - test_ap_wpa_eap_connection_2); - g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/3", - (gconstpointer) i, - test_ap_wpa_eap_connection_3); - g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/4", - (gconstpointer) i, - test_ap_wpa_eap_connection_4); - g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/5", - (gconstpointer) i, - test_ap_wpa_eap_connection_5); + ADD_FUNC(test_wpa_ap_empty_connection); + ADD_FUNC(test_wpa_ap_leap_connection_1); + ADD_FUNC(test_wpa_ap_leap_connection_2); + ADD_FUNC(test_wpa_ap_dynamic_wep_connection); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_1); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_2); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_3); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_4); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_5); + ADD_FUNC(test_ap_wpa_eap_connection_1); + ADD_FUNC(test_ap_wpa_eap_connection_2); + ADD_FUNC(test_ap_wpa_eap_connection_3); + ADD_FUNC(test_ap_wpa_eap_connection_4); + ADD_FUNC(test_ap_wpa_eap_connection_5); } +#undef ADD_FUNC +#define ADD_FUNC(func) do { \ + gchar *name_idx = g_strdup_printf ("/wifi/rsn_psk/" G_STRINGIFY (func) "/%ld", i); \ + g_test_add_data_func (name_idx, (gconstpointer) i, func); \ + g_free (name_idx); \ + } while (0) + /* RSN-PSK tests */ for (i = IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP; i <= IDX_RSN_PSK_PTKIP_PCCMP_GTKIP; i++) { - g_test_add_data_func ("/wifi/rsn_psk/empty_connection", - (gconstpointer) i, - test_wpa_ap_empty_connection); - g_test_add_data_func ("/wifi/rsn_psk/leap_connection/1", - (gconstpointer) i, - test_wpa_ap_leap_connection_1); - g_test_add_data_func ("/wifi/rsn_psk/leap_connection/2", - (gconstpointer) i, - test_wpa_ap_leap_connection_2); - - g_test_add_data_func ("/wifi/rsn_psk/dynamic_wep_connection", - (gconstpointer) i, - test_wpa_ap_dynamic_wep_connection); - - g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/1", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_1); - g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/2", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_2); - g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/3", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_3); - g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/4", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_4); - g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/5", - (gconstpointer) i, - test_wpa_ap_wpa_psk_connection_5); - - g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/1", - (gconstpointer) i, - test_ap_wpa_eap_connection_1); - g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/2", - (gconstpointer) i, - test_ap_wpa_eap_connection_2); - g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/3", - (gconstpointer) i, - test_ap_wpa_eap_connection_3); - g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/4", - (gconstpointer) i, - test_ap_wpa_eap_connection_4); - g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/5", - (gconstpointer) i, - test_ap_wpa_eap_connection_5); + ADD_FUNC(test_wpa_ap_empty_connection); + ADD_FUNC(test_wpa_ap_leap_connection_1); + ADD_FUNC(test_wpa_ap_leap_connection_2); + ADD_FUNC(test_wpa_ap_dynamic_wep_connection); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_1); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_2); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_3); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_4); + ADD_FUNC(test_wpa_ap_wpa_psk_connection_5); + ADD_FUNC(test_ap_wpa_eap_connection_1); + ADD_FUNC(test_ap_wpa_eap_connection_2); + ADD_FUNC(test_ap_wpa_eap_connection_3); + ADD_FUNC(test_ap_wpa_eap_connection_4); + ADD_FUNC(test_ap_wpa_eap_connection_5); } +#undef ADD_FUNC + /* Scanned signal strength conversion tests */ g_test_add_func ("/wifi/strength/dbm", test_strength_dbm); diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 16bc14d..cbee786 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -12756,12 +12756,12 @@ int main (int argc, char **argv) test_read_wired_static (TEST_IFCFG_WIRED_STATIC, "System test-wired-static", TRUE); test_read_wired_static (TEST_IFCFG_WIRED_STATIC_BOOTPROTO, "System test-wired-static-bootproto", FALSE); test_read_wired_dhcp (); - g_test_add_func (TPATH "dhcp-plus-ip", test_read_wired_dhcp_plus_ip); - g_test_add_func (TPATH "shared-plus-ip", test_read_wired_shared_plus_ip); - g_test_add_func (TPATH "dhcp-send-hostname", test_read_write_wired_dhcp_send_hostname); - g_test_add_func (TPATH "global-gateway", test_read_wired_global_gateway); - g_test_add_func (TPATH "obsolete-gateway-n", test_read_wired_obsolete_gateway_n); - g_test_add_func (TPATH "never-default", test_read_wired_never_default); + g_test_add_func (TPATH "read-dhcp-plus-ip", test_read_wired_dhcp_plus_ip); + g_test_add_func (TPATH "read-shared-plus-ip", test_read_wired_shared_plus_ip); + g_test_add_func (TPATH "read-dhcp-send-hostname", test_read_write_wired_dhcp_send_hostname); + g_test_add_func (TPATH "read-global-gateway", test_read_wired_global_gateway); + g_test_add_func (TPATH "read-obsolete-gateway-n", test_read_wired_obsolete_gateway_n); + g_test_add_func (TPATH "read-never-default", test_read_wired_never_default); test_read_wired_defroute_no (); test_read_wired_defroute_no_gatewaydev_yes (); g_test_add_func (TPATH "routes/read-static", test_read_wired_static_routes); @@ -12831,7 +12831,7 @@ int main (int argc, char **argv) test_write_wired_static_routes (); test_read_write_static_routes_legacy (); test_write_wired_dhcp (); - g_test_add_func (TPATH "dhcp-plus-ip", test_write_wired_dhcp_plus_ip); + g_test_add_func (TPATH "wired/write-dhcp-plus-ip", test_write_wired_dhcp_plus_ip); test_write_wired_dhcp_8021x_peap_mschapv2 (); test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_PATH, NM_SETTING_SECRET_FLAG_AGENT_OWNED); test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_PATH, NM_SETTING_SECRET_FLAG_NOT_SAVED); -- 2.4.3