test(fuzz): Use pre-generated tarball of 0..=2 byte inputs, and test both with this corpus and with none

This commit is contained in:
Chris Hennick 2024-06-22 22:07:10 -07:00
parent ce0da9ed31
commit c96b0881d8
No known key found for this signature in database
GPG key ID: DA47AABA4961C509
3 changed files with 27 additions and 11 deletions

View file

@ -18,14 +18,37 @@ for i in $(seq 1 $NORMAL_RESTARTS); do
done
mv "fuzz/corpus/fuzz_$1_restart_dictionaryless"/* "fuzz/corpus/fuzz_$1_pre_fresh_blood" || true
rm -rf "fuzz/corpus/fuzz_$1_restart_dictionaryless" || true
mkdir "fuzz/corpus/fuzz_$1_restart_dictionaryless" || true
echo "$(date): DICTIONARY-LESS RESTART"
cargo fuzz run --all-features "fuzz_$1" "fuzz/corpus/fuzz_$1" -- \
-max_len="$2" -fork="$ncpus" -max_total_time=5100 -runs=100000000
cargo fuzz run --all-features "fuzz_$1" "fuzz/corpus/fuzz_$1" -- \
-max_len="$2" -fork="$ncpus" -max_total_time=5100 -runs=100000000
mv "fuzz/corpus/fuzz_$1_restart_dictionaryless_012byte"/* "fuzz/corpus/fuzz_$1_pre_fresh_blood" || true
rm -rf "fuzz/corpus/fuzz_$1_restart_dictionaryless_012byte" || true
mkdir "fuzz/corpus/fuzz_$1_restart_dictionaryless_012byte" || true
echo "$(date): DICTIONARY-LESS RESTART WITH 0-2 BYTE CORPUS"
tar tar -xvzf "fuzz/012byte.tar.gz" -C "fuzz/corpus/fuzz_$1"
cargo fuzz run --all-features "fuzz_$1" "fuzz/corpus/fuzz_$1" -- \
-max_len="$2" -fork="$ncpus" -max_total_time=5100 -runs=100000000
mv "fuzz/corpus/fuzz_$1_restart_012byte"/* "fuzz/corpus/fuzz_$1_pre_fresh_blood" || true
rm -rf "fuzz/corpus/fuzz_$1_restart_012byte" || true
mkdir "fuzz/corpus/fuzz_$1_restart_012byte" || true
echo "$(date): RESTART WITH DICTIONARY AND 0-2 BYTE CORPUS"
tar tar -xvzf "fuzz/012byte.tar.gz" -C "fuzz/corpus/fuzz_$1"
cargo fuzz run --all-features "fuzz_$1" "fuzz/corpus/fuzz_$1" -- \
-dict=fuzz/fuzz.dict -max_len="$2" -fork="$ncpus" -max_total_time=5100 -runs=100000000
echo "$(date): MERGING CORPORA"
for i in $(seq 1 $NORMAL_RESTARTS); do
mv "fuzz/corpus/fuzz_$1_restart_${i}"/* "fuzz/corpus/fuzz_$1"
rmdir "fuzz/corpus/fuzz_$1_restart_${i}"
rm -rf "fuzz/corpus/fuzz_$1_restart_${i}"
done
SPECIAL_RESTARTS=("012byte" "dictionaryless_012byte" "dictionaryless")
for i in "${SPECIAL_RESTARTS[@]}"; do
mv "fuzz/corpus/fuzz_$1_restart_${i}"/* "fuzz/corpus/fuzz_$1"
rm -rf "fuzz/corpus/fuzz_$1_restart_${i}"
done
echo "$(date): RUNNING WITH MERGED CORPUS"
./fuzz-until-converged.sh "$1" "$2"

View file

@ -2,15 +2,8 @@
set -euxo pipefail
mkdir "fuzz/corpus/fuzz_$1_recombination_sources" || true
# Ensure all 0-byte, 1-byte and 2-byte strings are eligible for recombination
# Ensure the 0-byte, 1-byte and 2-byte strings won't gain duplicates during recombination
find "fuzz/corpus/fuzz_$1_recombination_sources" -type f -size -2c -delete
touch fuzz/corpus/fuzz_write_recombination_sources/empty
for i in $(seq 0 255); do
printf "%02X" "$i" | xargs -n 1 -I '{}' sh -c 'echo {} | xxd -r -p > fuzz/corpus/fuzz_write_recombination_sources/{}'
for j in $(seq 0 255); do
printf "%02X%02X" "$i" "$j" | xargs -n 1 -I '{}' sh -c 'echo {} | xxd -r -p > fuzz/corpus/fuzz_write_recombination_sources/{}'
done
done
for size in "${@:2}"; do
echo "$(date): STARTING ON SIZE $size"

BIN
fuzz/012byte.tar.gz Normal file

Binary file not shown.