mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 02:00:15 +01:00
build,tests: refactoring tests using TAP driver and improve valgrind script
This commit is contained in:
commit
9d75928bf3
20 changed files with 269 additions and 209 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
|
||||
|
|
|
|||
46
configure.ac
46
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])
|
||||
|
||||
|
|
@ -267,7 +255,11 @@ else
|
|||
fi
|
||||
AM_CONDITIONAL(HAVE_DBUS_GLIB_100, test "${have_dbus_glib_100}" = "yes")
|
||||
|
||||
PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.32 gmodule-2.0)
|
||||
PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0],
|
||||
[AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/tap-driver.sh'),
|
||||
AC_SUBST(AM_TESTS_FD_REDIRECT, '--tap')],
|
||||
[PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.32 gmodule-2.0)
|
||||
AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/test-driver')])
|
||||
|
||||
dnl GLIB_VERSION_MIN_REQUIRED should match the version above.
|
||||
dnl GLIB_VERSION_MAX_ALLOWED should be set to the same version;
|
||||
|
|
@ -828,6 +820,18 @@ AM_CONDITIONAL(BUILD_NMTUI, test "$build_nmtui" = yes)
|
|||
|
||||
NM_COMPILER_WARNINGS
|
||||
|
||||
AC_ARG_ENABLE(more-asserts,
|
||||
AS_HELP_STRING([--enable-more-asserts], [Enable more assertions for debugging (default: no)]))
|
||||
if test "${enable_more_asserts}" = "yes"; then
|
||||
AC_DEFINE(NM_MORE_ASSERTS, [1], [Define if more asserts are enabled])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(more-logging,
|
||||
AS_HELP_STRING([--enable-more-logging], [Enable more debug logging (default: no)]))
|
||||
if test "${enable_more_logging}" = "yes"; then
|
||||
AC_DEFINE(NM_MORE_LOGGING, [1], [Define if more asserts are enabled])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable Link Time Optimization for smaller size (default: no)]))
|
||||
if (test "${enable_lto}" = "yes"); then
|
||||
CFLAGS="-flto $CFLAGS"
|
||||
|
|
@ -859,8 +863,16 @@ AS_IF([test "$with_valgrind" == "yes"],
|
|||
# Add conditionals and substitutions
|
||||
AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" != "no")
|
||||
AM_CONDITIONAL(REQUIRE_ROOT_TESTS, test "$enable_tests" == "root")
|
||||
AC_ARG_WITH(valgrind-suppressions, AS_HELP_STRING([--with-valgrind-suppressions=path], [Use specific valgrind suppression file]))
|
||||
if test "$with_valgrind" == no; then
|
||||
with_valgrind_suppressions=
|
||||
else
|
||||
if test "$with_valgrind_suppressions" == ""; then
|
||||
with_valgrind_suppressions='$(top_srcdir)/valgrind.suppressions'
|
||||
fi
|
||||
fi
|
||||
AS_IF([test "$with_valgrind" != "no"],
|
||||
AC_SUBST(VALGRIND_RULES, 'TESTS_ENVIRONMENT = "$(top_srcdir)/tools/run-test-valgrind.sh" "$(LIBTOOL)" "$(with_valgrind)" "$(top_srcdir)/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")
|
||||
|
||||
|
|
@ -1084,7 +1096,7 @@ echo
|
|||
echo "Miscellaneous:"
|
||||
echo " documentation: $enable_gtk_doc"
|
||||
echo " tests: $enable_tests"
|
||||
echo " valgrind: $with_valgrind"
|
||||
echo " valgrind: $with_valgrind $with_valgrind_suppressions"
|
||||
echo " code coverage: $enable_code_coverage"
|
||||
echo " LTO: $enable_lto"
|
||||
echo
|
||||
|
|
|
|||
|
|
@ -97,9 +97,6 @@
|
|||
#include "gsystem-local-alloc.h"
|
||||
|
||||
|
||||
/* Analog to EXIT_SUCCESS and EXIT_FAILURE. */
|
||||
#define EXIT_SKIP (77)
|
||||
|
||||
/*******************************************************************************/
|
||||
|
||||
/* general purpose functions that have no dependency on other nmtst functions */
|
||||
|
|
|
|||
|
|
@ -102,6 +102,14 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifdef NM_MORE_ASSERTS
|
||||
#define nm_assert(cond) G_STMT_START { g_assert (cond); } G_STMT_END
|
||||
#else
|
||||
#define nm_assert(cond) G_STMT_START { if (FALSE) { if (cond) { } } } G_STMT_END
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_DEFINE_SINGLETON_INSTANCE(TYPE) \
|
||||
static TYPE *singleton_instance
|
||||
|
||||
|
|
|
|||
|
|
@ -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,7 +15,7 @@ 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
|
||||
TESTS = test-nm-client test-remote-settings-client
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
"$@"
|
||||
|
|
|
|||
|
|
@ -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,7 +20,7 @@ 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
|
||||
TESTS = test-nm-client test-remote-settings-client test-secret-agent
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
"$@"
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ test_cleanup_linux_CPPFLAGS = \
|
|||
-DKERNEL_HACKS=1
|
||||
test_cleanup_linux_LDADD = $(PLATFORM_LDADD)
|
||||
|
||||
|
||||
@VALGRIND_RULES@
|
||||
TESTS = \
|
||||
test-address-fake \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,18 +3,17 @@
|
|||
LIBTOOL="$1"; shift
|
||||
VALGRIND="$1"; shift
|
||||
SUPPRESSIONS="$1"; shift
|
||||
VALGRIND_ERROR=37
|
||||
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"
|
||||
"$@"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
|
|
@ -24,21 +23,48 @@ export G_SLICE=always-malloc
|
|||
export G_DEBUG=gc-friendly
|
||||
$LIBTOOL --mode=execute "$VALGRIND" \
|
||||
--quiet \
|
||||
--error-exitcode=1 \
|
||||
--error-exitcode=$VALGRIND_ERROR \
|
||||
--leak-check=full \
|
||||
--gen-suppressions=all \
|
||||
--suppressions="$SUPPRESSIONS" \
|
||||
--num-callers=100 \
|
||||
--log-file="$LOGFILE" \
|
||||
"$TEST"
|
||||
"$@"
|
||||
RESULT=$?
|
||||
|
||||
if [ $RESULT -eq 0 -a "$(wc -c "$LOGFILE" | awk '{print$1}')" -ne 0 ]; then
|
||||
echo "valgrind succeeded, but log is not empty: $LOGFILE"
|
||||
test -s "$LOGFILE"
|
||||
HAS_ERRORS=$?
|
||||
|
||||
if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
|
||||
if [ $HAS_ERRORS -ne 0 ]; then
|
||||
rm -f "$LOGFILE"
|
||||
elif [ $RESULT -ne $VALGRIND_ERROR ]; then
|
||||
# the test (probably) didn't fail due to valgrind.
|
||||
echo "The test failed. Also check the valgrind log at '`realpath "$LOGFILE"`'" >&2
|
||||
else
|
||||
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
|
||||
fi
|
||||
|
||||
if [ $HAS_ERRORS -eq 0 ]; then
|
||||
# shouldn't actually happen...
|
||||
echo "valgrind succeeded, but log is not empty: '`realpath "$LOGFILE"`'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
|
||||
echo "Don't forget to check the valgrind log at '`realpath $LOGFILE`'." >&2
|
||||
fi
|
||||
rm -f "$LOGFILE"
|
||||
|
||||
exit $RESULT
|
||||
|
|
|
|||
|
|
@ -107,6 +107,23 @@
|
|||
fun:_dl_init
|
||||
obj:/*/ld-*.so
|
||||
}
|
||||
{
|
||||
# added on Fedora 22
|
||||
# This happens when setting LD_LIBRARY_PATH and the linker is searching the libraries to load.
|
||||
# for example:
|
||||
# LD_LIBRARY_PATH=./././././././././././././././././libnm/.libs:./libnm-util/.libs:./libnm-glib/.libs
|
||||
_dl_expand_dynamic_string_token
|
||||
Memcheck:Cond
|
||||
fun:index
|
||||
fun:expand_dynamic_string_token
|
||||
...
|
||||
fun:dl_main
|
||||
fun:_dl_sysdep_start
|
||||
fun:_dl_start_final
|
||||
fun:_dl_start
|
||||
obj:/*/ld-*.so
|
||||
...
|
||||
}
|
||||
{
|
||||
all_gobject_init_ctor
|
||||
Memcheck:Leak
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue