Merge rust-bitcoin/rust-bitcoin#1309: Add script to launch fuzzing continuosly

9eca3c58c5 Add script to launch fuzzing continuosly (Riccardo Casatta)

Pull request description:

  Continuosly cycle over fuzz targets running each for 1 hour.

  I use this script on a server of mine and maybe sharing the script incentives other doing the same

ACKs for top commit:
  apoelstra:
    ACK 9eca3c58c5
  sanket1729:
    ACK 9eca3c58c5. I do have the resources to actually run it, but I successfully ran it locally with 5 sec cycle for testing.

Tree-SHA512: 23f24039bc32c091ea287ada9335e13bb81ae286cd8d42ab1a2b551c3dd8ba55c6d0c0051d9032baa169354786e77d257d6471f7255981a160bfd1695300201c
This commit is contained in:
Riccardo Casatta 2022-10-13 11:59:44 +02:00
commit be4a27a1f3
No known key found for this signature in database
GPG Key ID: FD986A969E450397
1 changed files with 23 additions and 0 deletions

23
fuzz/cycle.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Continuosly cycle over fuzz targets running each for 1 hour.
# It uses chrt SCHED_IDLE so that other process takes priority.
#
# For hfuzz options see https://github.com/google/honggfuzz/blob/master/docs/USAGE.md
export HFUZZ_BUILD_ARGS='--features honggfuzz_fuzz'
while :
do
for FILE in fuzz_targets/*;
do
TARGET=$(echo $FILE | cut -c 14- | cut -f 1 -d '.')
# fuzz for one hour
HFUZZ_RUN_ARGS='--run_time 3600' chrt -i 0 cargo hfuzz run $TARGET
# minimize the corpus
HFUZZ_RUN_ARGS="-i hfuzz_workspace/$TARGET/input/ -P -M" chrt -i 0 cargo hfuzz run $TARGET
done
done