From c12e10d785bfe70359a3ec4ae4666957c570c538 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 27 Jan 2023 12:57:35 +0100 Subject: [PATCH 1/4] meson: Add simple_tests list A lot of tests can be defined by just their filename. Moving into their own list keeps things simpler, especially with the next commit. It also makes it easier to keep the lists sorted. --- meson.build | 5 + src/libsystemd/meson.build | 61 +++--- src/login/meson.build | 6 +- src/test/meson.build | 401 +++++++++++++------------------------ 4 files changed, 170 insertions(+), 303 deletions(-) diff --git a/meson.build b/meson.build index 319246c6393..8a397e7c4d7 100644 --- a/meson.build +++ b/meson.build @@ -1936,6 +1936,7 @@ conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests) ############################################################ tests = [] +simple_tests = [] fuzzers = [] catalogs = [] @@ -4076,6 +4077,10 @@ if '-O2' in c_args and '-flto=auto' in c_args test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized') endif +foreach test : simple_tests + tests += [ [[test]] ] +endforeach + foreach tuple : tests sources = tuple[0] link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared] diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build index e2eb88f9fd4..8646da50a16 100644 --- a/src/libsystemd/meson.build +++ b/src/libsystemd/meson.build @@ -142,27 +142,36 @@ libsystemd_pc = custom_target( ############################################################ +simple_tests += files( + 'sd-journal/test-audit-type.c', + 'sd-journal/test-catalog.c', + 'sd-journal/test-journal-file.c', + 'sd-journal/test-journal-init.c', + 'sd-journal/test-journal-match.c', + 'sd-journal/test-journal-send.c', + 'sd-journal/test-mmap-cache.c', +) + tests += [ - [files('sd-journal/test-journal-file.c')], - - [files('sd-journal/test-journal-send.c')], - - [files('sd-journal/test-journal-match.c')], - [files('sd-journal/test-journal-enum.c'), [], [], [], '', 'timeout=360'], - - [files('sd-journal/test-journal-init.c')], - - [files('sd-journal/test-mmap-cache.c')], - - [files('sd-journal/test-catalog.c')], - - [files('sd-journal/test-audit-type.c')], ] ############################################################ +simple_tests += files( + 'sd-bus/test-bus-creds.c', + 'sd-bus/test-bus-introspect.c', + 'sd-bus/test-bus-match.c', + 'sd-bus/test-bus-vtable.c', + 'sd-device/test-device-util.c', + 'sd-device/test-sd-device-monitor.c', + 'sd-device/test-sd-device.c', + 'sd-event/test-event.c', + 'sd-login/test-login.c', + 'sd-netlink/test-netlink.c', +) + tests += [ [files('sd-bus/test-bus-address.c'), [], @@ -211,41 +220,19 @@ tests += [ [], [threads]], - [files('sd-bus/test-bus-vtable.c')], - - [files('sd-bus/test-bus-creds.c')], - - [files('sd-bus/test-bus-match.c')], - [files('sd-bus/test-bus-benchmark.c'), [], [threads], [], '', 'manual'], - [files('sd-bus/test-bus-introspect.c')], - - [files('sd-event/test-event.c')], - - [files('sd-netlink/test-netlink.c')], - [files('sd-resolve/test-resolve.c'), [], [threads], [], '', 'timeout=120'], - - [files('sd-login/test-login.c')], - - [files('sd-device/test-sd-device.c')], - - [files('sd-device/test-device-util.c')], - - [files('sd-device/test-sd-device-monitor.c')], ] if cxx_cmd != '' - tests += [ - [files('sd-bus/test-bus-vtable-cc.cc')], - ] + simple_tests += files('sd-bus/test-bus-vtable-cc.cc') endif ############################################################ diff --git a/src/login/meson.build b/src/login/meson.build index c93a2fd4c65..fd153d4ef81 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -77,9 +77,11 @@ endif ############################################################ -tests += [ - [files('test-login-shared.c')], +simple_tests += files( + 'test-login-shared.c' +) +tests += [ [files('test-inhibit.c'), [], [], [], '', 'manual'], diff --git a/src/test/meson.build b/src/test/meson.build index 1dbe12dc406..4274aad2225 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -39,13 +39,144 @@ test_dlopen_c = files('test-dlopen.c') ############################################################ +simple_tests += files( + 'test-alloc-util.c', + 'test-architecture.c', + 'test-argv-util.c', + 'test-barrier.c', + 'test-bitmap.c', + 'test-blockdev-util.c', + 'test-bootspec.c', + 'test-bus-util.c', + 'test-calendarspec.c', + 'test-cgroup-setup.c', + 'test-cgroup-util.c', + 'test-cgroup.c', + 'test-clock.c', + 'test-condition.c', + 'test-conf-files.c', + 'test-conf-parser.c', + 'test-copy.c', + 'test-coredump-util.c', + 'test-cpu-set-util.c', + 'test-creds.c', + 'test-daemon.c', + 'test-data-fd-util.c', + 'test-date.c', + 'test-dev-setup.c', + 'test-device-nodes.c', + 'test-devnum-util.c', + 'test-dns-domain.c', + 'test-ellipsize.c', + 'test-env-file.c', + 'test-env-util.c', + 'test-errno-util.c', + 'test-escape.c', + 'test-ether-addr-util.c', + 'test-exec-util.c', + 'test-execve.c', + 'test-exit-status.c', + 'test-extract-word.c', + 'test-fdset.c', + 'test-fileio.c', + 'test-firewall-util.c', + 'test-format-table.c', + 'test-format-util.c', + 'test-fs-util.c', + 'test-fstab-util.c', + 'test-glob-util.c', + 'test-gpt.c', + 'test-hash-funcs.c', + 'test-hexdecoct.c', + 'test-hmac.c', + 'test-hostname-setup.c', + 'test-hostname-util.c', + 'test-id128.c', + 'test-import-util.c', + 'test-in-addr-prefix-util.c', + 'test-in-addr-util.c', + 'test-install-file.c', + 'test-install-root.c', + 'test-io-util.c', + 'test-journal-importer.c', + 'test-kbd-util.c', + 'test-limits-util.c', + 'test-list.c', + 'test-local-addresses.c', + 'test-locale-util.c', + 'test-log.c', + 'test-logarithm.c', + 'test-macro.c', + 'test-memory-util.c', + 'test-mempool.c', + 'test-mkdir.c', + 'test-modhex.c', + 'test-mount-util.c', + 'test-mountpoint-util.c', + 'test-net-naming-scheme.c', + 'test-nulstr-util.c', + 'test-open-file.c', + 'test-ordered-set.c', + 'test-os-util.c', + 'test-parse-argument.c', + 'test-parse-helpers.c', + 'test-path-lookup.c', + 'test-path-util.c', + 'test-percent-util.c', + 'test-pretty-print.c', + 'test-prioq.c', + 'test-proc-cmdline.c', + 'test-procfs-util.c', + 'test-psi-util.c', + 'test-ratelimit.c', + 'test-raw-clone.c', + 'test-recurse-dir.c', + 'test-replace-var.c', + 'test-rlimit-util.c', + 'test-rm-rf.c', + 'test-sd-hwdb.c', + 'test-sd-path.c', + 'test-selinux.c', + 'test-serialize.c', + 'test-set.c', + 'test-sha256.c', + 'test-sigbus.c', + 'test-signal-util.c', + 'test-siphash24.c', + 'test-sleep.c', + 'test-socket-netlink.c', + 'test-socket-util.c', + 'test-specifier.c', + 'test-stat-util.c', + 'test-static-destruct.c', + 'test-strbuf.c', + 'test-string-util.c', + 'test-strip-tab-ansi.c', + 'test-strv.c', + 'test-strxcpyx.c', + 'test-sysctl-util.c', + 'test-terminal-util.c', + 'test-time-util.c', + 'test-tmpfile-util.c', + 'test-tmpfiles.c', + 'test-tpm2.c', + 'test-udev-util.c', + 'test-uid-alloc-range.c', + 'test-uid-range.c', + 'test-umask-util.c', + 'test-unaligned.c', + 'test-unit-file.c', + 'test-user-util.c', + 'test-utf8.c', + 'test-verbs.c', + 'test-web-util.c', + 'test-xattr-util.c', + 'test-xml.c', +) + +############################################################ + tests += [ - [files('test-argv-util.c')], - - [files('test-device-nodes.c')], - - [files('test-ether-addr-util.c')], - [files('test-engine.c'), [libcore, libshared], @@ -112,13 +243,9 @@ tests += [ libblkid], core_includes], - [files('test-dns-domain.c')], - [files('test-boot-timestamps.c'), [], [], [], 'ENABLE_EFI'], - [files('test-unit-file.c')], - [files('test-unit-name.c'), [libcore, libshared], @@ -141,8 +268,6 @@ tests += [ libblkid], core_includes], - [files('test-serialize.c')], - [files('test-unit-serialize.c'), [libcore, libshared], @@ -154,14 +279,6 @@ tests += [ libblkid], core_includes], - [files('test-utf8.c')], - - [files('test-kbd-util.c')], - - [files('test-blockdev-util.c')], - - [files('test-dev-setup.c')], - [files('test-capability.c'), [], [libcap]], @@ -169,12 +286,6 @@ tests += [ [files('test-async.c'), [], [], [], '', 'timeout=120'], - [files('test-locale-util.c')], - - [files('test-copy.c')], - - [files('test-recurse-dir.c')], - [files('test-compress.c'), [libshared, libbasic_compress]], @@ -185,160 +296,44 @@ tests += [ [], [], '', 'timeout=90'], - [files('test-data-fd-util.c')], - - [files('test-static-destruct.c')], - - [files('test-sigbus.c')], - - [files('test-condition.c')], - - [files('test-fdset.c')], - - [files('test-fstab-util.c')], - [files('test-random-util.c'), [], [libm], [], '', 'timeout=120'], - [files('test-format-table.c')], - - [files('test-format-util.c')], - - [files('test-ratelimit.c')], - - [files('test-raw-clone.c')], - - [files('test-limits-util.c')], - - [files('test-logarithm.c')], - - [files('test-macro.c')], - [files('test-math-util.c'), [], [libm]], - [files('test-memory-util.c')], - - [files('test-mkdir.c')], - [files('test-json.c'), [], [libm]], - [files('test-modhex.c')], - [files('test-libmount.c'), [], [threads, libmount]], - [files('test-mount-util.c')], - - [files('test-mountpoint-util.c')], - - [files('test-exec-util.c')], - - [files('test-execve.c')], - - [files('test-hexdecoct.c')], - - [files('test-alloc-util.c')], - - [files('test-xattr-util.c')], - - [files('test-io-util.c')], - - [files('test-glob-util.c')], - - [files('test-fs-util.c')], - - [files('test-install-file.c')], - - [files('test-umask-util.c')], - - [files('test-creds.c')], - - [files('test-proc-cmdline.c')], - [files('test-fd-util.c'), [], [libseccomp]], - [files('test-web-util.c')], - - [files('test-cpu-set-util.c')], - - [files('test-stat-util.c')], - - [files('test-devnum-util.c')], - - [files('test-os-util.c')], - [files('test-libcrypt-util.c'), [], [libcrypt], [], '', 'timeout=120'], - [files('test-escape.c')], - - [files('test-exit-status.c')], - - [files('test-specifier.c')], - - [files('test-string-util.c')], - - [files('test-extract-word.c')], - - [files('test-parse-argument.c')], - - [files('test-parse-helpers.c')], - [files('test-parse-util.c'), [], [libm]], - [files('test-sysctl-util.c')], - - [files('test-import-util.c')], - - [files('test-uid-alloc-range.c')], - - [files('test-user-util.c')], - - [files('test-hostname-setup.c')], - - [files('test-hostname-util.c')], - [files('test-process-util.c'), [], [threads]], - [files('test-terminal-util.c')], - - [files('test-path-lookup.c')], - - [files('test-pretty-print.c')], - - [files('test-uid-range.c')], - [files('test-cap-list.c') + generated_gperf_headers, [], [libcap]], - [files('test-socket-util.c')], - - [files('test-socket-netlink.c')], - - [files('test-in-addr-util.c')], - - [files('test-in-addr-prefix-util.c')], - - [files('test-barrier.c')], - - [files('test-tmpfiles.c')], - [files('test-namespace.c'), [libcore, libshared], @@ -346,10 +341,6 @@ tests += [ libblkid], core_includes], - [files('test-verbs.c')], - - [files('test-install-root.c')], - [files('test-acl-util.c'), [], [], [], 'HAVE_ACL'], @@ -358,13 +349,9 @@ tests += [ [libseccomp], [], 'HAVE_SECCOMP'], - [files('test-rlimit-util.c')], - [files('test-ask-password-api.c'), [], [], [], '', 'manual'], - [files('test-signal-util.c')], - [files('test-loop-block.c'), [libcore, libshared], @@ -372,8 +359,6 @@ tests += [ libblkid], core_includes, '', '', [], false], - [files('test-selinux.c')], - [files('test-sizeof.c'), [libbasic]], @@ -432,26 +417,10 @@ tests += [ [test_hashmap_ordered_c], [], [], [], '', 'timeout=180'], - [files('test-set.c')], - - [files('test-ordered-set.c')], - [files('test-set-disable-mempool.c'), [], [threads]], - [files('test-hash-funcs.c')], - - [files('test-bitmap.c')], - - [files('test-xml.c')], - - [files('test-list.c')], - - [files('test-procfs-util.c')], - - [files('test-unaligned.c')], - [files('test-tables.c'), [libcore, libjournal_core, @@ -466,63 +435,21 @@ tests += [ libselinux], [core_includes, journal_includes, udev_includes]], - [files('test-prioq.c')], - - [files('test-fileio.c')], - - [files('test-time-util.c')], - - [files('test-clock.c')], - - [files('test-tmpfile-util.c')], - - [files('test-architecture.c')], - - [files('test-gpt.c')], - - [files('test-log.c')], - [files('test-ipcrm.c'), [], [], [], '', 'unsafe'], [files('test-btrfs.c'), [], [], [], '', 'manual'], - [files('test-firewall-util.c')], - - [files('test-net-naming-scheme.c')], - [files('test-netlink-manual.c'), [], [libkmod], [], 'HAVE_KMOD', 'manual'], - [files('test-ellipsize.c')], - - [files('test-date.c')], - [files('test-sbat.c'), [], [], [], 'HAVE_GNU_EFI', '', ['-I@0@'.format(efi_config_h_dir)]], - [files('test-sleep.c')], - - [files('test-tpm2.c')], - - [files('test-mempool.c')], - - [files('test-replace-var.c')], - - [files('test-calendarspec.c')], - - [files('test-strip-tab-ansi.c')], - - [files('test-coredump-util.c')], - - [files('test-daemon.c')], - - [files('test-cgroup.c')], - [files('test-cgroup-cpu.c'), [libcore, libshared], @@ -550,26 +477,6 @@ tests += [ [], [threads]], - [files('test-cgroup-util.c')], - - [files('test-cgroup-setup.c')], - - [files('test-env-file.c')], - - [files('test-env-util.c')], - - [files('test-strbuf.c')], - - [files('test-bootspec.c')], - - [files('test-strv.c')], - - [files('test-nulstr-util.c')], - - [files('test-path-util.c')], - - [files('test-rm-rf.c')], - [files('test-chase-symlinks.c'), [], [], [], '', 'manual'], @@ -595,10 +502,6 @@ tests += [ libblkid], core_includes, '', 'timeout=360'], - [files('test-siphash24.c')], - - [files('test-strxcpyx.c')], - [files('test-install.c'), [libcore, libshared], @@ -619,10 +522,6 @@ tests += [ libblkid], core_includes], - [files('test-conf-files.c')], - - [files('test-conf-parser.c')], - [files('test-af-list.c') + generated_gperf_headers], @@ -632,13 +531,9 @@ tests += [ [files('test-errno-list.c') + generated_gperf_headers], - [files('test-errno-util.c')], - [files('test-ip-protocol-list.c') + shared_generated_gperf_headers], - [files('test-journal-importer.c')], - [files('test-utmp.c'), [], [], [], 'ENABLE_UTMP'], @@ -653,10 +548,6 @@ tests += [ libselinux], udev_includes, '', 'manual'], - [files('test-udev-util.c')], - - [files('test-id128.c')], - [files('test-cryptolib.c'), [libshared], [lib_openssl_or_gcrypt], @@ -674,30 +565,12 @@ tests += [ [libdl], [], 'ENABLE_NSS'], - [files('test-bus-util.c')], - - [files('test-percent-util.c')], - - [files('test-sd-hwdb.c')], - - [files('test-sd-path.c')], - - [files('test-local-addresses.c')], - - [files('test-psi-util.c')], - [files('test-qrcode-util.c'), [], [libdl]], [files('test-nscd-flush.c'), [], [], [], 'ENABLE_NSCD', 'manual'], - - [files('test-hmac.c')], - - [files('test-sha256.c')], - - [files('test-open-file.c')], ] ############################################################ From 822cd3ff2579d6de8acd45d85d2b9d5f44048d5c Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Wed, 25 Jan 2023 17:19:52 +0100 Subject: [PATCH 2/4] meson: Use dicts for test definitions Although this slightly more verbose it makes it much easier to reason about. The code that produces the tests heavily benefits from this. Test lists are also now sorted by test name. --- meson.build | 76 +-- src/analyze/meson.build | 14 +- src/boot/efi/meson.build | 20 +- src/busctl/meson.build | 8 +- src/core/meson.build | 5 + src/coredump/meson.build | 10 +- src/import/meson.build | 14 +- src/journal/meson.build | 77 ++- src/libsystemd-network/meson.build | 95 +-- src/libsystemd/meson.build | 120 ++-- src/libudev/meson.build | 10 +- src/locale/meson.build | 8 +- src/login/meson.build | 26 +- src/machine/meson.build | 12 +- src/network/meson.build | 67 +- src/nspawn/meson.build | 40 +- src/oom/meson.build | 11 +- src/resolve/meson.build | 93 +-- src/shutdown/meson.build | 11 +- src/test/meson.build | 801 ++++++++++++------------ src/timesync/meson.build | 12 +- src/tmpfiles/meson.build | 8 +- src/udev/meson.build | 43 +- src/xdg-autostart-generator/meson.build | 8 +- 24 files changed, 824 insertions(+), 765 deletions(-) diff --git a/meson.build b/meson.build index 8a397e7c4d7..d8ab43ba6cf 100644 --- a/meson.build +++ b/meson.build @@ -4078,60 +4078,50 @@ if '-O2' in c_args and '-flto=auto' in c_args endif foreach test : simple_tests - tests += [ [[test]] ] + tests += { 'sources' : [test] } endforeach -foreach tuple : tests - sources = tuple[0] - link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared] - dependencies = tuple.length() > 2 ? tuple[2] : [] - incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes - condition = tuple.length() > 4 ? tuple[4] : '' - type = tuple.length() > 5 ? tuple[5] : '' - defs = tuple.length() > 6 ? tuple[6] : [] - defs += test_cflags - parallel = tuple.length() > 7 ? tuple[7] : true - timeout = 30 +foreach test : tests + sources = test.get('sources') + condition = test.get('condition', '') + type = test.get('type', '') + base = test.get('base', {}) # FIXME: Use fs.stem() with meson >= 0.54.0 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0] - if type.startswith('timeout=') - timeout = type.split('=')[1].to_int() - type = '' - endif suite = fs.name(fs.parent('@0@'.format(sources[0]))) # FIXME: Use str.replace() with meson >= 0.58.0 suite = suite.split('sd-')[-1] - if condition == '' or conf.get(condition) == 1 - exe = executable( - name, - sources, - include_directories : incs, - link_with : link_with, - dependencies : [versiondep, - dependencies], - c_args : defs, - build_by_default : want_tests != 'false', - install_rpath : rootpkglibdir, - install : install_tests, - install_dir : testsdir / type, - link_depends : runtest_env) - - if type == 'manual' - message('@0@ is a manual test'.format(name)) - elif type == 'unsafe' and want_tests != 'unsafe' - message('@0@ is an unsafe test'.format(name)) - elif want_tests != 'false' - test(name, exe, - env : test_env, - timeout : timeout, - suite : suite, - is_parallel : parallel) - endif - else + if condition != '' and conf.get(condition) == 0 message('Not compiling @0@ because @1@ is not true'.format(name, condition)) + continue + endif + + exe = executable( + name, + sources, + include_directories : [base.get('includes', []), test.get('includes', includes)], + link_with : [base.get('link_with', []), test.get('link_with', libshared)], + dependencies : [versiondep, base.get('dependencies', []), test.get('dependencies', [])], + c_args : [test_cflags, test.get('c_args', [])], + build_by_default : want_tests != 'false', + install_rpath : rootpkglibdir, + install : install_tests, + install_dir : testsdir / type, + link_depends : runtest_env) + + if type == 'manual' + message('@0@ is a manual test'.format(name)) + elif type == 'unsafe' and want_tests != 'unsafe' + message('@0@ is an unsafe test'.format(name)) + elif want_tests != 'false' + test(name, exe, + env : test_env, + timeout : test.get('timeout', 30), + suite : suite, + is_parallel : test.get('parallel', true)) endif endforeach diff --git a/src/analyze/meson.build b/src/analyze/meson.build index 55b805b68e7..6493cb2e995 100644 --- a/src/analyze/meson.build +++ b/src/analyze/meson.build @@ -30,11 +30,11 @@ systemd_analyze_sources = files( ) tests += [ - [files('test-verify.c', - 'analyze-verify-util.c', - 'analyze-verify-util.h'), - [libcore, - libshared], - [], - core_includes], + { + 'sources' : files( + 'test-verify.c', + 'analyze-verify-util.c', + ), + 'base' : test_core_base, + }, ] diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index 380177449f4..80061a559bb 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -389,18 +389,26 @@ if efi_arch[1] in ['ia32', 'x86_64'] endif tests += [ - [files('test-efi-string.c', 'efi-string.c')], + { + 'sources' : files( + 'test-efi-string.c', + 'efi-string.c', + ) + }, ] # BCD parser only makes sense on arches that Windows supports. if efi_arch[1] in ['ia32', 'x86_64', 'arm', 'aarch64'] systemd_boot_sources += files('bcd.c') tests += [ - [files('test-bcd.c', 'efi-string.c'), - [], - [libzstd], - [], - 'HAVE_ZSTD'], + { + 'sources' : files( + 'test-bcd.c', + 'efi-string.c', + ), + 'dependencies' : libzstd, + 'condition' : 'HAVE_ZSTD', + }, ] fuzzers += [ [files('fuzz-bcd.c', 'bcd.c', 'efi-string.c')], diff --git a/src/busctl/meson.build b/src/busctl/meson.build index e3611b74d70..dce0224c39b 100644 --- a/src/busctl/meson.build +++ b/src/busctl/meson.build @@ -6,6 +6,10 @@ busctl_sources = files( ) tests += [ - [files('test-busctl-introspect.c', - 'busctl-introspect.c')], + { + 'sources' : files( + 'test-busctl-introspect.c', + 'busctl-introspect.c', + ) + }, ] diff --git a/src/core/meson.build b/src/core/meson.build index 981b46fc0b2..65b34bb467b 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -179,6 +179,11 @@ endif ############################################################ +test_core_base = { + 'link_with' : [libcore, libshared], + 'includes' : core_includes, +} + fuzzers += [ [files('fuzz-unit-file.c'), [libcore, diff --git a/src/coredump/meson.build b/src/coredump/meson.build index 9398a5142b2..fb31a2148fc 100644 --- a/src/coredump/meson.build +++ b/src/coredump/meson.build @@ -13,7 +13,11 @@ if conf.get('ENABLE_COREDUMP') == 1 and install_sysconfdir_samples endif tests += [ - [files('test-coredump-vacuum.c', - 'coredump-vacuum.c'), - [], [], [], '', 'manual'], + { + 'sources' : files( + 'test-coredump-vacuum.c', + 'coredump-vacuum.c', + ), + 'type' : 'manual', + }, ] diff --git a/src/import/meson.build b/src/import/meson.build index 41595c81c60..58b9719cc1b 100644 --- a/src/import/meson.build +++ b/src/import/meson.build @@ -52,9 +52,13 @@ if conf.get('ENABLE_IMPORTD') == 1 endif tests += [ - [files('test-qcow2.c', - 'qcow2-util.c'), - [], - [libz], - [], 'HAVE_ZLIB', 'manual'], + { + 'sources' : files( + 'test-qcow2.c', + 'qcow2-util.c', + ), + 'dependencies' : libz, + 'condition' : 'HAVE_ZLIB', + 'type' : 'manual', + }, ] diff --git a/src/journal/meson.build b/src/journal/meson.build index 30cebe4d443..8547a902228 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -65,41 +65,50 @@ endif ############################################################ +test_journal_base = { + 'link_with' : [libjournal_core, libshared], +} + tests += [ - [files('test-journal-syslog.c'), - [libjournal_core, - libshared], - [threads, - libxz, - liblz4, - libselinux]], - - [files('test-journal-config.c'), - [libjournal_core, - libshared], - [libxz, - liblz4, - libselinux]], - - [files('test-journal.c'), - [libjournal_core, - libshared]], - - [files('test-journal-stream.c'), - [libjournal_core, - libshared]], - - [files('test-journal-flush.c'), - [libjournal_core, - libshared]], - - [files('test-journal-verify.c'), - [libjournal_core, - libshared]], - - [files('test-journal-interleaving.c'), - [libjournal_core, - libshared]], + { + 'sources' : files('test-journal-config.c'), + 'dependencies' : [ + liblz4, + libselinux, + libxz, + ], + 'base' : test_journal_base, + }, + { + 'sources' : files('test-journal-flush.c'), + 'base' : test_journal_base, + }, + { + 'sources' : files('test-journal-interleaving.c'), + 'base' : test_journal_base, + }, + { + 'sources' : files('test-journal-stream.c'), + 'base' : test_journal_base, + }, + { + 'sources' : files('test-journal-syslog.c'), + 'dependencies' : [ + liblz4, + libselinux, + libxz, + threads, + ], + 'base' : test_journal_base, + }, + { + 'sources' : files('test-journal-verify.c'), + 'base' : test_journal_base, + }, + { + 'sources' : files('test-journal.c'), + 'base' : test_journal_base, + }, ] fuzzers += [ diff --git a/src/libsystemd-network/meson.build b/src/libsystemd-network/meson.build index 5f203f5cdad..21dc85d8de0 100644 --- a/src/libsystemd-network/meson.build +++ b/src/libsystemd-network/meson.build @@ -38,52 +38,57 @@ libsystemd_network_includes = [includes, include_directories('.')] ############################################################ +test_libsystemd_network_base = { + 'link_with' : [libshared, libsystemd_network], +} + tests += [ - [files('test-dhcp-option.c'), - [libshared, - libsystemd_network]], - - [files('test-sd-dhcp-lease.c'), - [libshared, - libsystemd_network]], - - [files('test-dhcp-client.c'), - [libshared, - libsystemd_network]], - - [files('test-dhcp-server.c'), - [libshared, - libsystemd_network]], - - [files('test-ipv4ll.c'), - [libshared, - libsystemd_network]], - - [files('test-ipv4ll-manual.c'), - [libshared, - libsystemd_network], - [], [], '', 'manual'], - - [files('test-acd.c'), - [libshared, - libsystemd_network], - [], [], '', 'manual'], - - [files('test-ndisc-rs.c'), - [libshared, - libsystemd_network]], - - [files('test-ndisc-ra.c'), - [libshared, - libsystemd_network]], - - [files('test-dhcp6-client.c'), - [libshared, - libsystemd_network]], - - [files('test-lldp-rx.c'), - [libshared, - libsystemd_network]], + { + 'sources' : files('test-acd.c'), + 'base' : test_libsystemd_network_base, + 'type' : 'manual', + }, + { + 'sources' : files('test-dhcp-client.c'), + 'base' : test_libsystemd_network_base, + }, + { + 'sources' : files('test-dhcp-option.c'), + 'base' : test_libsystemd_network_base, + }, + { + 'sources' : files('test-dhcp-server.c'), + 'base' : test_libsystemd_network_base, + }, + { + 'sources' : files('test-dhcp6-client.c'), + 'base' : test_libsystemd_network_base, + }, + { + 'sources' : files('test-ipv4ll-manual.c'), + 'base' : test_libsystemd_network_base, + 'type' : 'manual', + }, + { + 'sources' : files('test-ipv4ll.c'), + 'base' : test_libsystemd_network_base, + }, + { + 'sources' : files('test-lldp-rx.c'), + 'base' : test_libsystemd_network_base, + }, + { + 'sources' : files('test-ndisc-ra.c'), + 'base' : test_libsystemd_network_base, + }, + { + 'sources' : files('test-ndisc-rs.c'), + 'base' : test_libsystemd_network_base, + }, + { + 'sources' : files('test-sd-dhcp-lease.c'), + 'base' : test_libsystemd_network_base, + }, ] fuzzers += [ diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build index 8646da50a16..3478d9e5a05 100644 --- a/src/libsystemd/meson.build +++ b/src/libsystemd/meson.build @@ -153,8 +153,10 @@ simple_tests += files( ) tests += [ - [files('sd-journal/test-journal-enum.c'), - [], [], [], '', 'timeout=360'], + { + 'sources' : files('sd-journal/test-journal-enum.c'), + 'timeout' : 360, + }, ] ############################################################ @@ -173,62 +175,64 @@ simple_tests += files( ) tests += [ - [files('sd-bus/test-bus-address.c'), - [], - [threads]], - - [files('sd-bus/test-bus-marshal.c'), - [], - [threads, - libglib, - libgobject, - libgio, - libdbus, - libm]], - - [files('sd-bus/test-bus-signature.c'), - [], - [threads]], - - [files('sd-bus/test-bus-queue-ref-cycle.c'), - [], - [threads]], - - [files('sd-bus/test-bus-watch-bind.c'), - [], - [threads], - [], '', 'timeout=120'], - - [files('sd-bus/test-bus-chat.c'), - [], - [threads]], - - [files('sd-bus/test-bus-cleanup.c'), - [], - [threads, - libseccomp]], - - [files('sd-bus/test-bus-track.c'), - [], - [libseccomp]], - - [files('sd-bus/test-bus-server.c'), - [], - [threads]], - - [files('sd-bus/test-bus-objects.c'), - [], - [threads]], - - [files('sd-bus/test-bus-benchmark.c'), - [], - [threads], - [], '', 'manual'], - - [files('sd-resolve/test-resolve.c'), - [], - [threads], - [], '', 'timeout=120'], + { + 'sources' : files('sd-bus/test-bus-address.c'), + 'dependencies' : threads + }, + { + 'sources' : files('sd-bus/test-bus-benchmark.c'), + 'dependencies' : threads, + 'type' : 'manual', + }, + { + 'sources' : files('sd-bus/test-bus-chat.c'), + 'dependencies' : threads, + }, + { + 'sources' : files('sd-bus/test-bus-cleanup.c'), + 'dependencies' : [threads, libseccomp], + }, + { + 'sources' : files('sd-bus/test-bus-marshal.c'), + 'dependencies' : [ + libdbus, + libgio, + libglib, + libgobject, + libm, + threads, + ], + }, + { + 'sources' : files('sd-bus/test-bus-objects.c'), + 'dependencies' : threads, + }, + { + 'sources' : files('sd-bus/test-bus-queue-ref-cycle.c'), + 'dependencies' : threads, + }, + { + 'sources' : files('sd-bus/test-bus-server.c'), + 'dependencies' : threads, + }, + { + 'sources' : files('sd-bus/test-bus-signature.c'), + 'dependencies' : threads, + }, + { + 'sources' : files('sd-bus/test-bus-track.c'), + 'dependencies' : libseccomp, + }, + { + 'sources' : files('sd-bus/test-bus-watch-bind.c'), + 'dependencies' : threads, + 'timeout' : 120, + }, + { + 'sources' : files('sd-resolve/test-resolve.c'), + 'dependencies' : threads, + 'timeout' : 120, + }, ] if cxx_cmd != '' diff --git a/src/libudev/meson.build b/src/libudev/meson.build index 35c024a0e73..0e53b83e515 100644 --- a/src/libudev/meson.build +++ b/src/libudev/meson.build @@ -43,7 +43,11 @@ libudev_pc = custom_target( ############################################################ tests += [ - [files('test-libudev.c'), - [libshared, - libudev_basic]], + { + 'sources' : files('test-libudev.c'), + 'link_with' : [ + libshared, + libudev_basic, + ], + }, ] diff --git a/src/locale/meson.build b/src/locale/meson.build index fcf2798dd16..60d2666ffd6 100644 --- a/src/locale/meson.build +++ b/src/locale/meson.build @@ -29,6 +29,10 @@ if conf.get('ENABLE_LOCALED') == 1 endif tests += [ - [files('test-localed-util.c', - 'localed-util.c')], + { + 'sources' : files( + 'test-localed-util.c', + 'localed-util.c', + ), + }, ] diff --git a/src/login/meson.build b/src/login/meson.build index fd153d4ef81..198023715b6 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -82,14 +82,20 @@ simple_tests += files( ) tests += [ - [files('test-inhibit.c'), - [], [], [], '', 'manual'], - - [files('test-login-tables.c'), - [liblogind_core, - libshared], - [threads]], - - [files('test-session-properties.c'), - [], [], [], '', 'manual'], + { + 'sources' : files('test-inhibit.c'), + 'type' : 'manual', + }, + { + 'sources' : files('test-login-tables.c'), + 'link_with' : [ + liblogind_core, + libshared, + ], + 'dependencies' : threads, + }, + { + 'sources' : files('test-session-properties.c'), + 'type' : 'manual', + }, ] diff --git a/src/machine/meson.build b/src/machine/meson.build index 01d0bedd094..7b09d4b24f9 100644 --- a/src/machine/meson.build +++ b/src/machine/meson.build @@ -31,8 +31,12 @@ if conf.get('ENABLE_MACHINED') == 1 endif tests += [ - [files('test-machine-tables.c'), - [libmachine_core, - libshared], - [threads]], + { + 'sources' : files('test-machine-tables.c'), + 'link_with': [ + libmachine_core, + libshared + ], + 'dependencies': threads, + }, ] diff --git a/src/network/meson.build b/src/network/meson.build index f48c4ed1828..0b68b74b459 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -187,37 +187,40 @@ fuzzers += [ network_includes], ] +test_network_base = { + 'link_with' : [libnetworkd_core, libsystemd_network], + 'includes' : network_includes, +} + tests += [ - [files('test-networkd-address.c'), - [libnetworkd_core, - libsystemd_network], - [libatomic], - network_includes], - - [files('test-networkd-conf.c'), - [libnetworkd_core, - libsystemd_network], - [libatomic], - network_includes], - - [files('test-networkd-util.c'), - [libnetworkd_core, - libsystemd_network], - [], - network_includes], - - [files('test-network.c'), - [libnetworkd_core, - libsystemd_network], - [threads], - network_includes], - - [files('test-network-tables.c'), - [libnetworkd_core, - libsystemd_network], - [threads], - network_includes], - - [files('generator/test-network-generator.c', - 'generator/network-generator.c')], + { + 'sources' : files( + 'generator/network-generator.c', + 'generator/test-network-generator.c' + ) + }, + { + 'sources' : files('test-network-tables.c'), + 'dependencies' : threads, + 'base' : test_network_base, + }, + { + 'sources' : files('test-network.c'), + 'dependencies' : threads, + 'base' : test_network_base, + }, + { + 'sources' : files('test-networkd-address.c'), + 'dependencies' : libatomic, + 'base' : test_network_base, + }, + { + 'sources' : files('test-networkd-conf.c'), + 'dependencies' : libatomic, + 'base' : test_network_base, + }, + { + 'sources' : files('test-networkd-util.c'), + 'base' : test_network_base, + }, ] diff --git a/src/nspawn/meson.build b/src/nspawn/meson.build index 36f0a92686d..9d6bc21bbf1 100644 --- a/src/nspawn/meson.build +++ b/src/nspawn/meson.build @@ -39,21 +39,31 @@ systemd_nspawn_sources = files('nspawn.c') ############################################################ tests += [ - [files('test-nspawn-tables.c'), - [libnspawn_core, - libshared], - [libseccomp]], - - [files('test-nspawn-util.c'), - [libnspawn_core, - libshared], - [libseccomp]], - - [files('test-patch-uid.c'), - [libnspawn_core, - libshared], - [libacl], - [], '', 'manual'], + { + 'sources' : files('test-nspawn-tables.c'), + 'link_with' : [ + libnspawn_core, + libshared, + ], + 'dependencies' : libseccomp, + }, + { + 'sources' : files('test-nspawn-util.c'), + 'link_with' : [ + libnspawn_core, + libshared, + ], + 'dependencies' : libseccomp, + }, + { + 'sources' : files('test-patch-uid.c'), + 'link_with' : [ + libnspawn_core, + libshared, + ], + 'dependencies' : libacl, + 'type' : 'manual', + }, ] fuzzers += [ diff --git a/src/oom/meson.build b/src/oom/meson.build index 1c4e7f1e64a..8d31f05c984 100644 --- a/src/oom/meson.build +++ b/src/oom/meson.build @@ -23,8 +23,11 @@ if conf.get('ENABLE_OOMD') == 1 endif tests += [ - [files('test-oomd-util.c', - 'oomd-util.c'), - [], - [libatomic]] + { + 'sources' : files( + 'test-oomd-util.c', + 'oomd-util.c', + ), + 'dependencies' : libatomic, + }, ] diff --git a/src/resolve/meson.build b/src/resolve/meson.build index 331c925814a..b5083685c45 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -137,53 +137,54 @@ custom_target( ############################################################ +test_resolve_base = { + 'link_with' : [libsystemd_resolve_core, libshared], + 'dependencies' : [lib_openssl_or_gcrypt, libm], +} + tests += [ - [files('test-resolve-tables.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm]], - - [files('test-dns-packet.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm]], - - [files('test-resolved-etc-hosts.c', - 'resolved-etc-hosts.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm]], - - [files('test-resolved-packet.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm]], - - [files('test-resolved-stream.c') - + basic_dns_sources + systemd_resolved_sources, - [libshared], - [lib_openssl_or_gcrypt, - libm] - + systemd_resolved_dependencies, - resolve_includes], - - [files('test-dnssec.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm], - [], 'HAVE_OPENSSL_OR_GCRYPT'], - - [files('test-dnssec-complex.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm], - [], '', 'manual'], + { + 'sources' : files('test-resolve-tables.c'), + 'base' : test_resolve_base, + }, + { + 'sources' : files('test-dns-packet.c'), + 'base' : test_resolve_base, + }, + { + 'sources' : files( + 'test-resolved-etc-hosts.c', + 'resolved-etc-hosts.c', + ), + 'base' : test_resolve_base, + }, + { + 'sources' : files('test-resolved-packet.c'), + 'base' : test_resolve_base, + }, + { + 'sources' : files('test-dnssec.c'), + 'base' : test_resolve_base, + 'condition' : 'HAVE_OPENSSL_OR_GCRYPT', + }, + { + 'sources' : files('test-dnssec-complex.c'), + 'base' : test_resolve_base, + 'type' : 'manual', + }, + { + 'sources' : [ + files('test-resolved-stream.c'), + basic_dns_sources, + systemd_resolved_sources, + ], + 'dependencies' : [ + lib_openssl_or_gcrypt, + libm, + systemd_resolved_dependencies, + ], + 'includes' : resolve_includes, + }, ] fuzzers += [ diff --git a/src/shutdown/meson.build b/src/shutdown/meson.build index d62032a4f1d..1e28528b971 100644 --- a/src/shutdown/meson.build +++ b/src/shutdown/meson.build @@ -6,8 +6,11 @@ systemd_shutdown_sources = files( ) tests += [ - [files('test-umount.c', - 'umount.c'), - [], - [libmount]], + { + 'sources' : files( + 'test-umount.c', + 'umount.c', + ), + 'dependencies' : libmount, + }, ] diff --git a/src/test/meson.build b/src/test/meson.build index 4274aad2225..e3c0e67dcfb 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -176,401 +176,371 @@ simple_tests += files( ############################################################ +common_test_dependencies = [ + libblkid, + libmount, + librt, + libseccomp, + libselinux, + threads, +] + tests += [ - [files('test-engine.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes], - - [files('test-manager.c'), - [libcore, - libshared], - [], - core_includes], - - [files('test-emergency-action.c'), - [libcore, - libshared], - [], - core_includes], - - [files('test-chown-rec.c'), - [libcore, - libshared], - [], - core_includes], - - [files('test-dlopen-so.c'), - [], - libp11kit_cflags], - - [files('test-job-type.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes], - - [files('test-ns.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes, '', 'manual'], - - [files('test-loopback.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes], - - [files('test-boot-timestamps.c'), - [], [], [], 'ENABLE_EFI'], - - [files('test-unit-name.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes], - - [files('test-load-fragment.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes], - - [files('test-unit-serialize.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes], - - [files('test-capability.c'), - [], - [libcap]], - - [files('test-async.c'), - [], [], [], '', 'timeout=120'], - - [files('test-compress.c'), - [libshared, - libbasic_compress]], - - [files('test-compress-benchmark.c'), - [libshared, - libbasic_compress], - [], - [], '', 'timeout=90'], - - [files('test-random-util.c'), - [], - [libm], - [], '', 'timeout=120'], - - [files('test-math-util.c'), - [], - [libm]], - - [files('test-json.c'), - [], - [libm]], - - [files('test-libmount.c'), - [], - [threads, - libmount]], - - [files('test-fd-util.c'), - [], - [libseccomp]], - - [files('test-libcrypt-util.c'), - [], [libcrypt], [], '', 'timeout=120'], - - [files('test-parse-util.c'), - [], - [libm]], - - [files('test-process-util.c'), - [], - [threads]], - - [files('test-cap-list.c') + - generated_gperf_headers, - [], - [libcap]], - - [files('test-namespace.c'), - [libcore, - libshared], - [threads, - libblkid], - core_includes], - - [files('test-acl-util.c'), - [], [], [], 'HAVE_ACL'], - - [files('test-seccomp.c'), - [], - [libseccomp], - [], 'HAVE_SECCOMP'], - - [files('test-ask-password-api.c'), - [], [], [], '', 'manual'], - - [files('test-loop-block.c'), - [libcore, - libshared], - [threads, - libblkid], - core_includes, '', '', [], false], - - [files('test-sizeof.c'), - [libbasic]], - - [files('test-bpf-devices.c'), - [libcore, - libshared], - [libmount, - threads, - librt, - libseccomp, - libselinux, - libblkid], - core_includes], - - [files('test-bpf-firewall.c'), - [libcore, - libshared], - [libmount, - threads, - librt, - libseccomp, - libselinux, - libblkid], - core_includes], - - [files('test-bpf-foreign-programs.c'), - [libcore, - libshared], - [], - core_includes], - - [files('test-bpf-lsm.c'), - [libcore, - libshared], - [libmount, - threads, - librt, - libseccomp, - libselinux, - libblkid], - core_includes], - - [files('test-watch-pid.c'), - [libcore, - libshared], - [libmount, - threads, - librt, - libseccomp, - libselinux, - libblkid], - core_includes], - - [files('test-hashmap.c', - 'test-hashmap-plain.c') + - [test_hashmap_ordered_c], - [], [], [], '', 'timeout=180'], - - [files('test-set-disable-mempool.c'), - [], - [threads]], - - [files('test-tables.c'), - [libcore, - libjournal_core, - libudevd_core, - libshared], - [threads, - libseccomp, - libmount, - libxz, - liblz4, - libblkid, - libselinux], - [core_includes, journal_includes, udev_includes]], - - [files('test-ipcrm.c'), - [], [], [], '', 'unsafe'], - - [files('test-btrfs.c'), - [], [], [], '', 'manual'], - - [files('test-netlink-manual.c'), - [], - [libkmod], - [], 'HAVE_KMOD', 'manual'], - - [files('test-sbat.c'), - [], [], [], 'HAVE_GNU_EFI', '', - ['-I@0@'.format(efi_config_h_dir)]], - - [files('test-cgroup-cpu.c'), - [libcore, - libshared], - [], - core_includes], - - [files('test-cgroup-unit-default.c'), - [libcore, - libshared], - [], - core_includes], - - [files('test-cgroup-mask.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes], - - [files('test-varlink.c'), - [], - [threads]], - - [files('test-chase-symlinks.c'), - [], [], [], '', 'manual'], - - [files('test-path.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes, '', 'timeout=120'], - - [files('test-execute.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes, '', 'timeout=360'], - - [files('test-install.c'), - [libcore, - libshared], - [], - core_includes, '', 'manual'], - - [files('test-watchdog.c'), - [], [], [], '', 'unsafe'], - - [files('test-sched-prio.c'), - [libcore, - libshared], - [threads, - librt, - libseccomp, - libselinux, - libmount, - libblkid], - core_includes], - - [files('test-af-list.c') + - generated_gperf_headers], - - [files('test-arphrd-util.c') + - generated_gperf_headers], - - [files('test-errno-list.c') + - generated_gperf_headers], - - [files('test-ip-protocol-list.c') + - shared_generated_gperf_headers], - - [files('test-utmp.c'), - [], [], [], 'ENABLE_UTMP'], - - [files('test-udev.c'), - [libudevd_core, - libshared], - [threads, - librt, - libblkid, - libkmod, - libacl, - libselinux], - udev_includes, '', 'manual'], - - [files('test-cryptolib.c'), - [libshared], - [lib_openssl_or_gcrypt], - [], 'HAVE_OPENSSL_OR_GCRYPT'], - - [files('test-nss-hosts.c', - 'nss-test-util.c'), - [], - [libdl], - [], 'ENABLE_NSS', 'timeout=120'], - - [files('test-nss-users.c', - 'nss-test-util.c'), - [], - [libdl], - [], 'ENABLE_NSS'], - - [files('test-qrcode-util.c'), - [], - [libdl]], - - [files('test-nscd-flush.c'), - [], [], [], 'ENABLE_NSCD', 'manual'], + { + 'sources' : files('test-acl-util.c'), + 'condition' : 'HAVE_ACL', + }, + { + 'sources' : [ + files('test-af-list.c'), + generated_gperf_headers, + ], + }, + { + 'sources' : [ + files('test-arphrd-util.c'), + generated_gperf_headers, + ], + }, + { + 'sources' : files('test-ask-password-api.c'), + 'type' : 'manual', + }, + { + 'sources' : files('test-async.c'), + 'timeout' : 120, + }, + { + 'sources' : files('test-boot-timestamps.c'), + 'condition' : 'ENABLE_EFI', + }, + { + 'sources' : files('test-bpf-devices.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-bpf-firewall.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-bpf-foreign-programs.c'), + 'base' : test_core_base, + }, + { + 'sources' : files('test-bpf-lsm.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-btrfs.c'), + 'type' : 'manual', + }, + { + 'sources' : [ + files('test-cap-list.c'), + generated_gperf_headers, + ], + 'dependencies' : libcap, + }, + { + 'sources' : files('test-capability.c'), + 'dependencies' : libcap, + }, + { + 'sources' : files('test-cgroup-cpu.c'), + 'base' : test_core_base, + }, + { + 'sources' : files('test-cgroup-mask.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-cgroup-unit-default.c'), + 'base' : test_core_base, + }, + { + 'sources' : files('test-chase-symlinks.c'), + 'type' : 'manual', + }, + { + 'sources' : files('test-chown-rec.c'), + 'base' : test_core_base, + }, + { + 'sources' : files('test-compress-benchmark.c'), + 'link_with' : [ + libbasic_compress, + libshared, + ], + 'timeout' : 90, + }, + { + 'sources' : files('test-compress.c'), + 'link_with' : [ + libbasic_compress, + libshared, + ], + }, + { + 'sources' : files('test-cryptolib.c'), + 'link_with' : libshared, + 'dependencies' : lib_openssl_or_gcrypt, + 'condition' : 'HAVE_OPENSSL_OR_GCRYPT', + }, + { + 'sources' : files('test-dlopen-so.c'), + 'dependencies' : libp11kit_cflags + }, + { + 'sources' : files('test-emergency-action.c'), + 'base' : test_core_base, + }, + { + 'sources' : files('test-engine.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : [ + files('test-errno-list.c'), + generated_gperf_headers, + ], + }, + { + 'sources' : files('test-execute.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + 'timeout' : 360, + }, + { + 'sources' : files('test-fd-util.c'), + 'dependencies' : libseccomp, + }, + { + 'sources' : [files( + 'test-hashmap.c', + 'test-hashmap-plain.c'), + test_hashmap_ordered_c, + ], + 'timeout' : 180, + }, + { + 'sources' : files('test-install.c'), + 'base' : test_core_base, + 'type' : 'manual', + }, + { + 'sources' : [ + files('test-ip-protocol-list.c'), + shared_generated_gperf_headers, + ], + }, + { + 'sources' : files('test-ipcrm.c'), + 'type' : 'unsafe', + }, + { + 'sources' : files('test-job-type.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-json.c'), + 'dependencies' : libm, + }, + { + 'sources' : files('test-libcrypt-util.c'), + 'dependencies' : libcrypt, + 'timeout' : 120, + }, + { + 'sources' : files('test-libmount.c'), + 'dependencies' : [ + libmount, + threads, + ], + }, + { + 'sources' : files('test-load-fragment.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-loop-block.c'), + 'dependencies' : [threads, libblkid], + 'base' : test_core_base, + 'parallel' : false, + }, + { + 'sources' : files('test-loopback.c'), + 'dependencies' : common_test_dependencies, + }, + { + 'sources' : files('test-manager.c'), + 'base' : test_core_base, + }, + { + 'sources' : files('test-math-util.c'), + 'dependencies' : libm, + }, + { + 'sources' : files('test-namespace.c'), + 'dependencies' : [ + libblkid, + threads, + ], + 'base' : test_core_base, + }, + { + 'sources' : files('test-netlink-manual.c'), + 'dependencies' : libkmod, + 'condition' : 'HAVE_KMOD', + 'type' : 'manual', + }, + { + 'sources' : files('test-ns.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + 'type' : 'manual', + }, + { + 'sources' : files('test-nscd-flush.c'), + 'condition' : 'ENABLE_NSCD', + 'type' : 'manual', + }, + { + 'sources' : files( + 'test-nss-hosts.c', + 'nss-test-util.c', + ), + 'dependencies' : libdl, + 'condition' : 'ENABLE_NSS', + 'timeout' : 120, + }, + { + 'sources' : files( + 'test-nss-users.c', + 'nss-test-util.c', + ), + 'dependencies' : libdl, + 'condition' : 'ENABLE_NSS', + }, + { + 'sources' : files('test-parse-util.c'), + 'dependencies' : libm, + }, + { + 'sources' : files('test-path.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + 'timeout' : 120, + }, + { + 'sources' : files('test-process-util.c'), + 'dependencies' : threads, + }, + { + 'sources' : files('test-qrcode-util.c'), + 'dependencies' : libdl, + }, + { + 'sources' : files('test-random-util.c'), + 'dependencies' : libm, + 'timeout' : 120, + }, + { + 'sources' : files('test-sbat.c'), + 'condition' : 'HAVE_GNU_EFI', + 'c_args' : '-I@0@'.format(efi_config_h_dir), + }, + { + 'sources' : files('test-sched-prio.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-seccomp.c'), + 'dependencies' : libseccomp, + 'condition' : 'HAVE_SECCOMP', + }, + { + 'sources' : files('test-set-disable-mempool.c'), + 'dependencies' : threads, + }, + { + 'sources' : files('test-sizeof.c'), + 'link_with' : libbasic, + }, + { + 'sources' : files('test-tables.c'), + 'link_with' : [ + libcore, + libjournal_core, + libshared, + libudevd_core, + ], + 'dependencies' : [ + libblkid, + liblz4, + libmount, + libseccomp, + libselinux, + libxz, + threads, + ], + 'includes' : [ + core_includes, + journal_includes, + udev_includes, + ], + }, + { + 'sources' : files('test-udev.c'), + 'link_with' : [ + libshared, + libudevd_core, + ], + 'dependencies' : [ + libacl, + libblkid, + libkmod, + librt, + libselinux, + threads, + ], + 'includes' : udev_includes, + 'type' : 'manual', + }, + { + 'sources' : files('test-unit-name.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-unit-serialize.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-utmp.c'), + 'condition' : 'ENABLE_UTMP', + }, + { + 'sources' : files('test-varlink.c'), + 'dependencies' : threads, + }, + { + 'sources' : files('test-watch-pid.c'), + 'dependencies' : common_test_dependencies, + 'base' : test_core_base, + }, + { + 'sources' : files('test-watchdog.c'), + 'type' : 'unsafe', + }, ] ############################################################ @@ -578,24 +548,27 @@ tests += [ # define some tests here, because the link_with deps were not defined earlier tests += [ - [files('../libsystemd/sd-bus/test-bus-error.c'), - [libshared_static, - libsystemd_static]], - - [files('../libsystemd/sd-device/test-sd-device-thread.c'), - [libsystemd], - [threads]], - - [files('../libudev/test-udev-device-thread.c'), - [libudev], - [threads]], -] - -tests += [ - [files('test-socket-bind.c'), - [libcore, - libshared], - [libdl], - core_includes, - 'BPF_FRAMEWORK'], + { + 'sources' : files('../libsystemd/sd-bus/test-bus-error.c'), + 'link_with' : [ + libshared_static, + libsystemd_static, + ], + }, + { + 'sources' : files('../libsystemd/sd-device/test-sd-device-thread.c'), + 'link_with' : libsystemd, + 'dependencies' : threads, + }, + { + 'sources' : files('../libudev/test-udev-device-thread.c'), + 'link_with' : libudev, + 'dependencies' : threads, + }, + { + 'sources' : files('test-socket-bind.c'), + 'dependencies' : libdl, + 'condition' : 'BPF_FRAMEWORK', + 'base' : test_core_base, + }, ] diff --git a/src/timesync/meson.build b/src/timesync/meson.build index c215ce72c9b..f847728f62f 100644 --- a/src/timesync/meson.build +++ b/src/timesync/meson.build @@ -54,8 +54,12 @@ endif ############################################################ tests += [ - [files('test-timesync.c'), - [libtimesyncd_core, - libshared], - [libm]], + { + 'sources' : files('test-timesync.c'), + 'link_with' : [ + libshared, + libtimesyncd_core, + ], + 'dependencies' : libm, + }, ] diff --git a/src/tmpfiles/meson.build b/src/tmpfiles/meson.build index 816faa93cff..d0a1359501e 100644 --- a/src/tmpfiles/meson.build +++ b/src/tmpfiles/meson.build @@ -6,6 +6,10 @@ systemd_tmpfiles_sources = files( ) tests += [ - [files('test-offline-passwd.c', - 'offline-passwd.c')], + { + 'sources' : files( + 'test-offline-passwd.c', + 'offline-passwd.c', + ), + }, ] diff --git a/src/udev/meson.build b/src/udev/meson.build index f17b3c1cf30..9d647dd6056 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -180,25 +180,28 @@ fuzzers += [ 'fido_id/fido_id_desc.c')], ] +test_libudev_base = { + 'link_with' : [libudevd_core, libshared], + 'dependencies' : [threads, libacl], +} + tests += [ - [files('test-udev-event.c'), - [libudevd_core, - libshared], - [threads, - libacl]], - - [files('test-udev-node.c'), - [libudevd_core, - libshared], - [threads, - libacl]], - - [files('test-udev-builtin.c'), - [libudevd_core, - libshared], - [threads, - libacl]], - - [files('fido_id/test-fido-id-desc.c', - 'fido_id/fido_id_desc.c')], + { + 'sources' : files( + 'fido_id/test-fido-id-desc.c', + 'fido_id/fido_id_desc.c', + ), + }, + { + 'sources' : files('test-udev-builtin.c'), + 'base' : test_libudev_base, + }, + { + 'sources' : files('test-udev-event.c'), + 'base' : test_libudev_base, + }, + { + 'sources' : files('test-udev-node.c'), + 'base' : test_libudev_base, + }, ] diff --git a/src/xdg-autostart-generator/meson.build b/src/xdg-autostart-generator/meson.build index 5788fd4ae39..7f7d18bba66 100644 --- a/src/xdg-autostart-generator/meson.build +++ b/src/xdg-autostart-generator/meson.build @@ -6,8 +6,12 @@ systemd_xdg_autostart_generator_sources = files( ) tests += [ - [files('test-xdg-autostart.c', - 'xdg-autostart-service.c')], + { + 'sources' : files( + 'test-xdg-autostart.c', + 'xdg-autostart-service.c', + ), + }, ] fuzzers += [ From a9a7153cd24666edb67a4917b9a95fa41cd1929c Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 27 Jan 2023 13:22:36 +0100 Subject: [PATCH 3/4] meson: Add simple_fuzzers list --- meson.build | 5 +++++ src/fuzz/meson.build | 36 +++++++++++++----------------------- src/libsystemd/meson.build | 9 ++++----- src/udev/meson.build | 6 ++++-- 4 files changed, 26 insertions(+), 30 deletions(-) diff --git a/meson.build b/meson.build index d8ab43ba6cf..32fc9e966d6 100644 --- a/meson.build +++ b/meson.build @@ -1938,6 +1938,7 @@ conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests) tests = [] simple_tests = [] fuzzers = [] +simple_fuzzers = [] catalogs = [] ############################################################ @@ -4179,6 +4180,10 @@ endif ############################################################ +foreach fuzzer : simple_fuzzers + fuzzers += [ [[fuzzer]] ] +endforeach + fuzzer_exes = [] foreach tuple : fuzzers diff --git a/src/fuzz/meson.build b/src/fuzz/meson.build index 6f36536f1b5..02a722edb1e 100644 --- a/src/fuzz/meson.build +++ b/src/fuzz/meson.build @@ -1,25 +1,15 @@ # SPDX-License-Identifier: LGPL-2.1-or-later -fuzzers += [ - [files('fuzz-bootspec.c')], - - [files('fuzz-bus-label.c')], - - [files('fuzz-calendarspec.c')], - - [files('fuzz-catalog.c')], - - [files('fuzz-compress.c')], - - [files('fuzz-env-file.c')], - - [files('fuzz-hostname-setup.c')], - - [files('fuzz-json.c')], - - [files('fuzz-time-util.c')], - - [files('fuzz-udev-database.c')], - - [files('fuzz-varlink.c')], -] +simple_fuzzers += files( + 'fuzz-bootspec.c', + 'fuzz-bus-label.c', + 'fuzz-calendarspec.c', + 'fuzz-catalog.c', + 'fuzz-compress.c', + 'fuzz-env-file.c', + 'fuzz-hostname-setup.c', + 'fuzz-json.c', + 'fuzz-time-util.c', + 'fuzz-udev-database.c', + 'fuzz-varlink.c', +) diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build index 3478d9e5a05..23fa7c20cae 100644 --- a/src/libsystemd/meson.build +++ b/src/libsystemd/meson.build @@ -241,8 +241,7 @@ endif ############################################################ -fuzzers += [ - [files('sd-bus/fuzz-bus-message.c')], - - [files('sd-bus/fuzz-bus-match.c')], -] +simple_fuzzers += files( + 'sd-bus/fuzz-bus-match.c', + 'sd-bus/fuzz-bus-message.c', +) diff --git a/src/udev/meson.build b/src/udev/meson.build index 9d647dd6056..ab0489c6dde 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -160,6 +160,10 @@ if install_sysconfdir mkdir_p.format(sysconfdir / 'udev/rules.d')) endif +simple_fuzzers += files( + 'fuzz-udev-rule-parse-value.c', +) + fuzzers += [ [files('net/fuzz-link-parser.c'), [libudevd_core, @@ -174,8 +178,6 @@ fuzzers += [ [threads, libacl]], - [files('fuzz-udev-rule-parse-value.c')], - [files('fido_id/fuzz-fido-id-desc.c', 'fido_id/fido_id_desc.c')], ] From 2ed35b2f3e183ad6455142bbca455167e3b08f39 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Wed, 25 Jan 2023 17:39:12 +0100 Subject: [PATCH 4/4] meson: Use dicts for fuzzer definitions --- meson.build | 27 ++++---- src/boot/efi/meson.build | 22 ++++++- src/core/meson.build | 12 ++-- src/journal-remote/meson.build | 13 ++-- src/journal/meson.build | 82 ++++++++++++++----------- src/libsystemd-network/meson.build | 51 ++++++++------- src/network/meson.build | 27 ++++---- src/nspawn/meson.build | 22 ++++--- src/resolve/meson.build | 36 ++++++----- src/systemctl/meson.build | 12 ++-- src/udev/meson.build | 35 ++++++----- src/xdg-autostart-generator/meson.build | 8 ++- 12 files changed, 205 insertions(+), 142 deletions(-) diff --git a/meson.build b/meson.build index 32fc9e966d6..347e09b0e0b 100644 --- a/meson.build +++ b/meson.build @@ -4181,17 +4181,15 @@ endif ############################################################ foreach fuzzer : simple_fuzzers - fuzzers += [ [[fuzzer]] ] + fuzzers += { 'sources' : [fuzzer] } endforeach fuzzer_exes = [] -foreach tuple : fuzzers - sources = tuple[0] - link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared] - dependencies = tuple.length() > 2 ? tuple[2] : [] - incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes - defs = tuple.length() > 4 ? tuple[4] : [] +foreach fuzzer : fuzzers + sources = fuzzer.get('sources') + base = fuzzer.get('base', {}) + dependencies = [base.get('dependencies', []), fuzzer.get('dependencies', [])] link_args = [] if want_ossfuzz @@ -4203,7 +4201,7 @@ foreach tuple : fuzzers link_args += ['-fsanitize=fuzzer'] endif else - sources += 'src/fuzz/fuzz-main.c' + sources += files('src/fuzz/fuzz-main.c') endif sources += fuzz_generated_directives @@ -4213,11 +4211,14 @@ foreach tuple : fuzzers exe = executable( name, sources, - include_directories : [incs, include_directories('src/fuzz')], - link_with : link_with, - dependencies : [dependencies, - versiondep], - c_args : defs + test_cflags, + include_directories : [ + base.get('includes', []), + fuzzer.get('includes', includes), + include_directories('src/fuzz'), + ], + link_with : [base.get('link_with', []), fuzzer.get('link_with', libshared)], + dependencies : [dependencies, versiondep], + c_args : [test_cflags, fuzzer.get('c_args', [])], link_args: link_args, install : false, build_by_default : fuzzer_build) diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index 80061a559bb..8c509458a07 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -411,9 +411,25 @@ if efi_arch[1] in ['ia32', 'x86_64', 'arm', 'aarch64'] }, ] fuzzers += [ - [files('fuzz-bcd.c', 'bcd.c', 'efi-string.c')], - [files('fuzz-efi-string.c', 'efi-string.c')], - [files('fuzz-efi-printf.c', 'efi-string.c')], + { + '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 diff --git a/src/core/meson.build b/src/core/meson.build index 65b34bb467b..15df4485cae 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -185,8 +185,12 @@ test_core_base = { } fuzzers += [ - [files('fuzz-unit-file.c'), - [libcore, - libshared], - [libmount]], + { + 'sources' : files('fuzz-unit-file.c'), + 'link_with' : [ + libcore, + libshared + ], + 'dependencies' : libmount, + }, ] diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index ac375741b0c..74f01b04764 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -69,9 +69,12 @@ endif ############################################################ fuzzers += [ - [files('fuzz-journal-remote.c'), - [libsystemd_journal_remote, - libshared], - [], - [journal_includes]], + { + 'sources' : files('fuzz-journal-remote.c'), + 'link_with' : [ + libshared, + libsystemd_journal_remote, + ], + 'includes' : journal_includes, + }, ] diff --git a/src/journal/meson.build b/src/journal/meson.build index 8547a902228..c9ff54c9917 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -111,40 +111,52 @@ tests += [ }, ] +fuzzer_journald_base = { + 'link_with' : [libjournal_core, libshared], + 'dependencies' : [libselinux], +} + fuzzers += [ - [files('fuzz-journald-audit.c', - 'fuzz-journald.c'), - [libjournal_core, - libshared], - [libselinux]], - - [files('fuzz-journald-kmsg.c', - 'fuzz-journald.c'), - [libjournal_core, - libshared], - [libselinux]], - - [files('fuzz-journald-native.c', - 'fuzz-journald.c'), - [libjournal_core, - libshared], - [libselinux]], - - [files('fuzz-journald-native-fd.c', - 'fuzz-journald.c'), - [libjournal_core, - libshared], - [libselinux]], - - [files('fuzz-journald-stream.c', - 'fuzz-journald.c'), - [libjournal_core, - libshared], - [libselinux]], - - [files('fuzz-journald-syslog.c', - 'fuzz-journald.c'), - [libjournal_core, - libshared], - [libselinux]], + { + 'sources' : files( + 'fuzz-journald-audit.c', + 'fuzz-journald.c', + ), + 'base' : fuzzer_journald_base, + }, + { + 'sources' : files( + 'fuzz-journald-kmsg.c', + 'fuzz-journald.c', + ), + 'base' : fuzzer_journald_base, + }, + { + 'sources' : files( + 'fuzz-journald-native.c', + 'fuzz-journald.c', + ), + 'base' : fuzzer_journald_base, + }, + { + 'sources' : files( + 'fuzz-journald-native-fd.c', + 'fuzz-journald.c', + ), + 'base' : fuzzer_journald_base, + }, + { + 'sources' : files( + 'fuzz-journald-stream.c', + 'fuzz-journald.c', + ), + 'base' : fuzzer_journald_base, + }, + { + 'sources' : files( + 'fuzz-journald-syslog.c', + 'fuzz-journald.c', + ), + 'base' : fuzzer_journald_base, + }, ] diff --git a/src/libsystemd-network/meson.build b/src/libsystemd-network/meson.build index 21dc85d8de0..85d4afeb058 100644 --- a/src/libsystemd-network/meson.build +++ b/src/libsystemd-network/meson.build @@ -91,28 +91,33 @@ tests += [ }, ] +fuzzer_network_base = { + 'link_with' : [libshared, libsystemd_network], +} + fuzzers += [ - [files('fuzz-dhcp-client.c'), - [libshared, - libsystemd_network]], - - [files('fuzz-dhcp6-client.c'), - [libshared, - libsystemd_network]], - - [files('fuzz-dhcp-server.c'), - [libsystemd_network, - libshared]], - - [files('fuzz-dhcp-server-relay.c'), - [libsystemd_network, - libshared]], - - [files('fuzz-lldp-rx.c'), - [libshared, - libsystemd_network]], - - [files('fuzz-ndisc-rs.c'), - [libshared, - libsystemd_network]], + { + 'sources' : files('fuzz-dhcp-client.c'), + 'base' : fuzzer_network_base, + }, + { + 'sources' : files('fuzz-dhcp6-client.c'), + 'base' : fuzzer_network_base, + }, + { + 'sources' : files('fuzz-dhcp-server.c'), + 'base' : fuzzer_network_base, + }, + { + 'sources' : files('fuzz-dhcp-server-relay.c'), + 'base' : fuzzer_network_base, + }, + { + 'sources' : files('fuzz-lldp-rx.c'), + 'base' : fuzzer_network_base, + }, + { + 'sources' : files('fuzz-ndisc-rs.c'), + 'base' : fuzzer_network_base, + }, ] diff --git a/src/network/meson.build b/src/network/meson.build index 0b68b74b459..91572ba132c 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -171,20 +171,21 @@ if conf.get('ENABLE_NETWORKD') == 1 endif endif -fuzzers += [ - [files('fuzz-netdev-parser.c'), - [libnetworkd_core, - libsystemd_network, - networkd_link_with], - [threads], - network_includes], +fuzzer_network_base = { + 'link_with' : [libnetworkd_core, libsystemd_network, networkd_link_with], + 'dependencies' : threads, + 'includes' : network_includes, +} - [files('fuzz-network-parser.c'), - [libnetworkd_core, - libsystemd_network, - networkd_link_with], - [threads], - network_includes], +fuzzers += [ + { + 'sources' : files('fuzz-netdev-parser.c'), + 'base' : fuzzer_network_base, + }, + { + 'sources' : files('fuzz-network-parser.c'), + 'base' : fuzzer_network_base, + }, ] test_network_base = { diff --git a/src/nspawn/meson.build b/src/nspawn/meson.build index 9d6bc21bbf1..43e3e188b2f 100644 --- a/src/nspawn/meson.build +++ b/src/nspawn/meson.build @@ -66,14 +66,18 @@ tests += [ }, ] -fuzzers += [ - [files('fuzz-nspawn-settings.c'), - [libshared, - libnspawn_core], - [libseccomp]], +fuzzer_nspawn_base = { + 'link_with' : [libshared, libnspawn_core], + 'dependencies' : libseccomp +} - [files('fuzz-nspawn-oci.c'), - [libshared, - libnspawn_core], - [libseccomp]], +fuzzers += [ + { + 'sources' : files('fuzz-nspawn-settings.c'), + 'base' : fuzzer_nspawn_base, + }, + { + 'sources' : files('fuzz-nspawn-oci.c'), + 'base' : fuzzer_nspawn_base, + }, ] diff --git a/src/resolve/meson.build b/src/resolve/meson.build index b5083685c45..8166118c74f 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -187,23 +187,27 @@ tests += [ }, ] +fuzzer_resolve_base = { + 'link_with' : [libsystemd_resolve_core, libshared], + 'dependencies' : [lib_openssl_or_gcrypt, libm], +} + fuzzers += [ - [files('fuzz-dns-packet.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm]], - [files('fuzz-etc-hosts.c', - 'resolved-etc-hosts.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm]], - [files('fuzz-resource-record.c'), - [libsystemd_resolve_core, - libshared], - [lib_openssl_or_gcrypt, - libm]], + { + 'sources' : files('fuzz-dns-packet.c'), + 'base' : fuzzer_resolve_base, + }, + { + 'sources' : files( + 'fuzz-etc-hosts.c', + 'resolved-etc-hosts.c', + ), + 'base' : fuzzer_resolve_base, + }, + { + 'sources' : files('fuzz-resource-record.c'), + 'base' : fuzzer_resolve_base, + }, ] systemd_resolved_sources += files('resolved.c') diff --git a/src/systemctl/meson.build b/src/systemctl/meson.build index 30d0f576754..07049ca920f 100644 --- a/src/systemctl/meson.build +++ b/src/systemctl/meson.build @@ -48,8 +48,12 @@ else endif fuzzers += [ - [files('fuzz-systemctl-parse-argv.c') + - systemctl_sources, - systemctl_link_with, - [], [], ['-DFUZZ_SYSTEMCTL_PARSE_ARGV']] + { + 'sources' : [ + files('fuzz-systemctl-parse-argv.c'), + systemctl_sources, + ], + 'link_with' : systemctl_link_with, + 'c_args' : '-DFUZZ_SYSTEMCTL_PARSE_ARGV', + }, ] diff --git a/src/udev/meson.build b/src/udev/meson.build index ab0489c6dde..3f4ab00ac95 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -164,22 +164,27 @@ simple_fuzzers += files( 'fuzz-udev-rule-parse-value.c', ) +fuzzer_udev_base = { + 'link_with' : [libudevd_core, libshared], + 'dependencies' : [threads, libacl], +} + fuzzers += [ - [files('net/fuzz-link-parser.c'), - [libudevd_core, - libshared], - [threads, - libacl], - udev_includes], - - [files('fuzz-udev-rules.c'), - [libudevd_core, - libshared], - [threads, - libacl]], - - [files('fido_id/fuzz-fido-id-desc.c', - 'fido_id/fido_id_desc.c')], + { + 'sources' : files('net/fuzz-link-parser.c'), + 'includes' : udev_includes, + 'base' : fuzzer_udev_base, + }, + { + 'sources' : files('fuzz-udev-rules.c'), + 'base' : fuzzer_udev_base, + }, + { + 'sources' : files( + 'fido_id/fuzz-fido-id-desc.c', + 'fido_id/fido_id_desc.c', + ), + }, ] test_libudev_base = { diff --git a/src/xdg-autostart-generator/meson.build b/src/xdg-autostart-generator/meson.build index 7f7d18bba66..c7e56608814 100644 --- a/src/xdg-autostart-generator/meson.build +++ b/src/xdg-autostart-generator/meson.build @@ -15,6 +15,10 @@ tests += [ ] fuzzers += [ - [files('fuzz-xdg-desktop.c', - 'xdg-autostart-service.c')], + { + 'sources' : files( + 'fuzz-xdg-desktop.c', + 'xdg-autostart-service.c', + ), + }, ]