Skip to content

Commit 63d4275

Browse files
committed
script should exit with an error code if the crash is found and run fuzzer for 10 mins excluding build time
1 parent 56c41fe commit 63d4275

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

scripts/run-fuzzer.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ elif $IS_DARWIN; then
5656
check_command gtimeout "brew install coreutils"
5757
fi
5858

59-
FUZZ_TIME="${FUZZ_TIME:-"5m"}"
59+
FUZZ_TIME="${FUZZ_TIME:-"10m"}"
6060

6161
#---------------------------------------
6262
# Run fuzz test
@@ -66,18 +66,23 @@ cd ./test/subspace-test-fuzzer
6666
# remove existing afl output so that previous run is not continued
6767
rm -rf output
6868

69+
# build binary
70+
cargo ziggy build --release --no-honggfuzz
71+
72+
BINARY="./target/afl/release/subspace-test-fuzzer"
73+
6974
echo "🚀 Running Ziggy fuzzing for $FUZZ_TIME..."
7075

7176
# run behind a timeout since ziggy by itself one
7277
# TODO: https://github.com/srlabs/ziggy/issues/115
7378
if $IS_DARWIN; then
7479
set +e
75-
gtimeout --preserve-status "$FUZZ_TIME" cargo ziggy fuzz --release --no-honggfuzz
80+
gtimeout --preserve-status "$FUZZ_TIME" cargo ziggy fuzz -b ${BINARY}
7681
FUZZ_EXIT_CODE=$?
7782
set -e
7883
else
7984
set +e
80-
timeout --preserve-status "$FUZZ_TIME" cargo ziggy fuzz --release --no-honggfuzz
85+
timeout --preserve-status "$FUZZ_TIME" cargo ziggy fuzz -b ${BINARY}
8186
FUZZ_EXIT_CODE=$?
8287
set -e
8388
fi
@@ -95,10 +100,13 @@ if [[ -d "$CRASH_DIR" ]]; then
95100
CRASH_COUNT=$(find "$CRASH_DIR" -type f | wc -l | tr -d ' ')
96101
if [[ "$CRASH_COUNT" -gt 0 ]]; then
97102
echo "⚠️ Found $CRASH_COUNT crashes from this fuzzing run."
103+
exit 1
98104
else
99105
echo "✅ No crashes detected."
106+
exit 0
100107
fi
101108
else
102-
echo "⚠️ Crash directory not found: $CRASH_DIR"
103-
echo " (Fuzzer output structure may have changed)"
109+
echo "❌ Crash directory not found: $CRASH_DIR"
110+
echo " (Fuzzer output structure may have changed or fuzzing failed)"
111+
exit 2
104112
fi

0 commit comments

Comments
 (0)