]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
add false option for tests (#7778)
authorAdam Duskett <Aduskett@gmail.com>
Mon, 15 Jan 2018 11:25:46 +0000 (06:25 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 15 Jan 2018 11:25:46 +0000 (15:25 +0400)
Currently there is no way to prevent tests from building using meson.
This introduces two problems:

1) It adds a extra 381 files to compile.
2) One of these tests explicitly requires libgcrypt to be built even if systemd
   is not using it.
3) It adds C++ to the requirements to build systemd.

When cross-compiling, this is uneccessary.

meson.build
meson_options.txt

index 924274de630af0d1c3b28dc24d2987efdedb6a5f..5066ccf4323b032ad22bc92d5ae5eb1203f0c5d2 100644 (file)
@@ -260,10 +260,12 @@ cc = meson.get_compiler('c')
 pkgconfig = import('pkgconfig')
 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
 
-cxx = find_program('c++', required : false)
-if cxx.found()
-        #  Used only for tests
-        add_languages('cpp')
+if get_option('tests') != 'false'
+        cxx = find_program('c++', required : false)
+        if cxx.found()
+                #  Used only for tests
+                add_languages('cpp')
+        endif
 endif
 
 foreach arg : ['-Wextra',
@@ -2404,8 +2406,9 @@ foreach tuple : tests
                 timeout = type.split('=')[1].to_int()
                 type = ''
         endif
-
-        if condition == '' or conf.get(condition) == 1
+        if want_tests == 'false'
+                message('Not compiling @0@ because tests is set to false'.format(name))
+        elif condition == '' or conf.get(condition) == 1
                 exe = executable(
                         name,
                         sources,
index f71755cfa6ceb02c5eec8434e438dc6c956eaac0..af8be576a10c012e8f8479a227a678d9ce27d080 100644 (file)
@@ -285,7 +285,7 @@ option('bashcompletiondir', type : 'string',
 option('zshcompletiondir', type : 'string',
        description : 'directory for zsh completion scripts ["no" disables]')
 
-option('tests', type : 'combo', choices : ['true', 'unsafe'],
+option('tests', type : 'combo', choices : ['true', 'unsafe', 'false'],
        description : 'enable extra tests with =unsafe')
 option('slow-tests', type : 'boolean', value : 'false',
        description : 'run the slow tests by default')