mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-21 18:03:41 +03:00
meson: Use dicts for fuzzer definitions
This commit is contained in:
parent
a9a7153cd2
commit
2ed35b2f3e
27
meson.build
27
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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
},
|
||||
]
|
||||
|
@ -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,
|
||||
},
|
||||
]
|
||||
|
@ -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,
|
||||
},
|
||||
]
|
||||
|
@ -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,
|
||||
},
|
||||
]
|
||||
|
@ -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 = {
|
||||
|
@ -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,
|
||||
},
|
||||
]
|
||||
|
@ -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')
|
||||
|
@ -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',
|
||||
},
|
||||
]
|
||||
|
@ -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 = {
|
||||
|
@ -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',
|
||||
),
|
||||
},
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user