From a2479b95c0d44d3d5cea77ce1703407b4be6fb92 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 11 Apr 2018 10:49:33 +0200 Subject: [PATCH] build: meson: use run-nm-test.sh to run tests Like autotools, use the wrapper script 'run-nm-test.sh' that starts a separate D-Bus session when needed. --- clients/common/tests/meson.build | 6 +++++- dispatcher/tests/meson.build | 6 +++++- libnm-core/tests/meson.build | 7 +++++-- libnm-glib/tests/meson.build | 6 +++++- libnm-util/tests/meson.build | 6 +++++- libnm/tests/meson.build | 6 +++++- meson.build | 11 +++++++++-- src/devices/tests/meson.build | 6 +++++- src/devices/wifi/tests/meson.build | 6 +++++- src/dhcp/tests/meson.build | 6 +++++- src/dnsmasq/tests/meson.build | 6 +++++- src/ndisc/tests/meson.build | 6 +++++- src/platform/tests/meson.build | 6 +++++- src/settings/plugins/ibft/tests/meson.build | 6 +++++- src/settings/plugins/ifcfg-rh/tests/meson.build | 6 +++++- src/settings/plugins/ifupdown/tests/meson.build | 6 +++++- src/settings/plugins/keyfile/tests/meson.build | 6 +++++- src/supplicant/tests/meson.build | 6 +++++- src/tests/config/meson.build | 6 +++++- src/tests/meson.build | 12 ++++++++++-- tools/run-nm-test.sh | 7 ++++++- 21 files changed, 115 insertions(+), 24 deletions(-) diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index b7784e715..faddd808c 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -16,4 +16,8 @@ exe = executable( ], ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/dispatcher/tests/meson.build b/dispatcher/tests/meson.build index 8675271c5..b2568ce30 100644 --- a/dispatcher/tests/meson.build +++ b/dispatcher/tests/meson.build @@ -20,4 +20,8 @@ exe = executable( link_with: libnm_dispatcher_core ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index b3d62d474..a76cda0eb 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -43,6 +43,9 @@ foreach test_unit: test_units c_args: cflags, link_with: libnm_core ) - - test(test_unit, exe) + test( + test_unit, + test_script, + args: test_args + [exe.full_path()] + ) endforeach diff --git a/libnm-glib/tests/meson.build b/libnm-glib/tests/meson.build index 14c3a67bf..954cccb8c 100644 --- a/libnm-glib/tests/meson.build +++ b/libnm-glib/tests/meson.build @@ -23,5 +23,9 @@ foreach test_unit: test_units ], ) - test(test_unit, exe) + test( + test_unit, + test_script, + args: test_args + [exe.full_path()] + ) endforeach diff --git a/libnm-util/tests/meson.build b/libnm-util/tests/meson.build index c1f7800a4..b6f67ef46 100644 --- a/libnm-util/tests/meson.build +++ b/libnm-util/tests/meson.build @@ -39,5 +39,9 @@ foreach test_unit: test_units link_depends: test_unit[2] ) - test(test_unit[0], exe) + test( + 'libnm-util-' + test_unit[0], + test_script, + args: test_args + [exe.full_path()] + ) endforeach diff --git a/libnm/tests/meson.build b/libnm/tests/meson.build index 8edb9fbed..731fd8831 100644 --- a/libnm/tests/meson.build +++ b/libnm/tests/meson.build @@ -26,7 +26,11 @@ foreach test_unit: test_units link_with: test_unit[2] ) - test(test_unit[0], exe) + test( + 'libnm-' + test_unit[0], + test_script, + args: test_args + [exe.full_path()] + ) endforeach # just test, that we can build "nm-vpn-plugin-utils.c" diff --git a/meson.build b/meson.build index 65f1f8901..5f29c16a6 100644 --- a/meson.build +++ b/meson.build @@ -209,8 +209,6 @@ have_systemd_200 = systemd_dep.found() and systemd_dep.version().version_compare gio_unix_dep = dependency('gio-unix-2.0', version: '>= 2.40') -log_driver = join_paths(meson.source_root(), 'build-aux', (gio_unix_dep.version().version_compare('>= 2.37.6') ? 'tap-driver.sh' : 'test-driver')) - glib_dep = declare_dependency( dependencies: [ gio_unix_dep, @@ -724,6 +722,7 @@ endif tests = get_option('tests') enable_tests = (tests != 'no') require_root_tests = (tests == 'root') +test_script = find_program(join_paths(meson.source_root(), 'tools', 'run-nm-test.sh')) # valgrind locations = get_option('valgrind') @@ -740,6 +739,14 @@ if enable_valgrind endif endif +test_args = [ + '--called-from-make', + '', + enable_valgrind ? valgrind.path() : '', + enable_valgrind ? valgrind_suppressions_path : '', + '--launch-dbus=auto' +] + # FIXME #AC_SUBST(NM_LOG_COMPILER, 'LOG_COMPILER = "$(top_srcdir)/tools/run-nm-test.sh" --called-from-make "$(LIBTOOL)" "$(with_valgrind)" "'"$with_valgrind_suppressions"'" --launch-dbus=auto') diff --git a/src/devices/tests/meson.build b/src/devices/tests/meson.build index c1d6def4e..9216b8148 100644 --- a/src/devices/tests/meson.build +++ b/src/devices/tests/meson.build @@ -10,5 +10,9 @@ foreach test_unit: test_units dependencies: test_nm_dep ) - test(test_unit, exe) + test( + test_unit, + test_script, + args: test_args + [exe.full_path()] + ) endforeach diff --git a/src/devices/wifi/tests/meson.build b/src/devices/wifi/tests/meson.build index 05db2ffbb..1b087f6e8 100644 --- a/src/devices/wifi/tests/meson.build +++ b/src/devices/wifi/tests/meson.build @@ -6,4 +6,8 @@ exe = executable( dependencies: test_nm_dep ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/src/dhcp/tests/meson.build b/src/dhcp/tests/meson.build index 2a6b55df2..533cde5ea 100644 --- a/src/dhcp/tests/meson.build +++ b/src/dhcp/tests/meson.build @@ -11,5 +11,9 @@ foreach test_unit: test_units c_args: '-DTESTDIR="@0@"'.format(meson.current_source_dir()) ) - test(test_unit, exe) + test( + test_unit, + test_script, + args: test_args + [exe.full_path()] + ) endforeach diff --git a/src/dnsmasq/tests/meson.build b/src/dnsmasq/tests/meson.build index 56d917486..5b4946d94 100644 --- a/src/dnsmasq/tests/meson.build +++ b/src/dnsmasq/tests/meson.build @@ -7,4 +7,8 @@ exe = executable( c_args: '-DTESTDIR="@0@"'.format(meson.source_root()) ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/src/ndisc/tests/meson.build b/src/ndisc/tests/meson.build index 708ecf412..d2d83d07d 100644 --- a/src/ndisc/tests/meson.build +++ b/src/ndisc/tests/meson.build @@ -7,7 +7,11 @@ exe = executable( c_args: test_cflags_platform ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) test = 'test-ndisc-linux' diff --git a/src/platform/tests/meson.build b/src/platform/tests/meson.build index 6c18241e7..3e0c1b104 100644 --- a/src/platform/tests/meson.build +++ b/src/platform/tests/meson.build @@ -19,7 +19,11 @@ foreach test_unit: test_units c_args: test_cflags_platform ) - test(test_unit[0], exe) + test( + 'platform-' + test_unit[0], + test_script, + args: test_args + [exe.full_path()] + ) endforeach test = 'monitor' diff --git a/src/settings/plugins/ibft/tests/meson.build b/src/settings/plugins/ibft/tests/meson.build index d57989524..0f07d6989 100644 --- a/src/settings/plugins/ibft/tests/meson.build +++ b/src/settings/plugins/ibft/tests/meson.build @@ -15,4 +15,8 @@ exe = executable( link_with: libnms_ibft_core ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/src/settings/plugins/ifcfg-rh/tests/meson.build b/src/settings/plugins/ifcfg-rh/tests/meson.build index 3be38bd3c..aeb29118b 100644 --- a/src/settings/plugins/ifcfg-rh/tests/meson.build +++ b/src/settings/plugins/ifcfg-rh/tests/meson.build @@ -15,4 +15,8 @@ exe = executable( link_with: libnms_ifcfg_rh_core ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/src/settings/plugins/ifupdown/tests/meson.build b/src/settings/plugins/ifupdown/tests/meson.build index 287c89d2e..e96add7e5 100644 --- a/src/settings/plugins/ifupdown/tests/meson.build +++ b/src/settings/plugins/ifupdown/tests/meson.build @@ -10,4 +10,8 @@ exe = executable( link_with: libnms_ifupdown_core ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/src/settings/plugins/keyfile/tests/meson.build b/src/settings/plugins/keyfile/tests/meson.build index 1f32650b2..bdbfc62a8 100644 --- a/src/settings/plugins/keyfile/tests/meson.build +++ b/src/settings/plugins/keyfile/tests/meson.build @@ -14,4 +14,8 @@ exe = executable( c_args: cflags ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/src/supplicant/tests/meson.build b/src/supplicant/tests/meson.build index 87acc7eb5..a98040984 100644 --- a/src/supplicant/tests/meson.build +++ b/src/supplicant/tests/meson.build @@ -7,4 +7,8 @@ exe = executable( c_args: '-DTEST_CERT_DIR="@0@"'.format(join_paths(meson.current_source_dir(), 'certs')) ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/src/tests/config/meson.build b/src/tests/config/meson.build index 80d289f71..6f63c8a15 100644 --- a/src/tests/config/meson.build +++ b/src/tests/config/meson.build @@ -19,4 +19,8 @@ exe = executable( c_args: cflags ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/src/tests/meson.build b/src/tests/meson.build index b87da713d..71e8bfa25 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -17,7 +17,11 @@ foreach test_unit: test_units dependencies: test_nm_dep ) - test(test_unit, exe) + test( + test_unit, + test_script, + args: test_args + [exe.full_path()] + ) endforeach test_unit = 'test-systemd' @@ -36,4 +40,8 @@ exe = executable( link_with: libsystemd_nm ) -test(test_unit, exe) +test( + test_unit, + test_script, + args: test_args + [exe.full_path()] +) diff --git a/tools/run-nm-test.sh b/tools/run-nm-test.sh index 2c23e7175..7f3053ce1 100755 --- a/tools/run-nm-test.sh +++ b/tools/run-nm-test.sh @@ -35,7 +35,12 @@ else fi if [ "$CALLED_FROM_MAKE" == 1 ]; then - NMTST_LIBTOOL=($1 --mode=execute); shift + if [ -n "$1" ]; then + NMTST_LIBTOOL=($1 --mode=execute); + else + NMTST_LIBTOOL=() + fi + shift NMTST_VALGRIND_ARG="$1"; shift if [[ "$NMTST_VALGRIND_ARG" == no ]]; then NMTST_VALGRIND_ARG=