diff --git a/infra/base-images/base-runner/coverage b/infra/base-images/base-runner/coverage index df8c3d15152a..35cf236d0739 100755 --- a/infra/base-images/base-runner/coverage +++ b/infra/base-images/base-runner/coverage @@ -69,7 +69,9 @@ TIMEOUT=1h objects="" # Number of CPUs available, this is needed for running tests in parallel. +# Set the max number of parallel jobs to be the CPU count and a max of 10. NPROC=$(nproc) +MAX_PARALLEL_COUNT=10 CORPUS_DIR=${CORPUS_DIR:-"/corpus"} @@ -364,9 +366,9 @@ for fuzz_target in $FUZZ_TARGETS; do fi - # Do not spawn more processes than the number of CPUs available. + # Limit the number of processes to be spawned. n_child_proc=$(jobs -rp | wc -l) - while [ "$n_child_proc" -eq "$NPROC" ]; do + while [[ "$n_child_proc" -eq "$NPROC" || "$n_child_proc" -gt "$MAX_PARALLEL_COUNT" ]]; do sleep 4 n_child_proc=$(jobs -rp | wc -l) done