summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-10-05 19:46:18 +0200
committerMax Kellermann <max@musicpd.org>2020-10-05 20:25:26 +0200
commitdffd5831f83e31b7d07962d69922d64131c6880a (patch)
tree0aab38c13ff70859eaa0cbfa0cf6b1e1a9a42bcf /meson.build
parent8358b34efa8489617440ea7bb277d72cc26182f7 (diff)
test/fuzzer: a simple fuzzer using libFuzzer
This commit adds some basic infrastructure for fuzzers, and adds a fuzzer for the CUE sheet parser.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build12
1 files changed, 12 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index f5b7ad88a..fe37628a1 100644
--- a/meson.build
+++ b/meson.build
@@ -112,6 +112,13 @@ if get_option('buildtype') != 'debug'
]
endif
+if get_option('fuzzer')
+ fuzzer_flags = ['-fsanitize=fuzzer,address,undefined']
+ add_global_arguments(fuzzer_flags, language: 'cpp')
+ add_global_arguments(fuzzer_flags, language: 'c')
+ add_global_link_arguments(fuzzer_flags, language: 'cpp')
+endif
+
add_global_arguments(common_cxxflags + compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
add_global_arguments(common_cflags + c_compiler.get_supported_arguments(test_cflags), language: 'c')
add_global_link_arguments(compiler.get_supported_link_arguments(test_ldflags), language: 'cpp')
@@ -502,6 +509,7 @@ mpd = build_target(
chromaprint_dep,
],
link_args: link_args,
+ build_by_default: not get_option('fuzzer'),
install: not is_android and not is_haiku,
)
@@ -542,3 +550,7 @@ subdir('doc')
if get_option('test')
subdir('test')
endif
+
+if get_option('fuzzer')
+ subdir('test/fuzzer')
+endif