Rebased PR #21496
Fixes #21461
This supports whole directory runs of the fuzzing seeds without needing a fuzzing library.
Reviewers are also requested look at the issue #76 in bitcoin-core/qa-assets
.
Testing instructions: To build without libFuzzer, exclude the sanitizers.
0CC=clang CXX=clang++ ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" --without-gui --with-zmq --enable-fuzz
Tests:
0# clean and build
1make clean
2make -j "$(($(nproc)+1))"
3
4# get qa-assets if you don't have already
5git clone https://github.com/bitcoin-core/qa-assets
6
7# existing way to feed 1 at a time, still supported
8FUZZ=process_message src/test/fuzz/fuzz < qa-assets/fuzz_seed_corpus/process_message/1258dd51f2a5f3221b33a306279ef7290c5fca6d
9
10# new with this PR: one at a time
11FUZZ=process_message src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/process_message/1258dd51f2a5f3221b33a306279ef7290c5fca6d
12
13# or multiple files at the same time
14FUZZ=process_message src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/process_message/1258dd51f2a5f3221b33a306279ef7290c5fca6d qa-assets/fuzz_seed_corpus/process_message/322a92239d967fba9ef3035aca3cb3090da344b2 qa-assets/fuzz_seed_corpus/process_message/32c460293ac230ebe269a92c7941518d8b76c95a
15
16# new with this PR: whole directory at a time
17FUZZ=process_message src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/process_message
18
19# or mix of files and directories at the same time
20FUZZ=process_message src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/process_message/1258dd51f2a5f3221b33a306279ef7290c5fca6d qa-assets/fuzz_seed_corpus/process_message/322a92239d967fba9ef3035aca3cb3090da344b2 qa-assets/fuzz_seed_corpus/process_message/32c460293ac230ebe269a92c7941518d8b76c95a qa-assets/fuzz_seed_corpus/process_message/
21
22# new with this PR: wildcard support
23FUZZ=process_messages src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/process_messages/*
24
25# new with this PR: run all seeds in all targets, one target/directory at a time
26for D in qa-assets/fuzz_seed_corpus/*; do [ -d "${D}" ] && echo "${D##*/}" && FUZZ="${D##*/}" src/test/fuzz/fuzz qa-assets/fuzz_seed_corpus/"${D##*/}"; done