Skip to content

Commit 4db8fc3

Browse files
feat(ci): add core corpus data to fuzzing ci
1 parent 1905961 commit 4db8fc3

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ jobs:
214214
- name: Install cargo-fuzz
215215
run: cargo install cargo-fuzz
216216

217+
- name: Clone fuzzing corpus
218+
run: |
219+
git clone --depth=1 https://github.com/bitcoin-core/qa-assets /tmp/qa-assets
220+
echo "QA_ASSETS_DIR=/tmp/qa-assets" >> $GITHUB_ENV
221+
217222
- name: Set up fuzzing directories
218223
run: |
219224
mkdir -p /tmp/rust_kernel_fuzz
@@ -226,10 +231,26 @@ jobs:
226231
run: |
227232
# First compile the main crate with sanitizer flags
228233
cargo build --verbose
229-
# Now build and run the fuzzing targets with the same sanitizer flags
234+
# Now build all fuzz targets
230235
cargo fuzz build fuzz_target_block
231236
cargo fuzz build fuzz_target_chainman
232237
cargo fuzz build fuzz_target_verify
233-
cargo fuzz run fuzz_target_verify -- -max_total_time=20
234-
cargo fuzz run fuzz_target_chainman -- -max_total_time=20
235-
cargo fuzz run fuzz_target_block -- -max_total_time=20
238+
239+
# Define target to corpus mapping
240+
declare -A CORPUS_MAP=(
241+
["fuzz_target_block"]="block_deserialize"
242+
["fuzz_target_verify"]=""
243+
["fuzz_target_chainman"]=""
244+
)
245+
246+
# Run each target with its corpus if available
247+
for target in "${!CORPUS_MAP[@]"; do
248+
corpus="${CORPUS_MAP[$target]}"
249+
if [ -n "$corpus" ] && [ -d "QA_ASSETS_DIR/fuzz_corpora/$corpus" ]; then
250+
echo "Running $target with corpus $corpus"
251+
cargo fuzz run $target "$QA_ASSETS_DIR/fuzz_corpora/$corpus" -- -max_total_time=20
252+
else
253+
echo "Running $target without corpus"
254+
cargo fuzz run $target -- -max_total_time=20
255+
fi
256+
done

0 commit comments

Comments
 (0)