diff options
Diffstat (limited to 'fuzz/meson.build')
| -rw-r--r-- | fuzz/meson.build | 95 |
1 files changed, 57 insertions, 38 deletions
diff --git a/fuzz/meson.build b/fuzz/meson.build index c7652aa..1b61551 100644 --- a/fuzz/meson.build +++ b/fuzz/meson.build @@ -1,40 +1,59 @@ cbindgen = find_program('cbindgen') -gencorpus = executable( - 'gencorpus', - 'gencorpus.rs', - dependencies: [mon], - link_with: [gentoo_utils], -) - -corpus_directory = meson.current_build_dir() / 'corpus' - -corpus = custom_target( - 'corpus', - output: 'corpus', - command: [gencorpus, corpus_directory], -) - -fuzz_h = custom_target( - 'fuzz_h', - input: 'fuzz.rs', - output: 'fuzz.h', - command: [cbindgen, '@INPUT@', '-o', '@OUTPUT'], -) - -fuzz_rs = static_library( - 'fuzz_rs', - 'fuzz.rs', - rust_abi: 'c', - rust_args: [ - '-Cpasses=sancov-module', - '-Cllvm-args=-sanitizer-coverage-level=3', - '-Cllvm-args=-sanitizer-coverage-inline-8bit-counters', - ], - dependencies: [mon], - link_with: [gentoo_utils], -) - -fuzz = executable('fuzz', link_args: ['-fsanitize=fuzzer'], link_with: [fuzz_rs]) - -test('fuzz', fuzz, args: [corpus_directory], depends: [corpus], timeout: 0) +fuzzers = {} + +subdir('atom') + +foreach fuzzer, sources : fuzzers + gencorpus_rs = sources[0] + fuzz_rs = sources[1] + + gencorpus = executable( + fuzzer + '_' + 'gencorpus', + gencorpus_rs, + dependencies: [mon], + link_with: [gentoo_utils], + ) + + corpus_directory = fuzzer + '_' + 'corpus' + + corpus = custom_target( + fuzzer + '_' + 'corpus', + output: fuzzer + '_' + 'corpus', + command: [gencorpus, corpus_directory], + ) + + fuzz_h = custom_target( + fuzzer + '_' + 'fuzz_h', + input: fuzz_rs, + output: fuzzer + '_' + 'fuzz.h', + command: [cbindgen, '@INPUT@', '-o', '@OUTPUT'], + ) + + fuzz_rs = static_library( + fuzzer + '.rs', + fuzz_rs, + rust_abi: 'c', + rust_args: [ + '-Cpasses=sancov-module', + '-Cllvm-args=-sanitizer-coverage-level=3', + '-Cllvm-args=-sanitizer-coverage-inline-8bit-counters', + ], + dependencies: [mon], + link_with: [gentoo_utils], + ) + + fuzz = executable( + fuzzer + '_' + 'fuzzer', + link_args: ['-fsanitize=fuzzer'], + link_with: [fuzz_rs], + ) + + test( + fuzzer + '_' + 'fuzz', + fuzz, + args: [corpus_directory], + depends: [corpus], + timeout: 0, + ) +endforeach |
