Skip to content

Commit f73d47d

Browse files
authored
More stable just test for libfuzzer_stb_image_sugar (#3097)
* aa * tab to space * bash syntax is ❤❤❤❤
1 parent 2166b45 commit f73d47d

File tree

1 file changed

+15
-6
lines changed
  • fuzzers/inprocess/libfuzzer_stb_image_sugar

1 file changed

+15
-6
lines changed

fuzzers/inprocess/libfuzzer_stb_image_sugar/Justfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,26 @@ run: fuzzer
3535
[macos]
3636
test: fuzzer
3737
#!/bin/bash
38+
success=0
3839
rm -rf libafl_unix_shmem_server || true
39-
(timeout 31s ./{{FUZZER_NAME}} | tee fuzz_stdout.log 2>/dev/null || true) &
40+
(timeout 5s ./{{FUZZER_NAME}} >fuzz_stdout.log 2>/dev/null || true) &
4041
sleep 0.2
41-
timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true
42-
if grep -qa "corpus: 30" fuzz_stdout.log; then
43-
echo "Fuzzer is working"
42+
timeout 5s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true
43+
while read -r line; do
44+
corpus_number=$(echo "$line" | cut -d' ' -f2)
45+
if (( corpus_number > 50 )); then
46+
success=1
47+
fi
48+
done < <(grep -o 'corpus: [0-9]\+' fuzz_stdout.log)
49+
50+
if [ "$success" -eq 1 ]; then
51+
echo "Fuzzer is working!"
52+
exit 0
4453
else
45-
echo "Fuzzer does not generate any testcases or any crashes"
54+
echo "Fuzzer not working!"
4655
exit 1
4756
fi
48-
57+
4958
clean:
5059
#!/bin/bash
5160
rm -f {{FUZZER_NAME}}

0 commit comments

Comments
 (0)