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.
This commit is contained in:
Beniamino Galvani 2018-04-11 10:49:33 +02:00
parent 3b5a522ef6
commit a2479b95c0
21 changed files with 115 additions and 24 deletions

View file

@ -16,4 +16,8 @@ exe = executable(
],
)
test(test_unit, exe)
test(
test_unit,
test_script,
args: test_args + [exe.full_path()]
)

View file

@ -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()]
)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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')

View file

@ -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

View file

@ -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()]
)

View file

@ -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

View file

@ -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()]
)

View file

@ -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'

View file

@ -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'

View file

@ -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()]
)

View file

@ -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()]
)

View file

@ -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()]
)

View file

@ -14,4 +14,8 @@ exe = executable(
c_args: cflags
)
test(test_unit, exe)
test(
test_unit,
test_script,
args: test_args + [exe.full_path()]
)

View file

@ -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()]
)

View file

@ -19,4 +19,8 @@ exe = executable(
c_args: cflags
)
test(test_unit, exe)
test(
test_unit,
test_script,
args: test_args + [exe.full_path()]
)

View file

@ -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()]
)

View file

@ -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=