This will make future patches nicer. Note that we need to handle these somewhat late because of the dependency on information about the compiler and the flags it supports. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- meson.build | 57 +++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/meson.build b/meson.build index 6fa1f74670..ef0b5641de 100644 --- a/meson.build +++ b/meson.build @@ -151,23 +151,6 @@ if packager_version != '' endif -# test options - -if get_option('expensive_tests').auto() - use_expensive_tests = not git -else - use_expensive_tests = get_option('expensive_tests').enabled() -endif - -coverage_flags = [] -if get_option('test_coverage') - coverage_flags = [ - '-fprofile-arcs', - '-ftest-coverage', - ] -endif - - # Add RPATH information when building for a non-standard prefix, or # when explicitly requested to do so @@ -2028,6 +2011,35 @@ if conf.has('WITH_DECL_SYS_PIDFD_OPEN') conf.set('WITH_NBDKIT', 1) endif + +# test options + +build_tests = [ not get_option('tests').disabled() ] +if build_tests[0] and \ + cc.get_id() == 'clang' and \ + not supported_cc_flags.contains('-fsemantic-interposition') \ + and get_option('optimization') != '0' + # If CLang doesn't support -fsemantic-interposition then our + # mocking doesn't work. The best we can do is to not run the + # test suite. + build_tests = [ false, '!!! Forcibly disabling tests because CLang lacks -fsemantic-interposition. Update CLang or disable optimization !!!' ] +endif + +if get_option('expensive_tests').auto() + use_expensive_tests = not git +else + use_expensive_tests = get_option('expensive_tests').enabled() +endif + +coverage_flags = [] +if get_option('test_coverage') + coverage_flags = [ + '-fprofile-arcs', + '-ftest-coverage', + ] +endif + + # Various definitions # Python3 < 3.7 treats the C locale as 7-bit only. We must force env vars so @@ -2051,17 +2063,6 @@ subdir('src') subdir('tools') -build_tests = [ not get_option('tests').disabled() ] -if build_tests[0] and \ - cc.get_id() == 'clang' and \ - not supported_cc_flags.contains('-fsemantic-interposition') \ - and get_option('optimization') != '0' - # If CLang doesn't support -fsemantic-interposition then our - # mocking doesn't work. The best we can do is to not run the - # test suite. - build_tests = [ false, '!!! Forcibly disabling tests because CLang lacks -fsemantic-interposition. Update CLang or disable optimization !!!' ] -endif - if build_tests[0] subdir('tests') endif -- 2.41.0