meson: allow fuzzers to be built even if fuzz testing is disabled
This makes commands like 'ninja -C build fuzz-journal-remote' or
'ninja -C build fuzzers' work, even if we have -Dfuzz-tests=false.
Two advantages: correctness of the meson declarations is verified even
if fuzzers are not built, and it easier to do a one-off build to check for
regressions or such.
Follow-up for 1763ef1d49
.
This commit is contained in:
parent
ce9067697b
commit
7e299ffe10
55
meson.build
55
meson.build
|
@ -3438,40 +3438,39 @@ endif
|
||||||
|
|
||||||
fuzzer_exes = []
|
fuzzer_exes = []
|
||||||
|
|
||||||
if fuzz_tests or fuzzer_build
|
foreach tuple : fuzzers
|
||||||
foreach tuple : fuzzers
|
sources = tuple[0]
|
||||||
sources = tuple[0]
|
link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
|
||||||
link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
|
dependencies = tuple[2]
|
||||||
dependencies = tuple[2]
|
defs = tuple.length() >= 4 ? tuple[3] : []
|
||||||
defs = tuple.length() >= 4 ? tuple[3] : []
|
incs = tuple.length() >= 5 ? tuple[4] : includes
|
||||||
incs = tuple.length() >= 5 ? tuple[4] : includes
|
link_args = []
|
||||||
link_args = []
|
|
||||||
|
|
||||||
if want_ossfuzz
|
if want_ossfuzz
|
||||||
|
dependencies += fuzzing_engine
|
||||||
|
elif want_libfuzzer
|
||||||
|
if fuzzing_engine.found()
|
||||||
dependencies += fuzzing_engine
|
dependencies += fuzzing_engine
|
||||||
elif want_libfuzzer
|
|
||||||
if fuzzing_engine.found()
|
|
||||||
dependencies += fuzzing_engine
|
|
||||||
else
|
|
||||||
link_args += ['-fsanitize=fuzzer']
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
sources += 'src/fuzz/fuzz-main.c'
|
link_args += ['-fsanitize=fuzzer']
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
sources += 'src/fuzz/fuzz-main.c'
|
||||||
|
endif
|
||||||
|
|
||||||
name = sources[0].split('/')[-1].split('.')[0]
|
name = sources[0].split('/')[-1].split('.')[0]
|
||||||
|
|
||||||
fuzzer_exes += executable(
|
fuzzer_exes += executable(
|
||||||
name,
|
name,
|
||||||
sources,
|
sources,
|
||||||
include_directories : [incs, include_directories('src/fuzz')],
|
include_directories : [incs, include_directories('src/fuzz')],
|
||||||
link_with : link_with,
|
link_with : link_with,
|
||||||
dependencies : dependencies,
|
dependencies : dependencies,
|
||||||
c_args : defs,
|
c_args : defs,
|
||||||
link_args: link_args,
|
link_args: link_args,
|
||||||
install : false)
|
install : false,
|
||||||
endforeach
|
build_by_default : fuzz_tests or fuzzer_build)
|
||||||
endif
|
endforeach
|
||||||
|
|
||||||
run_target(
|
run_target(
|
||||||
'fuzzers',
|
'fuzzers',
|
||||||
|
|
Loading…
Reference in New Issue