int
main (int argc, char **argv)
{
- char *base;
-
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
-
nmtst_init (&argc, &argv, TRUE);
/* The tests */
- test_need_tls_secrets_path ();
- test_need_tls_secrets_blob ();
- test_need_tls_phase2_secrets_path ();
- test_need_tls_phase2_secrets_blob ();
-
- test_update_secrets_wifi_single_setting ();
- test_update_secrets_wifi_full_hash ();
- test_update_secrets_wifi_bad_setting_name ();
-
- test_update_secrets_whole_connection ();
- test_update_secrets_whole_connection_empty_hash ();
- test_update_secrets_whole_connection_bad_setting ();
- test_update_secrets_whole_connection_empty_base_setting ();
- test_update_secrets_null_setting_name_with_setting_hash ();
-
- base = g_path_get_basename (argv[0]);
- fprintf (stdout, "%s: SUCCESS\n", base);
- g_free (base);
- return 0;
+ g_test_add_func ("/libnm/need_tls_secrets_path", test_need_tls_secrets_path);
+ g_test_add_func ("/libnm/need_tls_secrets_blob", test_need_tls_secrets_blob);
+ g_test_add_func ("/libnm/need_tls_phase2_secrets_path", test_need_tls_phase2_secrets_path);
+ g_test_add_func ("/libnm/need_tls_phase2_secrets_blob", test_need_tls_phase2_secrets_blob);
+
+ g_test_add_func ("/libnm/update_secrets_wifi_single_setting", test_update_secrets_wifi_single_setting);
+ g_test_add_func ("/libnm/update_secrets_wifi_full_hash", test_update_secrets_wifi_full_hash);
+ g_test_add_func ("/libnm/update_secrets_wifi_bad_setting_name", test_update_secrets_wifi_bad_setting_name);
+
+ g_test_add_func ("/libnm/update_secrets_whole_connection", test_update_secrets_whole_connection);
+ g_test_add_func ("/libnm/update_secrets_whole_connection_empty_hash", test_update_secrets_whole_connection_empty_hash);
+ g_test_add_func ("/libnm/update_secrets_whole_connection_bad_setting", test_update_secrets_whole_connection_bad_setting);
+ g_test_add_func ("/libnm/update_secrets_whole_connection_empty_base_setting", test_update_secrets_whole_connection_empty_base_setting);
+ g_test_add_func ("/libnm/update_secrets_null_setting_name_with_setting_hash", test_update_secrets_null_setting_name_with_setting_hash);
+
+ return g_test_run ();
}
-
}
static void
-test_setting_compare_secrets (NMSettingSecretFlags secret_flags,
- NMSettingCompareFlags comp_flags,
- gboolean remove_secret)
+_compare_secrets (NMSettingSecretFlags secret_flags,
+ NMSettingCompareFlags comp_flags,
+ gboolean remove_secret)
{
gs_unref_object NMSetting *old = NULL, *new = NULL;
gboolean success;
}
static void
-test_setting_compare_vpn_secrets (NMSettingSecretFlags secret_flags,
- NMSettingCompareFlags comp_flags,
- gboolean remove_secret)
+test_setting_compare_secrets (void)
+{
+ _compare_secrets (NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE);
+ _compare_secrets (NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
+ _compare_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
+ _compare_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
+}
+
+static void
+_compare_vpn_secrets (NMSettingSecretFlags secret_flags,
+ NMSettingCompareFlags comp_flags,
+ gboolean remove_secret)
{
gs_unref_object NMSetting *old = NULL, *new = NULL;
gboolean success;
g_assert (success);
}
+static void
+test_setting_compare_vpn_secrets (void)
+{
+ _compare_vpn_secrets (NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE);
+ _compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
+ _compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
+ _compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
+}
+
static void
test_hwaddr_aton_ether_normal (void)
{
int main (int argc, char **argv)
{
- char *base;
-
nmtst_init (&argc, &argv, TRUE);
/* The tests */
- test_setting_vpn_items ();
- test_setting_vpn_update_secrets ();
- test_setting_vpn_modify_during_foreach ();
- test_setting_ip6_config_old_address_array ();
- test_setting_gsm_apn_spaces ();
- test_setting_gsm_apn_bad_chars ();
- test_setting_gsm_apn_underscore ();
- test_setting_gsm_without_number ();
- test_setting_to_hash_all ();
- test_setting_to_hash_no_secrets ();
- test_setting_to_hash_only_secrets ();
- test_setting_compare_id ();
- test_setting_compare_secrets (NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE);
- test_setting_compare_secrets (NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
- test_setting_compare_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
- test_setting_compare_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
- test_setting_compare_vpn_secrets (NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE);
- test_setting_compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
- test_setting_compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
- test_setting_compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
- test_setting_old_uuid ();
-
- test_connection_to_hash_setting_name ();
- test_setting_new_from_hash ();
- test_connection_replace_settings ();
- test_connection_replace_settings_from_connection ();
- test_connection_new_from_hash ();
- test_connection_verify_sets_interface_name ();
- test_connection_normalize_virtual_iface_name ();
-
- test_setting_connection_permissions_helpers ();
- test_setting_connection_permissions_property ();
-
- test_connection_compare_same ();
- test_connection_compare_key_only_in_a ();
- test_connection_compare_setting_only_in_a ();
- test_connection_compare_key_only_in_b ();
- test_connection_compare_setting_only_in_b ();
-
- test_connection_diff_a_only ();
- test_connection_diff_same ();
- test_connection_diff_different ();
- test_connection_diff_no_secrets ();
- test_connection_diff_inferrable ();
- test_connection_good_base_types ();
- test_connection_bad_base_types ();
-
- test_hwaddr_aton_ether_normal ();
- test_hwaddr_aton_ib_normal ();
- test_hwaddr_aton_no_leading_zeros ();
- test_hwaddr_aton_malformed ();
- test_ip4_prefix_to_netmask ();
- test_ip4_netmask_to_prefix ();
-
- test_connection_changed_signal ();
- test_setting_connection_changed_signal ();
- test_setting_bond_changed_signal ();
- test_setting_ip4_changed_signal ();
- test_setting_ip6_changed_signal ();
- test_setting_vlan_changed_signal ();
- test_setting_vpn_changed_signal ();
- test_setting_wired_changed_signal ();
- test_setting_wireless_changed_signal ();
- test_setting_wireless_security_changed_signal ();
- test_setting_802_1x_changed_signal ();
-
- test_libnm_linking ();
-
- test_nm_utils_uuid_generate_from_string ();
-
- base = g_path_get_basename (argv[0]);
- fprintf (stdout, "%s: SUCCESS\n", base);
- g_free (base);
- return 0;
+ g_test_add_func ("/libnm/setting_vpn_items", test_setting_vpn_items);
+ g_test_add_func ("/libnm/setting_vpn_update_secrets", test_setting_vpn_update_secrets);
+ g_test_add_func ("/libnm/setting_vpn_modify_during_foreach", test_setting_vpn_modify_during_foreach);
+ g_test_add_func ("/libnm/setting_ip6_config_old_address_array", test_setting_ip6_config_old_address_array);
+ g_test_add_func ("/libnm/setting_gsm_apn_spaces", test_setting_gsm_apn_spaces);
+ g_test_add_func ("/libnm/setting_gsm_apn_bad_chars", test_setting_gsm_apn_bad_chars);
+ g_test_add_func ("/libnm/setting_gsm_apn_underscore", test_setting_gsm_apn_underscore);
+ g_test_add_func ("/libnm/setting_gsm_without_number", test_setting_gsm_without_number);
+ g_test_add_func ("/libnm/setting_to_hash_all", test_setting_to_hash_all);
+ g_test_add_func ("/libnm/setting_to_hash_no_secrets", test_setting_to_hash_no_secrets);
+ g_test_add_func ("/libnm/setting_to_hash_only_secrets", test_setting_to_hash_only_secrets);
+ g_test_add_func ("/libnm/setting_compare_id", test_setting_compare_id);
+ g_test_add_func ("/libnm/setting_compare_secrets", test_setting_compare_secrets);
+ g_test_add_func ("/libnm/setting_compare_vpn_secrets", test_setting_compare_vpn_secrets);
+ g_test_add_func ("/libnm/setting_old_uuid", test_setting_old_uuid);
+
+ g_test_add_func ("/libnm/connection_to_hash_setting_name", test_connection_to_hash_setting_name);
+ g_test_add_func ("/libnm/setting_new_from_hash", test_setting_new_from_hash);
+ g_test_add_func ("/libnm/connection_replace_settings", test_connection_replace_settings);
+ g_test_add_func ("/libnm/connection_replace_settings_from_connection", test_connection_replace_settings_from_connection);
+ g_test_add_func ("/libnm/connection_new_from_hash", test_connection_new_from_hash);
+ g_test_add_func ("/libnm/connection_verify_sets_interface_name", test_connection_verify_sets_interface_name);
+ g_test_add_func ("/libnm/connection_normalize_virtual_iface_name", test_connection_normalize_virtual_iface_name);
+
+ g_test_add_func ("/libnm/setting_connection_permissions_helpers", test_setting_connection_permissions_helpers);
+ g_test_add_func ("/libnm/setting_connection_permissions_property", test_setting_connection_permissions_property);
+
+ g_test_add_func ("/libnm/connection_compare_same", test_connection_compare_same);
+ g_test_add_func ("/libnm/connection_compare_key_only_in_a", test_connection_compare_key_only_in_a);
+ g_test_add_func ("/libnm/connection_compare_setting_only_in_a", test_connection_compare_setting_only_in_a);
+ g_test_add_func ("/libnm/connection_compare_key_only_in_b", test_connection_compare_key_only_in_b);
+ g_test_add_func ("/libnm/connection_compare_setting_only_in_b", test_connection_compare_setting_only_in_b);
+
+ g_test_add_func ("/libnm/connection_diff_a_only", test_connection_diff_a_only);
+ g_test_add_func ("/libnm/connection_diff_same", test_connection_diff_same);
+ g_test_add_func ("/libnm/connection_diff_different", test_connection_diff_different);
+ g_test_add_func ("/libnm/connection_diff_no_secrets", test_connection_diff_no_secrets);
+ g_test_add_func ("/libnm/connection_diff_inferrable", test_connection_diff_inferrable);
+ g_test_add_func ("/libnm/connection_good_base_types", test_connection_good_base_types);
+ g_test_add_func ("/libnm/connection_bad_base_types", test_connection_bad_base_types);
+
+ g_test_add_func ("/libnm/hwaddr_aton_ether_normal", test_hwaddr_aton_ether_normal);
+ g_test_add_func ("/libnm/hwaddr_aton_ib_normal", test_hwaddr_aton_ib_normal);
+ g_test_add_func ("/libnm/hwaddr_aton_no_leading_zeros", test_hwaddr_aton_no_leading_zeros);
+ g_test_add_func ("/libnm/hwaddr_aton_malformed", test_hwaddr_aton_malformed);
+ g_test_add_func ("/libnm/ip4_prefix_to_netmask", test_ip4_prefix_to_netmask);
+ g_test_add_func ("/libnm/ip4_netmask_to_prefix", test_ip4_netmask_to_prefix);
+
+ g_test_add_func ("/libnm/connection_changed_signal", test_connection_changed_signal);
+ g_test_add_func ("/libnm/setting_connection_changed_signal", test_setting_connection_changed_signal);
+ g_test_add_func ("/libnm/setting_bond_changed_signal", test_setting_bond_changed_signal);
+ g_test_add_func ("/libnm/setting_ip4_changed_signal", test_setting_ip4_changed_signal);
+ g_test_add_func ("/libnm/setting_ip6_changed_signal", test_setting_ip6_changed_signal);
+ g_test_add_func ("/libnm/setting_vlan_changed_signal", test_setting_vlan_changed_signal);
+ g_test_add_func ("/libnm/setting_vpn_changed_signal", test_setting_vpn_changed_signal);
+ g_test_add_func ("/libnm/setting_wired_changed_signal", test_setting_wired_changed_signal);
+ g_test_add_func ("/libnm/setting_wireless_changed_signal", test_setting_wireless_changed_signal);
+ g_test_add_func ("/libnm/setting_wireless_security_changed_signal", test_setting_wireless_security_changed_signal);
+ g_test_add_func ("/libnm/setting_802_1x_changed_signal", test_setting_802_1x_changed_signal);
+
+ g_test_add_func ("/libnm/libnm_linking", test_libnm_linking);
+
+ g_test_add_func ("/libnm/nm_utils_uuid_generate_from_string", test_nm_utils_uuid_generate_from_string);
+
+ return g_test_run ();
}
g_object_unref (connection);
}
+NMTST_DEFINE ();
+
int main (int argc, char **argv)
{
GError *error = NULL;
- char *base;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nmtst_init (&argc, &argv, TRUE);
if (!nm_utils_init (&error))
FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message);
/* The tests */
- test_need_tls_secrets_path ();
- test_need_tls_secrets_blob ();
- test_need_tls_phase2_secrets_path ();
- test_need_tls_phase2_secrets_blob ();
-
- test_update_secrets_wifi_single_setting ();
- test_update_secrets_wifi_full_hash ();
- test_update_secrets_wifi_bad_setting_name ();
-
- test_update_secrets_whole_connection ();
- test_update_secrets_whole_connection_empty_hash ();
- test_update_secrets_whole_connection_bad_setting ();
- test_update_secrets_whole_connection_empty_base_setting ();
- test_update_secrets_null_setting_name_with_setting_hash ();
-
- base = g_path_get_basename (argv[0]);
- fprintf (stdout, "%s: SUCCESS\n", base);
- g_free (base);
- return 0;
+ g_test_add_func ("/libnm/need_tls_secrets_path", test_need_tls_secrets_path);
+ g_test_add_func ("/libnm/need_tls_secrets_blob", test_need_tls_secrets_blob);
+ g_test_add_func ("/libnm/need_tls_phase2_secrets_path", test_need_tls_phase2_secrets_path);
+ g_test_add_func ("/libnm/need_tls_phase2_secrets_blob", test_need_tls_phase2_secrets_blob);
+
+ g_test_add_func ("/libnm/update_secrets_wifi_single_setting", test_update_secrets_wifi_single_setting);
+ g_test_add_func ("/libnm/update_secrets_wifi_full_hash", test_update_secrets_wifi_full_hash);
+ g_test_add_func ("/libnm/update_secrets_wifi_bad_setting_name", test_update_secrets_wifi_bad_setting_name);
+
+ g_test_add_func ("/libnm/update_secrets_whole_connection", test_update_secrets_whole_connection);
+ g_test_add_func ("/libnm/update_secrets_whole_connection_empty_hash", test_update_secrets_whole_connection_empty_hash);
+ g_test_add_func ("/libnm/update_secrets_whole_connection_bad_setting", test_update_secrets_whole_connection_bad_setting);
+ g_test_add_func ("/libnm/update_secrets_whole_connection_empty_base_setting", test_update_secrets_whole_connection_empty_base_setting);
+ g_test_add_func ("/libnm/update_secrets_null_setting_name_with_setting_hash", test_update_secrets_null_setting_name_with_setting_hash);
+
+ return g_test_run ();
}
ASSERT (result == expected_ignored, desc, "unexpected ignore result for path '%s'", path);
}
-NMTST_DEFINE ();
-
-int main (int argc, char **argv)
+static void
+test_name (void)
{
- char *base;
-
- nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
-
- /* The tests */
test_get_ifcfg_name ("get-ifcfg-name-bad", "/foo/bar/adfasdfadf", FALSE, NULL);
test_get_ifcfg_name ("get-ifcfg-name-good", "/foo/bar/ifcfg-FooBar", FALSE, "FooBar");
test_get_ifcfg_name ("get-ifcfg-name-keys", "/foo/bar/keys-BlahLbah", FALSE, "BlahLbah");
test_get_ifcfg_name ("get-ifcfg-name-bad2-ifcfg", "/foo/bar/asdfasifcfg-Foobar", FALSE, NULL);
test_get_ifcfg_name ("get-ifcfg-name-bad2-keys", "/foo/bar/asdfaskeys-Foobar", FALSE, NULL);
test_get_ifcfg_name ("get-ifcfg-name-bad2-route", "/foo/bar/asdfasroute-Foobar", FALSE, NULL);
+}
+static void
+test_path (void)
+{
test_get_ifcfg_path ("ifcfg-path-bad", "/foo/bar/adfasdfasdf", NULL);
test_get_ifcfg_path ("ifcfg-path-from-keys-no-path", "keys-BlahBlah", "ifcfg-BlahBlah");
test_get_ifcfg_path ("ifcfg-path-from-keys", "/foo/bar/keys-BlahBlah", "/foo/bar/ifcfg-BlahBlah");
test_get_route_path ("route-path-from-ifcfg-no-path", "ifcfg-FooBar", "route-FooBar");
test_get_route_path ("route-path-from-ifcfg", "/foo/bar/ifcfg-FooBar", "/foo/bar/route-FooBar");
test_get_route_path ("route-path-from-keys", "/foo/bar/keys-FooBar", "/foo/bar/route-FooBar");
+}
+static void
+test_ignore (void)
+{
test_ignored ("ignored-ifcfg", "ifcfg-FooBar", FALSE);
test_ignored ("ignored-keys", "keys-FooBar", FALSE);
test_ignored ("ignored-route", "route-FooBar", FALSE);
test_ignored ("ignored-rpmnew", "ifcfg-FooBar" RPMNEW_TAG, TRUE);
test_ignored ("ignored-augnew", "ifcfg-FooBar" AUGNEW_TAG, TRUE);
test_ignored ("ignored-augtmp", "ifcfg-FooBar" AUGTMP_TAG, TRUE);
+}
+
+NMTST_DEFINE ();
+
+int main (int argc, char **argv)
+{
+ nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
+
+ /* The tests */
+ g_test_add_func ("/settings/plugins/ifcfg-rh/name", test_name);
+ g_test_add_func ("/settings/plugins/ifcfg-rh/path", test_path);
+ g_test_add_func ("/settings/plugins/ifcfg-rh/ignore", test_ignore);
- base = g_path_get_basename (argv[0]);
- fprintf (stdout, "%s: SUCCESS\n", base);
- g_free (base);
- return 0;
+ return g_test_run ();
}