]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: do not build tests by default when '-Dtests=false'
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 12 Sep 2018 12:47:56 +0000 (21:47 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Sep 2018 10:07:34 +0000 (12:07 +0200)
[zj: it is still possible to build tests explicitly by calling
     ninja -C build test-name. This way we have full flexibility.]

meson.build
src/test/meson.build
test/meson.build

index 12ddddd3ebe7ecc3dd51d1d926942231d31a5782..694c5cfcdd7e2ee7b8f3c3a0c822badbc1bd9680 100644 (file)
@@ -1466,7 +1466,8 @@ test_dlopen = executable(
         test_dlopen_c,
         include_directories : includes,
         link_with : [libbasic],
-        dependencies : [libdl])
+        dependencies : [libdl],
+        build_by_default : want_tests != 'false')
 
 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
                  ['systemd',    'ENABLE_NSS_SYSTEMD'],
@@ -2672,6 +2673,7 @@ exe = executable(
         test_libsystemd_sym_c,
         include_directories : includes,
         link_with : [libsystemd],
+        build_by_default : want_tests != 'false',
         install : install_tests,
         install_dir : testsdir)
 if want_tests != 'false'
@@ -2685,7 +2687,7 @@ exe = executable(
         link_with : [install_libsystemd_static],
         dependencies : [threads], # threads is already included in dependencies on the library,
                                   # but does not seem to get propagated. Add here as a work-around.
-        build_by_default : static_libsystemd_pic,
+        build_by_default : want_tests != 'false' and static_libsystemd_pic,
         install : install_tests and static_libsystemd_pic,
         install_dir : testsdir)
 if want_tests != 'false' and static_libsystemd_pic
@@ -2698,6 +2700,7 @@ exe = executable(
         include_directories : includes,
         c_args : ['-Wno-deprecated-declarations'],
         link_with : [libudev],
+        build_by_default : want_tests != 'false',
         install : install_tests,
         install_dir : testsdir)
 if want_tests != 'false'
@@ -2710,7 +2713,7 @@ exe = executable(
         include_directories : includes,
         c_args : ['-Wno-deprecated-declarations'],
         link_with : [install_libudev_static],
-        build_by_default : static_libudev_pic,
+        build_by_default : want_tests != 'false' and static_libudev_pic,
         install : install_tests and static_libudev_pic,
         install_dir : testsdir)
 if want_tests != 'false' and static_libudev_pic
index e82c993ab4d6b471c06bf60ed266886b3d17870a..86d7b16d459ec6e6f02117183414c1ece331c087 100644 (file)
@@ -6,7 +6,8 @@ test_hashmap_ordered_c = custom_target(
         input : [awkscript, 'test-hashmap-plain.c'],
         output : 'test-hashmap-ordered.c',
         command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
-        capture : true)
+        capture : true,
+        build_by_default : want_tests != 'false')
 
 test_include_dir = include_directories('.')
 
@@ -26,14 +27,16 @@ test_libsystemd_sym_c = custom_target(
         input : [libsystemd_sym_path] + systemd_headers,
         output : 'test-libsystemd-sym.c',
         command : [generate_sym_test_py, libsystemd_sym_path] + systemd_headers,
-        capture : true)
+        capture : true,
+        build_by_default : want_tests != 'false')
 
 test_libudev_sym_c = custom_target(
         'test-libudev-sym.c',
         input : [libudev_sym_path, libudev_h_path],
         output : 'test-libudev-sym.c',
         command : [generate_sym_test_py, '@INPUT0@', '@INPUT1@'],
-        capture : true)
+        capture : true,
+        build_by_default : want_tests != 'false')
 
 test_dlopen_c = files('test-dlopen.c')
 
index 8bec8dc07c85a393ca68fdfc6422f85180313279..9750ff22b944a2409e22dbbba976fdc5a02573ad 100644 (file)
@@ -235,7 +235,7 @@ custom_target(
         'sys',
         command : [sys_script_py, meson.current_build_dir()],
         output : 'sys',
-        build_by_default : true)
+        build_by_default : want_tests != 'false')
 
 if perl.found()
         udev_test_pl = find_program('udev-test.pl')