ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
594167
From a21bc03df9504c7a9b0c8e0e894d94f226a7a038 Mon Sep 17 00:00:00 2001
594167
From: Jan Janssen <medhefgo@web.de>
594167
Date: Tue, 11 Jan 2022 10:47:01 +0100
594167
Subject: [PATCH] meson: Use files() for fuzzers
594167
594167
Not having to provide the full path in the source tree is much
594167
nicer and the produced lists can also be used anywhere in the source
594167
tree.
594167
594167
(cherry picked from commit bbec46c817951225f1e535d3df95b82a114e502a)
594167
594167
Related: #2017035
594167
---
594167
 meson.build                             |  3 ++-
594167
 src/boot/efi/meson.build                |  2 +-
594167
 src/core/meson.build                    |  2 +-
594167
 src/fuzz/meson.build                    | 20 ++++++++++----------
594167
 src/journal-remote/meson.build          |  2 +-
594167
 src/journal/meson.build                 | 24 ++++++++++++------------
594167
 src/libsystemd-network/meson.build      |  8 ++++----
594167
 src/libsystemd/meson.build              |  4 ++--
594167
 src/network/meson.build                 |  4 ++--
594167
 src/nspawn/meson.build                  |  4 ++--
594167
 src/resolve/meson.build                 |  2 +-
594167
 src/systemctl/meson.build               |  7 ++++---
594167
 src/udev/meson.build                    | 11 +++++------
594167
 src/xdg-autostart-generator/meson.build |  6 +++---
594167
 14 files changed, 50 insertions(+), 49 deletions(-)
594167
594167
diff --git a/meson.build b/meson.build
594167
index 35ba29aecf..fdf02b8110 100644
594167
--- a/meson.build
594167
+++ b/meson.build
594167
@@ -3677,7 +3677,8 @@ foreach tuple : fuzzers
594167
                 sources += 'src/fuzz/fuzz-main.c'
594167
         endif
594167
 
594167
-        name = sources[0].split('/')[-1].split('.')[0]
594167
+        # FIXME: Use fs.stem() with meson >= 0.54.0
594167
+        name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
594167
 
594167
         exe = executable(
594167
                 name,
594167
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
594167
index 229771026d..3e948281f2 100644
594167
--- a/src/boot/efi/meson.build
594167
+++ b/src/boot/efi/meson.build
594167
@@ -359,7 +359,7 @@ if efi_arch[1] in ['ia32', 'x86_64', 'arm', 'aarch64']
594167
                  'HAVE_ZSTD'],
594167
         ]
594167
         fuzzers += [
594167
-                [['src/boot/efi/fuzz-bcd.c']],
594167
+                [files('fuzz-bcd.c')],
594167
         ]
594167
 endif
594167
 
594167
diff --git a/src/core/meson.build b/src/core/meson.build
594167
index d229d46779..97ac431763 100644
594167
--- a/src/core/meson.build
594167
+++ b/src/core/meson.build
594167
@@ -228,7 +228,7 @@ endif
594167
 ############################################################
594167
 
594167
 fuzzers += [
594167
-        [['src/core/fuzz-unit-file.c'],
594167
+        [files('fuzz-unit-file.c'),
594167
          [libcore,
594167
           libshared],
594167
          [libmount]],
594167
diff --git a/src/fuzz/meson.build b/src/fuzz/meson.build
594167
index 1ed1dd8251..d987f32b08 100644
594167
--- a/src/fuzz/meson.build
594167
+++ b/src/fuzz/meson.build
594167
@@ -1,23 +1,23 @@
594167
 # SPDX-License-Identifier: LGPL-2.1-or-later
594167
 
594167
 fuzzers += [
594167
-        [['src/fuzz/fuzz-catalog.c']],
594167
+        [files('fuzz-catalog.c')],
594167
 
594167
-        [['src/fuzz/fuzz-json.c']],
594167
+        [files('fuzz-json.c')],
594167
 
594167
-        [['src/fuzz/fuzz-varlink.c']],
594167
+        [files('fuzz-varlink.c')],
594167
 
594167
-        [['src/fuzz/fuzz-udev-database.c']],
594167
+        [files('fuzz-udev-database.c')],
594167
 
594167
-        [['src/fuzz/fuzz-compress.c']],
594167
+        [files('fuzz-compress.c')],
594167
 
594167
-        [['src/fuzz/fuzz-bus-label.c']],
594167
+        [files('fuzz-bus-label.c')],
594167
 
594167
-        [['src/fuzz/fuzz-env-file.c']],
594167
+        [files('fuzz-env-file.c')],
594167
 
594167
-        [['src/fuzz/fuzz-hostname-setup.c']],
594167
+        [files('fuzz-hostname-setup.c')],
594167
 
594167
-        [['src/fuzz/fuzz-calendarspec.c']],
594167
+        [files('fuzz-calendarspec.c')],
594167
 
594167
-        [['src/fuzz/fuzz-time-util.c']],
594167
+        [files('fuzz-time-util.c')],
594167
 ]
594167
diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build
594167
index 168d0ed6a3..1f3e0878ae 100644
594167
--- a/src/journal-remote/meson.build
594167
+++ b/src/journal-remote/meson.build
594167
@@ -76,7 +76,7 @@ endif
594167
 ############################################################
594167
 
594167
 fuzzers += [
594167
-        [['src/journal-remote/fuzz-journal-remote.c'],
594167
+        [files('fuzz-journal-remote.c'),
594167
          [libsystemd_journal_remote,
594167
           libshared],
594167
          [],
594167
diff --git a/src/journal/meson.build b/src/journal/meson.build
594167
index b9a63d5e2f..21c4d2561c 100644
594167
--- a/src/journal/meson.build
594167
+++ b/src/journal/meson.build
594167
@@ -116,38 +116,38 @@ tests += [
594167
 ]
594167
 
594167
 fuzzers += [
594167
-        [['src/journal/fuzz-journald-audit.c',
594167
-          'src/journal/fuzz-journald.c'],
594167
+        [files('fuzz-journald-audit.c',
594167
+               'fuzz-journald.c'),
594167
          [libjournal_core,
594167
           libshared],
594167
          [libselinux]],
594167
 
594167
-        [['src/journal/fuzz-journald-kmsg.c',
594167
-          'src/journal/fuzz-journald.c'],
594167
+        [files('fuzz-journald-kmsg.c',
594167
+               'fuzz-journald.c'),
594167
          [libjournal_core,
594167
           libshared],
594167
          [libselinux]],
594167
 
594167
-        [['src/journal/fuzz-journald-native.c',
594167
-          'src/journal/fuzz-journald.c'],
594167
+        [files('fuzz-journald-native.c',
594167
+               'fuzz-journald.c'),
594167
          [libjournal_core,
594167
           libshared],
594167
          [libselinux]],
594167
 
594167
-        [['src/journal/fuzz-journald-native-fd.c',
594167
-          'src/journal/fuzz-journald.c'],
594167
+        [files('fuzz-journald-native-fd.c',
594167
+               'fuzz-journald.c'),
594167
          [libjournal_core,
594167
           libshared],
594167
          [libselinux]],
594167
 
594167
-        [['src/journal/fuzz-journald-stream.c',
594167
-          'src/journal/fuzz-journald.c'],
594167
+        [files('fuzz-journald-stream.c',
594167
+               'fuzz-journald.c'),
594167
          [libjournal_core,
594167
           libshared],
594167
          [libselinux]],
594167
 
594167
-        [['src/journal/fuzz-journald-syslog.c',
594167
-          'src/journal/fuzz-journald.c'],
594167
+        [files('fuzz-journald-syslog.c',
594167
+               'fuzz-journald.c'),
594167
          [libjournal_core,
594167
           libshared],
594167
          [libselinux]],
594167
diff --git a/src/libsystemd-network/meson.build b/src/libsystemd-network/meson.build
594167
index 3923df48ea..6be409d8ad 100644
594167
--- a/src/libsystemd-network/meson.build
594167
+++ b/src/libsystemd-network/meson.build
594167
@@ -105,19 +105,19 @@ tests += [
594167
 ]
594167
 
594167
 fuzzers += [
594167
-        [['src/libsystemd-network/fuzz-dhcp6-client.c'],
594167
+        [files('fuzz-dhcp6-client.c'),
594167
          [libshared,
594167
           libsystemd_network]],
594167
 
594167
-        [['src/libsystemd-network/fuzz-dhcp-server.c'],
594167
+        [files('fuzz-dhcp-server.c'),
594167
          [libsystemd_network,
594167
           libshared]],
594167
 
594167
-        [['src/libsystemd-network/fuzz-lldp-rx.c'],
594167
+        [files('fuzz-lldp-rx.c'),
594167
          [libshared,
594167
           libsystemd_network]],
594167
 
594167
-        [['src/libsystemd-network/fuzz-ndisc-rs.c'],
594167
+        [files('fuzz-ndisc-rs.c'),
594167
          [libshared,
594167
           libsystemd_network]],
594167
 ]
594167
diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build
594167
index 42746e560f..2e5255d479 100644
594167
--- a/src/libsystemd/meson.build
594167
+++ b/src/libsystemd/meson.build
594167
@@ -316,7 +316,7 @@ endif
594167
 ############################################################
594167
 
594167
 fuzzers += [
594167
-        [['src/libsystemd/sd-bus/fuzz-bus-message.c']],
594167
+        [files('sd-bus/fuzz-bus-message.c')],
594167
 
594167
-        [['src/libsystemd/sd-bus/fuzz-bus-match.c']],
594167
+        [files('sd-bus/fuzz-bus-match.c')],
594167
 ]
594167
diff --git a/src/network/meson.build b/src/network/meson.build
594167
index a598701e4f..23743233fa 100644
594167
--- a/src/network/meson.build
594167
+++ b/src/network/meson.build
594167
@@ -261,14 +261,14 @@ if conf.get('ENABLE_NETWORKD') == 1
594167
 endif
594167
 
594167
 fuzzers += [
594167
-        [['src/network/fuzz-netdev-parser.c'],
594167
+        [files('fuzz-netdev-parser.c'),
594167
          [libnetworkd_core,
594167
           libsystemd_network,
594167
           networkd_link_with],
594167
          [threads],
594167
          network_includes],
594167
 
594167
-        [['src/network/fuzz-network-parser.c'],
594167
+        [files('fuzz-network-parser.c'),
594167
          [libnetworkd_core,
594167
           libsystemd_network,
594167
           networkd_link_with],
594167
diff --git a/src/nspawn/meson.build b/src/nspawn/meson.build
594167
index 3c1a9c6182..2934672e9a 100644
594167
--- a/src/nspawn/meson.build
594167
+++ b/src/nspawn/meson.build
594167
@@ -66,12 +66,12 @@ tests += [
594167
 ]
594167
 
594167
 fuzzers += [
594167
-        [['src/nspawn/fuzz-nspawn-settings.c'],
594167
+        [files('fuzz-nspawn-settings.c'),
594167
          [libshared,
594167
           libnspawn_core],
594167
          [libseccomp]],
594167
 
594167
-        [['src/nspawn/fuzz-nspawn-oci.c'],
594167
+        [files('fuzz-nspawn-oci.c'),
594167
          [libshared,
594167
           libnspawn_core],
594167
          [libseccomp]],
594167
diff --git a/src/resolve/meson.build b/src/resolve/meson.build
594167
index 4de50c3d8e..1fee993d0a 100644
594167
--- a/src/resolve/meson.build
594167
+++ b/src/resolve/meson.build
594167
@@ -216,7 +216,7 @@ tests += [
594167
 ]
594167
 
594167
 fuzzers += [
594167
-        [['src/resolve/fuzz-dns-packet.c'],
594167
+        [files('fuzz-dns-packet.c'),
594167
          [libsystemd_resolve_core,
594167
           libshared],
594167
          [lib_openssl_or_gcrypt,
594167
diff --git a/src/systemctl/meson.build b/src/systemctl/meson.build
594167
index 38bf33d49a..f0d405bb58 100644
594167
--- a/src/systemctl/meson.build
594167
+++ b/src/systemctl/meson.build
594167
@@ -83,7 +83,8 @@ else
594167
 endif
594167
 
594167
 fuzzers += [
594167
-        [['src/systemctl/fuzz-systemctl-parse-argv.c',
594167
-          systemctl_sources],
594167
+        [files('fuzz-systemctl-parse-argv.c') +
594167
+         systemctl_sources,
594167
          systemctl_link_with,
594167
-         [], [], ['-DFUZZ_SYSTEMCTL_PARSE_ARGV']]]
594167
+         [], [], ['-DFUZZ_SYSTEMCTL_PARSE_ARGV']]
594167
+]
594167
diff --git a/src/udev/meson.build b/src/udev/meson.build
594167
index 57fbf8c8fc..9fd0bcdd0e 100644
594167
--- a/src/udev/meson.build
594167
+++ b/src/udev/meson.build
594167
@@ -174,24 +174,23 @@ if install_sysconfdir
594167
 endif
594167
 
594167
 fuzzers += [
594167
-        [['src/udev/net/fuzz-link-parser.c',
594167
-          'src/fuzz/fuzz.h'],
594167
+        [files('net/fuzz-link-parser.c'),
594167
          [libudevd_core,
594167
           libshared],
594167
          [threads,
594167
           libacl],
594167
          udev_includes],
594167
 
594167
-        [['src/udev/fuzz-udev-rules.c'],
594167
+        [files('fuzz-udev-rules.c'),
594167
          [libudevd_core,
594167
           libshared],
594167
          [threads,
594167
           libacl]],
594167
 
594167
-        [['src/udev/fuzz-udev-rule-parse-value.c']],
594167
+        [files('fuzz-udev-rule-parse-value.c')],
594167
 
594167
-        [['src/udev/fido_id/fuzz-fido-id-desc.c',
594167
-          'src/udev/fido_id/fido_id_desc.c']],
594167
+        [files('fido_id/fuzz-fido-id-desc.c',
594167
+               'fido_id/fido_id_desc.c')],
594167
 ]
594167
 
594167
 tests += [
594167
diff --git a/src/xdg-autostart-generator/meson.build b/src/xdg-autostart-generator/meson.build
594167
index 6418f57c40..cdce66b6fc 100644
594167
--- a/src/xdg-autostart-generator/meson.build
594167
+++ b/src/xdg-autostart-generator/meson.build
594167
@@ -12,7 +12,7 @@ tests += [
594167
 ]
594167
 
594167
 fuzzers += [
594167
-        [['src/xdg-autostart-generator/fuzz-xdg-desktop.c',
594167
-          'src/xdg-autostart-generator/xdg-autostart-service.c',
594167
-          'src/xdg-autostart-generator/xdg-autostart-service.h']],
594167
+        [files('fuzz-xdg-desktop.c',
594167
+               'xdg-autostart-service.c',
594167
+               'xdg-autostart-service.h')],
594167
 ]