From 320266b9616ef720cc6e7622b9f0a86b0b51b289 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 6 Jun 2023 13:03:41 +0200 Subject: [PATCH] test_ukify: pass through path to addon stub 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 | 6 ++++++ src/test/meson.build | 4 ++++ src/ukify/test/test_ukify.py | 12 +++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index b573e6996d1..68c19fbcc9b 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -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) diff --git a/src/test/meson.build b/src/test/meson.build index 84d642bf6e1..fe1a0fec216 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -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') diff --git a/src/ukify/test/test_ukify.py b/src/ukify/test/test_ukify.py index 05e2668d549..ac25c71e9e0 100755 --- a/src/ukify/test/test_ukify.py +++ b/src/ukify/test/test_ukify.py @@ -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) -- 2.47.3