fuzz: execute each file in dir without fuzz engine #22763

pull prakash1512 wants to merge 2 commits into bitcoin:master from prakash1512:issue-21461-execute-file-without-fuzz-engine changing 1 files +57 −2
  1. prakash1512 commented at 5:50 pm on August 21, 2021: contributor

    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
    
  2. fuzz: execute each file in dir without fuzz engine c5de0d9dd4
  3. fuzz: execute each file in dir without fuzz engine b5fa5dd282
  4. DrahtBot added the label Tests on Aug 21, 2021
  5. in src/test/fuzz/fuzz.cpp:183 in b5fa5dd282
    180+            test_one_input(buffer);
    181+            ++tested;
    182+            buffer.clear();
    183+        }
    184+    }
    185+    std::cout << "tested " << tested << " files\n";
    


    ajtowns commented at 7:08 am on October 15, 2021:

    I think this message would be much better if it included the name of the fuzzer doing the testing. (Need to copy it into a global from initialize to make that happen)

    Reporting the time taken might also be good?

  6. ajtowns commented at 7:14 am on October 15, 2021: member

    I think the two commits here should be squashed together? Otherwise a clearer explanation of what they’re both doing in the commit message is needed.

    Concept ACK, and have tested the patch works reasonably against current master.

  7. nosakhare1717 approved
  8. DrahtBot added the label Needs rebase on Feb 3, 2022
  9. DrahtBot commented at 4:11 pm on February 3, 2022: member

    🐙 This pull request conflicts with the target branch and needs rebase.

    Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.

  10. ajtowns deleted a comment on Feb 4, 2022
  11. MarcoFalke commented at 9:13 am on March 4, 2022: member
    #https://github.com/bitcoin/bitcoin/pull/24472
  12. MarcoFalke closed this on Mar 4, 2022

  13. MarcoFalke referenced this in commit bf2c0fb2a2 on Mar 17, 2022
  14. sidhujag referenced this in commit 16b7f5f572 on Mar 18, 2022
  15. DrahtBot locked this on Mar 4, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-04-02 00:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me