Page MenuHomePhabricator

qa: Add test/fuzz/test_runner.py
ClosedPublic

Authored by Fabien on Dec 4 2019, 11:51.

Details

Summary
Can be run with ./test/fuzz/test_runner.py after building as described
in doc/fuzzing.md

Backport of core PR15295:
https://github.com/bitcoin/bitcoin/pull/15295/files

Depends on D4615.

Test Plan
export CC=clang CXX=clang++
../configure --enable-fuzz --with-sanitizers=fuzzer,address \
  --disable-wallet \
  --disable-bench \
  --with-utils=no \
  --with-daemon=no \
  --with-libs=no \
  --with-gui=no \
  --with-seeder=no
make
mkdir -p test/fuzz
cp ../test/fuzz/test_runner.py test/fuzz/
./test/fuzz/test_runner.py -l DEBUG <path_to_corpus>
cmake -GNinja .. -DENABLE_SANITIZERS="address;fuzzer" \
  -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
ninja bitcoin-fuzzers link-fuzz-test_runner.py
./test/fuzz/test_runner.py -l DEBUG <path_to_corpus>

Check the corpus is run exactly once for all the tests.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
PR15295
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 9882
Build 17624: Default Diff Build & Tests
Build 17623: arc lint + arc unit

Event Timeline

deadalnix requested changes to this revision.Dec 6 2019, 11:54
deadalnix added inline comments.
doc/fuzzing.md
20 ↗(On Diff #14606)

Clearly, this isn't going to cut it.

test/CMakeLists.txt
21 ↗(On Diff #14606)

What does this do?

This revision now requires changes to proceed.Dec 6 2019, 11:54
test/CMakeLists.txt
21 ↗(On Diff #14606)

The var is used to fill the config.ini used by the test_runner.py scripts to determine which feature has been built.

Fabien planned changes to this revision.Mar 16 2020, 15:42

Waiting for the link to become active.

Fabien requested review of this revision.Mar 18 2020, 14:22

Link is active.

deadalnix requested changes to this revision.Mar 19 2020, 00:38
deadalnix added inline comments.
src/Makefile.test.include
31 ↗(On Diff #14606)

Why isn't test_bitcoin built when the fuzzer is on? Why isn't that behavior matched with cmake?

test/CMakeLists.txt
53 ↗(On Diff #14606)

Just always link. Also create a directory.

This revision now requires changes to proceed.Mar 19 2020, 00:38
src/Makefile.test.include
31 ↗(On Diff #14606)

No other executable will link with -fsanitize=fuzzer because it defines a main and expect some functions to be defined. CMake has a different target to build all the fuzzer executables so you don't need to disable everything to build them.
I updated the test plan so you get a better idea of the difference.

Always link, create the target directory as needed.

This revision is now accepted and ready to land.Mar 19 2020, 13:16
This revision was automatically updated to reflect the committed changes.