Skip to content

Commit 15ec2a0

Browse files
committed
fix: handle missing corpus in scheduled fuzz coverage job
The fuzz-coverage job was failing when run on schedule because it expected an existing corpus but none was available. Now it: 1. Attempts to restore corpus from cache 2. Generates a minimal corpus if none exists (10 second run per target) 3. Then generates coverage reports This ensures the scheduled fuzzing job can complete successfully even when starting from a clean state.
1 parent bd2bba7 commit 15ec2a0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/fuzz.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,31 @@ jobs:
8989
cargo install cargo-fuzz
9090
cargo install rustfilt
9191
92+
- name: Cache fuzz corpus
93+
uses: actions/cache@v4
94+
with:
95+
path: fuzz/corpus
96+
key: fuzz-corpus-all-${{ github.sha }}
97+
restore-keys: |
98+
fuzz-corpus-all-
99+
fuzz-corpus-
100+
101+
- name: Generate minimal corpus if needed
102+
run: |
103+
for target in protocol_parsing jsonrpc_handling transport_layer auth_flows; do
104+
# Create corpus directory if it doesn't exist
105+
mkdir -p fuzz/corpus/$target
106+
107+
# If corpus is empty, run fuzzer briefly to generate some inputs
108+
if [ -z "$(ls -A fuzz/corpus/$target 2>/dev/null)" ]; then
109+
echo "No corpus found for $target, generating minimal corpus..."
110+
cargo fuzz run $target -- \
111+
-max_total_time=10 \
112+
-print_final_stats=1 \
113+
-detect_leaks=0 || true
114+
fi
115+
done
116+
92117
- name: Generate coverage
93118
run: |
94119
for target in protocol_parsing jsonrpc_handling transport_layer auth_flows; do

0 commit comments

Comments
 (0)