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') parse_hwdb_py = find_program('parse_hwdb.py')
test('parse-hwdb', if want_tests != 'false'
parse_hwdb_py, test('parse-hwdb',
timeout : 90) parse_hwdb_py,
timeout : 90)
endif
############################################################ ############################################################

View File

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

View File

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

View File

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

View File

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