[tests] Add libFuzzer support.
Summary:
This is a backport of core PR10440:
https://github.com/bitcoin/bitcoin/pull/10440/files
I added some modifications to the CMake files to support enabling the
libFuzzer support easily (it requires manual compilation otherwise).
This is natively supported by ECM, but will try to apply to every build
with a main() which is not the desired behavior as it should only
apply to the test_bitcoin_fuzzy target.
Depends on D5182 (for the test plan).
Test Plan:
Build with Clang >= 6.0:
cmake -GNinja .. -DENABLE_SANITIZERS=fuzzer ninja test_bitcoin_fuzzy ./src/test/test_bitcoin_fuzzy
Stop it with CTRL+C when you're bored, as it will run indefinitely.
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D4588