]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Add missing test dependencies
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 21 Jan 2022 14:28:23 +0000 (14:28 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 21 Jan 2022 16:56:03 +0000 (01:56 +0900)
Currently, running "meson build" followed by "meson test -C build"
will result in many failed tests due to missing dependencies. This
commit adds the missing dependencies to make sure no tests fail.

catalog/meson.build
man/meson.build
meson.build
src/udev/meson.build
test/meson.build

index 7139c2e0531397711f4bfcfda7501d247be109e7..a20189d31491bbc62a2ce07623b3895c93adf272 100644 (file)
@@ -19,7 +19,7 @@ support_url = get_option('support-url')
 support_sed = 's~%SUPPORT_URL%~@0@~'.format(support_url)
 
 foreach file : in_files
-        custom_target(
+        catalogs += custom_target(
                 file,
                 input : file + '.in',
                 output: file,
index 710b4ca0088542d47a97e0707b2f7fe5b3aea0a4..069772467eb782caadd8963c7da7c3f2b2abe158 100644 (file)
@@ -226,7 +226,8 @@ update_dbus_docs = custom_target(
 if conf.get('BUILD_MODE_DEVELOPER') == 1
         test('dbus-docs-fresh',
              update_dbus_docs_py,
-             args : ['--build-dir', project_build_root, '--test', dbus_docs])
+             args : ['--build-dir', project_build_root, '--test', dbus_docs],
+             depends : dbus_programs)
 endif
 
 update_man_rules = custom_target(
index 0abdd3661635a019b2c1fb468f75912d605b3dbe..a3548a02785e5a744d01137f859d72fe20cd9638 100644 (file)
@@ -1765,6 +1765,7 @@ conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
 
 tests = []
 fuzzers = []
+catalogs = []
 
 ############################################################
 
@@ -2072,7 +2073,8 @@ foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
                         test('dlopen-nss_' + module,
                              test_dlopen,
                              # path to dlopen must include a slash
-                             args : nss.full_path())
+                             args : nss.full_path(),
+                             depends : nss)
                 endif
         endif
 endforeach
@@ -2186,7 +2188,8 @@ if want_tests != 'false'
         test('test-fstab-generator',
              test_fstab_generator_sh,
              # https://github.com/mesonbuild/meson/issues/2681
-             args : exe.full_path())
+             args : exe.full_path(),
+             depends : exe)
 endif
 
 if conf.get('ENABLE_ENVIRONMENT_D') == 1
@@ -2337,7 +2340,8 @@ if conf.get('ENABLE_LOGIND') == 1
                         test('dlopen-pam_systemd',
                              test_dlopen,
                              # path to dlopen must include a slash
-                             args : pam_systemd.full_path())
+                             args : pam_systemd.full_path(),
+                             depends : pam_systemd)
                 endif
         endif
 
@@ -2676,7 +2680,7 @@ if conf.get('HAVE_LIBCRYPTSETUP') == 1
 endif
 
 if conf.get('HAVE_SYSV_COMPAT') == 1
-        executable(
+        exe = executable(
                 'systemd-sysv-generator',
                 'src/sysv-generator/sysv-generator.c',
                 include_directories : includes,
@@ -2685,6 +2689,13 @@ if conf.get('HAVE_SYSV_COMPAT') == 1
                 install : true,
                 install_dir : systemgeneratordir)
 
+        sysv_generator_test_py = find_program('test/sysv-generator-test.py')
+        if want_tests != 'false'
+                test('sysv-generator-test',
+                     sysv_generator_test_py,
+                     depends : exe)
+        endif
+
         executable(
                 'systemd-rc-local-generator',
                 'src/rc-local-generator/rc-local-generator.c',
@@ -3568,7 +3579,8 @@ if want_tests != 'false'
         test('test-network-generator-conversion',
              test_network_generator_conversion_sh,
              # https://github.com/mesonbuild/meson/issues/2681
-             args : exe.full_path())
+             args : exe.full_path(),
+             depends : exe)
 endif
 
 executable(
@@ -3582,13 +3594,14 @@ executable(
 
 ############################################################
 
-custom_target(
+runtest_env = custom_target(
         'systemd-runtest.env',
         output : 'systemd-runtest.env',
         command : [sh, '-c',
                    '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
                            project_source_root / 'test',
                            project_build_root / 'catalog')],
+        depends : catalogs,
         build_by_default : true)
 
 test_cflags = ['-DTEST_CODE=1']
@@ -3631,7 +3644,8 @@ foreach tuple : tests
                         build_by_default : want_tests != 'false',
                         install_rpath : rootlibexecdir,
                         install : install_tests,
-                        install_dir : testsdir / type)
+                        install_dir : testsdir / type,
+                        link_depends : runtest_env)
 
                 if type == 'manual'
                         message('@0@ is a manual test'.format(name))
@@ -3824,7 +3838,8 @@ foreach exec : public_programs
         if want_tests != 'false'
                 test('check-help-' + name,
                      check_help,
-                     args : exec.full_path())
+                     args : exec.full_path(),
+                     depends: exec)
         endif
 endforeach
 
index 9fd0bcdd0efa76d76f70360709698f6b060bcb50..7d1e6d06bf523cf31c154a6cb785616cc6a58049 100644 (file)
@@ -152,7 +152,7 @@ foreach prog : udev_progs
                 install : true,
                 install_dir : udevlibexecdir)
 
-        udev_prog_paths += {name : exe.full_path()}
+        udev_prog_paths += {name : exe}
 endforeach
 
 if install_sysconfdir_samples
index 6f6bba699466e5fb1201392ae36e0c067b4c1a4f..546ef74d4ac88ba8a1bf79dd6ae91afc31069053 100644 (file)
@@ -116,16 +116,6 @@ endif
 
 ############################################################
 
-if conf.get('HAVE_SYSV_COMPAT') == 1
-        sysv_generator_test_py = find_program('sysv-generator-test.py')
-        if want_tests != 'false'
-                test('sysv-generator-test',
-                     sysv_generator_test_py)
-        endif
-endif
-
-############################################################
-
 if install_tests
         install_data('run-unit-tests.py',
                      install_mode : 'rwxr-xr-x',
@@ -184,9 +174,10 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
 
                 test(name,
                      udev_dmi_memory_id_test,
-                     args : [udev_prog_paths['dmi_memory_id'],
+                     args : [udev_prog_paths['dmi_memory_id'].full_path(),
                              source,
-                             source + '.txt'])
+                             source + '.txt'],
+                     depends : udev_prog_paths['dmi_memory_id'])
         endforeach
 endif