diff --git a/fuzzers/inprocess/libfuzzer_stb_image_sugar/Justfile b/fuzzers/inprocess/libfuzzer_stb_image_sugar/Justfile index 4fa6f647f9..ac06cf0f29 100644 --- a/fuzzers/inprocess/libfuzzer_stb_image_sugar/Justfile +++ b/fuzzers/inprocess/libfuzzer_stb_image_sugar/Justfile @@ -35,17 +35,26 @@ run: fuzzer [macos] test: fuzzer #!/bin/bash + success=0 rm -rf libafl_unix_shmem_server || true - (timeout 31s ./{{FUZZER_NAME}} | tee fuzz_stdout.log 2>/dev/null || true) & + (timeout 5s ./{{FUZZER_NAME}} >fuzz_stdout.log 2>/dev/null || true) & sleep 0.2 - timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true - if grep -qa "corpus: 30" fuzz_stdout.log; then - echo "Fuzzer is working" + timeout 5s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true + while read -r line; do + corpus_number=$(echo "$line" | cut -d' ' -f2) + if (( corpus_number > 50 )); then + success=1 + fi + done < <(grep -o 'corpus: [0-9]\+' fuzz_stdout.log) + + if [ "$success" -eq 1 ]; then + echo "Fuzzer is working!" + exit 0 else - echo "Fuzzer does not generate any testcases or any crashes" + echo "Fuzzer not working!" exit 1 fi - + clean: #!/bin/bash rm -f {{FUZZER_NAME}}