]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test_ukify: pass through path to addon stub
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 6 Jun 2023 11:03:41 +0000 (13:03 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 6 Jun 2023 13:45:57 +0000 (15:45 +0200)
Without this, the tests would generally be skipped, since we haven't made a
release with the addon stub yet. But even if the file is there, we always want
to test the freshly-built item.

src/boot/efi/meson.build
src/test/meson.build
src/ukify/test/test_ukify.py

index b573e6996d1811ee2891a75e368503abdabdfb95..68c19fbcc9b328cc2412d8432177fb5bb236aca3 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 
 efi_config_h_dir = meson.current_build_dir()
+efi_addon = ''
 
 if efi_arch != ''
         libefitest = static_library(
@@ -376,6 +377,11 @@ foreach efi_elf_binary : efi_elf_binaries
         if name.startswith('linux')
                 boot_stubs += exe
         endif
+
+        # This is supposed to match exactly one time
+        if name == 'addon@0@.efi.stub'.format(efi_arch)
+                efi_addon = exe.full_path()
+        endif
 endforeach
 
 alias_target('systemd-boot', boot_targets)
index 84d642bf6e1792a59080433dee934f683abbc67e..fe1a0fec216594d30664ca452131511be9a83782 100644 (file)
@@ -15,6 +15,10 @@ test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
 test_env.set('PATH', project_build_root + ':' + path)
 test_env.set('PROJECT_BUILD_ROOT', project_build_root)
 
+if efi_addon != ''
+        test_env.set('EFI_ADDON', efi_addon)
+endif
+
 ############################################################
 
 generate_sym_test_py = find_program('generate-sym-test.py')
index 05e2668d5493095e054db6e755a3adee4eae2761..ac25c71e9e0986a1a002b0fa7e6bd7b2077f6ae1 100755 (executable)
@@ -385,15 +385,21 @@ def test_sections(kernel_initrd, tmpdir):
 
 def test_addon(kernel_initrd, tmpdir):
     output = f'{tmpdir}/addon.efi'
-    opts = ukify.parse_args([
+    args = [
         f'--output={output}',
         '--cmdline=ARG1 ARG2 ARG3',
         '--section=.test:CONTENTZ',
-    ])
+    ]
+    if stub := os.getenv('EFI_ADDON'):
+        args += [f'--stub={stub}']
+        expected_exceptions = ()
+    else:
+        expected_exceptions = FileNotFoundError,
 
+    opts = ukify.parse_args(args)
     try:
         ukify.check_inputs(opts)
-    except OSError as e:
+    except expected_exceptions as e:
         pytest.skip(str(e))
 
     ukify.make_uki(opts)