From 938be08926aa3c05faaca854776f29b9dab72661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 12 Sep 2018 11:08:49 +0200 Subject: [PATCH] meson: disable _all_ tests when -Dtests=false Back in 08318a2c5acb3d0e4243c36461e69a3e45482441, 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. --- hwdb/meson.build | 8 ++++--- meson.build | 48 ++++++++++++++++++++++++++-------------- src/boot/efi/meson.build | 8 ++++--- src/systemd/meson.build | 12 +++++----- test/meson.build | 28 ++++++++++++++--------- 5 files changed, 66 insertions(+), 38 deletions(-) diff --git a/hwdb/meson.build b/hwdb/meson.build index 158292c712..31ee3e7409 100644 --- a/hwdb/meson.build +++ b/hwdb/meson.build @@ -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 ############################################################ diff --git a/meson.build b/meson.build index 28fd4da365..12ddddd3eb 100644 --- a/meson.build +++ b/meson.build @@ -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 ############################################################ diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index 1cec5505a0..c5509e73d1 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -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], diff --git a/src/systemd/meson.build b/src/systemd/meson.build index 5f84439a58..212f99cf78 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -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 diff --git a/test/meson.build b/test/meson.build index 616ffb9728..8bec8dc07c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -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')