From 860447a7121e344cc1627f492f67f3a23e86e6c5 Mon Sep 17 00:00:00 2001 From: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> Date: Mon, 6 Feb 2023 18:48:33 -0500 Subject: [PATCH] Fix centipede's bad_build_check projects with many targets (#9606) --- infra/base-images/base-runner/bad_build_check | 2 -- infra/base-images/base-runner/test_all.py | 13 +++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/infra/base-images/base-runner/bad_build_check b/infra/base-images/base-runner/bad_build_check index 5c39bd379..3ee7a0416 100755 --- a/infra/base-images/base-runner/bad_build_check +++ b/infra/base-images/base-runner/bad_build_check @@ -122,8 +122,6 @@ 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. - CENTIPEDE_WORKDIR=/tmp/centipede-workdir - mkdir -p $CENTIPEDE_WORKDIR 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 diff --git a/infra/base-images/base-runner/test_all.py b/infra/base-images/base-runner/test_all.py index ec7c457d9..428e49ac0 100755 --- a/infra/base-images/base-runner/test_all.py +++ b/infra/base-images/base-runner/test_all.py @@ -111,10 +111,15 @@ def do_bad_build_check(fuzz_target): auxiliary = [] command = ['bad_build_check', fuzz_target] + auxiliary - return subprocess.run(command, - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - check=False) + with tempfile.TemporaryDirectory() as temp_centipede_workdir: + # Do this so that centipede doesn't fill up the disk during bad build check + env = os.environ.copy() + env['CENTIPEDE_WORKDIR'] = temp_centipede_workdir + return subprocess.run(command, + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + env=env, + check=False) def get_broken_fuzz_targets(bad_build_results, fuzz_targets):