Page MenuHomePhabricator

qa: Add test/fuzz/

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


Can be run with ./test/fuzz/ after building as described
in doc/

Backport of core PR15295:

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 \
mkdir -p test/fuzz
cp ../test/fuzz/ test/fuzz/
./test/fuzz/ -l DEBUG <path_to_corpus>
cmake -GNinja .. -DENABLE_SANITIZERS="address;fuzzer" \
ninja bitcoin-fuzzers
./test/fuzz/ -l DEBUG <path_to_corpus>

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

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.Dec 4 2019, 11:51
Herald added a reviewer: Restricted Project. · View Herald TranscriptDec 4 2019, 11:51
deadalnix requested changes to this revision.Dec 6 2019, 11:54
deadalnix added inline comments.
20 ↗(On Diff #14606)

Clearly, this isn't going to cut it.

21 ↗(On Diff #14606)

What does this do?

This revision now requires changes to proceed.Dec 6 2019, 11:54
Fabien added inline comments.Dec 10 2019, 22:21
21 ↗(On Diff #14606)

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

Fabien updated this revision to Diff 16943.Mar 16 2020, 15:41

Rebase, update link.

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.
31 ↗(On Diff #14606)

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

53 ↗(On Diff #14606)

Just always link. Also create a directory.

This revision now requires changes to proceed.Mar 19 2020, 00:38
Fabien edited the test plan for this revision. (Show Details)Mar 19 2020, 08:32
Fabien added inline comments.Mar 19 2020, 08:45
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.

Fabien updated this revision to Diff 17029.Mar 19 2020, 09:06

Always link, create the target directory as needed.

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