From 2f53dca4541b265afa66c5f16d36ea2391724290 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Sun, 23 Jun 2024 22:42:49 -0700 Subject: [PATCH] test(fuzz): Bug fix? Make recursive-fuzz-cmin.sh clean up more conservatively --- recursive-fuzz-cmin.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/recursive-fuzz-cmin.sh b/recursive-fuzz-cmin.sh index 644db25b..976accc1 100755 --- a/recursive-fuzz-cmin.sh +++ b/recursive-fuzz-cmin.sh @@ -1,19 +1,22 @@ #!/bin/bash i=0 -find fuzz/corpus -iname "fuzz_$1_iter_*" -exec rm -r {} + -cp -r "fuzz/corpus/fuzz_$1" "fuzz/corpus/fuzz_$1_iter_0" +rm -rf "fuzz/corpus/fuzz_$1_iter_0" || true +mkdir "fuzz/corpus/fuzz_$1_iter_0" +find "fuzz/corpus/fuzz_$1" -exec mv '{}' "fuzz/corpus/fuzz_$1_iter_0" ';' while true; do j=$((i + 1)) + rm -rf "fuzz/corpus/fuzz_$1_iter_${i}.bak" || true cp -r "fuzz/corpus/fuzz_$1_iter_${i}" "fuzz/corpus/fuzz_$1_iter_${i}.bak" + rm -rf "fuzz/corpus/fuzz_$1_iter_${j}" || true mkdir "fuzz/corpus/fuzz_$1_iter_${j}" cargo fuzz cmin --all-features "fuzz_$1" "fuzz/corpus/fuzz_$1_iter_${i}" -- \ -dict=fuzz/fuzz.dict -max_len="$2" -rss_limit_mb=8192 -timeout=30 "fuzz/corpus/fuzz_$1_iter_${j}" if diff "fuzz/corpus/fuzz_$1_iter_${i}.bak" "fuzz/corpus/fuzz_$1_iter_${j}"; then # Last iteration made no difference, so we're done - rm -r "fuzz/corpus/fuzz_$1" + rm -rf "fuzz/corpus/fuzz_$1" mkdir "fuzz/corpus/fuzz_$1" find "fuzz/corpus/fuzz_$1_iter_${j}" -type f -exec mv '{}' "fuzz/corpus/fuzz_$1" ';' - find fuzz/corpus -iname "fuzz_$1_iter_*" -exec rm -r {} + + rm -rf "fuzz/corpus/fuzz_$1_iter_${i}.bak" exit 0 fi i=$j