summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2023-03-04 14:10:35 +0100
committerJan Janssen <medhefgo@web.de>2023-03-10 11:41:08 +0100
commit2c7c68e4e404a24aaebc7ee1bae6661c95fe3d54 (patch)
tree01d84066c84e2c5f0029f8a28f33ab6973714ef9 /src/boot
parent5d5525245b67c22253df859f2657df18fa13f07f (diff)
downloadsystemd-2c7c68e4e404a24aaebc7ee1bae6661c95fe3d54.tar.gz
meson: Use static library for EFI tests
This also moves them so that fuzz builds do not need pyelftools around.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/efi/meson.build89
1 files changed, 49 insertions, 40 deletions
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index 6b04cfb495..7e497f7866 100644
--- a/src/boot/efi/meson.build
+++ b/src/boot/efi/meson.build
@@ -2,6 +2,55 @@
efi_config_h_dir = meson.current_build_dir()
+if efi_arch != ''
+ libefitest = static_library(
+ 'efitest',
+ files(
+ 'bcd.c',
+ 'efi-string.c',
+ ),
+ build_by_default : false,
+ include_directories : [
+ basic_includes,
+ include_directories('.'),
+ ],
+ dependencies : userspace)
+
+ efitest_base = {
+ 'link_with' : [
+ libefitest,
+ libshared,
+ ],
+ }
+
+ tests += [
+ {
+ 'sources' : files('test-bcd.c'),
+ 'dependencies' : libzstd,
+ 'condition' : 'HAVE_ZSTD',
+ 'base' : efitest_base,
+ },
+ {
+ 'sources' : files('test-efi-string.c'),
+ 'base' : efitest_base,
+ },
+ ]
+ fuzzers += [
+ {
+ 'sources' : files('fuzz-bcd.c'),
+ 'base' : efitest_base,
+ },
+ {
+ 'sources' : files('fuzz-efi-string.c'),
+ 'base' : efitest_base,
+ },
+ {
+ 'sources' : files('fuzz-efi-printf.c'),
+ 'base' : efitest_base,
+ },
+ ]
+endif
+
if conf.get('ENABLE_BOOTLOADER') != 1
subdir_done()
endif
@@ -209,49 +258,9 @@ if host_machine.cpu_family() in ['x86', 'x86_64']
stub_sources += files('linux_x86.c')
endif
-tests += [
- {
- 'sources' : files(
- 'test-efi-string.c',
- 'efi-string.c',
- )
- },
-]
-
# BCD parser only makes sense on arches that Windows supports.
if host_machine.cpu_family() in ['aarch64', 'arm', 'x86_64', 'x86']
systemd_boot_sources += files('bcd.c')
- tests += [
- {
- 'sources' : files(
- 'test-bcd.c',
- 'efi-string.c',
- ),
- 'dependencies' : libzstd,
- 'condition' : 'HAVE_ZSTD',
- },
- ]
- fuzzers += [
- {
- 'sources' : files(
- 'fuzz-bcd.c',
- 'bcd.c',
- 'efi-string.c'
- ),
- },
- {
- 'sources' : files(
- 'fuzz-efi-string.c',
- 'efi-string.c'
- ),
- },
- {
- 'sources' : files(
- 'fuzz-efi-printf.c',
- 'efi-string.c'
- ),
- },
- ]
endif
boot_targets = []