]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Fix missing test dependencies
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Mon, 14 Jul 2025 09:54:00 +0000 (11:54 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 14 Jul 2025 12:07:29 +0000 (13:07 +0100)
These test would fail when executed directly with meson test before
doing a build because the required dependencies are not declared, let's
fix that.

src/boot/meson.build
src/rpm/meson.build
src/test/meson.build
src/ukify/test/meson.build
test/meson.build

index 68f1432d1dc93b6df22b476230721c4c5806883b..7cb500fac08feab90654243cf7f3a8439c05b44f 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 
 efi_config_h_dir = meson.current_build_dir()
-efi_addon = ''
+efi_addon = []
 
 libefitest = static_library(
         'efitest',
@@ -466,12 +466,12 @@ foreach efi_elf_binary : efi_elf_binaries
 
         # This is supposed to match exactly one time
         if name == 'addon@0@.efi.stub'.format(efi_arch)
-                efi_addon = exe.full_path()
+                efi_addon = [exe]
         endif
 
         test('check-alignment-@0@'.format(name),
              check_efi_alignment_py,
-             args : exe.full_path(),
+             args : exe,
              suite : 'boot')
 endforeach
 
index ffb57bf45d4a46374885bce142548068ccbf2df0..a2bbd969503dd6cb6f2b6d24aa1dc8c72b28e5fc 100644 (file)
@@ -12,9 +12,11 @@ in_files = [
 # The last two don't get installed anywhere, one of them needs to included in
 # the rpm spec file definition instead.
 
+rpm_depends = []
+
 foreach tuple : in_files
         file = tuple[0]
-        custom_target(
+        rpm_depends += custom_target(
                 input : file + '.in',
                 output : file,
                 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
index 87e54d2b05f3b68a977117b5d5690ce1aff38a0c..111fe541ba9d96afcd77af1ec069acbace18d26a 100644 (file)
@@ -11,17 +11,14 @@ test_hashmap_ordered_c = custom_target(
 generated_sources += test_hashmap_ordered_c
 
 path = run_command(sh, '-c', 'echo "$PATH"', check: true).stdout().strip()
-test_env = environment()
+test_env = {
+        'PATH' : meson.project_build_root() + ':' + path,
+        'PROJECT_BUILD_ROOT' : meson.project_build_root(),
+        'SYSTEMD_SLOW_TESTS' : want_slow_tests ? '1' : '0',
+        'PYTHONDONTWRITEBYTECODE' : '1',
+}
 if conf.get('ENABLE_LOCALED') == 1
-        test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
-endif
-test_env.set('PATH', meson.project_build_root() + ':' + path)
-test_env.set('PROJECT_BUILD_ROOT', meson.project_build_root())
-test_env.set('SYSTEMD_SLOW_TESTS', want_slow_tests ? '1' : '0')
-test_env.set('PYTHONDONTWRITEBYTECODE', '1')
-
-if efi_addon != ''
-        test_env.set('EFI_ADDON', efi_addon)
+        test_env += {'SYSTEMD_LANGUAGE_FALLBACK_MAP' : language_fallback_map}
 endif
 
 ############################################################
index 2df196b47751dc7cc654b7bf7193d12068de0060..68be54e228213b080131f424a2c33fe3b60f90c1 100644 (file)
@@ -15,7 +15,8 @@ if want_ukify and want_tests != 'false'
         test('test-ukify',
              files('test_ukify.py'),
              args: args,
-             env : test_env,
+             env : test_env + {'EFI_ADDON' : efi_addon.length() > 0 ? efi_addon[0].full_path() : ''},
              timeout : 120,
-             suite : 'ukify')
+             suite : 'ukify',
+             depends : efi_addon)
 endif
index 9149ca1e1e805f1ba96a98c1aff2dc73982d35dd..cd5f747c9fe62fe38f135da7fb7193a506c0851a 100644 (file)
@@ -220,7 +220,8 @@ if rpm.found() and rpmspec.found()
                 test('test-rpm-macros',
                      test_rpm_macros,
                      suite : 'dist',
-                     args : [meson.project_build_root()])
+                     args : [meson.project_build_root()],
+                     depends : rpm_depends)
         endif
 else
       message('Skipping test-rpm-macros since rpm and/or rpmspec are not available')