2023-03-22 13:55:08 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-10-07 09:56:09 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2023-03-22 13:55:08 +00:00
|
|
|
set -e
|
|
|
|
REPO_DIR=$(git rev-parse --show-toplevel)
|
|
|
|
# shellcheck source=./fuzz-util.sh
|
|
|
|
source "$REPO_DIR/fuzz/fuzz-util.sh"
|
2022-10-07 09:56:09 +00:00
|
|
|
|
|
|
|
while :
|
|
|
|
do
|
2023-03-22 13:55:08 +00:00
|
|
|
for targetFile in $(listTargetFiles); do
|
|
|
|
targetName=$(targetFileToName "$targetFile")
|
|
|
|
echo "Fuzzing target $targetName ($targetFile)"
|
2022-10-07 09:56:09 +00:00
|
|
|
|
|
|
|
# fuzz for one hour
|
2023-03-22 13:55:08 +00:00
|
|
|
HFUZZ_RUN_ARGS='--run_time 3600' chrt -i 0 cargo hfuzz run "$targetName"
|
2022-10-07 09:56:09 +00:00
|
|
|
# minimize the corpus
|
2023-03-22 13:55:08 +00:00
|
|
|
HFUZZ_RUN_ARGS="-i hfuzz_workspace/$targetName/input/ -P -M" chrt -i 0 cargo hfuzz run "$targetName"
|
2022-10-07 09:56:09 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|