Skip to content

Commit

Permalink
Centipede skips seed corpus in build test (google#9587)
Browse files Browse the repository at this point in the history
In google#9427, some projects [failed on
`bad_build_check`](https://pantheon.corp.google.com/cloud-build/builds;region=us-central1/31a7e835-32aa-49c8-81f1-f8d2eab9e3c1;step=20?project=oss-fuzz)
(e.g.,
[`matio`](https://github.com/google/oss-fuzz/tree/master/projects/matio)
has seed corpus) without explicit reason.
This is because `Centipede` [does not skip seed corpus in
`run_fuzzer`](https://github.com/google/oss-fuzz/blob/a5ee351ed1cfb97b73eab96787c0a86434cfd99e/infra/base-images/base-runner/run_fuzzer#L89)
like [other
fuzzers](https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-runner/bad_build_check#L147).

This PR sets the environment variable so that `Centipede` also skips
seeds and pass the `bad_build_check`.
  • Loading branch information
DonggeLiu authored and eamonnmcmanus committed Mar 15, 2023
1 parent d49648a commit ac01356
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion infra/base-images/base-runner/bad_build_check
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function check_engine {
# binaries if they are from trial build and production build.
# TODO(Dongge): Support run test with sanitized binaries for trial and
# production build.
timeout --preserve-status -s INT 20s run_fuzzer $FUZZER_NAME &>$FUZZER_OUTPUT
SKIP_SEED_CORPUS=1 timeout --preserve-status -s INT 20s run_fuzzer $FUZZER_NAME &>$FUZZER_OUTPUT
CHECK_PASSED=$(egrep "\[0] begin-fuzz: ft: 0 cov: 0" -c $FUZZER_OUTPUT)
if (( $CHECK_PASSED == 0 )); then
echo "BAD BUILD: fuzzing $FUZZER with centipede failed."
Expand Down
3 changes: 3 additions & 0 deletions infra/base-images/base-runner/run_fuzzer
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ rm -rf $FUZZER_OUT && mkdir -p $FUZZER_OUT

SEED_CORPUS="${FUZZER}_seed_corpus.zip"

# TODO: Investigate why this code block is skipped
# by all default fuzzers in bad_build_check.
# They all set SKIP_SEED_CORPUS=1.
if [ -f $SEED_CORPUS ] && [ -z ${SKIP_SEED_CORPUS:-} ]; then
echo "Using seed corpus: $SEED_CORPUS"
unzip -o -d ${CORPUS_DIR}/ $SEED_CORPUS > /dev/null
Expand Down

0 comments on commit ac01356

Please sign in to comment.