ci(fuzz): Bug fixes and tweaks for fuzz scripts

This commit is contained in:
Chris Hennick 2024-06-06 15:18:29 -07:00
parent ca37dbc74e
commit d6d7145cd0
No known key found for this signature in database
GPG key ID: DA47AABA4961C509
2 changed files with 17 additions and 2 deletions

13
fuzz-until-converged.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
rm -r "fuzz/corpus/fuzz_$1_old"
updated=1
while [[ $updated ]]; do
updated=0
cp -r "fuzz/corpus/fuzz_$1" "fuzz/corpus/fuzz_$1_old"
cargo fuzz run --all-features "fuzz_$1" "fuzz/corpus/fuzz_$1" -- \
-dict=fuzz/fuzz.dict -max_len="$2" -rss_limit_mb=8192 \
-fork="$(nproc || getconf NPROCESSORS_ONLN)" -runs=1000000
./recursive-fuzz-cmin.sh "$1" "$2"
updated=$(diff "fuzz/corpus/fuzz_$1" "fuzz/corpus/fuzz_$1_old")
rm -r "fuzz/corpus/fuzz_$1_old"
done

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
cp -r "fuzz/corpus/fuzz_$1" "fuzz/corpus/fuzz_$1_iter_0"
i=0 i=0
find fuzz/corpus -iname "fuzz_$1_iter_*" -exec rm -r {} +
cp -r "fuzz/corpus/fuzz_$1" "fuzz/corpus/fuzz_$1_iter_0"
while true; do while true; do
j=$((i + 1)) j=$((i + 1))
cp -r "fuzz/corpus/fuzz_$1_iter_${i}" "fuzz/corpus/fuzz_$1_iter_${i}.bak" cp -r "fuzz/corpus/fuzz_$1_iter_${i}" "fuzz/corpus/fuzz_$1_iter_${i}.bak"
@ -11,7 +12,8 @@ while true; do
# Last iteration made no difference, so we're done # Last iteration made no difference, so we're done
rm -r "fuzz/corpus/fuzz_$1" rm -r "fuzz/corpus/fuzz_$1"
mv "fuzz/corpus/fuzz_$1_iter_${j}" "fuzz/corpus/fuzz_$1" mv "fuzz/corpus/fuzz_$1_iter_${j}" "fuzz/corpus/fuzz_$1"
find fuzz/corpus -iname "fuzz_$1_iter_*" -exec rm -r {} +
exit 0 exit 0
fi fi
i=$j i=$j
done done