summaryrefslogtreecommitdiffstats
path: root/test/fuzz/meson.build
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:00:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:00:47 +0000
commit2cb7e0aaedad73b076ea18c6900b0e86c5760d79 (patch)
treeda68ca54bb79f4080079bf0828acda937593a4e1 /test/fuzz/meson.build
parentInitial commit. (diff)
downloadsystemd-upstream.tar.xz
systemd-upstream.zip
Adding upstream version 247.3.upstream/247.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/fuzz/meson.build')
-rw-r--r--test/fuzz/meson.build43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build
new file mode 100644
index 0000000..7a83961
--- /dev/null
+++ b/test/fuzz/meson.build
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+# The 'optimization' option was introduced in meson 0.48.0, so let's keep
+# the code compatible with older versions as well
+if meson.version().version_compare('>=0.48.0')
+ optimization = '--optimization=@0@'.format(get_option('optimization'))
+else
+ optimization = ''
+endif
+
+sanitize_address_undefined = custom_target(
+ 'sanitize-address-undefined-fuzzers',
+ output : 'sanitize-address-undefined-fuzzers',
+ command : [meson_build_sh,
+ project_source_root,
+ '@OUTPUT@',
+ 'fuzzers',
+ '-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined @0@'.format(optimization),
+ ' '.join(cc.cmd_array()),
+ cxx_cmd])
+
+sanitizers = [['address,undefined', sanitize_address_undefined]]
+
+if git.found()
+ out = run_command(
+ git,
+ '--git-dir=@0@/.git'.format(project_source_root),
+ 'ls-files', ':/test/fuzz/*/*')
+else
+ out = run_command(
+ 'sh', '-c', 'ls @0@/test/fuzz/*/*'.format(project_source_root))
+endif
+
+fuzz_regression_tests = []
+foreach p : out.stdout().split()
+ # Remove the last entry which is ''.
+ #
+ # Also, backslashes get mangled, so skip test. See
+ # https://github.com/mesonbuild/meson/issues/1564.
+ if not p.contains('\\')
+ fuzz_regression_tests += p
+ endif
+endforeach