Centipede skips seed corpus in build test (#9587)

In #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`](a5ee351ed1/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`.
This commit is contained in:
Dongge Liu 2023-02-07 03:31:31 +11:00 committed by GitHub
parent 467f5c5240
commit 50014560fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -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."

View File

@ -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