]> 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, 4 Aug 2025 14:34:09 +0000 (15:34 +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.

(cherry picked from commit 140850531877aad2401c7f83e60a3a2eac687883)

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

index 9370274d9689715deb327298ad69d36f7dd5f058..9d45b5ad76b86aa5a1a2689bcd8a1e669b4d7a33 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',
@@ -418,12 +418,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 af39ff145ab95d1f87a3e8c11e0437a8eea19904..3cb1ce6ee6ae8ad025cadf203bb0c4a2fa78c2d3 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(
                 file,
                 input : file + '.in',
                 output : file,
index c61e36983bf4cee70c28bb8586c72f874017a0a6..3e1be816de79f29c7a5764b6cca1d6fb544ffc9f 100644 (file)
@@ -10,17 +10,14 @@ test_hashmap_ordered_c = custom_target(
         build_by_default : want_tests != 'false')
 
 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 6627a4f03a7af014ffbe714233cd68ea64933ab1..e8f2cd78e2f3436c025cbedb8e001534ceb3a1fb 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')