summaryrefslogtreecommitdiff
path: root/fuzz/meson.build
blob: c7652aa667a87ae5e385eeb1dced9761ac11f117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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)