mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-12 08:58:24 +02:00
merge: branch 'lr/tap-tests' (bgo #749375)
https://bugzilla.gnome.org/show_bug.cgi?id=749375
This commit is contained in:
commit
defe992a10
32 changed files with 230 additions and 201 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -28,6 +28,8 @@ gtk-doc.make
|
|||
*.pc
|
||||
cscope.*out
|
||||
valgrind-*.log
|
||||
test-*.log
|
||||
test-*.trs
|
||||
*-glue.h
|
||||
|
||||
/ABOUT-NLS
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ test_dispatcher_envp_LDADD = \
|
|||
###########################################
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-dispatcher-envp
|
||||
|
||||
endif
|
||||
|
|
|
|||
18
configure.ac
18
configure.ac
|
|
@ -15,21 +15,9 @@ AC_INIT([NetworkManager], [nm_version],
|
|||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_REQUIRE_AUX_FILE([tap-driver.sh])
|
||||
|
||||
dnl Initialize automake. automake < 1.12 didn't have serial-tests and
|
||||
dnl gives an error if it sees this, but for automake >= 1.13
|
||||
dnl serial-tests is required so we have to include it. Solution is to
|
||||
dnl test for the version of automake (by running an external command)
|
||||
dnl and provide it if necessary. Note we have to do this entirely using
|
||||
dnl m4 macros since automake queries this macro by running
|
||||
dnl 'autoconf --trace ...'.
|
||||
m4_define([serial_tests], [
|
||||
m4_esyscmd([automake --version |
|
||||
head -1 |
|
||||
awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
|
||||
])
|
||||
])
|
||||
AM_INIT_AUTOMAKE(1.11 serial_tests tar-ustar no-dist-gzip dist-bzip2 -Wno-portability) dnl NB: Do not [quote] this parameter.
|
||||
AM_INIT_AUTOMAKE(1.12 tar-ustar no-dist-gzip dist-bzip2 -Wno-portability) dnl NB: Do not [quote] this parameter.
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
|
|
@ -868,7 +856,7 @@ else
|
|||
fi
|
||||
fi
|
||||
AS_IF([test "$with_valgrind" != "no"],
|
||||
AC_SUBST(VALGRIND_RULES, 'TESTS_ENVIRONMENT = "$(top_srcdir)/tools/run-test-valgrind.sh" "$(LIBTOOL)" "$(with_valgrind)" '"$with_valgrind_suppressions"),
|
||||
AC_SUBST(VALGRIND_RULES, 'LOG_COMPILER = "$(top_srcdir)/tools/run-test-valgrind.sh" "$(LIBTOOL)" "$(with_valgrind)" '"$with_valgrind_suppressions"),
|
||||
AC_SUBST(VALGRIND_RULES, []))
|
||||
AM_CONDITIONAL(WITH_VALGRIND, test "${with_valgrind}" != "no")
|
||||
|
||||
|
|
|
|||
|
|
@ -103,9 +103,6 @@
|
|||
#include "nm-keyfile-internal.h"
|
||||
#endif
|
||||
|
||||
/* Analog to EXIT_SUCCESS and EXIT_FAILURE. */
|
||||
#define EXIT_SKIP (77)
|
||||
|
||||
/*******************************************************************************/
|
||||
|
||||
/* general purpose functions that have no dependency on other nmtst functions */
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ LDADD = \
|
|||
$(GLIB_LIBS)
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = $(noinst_PROGRAMS)
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -739,33 +739,23 @@ NMTST_DEFINE ();
|
|||
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 ();
|
||||
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);
|
||||
|
||||
test_update_secrets_wifi_single_setting ();
|
||||
test_update_secrets_wifi_full_hash ();
|
||||
test_update_secrets_wifi_bad_setting_name ();
|
||||
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);
|
||||
|
||||
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 ();
|
||||
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);
|
||||
|
||||
base = g_path_get_basename (argv[0]);
|
||||
fprintf (stdout, "%s: SUCCESS\n", base);
|
||||
g_free (base);
|
||||
return 0;
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,15 +101,9 @@ test_defaults (GType type, const char *name)
|
|||
g_object_unref (setting);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
static void
|
||||
defaults ()
|
||||
{
|
||||
char *base;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 35, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
||||
/* The tests */
|
||||
test_defaults (NM_TYPE_SETTING_CONNECTION, NM_SETTING_CONNECTION_SETTING_NAME);
|
||||
test_defaults (NM_TYPE_SETTING_802_1X, NM_SETTING_802_1X_SETTING_NAME);
|
||||
|
|
@ -124,10 +118,17 @@ main (int argc, char **argv)
|
|||
test_defaults (NM_TYPE_SETTING_WIRED, NM_SETTING_WIRED_SETTING_NAME);
|
||||
test_defaults (NM_TYPE_SETTING_WIRELESS, NM_SETTING_WIRELESS_SETTING_NAME);
|
||||
test_defaults (NM_TYPE_SETTING_WIRELESS_SECURITY, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
|
||||
|
||||
base = g_path_get_basename (argv[0]);
|
||||
fprintf (stdout, "%s: SUCCESS\n", base);
|
||||
g_free (base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
NMTST_DEFINE ();
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
nmtst_init (&argc, &argv, TRUE);
|
||||
|
||||
g_test_add_func ("/libnm/defaults", defaults);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,10 @@ noinst_PROGRAMS = $(TESTS)
|
|||
if WITH_VALGRIND
|
||||
@VALGRIND_RULES@ --launch-dbus
|
||||
else
|
||||
TESTS_ENVIRONMENT = $(srcdir)/libnm-glib-test-launch.sh
|
||||
LOG_COMPILER = $(srcdir)/libnm-glib-test-launch.sh
|
||||
endif
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-nm-client test-remote-settings-client
|
||||
|
||||
####### NMClient and non-settings tests #######
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Spawn DBus if there's none
|
||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
||||
eval `dbus-launch --sh-syntax`
|
||||
trap "kill $DBUS_SESSION_BUS_PID" EXIT
|
||||
fi
|
||||
# Spawn DBus
|
||||
eval `dbus-launch --sh-syntax`
|
||||
trap "kill $DBUS_SESSION_BUS_PID" EXIT
|
||||
|
||||
"$@"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ AM_CPPFLAGS = \
|
|||
-DTEST_CERT_DIR=\"$(top_srcdir)/libnm-core/tests/certs/\"
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = \
|
||||
test-settings-defaults \
|
||||
test-crypto \
|
||||
|
|
|
|||
|
|
@ -1703,9 +1703,9 @@ test_setting_compare_id (void)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -1735,9 +1735,18 @@ test_setting_compare_secrets (NMSettingSecretFlags secret_flags,
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -1767,6 +1776,15 @@ test_setting_compare_vpn_secrets (NMSettingSecretFlags secret_flags,
|
|||
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)
|
||||
{
|
||||
|
|
@ -2546,84 +2564,73 @@ NMTST_DEFINE ();
|
|||
|
||||
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 ();
|
||||
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);
|
||||
|
||||
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 ();
|
||||
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);
|
||||
|
||||
test_setting_connection_permissions_helpers ();
|
||||
test_setting_connection_permissions_property ();
|
||||
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);
|
||||
|
||||
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 ();
|
||||
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);
|
||||
|
||||
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 ();
|
||||
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);
|
||||
|
||||
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 ();
|
||||
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);
|
||||
|
||||
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 ();
|
||||
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);
|
||||
|
||||
test_libnm_linking ();
|
||||
g_test_add_func ("/libnm/libnm_linking", test_libnm_linking);
|
||||
|
||||
test_nm_utils_uuid_generate_from_string ();
|
||||
g_test_add_func ("/libnm/nm_utils_uuid_generate_from_string", 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;
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -734,37 +734,33 @@ test_update_secrets_null_setting_name_with_setting_hash (void)
|
|||
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 ();
|
||||
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);
|
||||
|
||||
test_update_secrets_wifi_single_setting ();
|
||||
test_update_secrets_wifi_full_hash ();
|
||||
test_update_secrets_wifi_bad_setting_name ();
|
||||
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);
|
||||
|
||||
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 ();
|
||||
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);
|
||||
|
||||
base = g_path_get_basename (argv[0]);
|
||||
fprintf (stdout, "%s: SUCCESS\n", base);
|
||||
g_free (base);
|
||||
return 0;
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,18 +101,9 @@ test_defaults (GType type, const char *name)
|
|||
g_object_unref (setting);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
static void
|
||||
defaults (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
char *base;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 35, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
||||
if (!nm_utils_init (&error))
|
||||
FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message);
|
||||
|
||||
/* The tests */
|
||||
test_defaults (NM_TYPE_SETTING_CONNECTION, NM_SETTING_CONNECTION_SETTING_NAME);
|
||||
test_defaults (NM_TYPE_SETTING_802_1X, NM_SETTING_802_1X_SETTING_NAME);
|
||||
|
|
@ -127,10 +118,16 @@ int main (int argc, char **argv)
|
|||
test_defaults (NM_TYPE_SETTING_WIRED, NM_SETTING_WIRED_SETTING_NAME);
|
||||
test_defaults (NM_TYPE_SETTING_WIRELESS, NM_SETTING_WIRELESS_SETTING_NAME);
|
||||
test_defaults (NM_TYPE_SETTING_WIRELESS_SECURITY, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
|
||||
|
||||
base = g_path_get_basename (argv[0]);
|
||||
fprintf (stdout, "%s: SUCCESS\n", base);
|
||||
g_free (base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
NMTST_DEFINE ();
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
nmtst_init (&argc, &argv, TRUE);
|
||||
|
||||
g_test_add_func ("/libnm/defaults", defaults);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,8 @@ _nm_dbus_new_connection (GCancellable *cancellable, GError **error)
|
|||
GDBusConnection *connection = NULL;
|
||||
|
||||
/* If running as root try the private bus first */
|
||||
if (0 == geteuid ()) {
|
||||
if (0 == geteuid () && !g_test_initialized ()) {
|
||||
|
||||
GError *local = NULL;
|
||||
GDBusConnection *p;
|
||||
|
||||
|
|
@ -203,7 +204,7 @@ _nm_dbus_new_connection_async (GCancellable *cancellable,
|
|||
simple = g_simple_async_result_new (NULL, callback, user_data, _nm_dbus_new_connection_async);
|
||||
|
||||
/* If running as root try the private bus first */
|
||||
if (0 == geteuid ()) {
|
||||
if (0 == geteuid () && !g_test_initialized ()) {
|
||||
GDBusConnection *p;
|
||||
|
||||
if (cancellable) {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@ noinst_PROGRAMS = $(TESTS)
|
|||
if WITH_VALGRIND
|
||||
@VALGRIND_RULES@ --launch-dbus
|
||||
else
|
||||
TESTS_ENVIRONMENT = $(srcdir)/libnm-test-launch.sh
|
||||
LOG_COMPILER = $(srcdir)/libnm-test-launch.sh
|
||||
endif
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-nm-client test-remote-settings-client test-secret-agent
|
||||
|
||||
test_nm_client_SOURCES = \
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Spawn DBus if there's none
|
||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
||||
eval `dbus-launch --sh-syntax`
|
||||
trap "kill $DBUS_SESSION_BUS_PID" EXIT
|
||||
fi
|
||||
# Spawn DBus
|
||||
eval `dbus-launch --sh-syntax`
|
||||
trap "kill $DBUS_SESSION_BUS_PID" EXIT
|
||||
|
||||
"$@"
|
||||
|
|
|
|||
|
|
@ -24,5 +24,7 @@ test_wifi_ap_utils_SOURCES = \
|
|||
test_wifi_ap_utils_LDADD = $(top_builddir)/src/libNetworkManager.la
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-wifi-ap-utils
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ test_dhcp_utils_LDADD = \
|
|||
#################################
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-dhcp-dhclient test-dhcp-utils
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
|
|
|||
|
|
@ -20,5 +20,7 @@ test_dnsmasq_utils_LDADD = \
|
|||
$(top_builddir)/src/libNetworkManager.la
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-dnsmasq-utils
|
||||
|
||||
|
|
|
|||
|
|
@ -109,8 +109,9 @@ test_cleanup_linux_CPPFLAGS = \
|
|||
-DKERNEL_HACKS=1
|
||||
test_cleanup_linux_LDADD = $(PLATFORM_LDADD)
|
||||
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = \
|
||||
test-address-fake \
|
||||
test-address-linux \
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ main (int argc, char **argv)
|
|||
return EXIT_FAILURE;
|
||||
#else
|
||||
g_print ("Skipping test: requires root privileges (%s)\n", program);
|
||||
return EXIT_SKIP;
|
||||
return g_test_run ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,5 +33,7 @@ test_rdisc_fake_LDADD = \
|
|||
$(top_builddir)/src/libNetworkManager.la
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-rdisc-fake
|
||||
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ main (int argc, char **argv)
|
|||
|
||||
if (nmtst_test_quick ()) {
|
||||
g_print ("Skipping test: don't run long running test %s (NMTST_DEBUG=slow)\n", str_if_set (g_get_prgname (), "test-rdisc-fake"));
|
||||
return EXIT_SKIP;
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
nm_fake_platform_setup ();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ test_ibft_LDADD = \
|
|||
$(top_builddir)/src/libNetworkManager.la
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-ibft
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ test_ifcfg_rh_utils_LDADD = \
|
|||
$(top_builddir)/src/libNetworkManager.la
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-ifcfg-rh-utils test-ifcfg-rh
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -115,15 +115,9 @@ test_ignored (const char *desc, const char *path, gboolean expected_ignored)
|
|||
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");
|
||||
|
|
@ -137,7 +131,11 @@ int main (int argc, char **argv)
|
|||
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");
|
||||
|
|
@ -152,7 +150,11 @@ int main (int argc, char **argv)
|
|||
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);
|
||||
|
|
@ -163,10 +165,19 @@ int main (int argc, char **argv)
|
|||
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);
|
||||
|
||||
base = g_path_get_basename (argv[0]);
|
||||
fprintf (stdout, "%s: SUCCESS\n", base);
|
||||
g_free (base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ test_ifupdown_LDADD = \
|
|||
|
||||
# TODO: enable valgrind for ifupdown. Currently it fails.
|
||||
#@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-ifupdown
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ test_keyfile_LDADD = \
|
|||
$(CODE_COVERAGE_LDFLAGS)
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-keyfile
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -19,4 +19,6 @@ test_supplicant_config_LDADD = \
|
|||
$(top_builddir)/src/libNetworkManager.la
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-supplicant-config
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ EXTRA_DIST = test-secret-agent.py
|
|||
###########################################
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = \
|
||||
test-ip4-config \
|
||||
test-ip6-config \
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ test_config_LDADD = \
|
|||
$(top_builddir)/src/libNetworkManager.la
|
||||
|
||||
@VALGRIND_RULES@
|
||||
AM_TESTS_FD_REDIRECT = --tap
|
||||
LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh
|
||||
TESTS = test-config
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
|
|
|||
|
|
@ -4,14 +4,12 @@ LIBTOOL="$1"; shift
|
|||
VALGRIND="$1"; shift
|
||||
SUPPRESSIONS="$1"; shift
|
||||
if [ "$1" = "--launch-dbus" ]; then
|
||||
# Spawn DBus if there's none
|
||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
||||
eval `dbus-launch --sh-syntax`
|
||||
trap "kill $DBUS_SESSION_BUS_PID" EXIT
|
||||
fi
|
||||
# Spawn DBus
|
||||
eval `dbus-launch --sh-syntax`
|
||||
trap "kill $DBUS_SESSION_BUS_PID" EXIT
|
||||
shift
|
||||
fi
|
||||
TEST="$1"; shift
|
||||
TEST="$1"
|
||||
|
||||
if [ "$NMTST_NO_VALGRIND" != "" ]; then
|
||||
"$TEST"
|
||||
|
|
@ -29,7 +27,7 @@ $LIBTOOL --mode=execute "$VALGRIND" \
|
|||
--gen-suppressions=all \
|
||||
--suppressions="$SUPPRESSIONS" \
|
||||
--log-file="$LOGFILE" \
|
||||
"$TEST"
|
||||
"$@"
|
||||
RESULT=$?
|
||||
|
||||
if [ $RESULT -eq 0 -a "$(wc -c "$LOGFILE" | awk '{print$1}')" -ne 0 ]; then
|
||||
|
|
@ -38,7 +36,19 @@ if [ $RESULT -eq 0 -a "$(wc -c "$LOGFILE" | awk '{print$1}')" -ne 0 ]; then
|
|||
fi
|
||||
|
||||
if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
|
||||
echo "Don't forget to check the valgrind log at '`realpath $LOGFILE`'." >&2
|
||||
echo "valgrind failed! Check the log at '`realpath $LOGFILE`'." >&2
|
||||
UNRESOLVED=$(awk -F: '/obj:\// {print $NF}' "$LOGFILE" | sort | uniq)
|
||||
if [ -n "$UNRESOLVED" ]; then
|
||||
echo Some addresses could not be resolved into symbols. >&2
|
||||
echo The errors might get suppressed when you install the debuging symbols. >&2
|
||||
if [ -x /usr/bin/dnf ]; then
|
||||
echo Hint: dnf debuginfo-install $UNRESOLVED >&2
|
||||
elif [ -x /usr/bin/debuginfo-install ]; then
|
||||
echo Hint: debuginfo-install $UNRESOLVED >&2
|
||||
else
|
||||
echo Files without debugging symbols: $UNRESOLVED >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $RESULT
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue