[libvirt PATCH v2 4/8] meson: Move all handling of test options together

Andrea Bolognani abologna at redhat.com
Wed Oct 25 17:06:57 UTC 2023


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 at redhat.com>
Reviewed-by: Michal Privoznik <mprivozn at redhat.com>
---
 meson.build | 57 +++++++++++++++++++++++++++--------------------------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/meson.build b/meson.build
index 47748febb8..a372f99c21 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
 
@@ -2041,6 +2024,35 @@ endif
 
 conf.set_quoted('TLS_PRIORITY', get_option('tls_priority'))
 
+
+# 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
@@ -2064,17 +2076,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



More information about the libvir-list mailing list