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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2023-06-06 15:45:57 +02:00
parent 0d66468243
commit 320266b961
3 changed files with 19 additions and 3 deletions
+6
View 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)
+4
View 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')
+9 -3
View File
@@ -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)