meson: disable _all_ tests when -Dtests=false

Back in 08318a2c5a, value "false" was enabled for
'-Dtests=', but various tests were not conditionalized properly. So even with
-Dtests=false -Dslow-tests=false we'd run 120 tests. Let's make this consistent.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-09-12 11:08:49 +02:00
parent d3da291eb0
commit 938be08926
5 changed files with 66 additions and 38 deletions

View File

@ -36,9 +36,11 @@ endif
############################################################
parse_hwdb_py = find_program('parse_hwdb.py')
test('parse-hwdb',
parse_hwdb_py,
timeout : 90)
if want_tests != 'false'
test('parse-hwdb',
parse_hwdb_py,
timeout : 90)
endif
############################################################

View File

@ -1504,9 +1504,12 @@ foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
'rm $DESTDIR@0@/libnss_@1@.so'
.format(rootlibdir, module))
test('dlopen-nss_' + module,
test_dlopen,
args : [nss.full_path()]) # path to dlopen must include a slash
if want_tests != 'false'
test('dlopen-nss_' + module,
test_dlopen,
# path to dlopen must include a slash
args : nss.full_path())
endif
endif
endforeach
@ -1747,9 +1750,12 @@ if conf.get('ENABLE_LOGIND') == 1
install : true,
install_dir : pamlibdir)
test('dlopen-pam_systemd',
test_dlopen,
args : [pam_systemd.full_path()]) # path to dlopen must include a slash
if want_tests != 'false'
test('dlopen-pam_systemd',
test_dlopen,
# path to dlopen must include a slash
args : [pam_systemd.full_path()])
endif
endif
endif
@ -2436,10 +2442,12 @@ if conf.get('ENABLE_TMPFILES') == 1
install_dir : rootbindir)
public_programs += exe
test('test-systemd-tmpfiles',
test_systemd_tmpfiles_py,
args : exe.full_path())
# https://github.com/mesonbuild/meson/issues/2681
if want_tests != 'false'
test('test-systemd-tmpfiles',
test_systemd_tmpfiles_py,
# https://github.com/mesonbuild/meson/issues/2681
args : exe.full_path())
endif
endif
if conf.get('ENABLE_HWDB') == 1
@ -2666,7 +2674,9 @@ exe = executable(
link_with : [libsystemd],
install : install_tests,
install_dir : testsdir)
test('test-libsystemd-sym', exe)
if want_tests != 'false'
test('test-libsystemd-sym', exe)
endif
exe = executable(
'test-libsystemd-static-sym',
@ -2678,7 +2688,7 @@ exe = executable(
build_by_default : static_libsystemd_pic,
install : install_tests and static_libsystemd_pic,
install_dir : testsdir)
if static_libsystemd_pic
if want_tests != 'false' and static_libsystemd_pic
test('test-libsystemd-static-sym', exe)
endif
@ -2690,7 +2700,9 @@ exe = executable(
link_with : [libudev],
install : install_tests,
install_dir : testsdir)
test('test-libudev-sym', exe)
if want_tests != 'false'
test('test-libudev-sym', exe)
endif
exe = executable(
'test-libudev-static-sym',
@ -2701,7 +2713,7 @@ exe = executable(
build_by_default : static_libudev_pic,
install : install_tests and static_libudev_pic,
install_dir : testsdir)
if static_libudev_pic
if want_tests != 'false' and static_libudev_pic
test('test-libudev-static-sym', exe)
endif
@ -2791,9 +2803,11 @@ meson_check_help = find_program('tools/meson-check-help.sh')
foreach exec : public_programs
name = exec.full_path().split('/')[-1]
test('check-help-' + name,
meson_check_help,
args : [exec.full_path()])
if want_tests != 'false'
test('check-help-' + name,
meson_check_help,
args : [exec.full_path()])
endif
endforeach
############################################################

View File

@ -169,9 +169,11 @@ if have_gnu_efi
efi_ldflags + tuple[2] +
['-lefi', '-lgnuefi', libgcc_file_name])
test('no-undefined-symbols-' + tuple[0],
no_undefined_symbols,
args : [so])
if want_tests != 'false'
test('no-undefined-symbols-' + tuple[0],
no_undefined_symbols,
args : [so])
endif
stub = custom_target(
tuple[1],

View File

@ -65,10 +65,12 @@ endif
foreach header : _systemd_headers
foreach opt : opts
name = ''.join([header, ':'] + opt)
test('cc-' + name,
check_compilation_sh,
args : cc.cmd_array() + ['-c', '-x'] + opt +
['-Werror', '-include',
join_paths(meson.current_source_dir(), header)])
if want_tests != 'false'
test('cc-' + name,
check_compilation_sh,
args : cc.cmd_array() + ['-c', '-x'] + opt +
['-Werror', '-include',
join_paths(meson.current_source_dir(), header)])
endif
endforeach
endforeach

View File

@ -211,16 +211,20 @@ endif
############################################################
rule_syntax_check_py = find_program('rule-syntax-check.py')
test('rule-syntax-check',
rule_syntax_check_py,
args : all_rules)
if want_tests != 'false'
test('rule-syntax-check',
rule_syntax_check_py,
args : all_rules)
endif
############################################################
if conf.get('HAVE_SYSV_COMPAT') == 1
sysv_generator_test_py = find_program('sysv-generator-test.py')
test('sysv-generator-test',
sysv_generator_test_py)
if want_tests != 'false'
test('sysv-generator-test',
sysv_generator_test_py)
endif
endif
############################################################
@ -235,17 +239,21 @@ custom_target(
if perl.found()
udev_test_pl = find_program('udev-test.pl')
test('udev-test',
udev_test_pl)
if want_tests != 'false'
test('udev-test',
udev_test_pl)
endif
else
message('Skipping udev-test because perl is not available')
endif
if conf.get('ENABLE_HWDB') == 1
hwdb_test_sh = find_program('hwdb-test.sh')
test('hwdb-test',
hwdb_test_sh,
timeout : 90)
if want_tests != 'false'
test('hwdb-test',
hwdb_test_sh,
timeout : 90)
endif
endif
subdir('fuzz-regressions')