From 049b77cf3749acf629e9c3c74650e0f92399f64c Mon Sep 17 00:00:00 2001 From: Andrew McRae Date: Thu, 20 Aug 2020 15:27:33 +1000 Subject: EC: Fix presubmit message to avoid unbounded parallel make The presubmit message that checks for 'make buildall' having been run suggests using 'make buildall -j', which can cause an unbounded number of processes to be started, especially as the number of EC targets have increased. Suggest a more reasonable value. BUG=none TEST=Check presubmit output. BRANCH=none Change-Id: Ie35a545dc1c4d58a3ad9d0ed0233c62ab5a92464 Signed-off-by: Andrew McRae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2366324 Reviewed-by: Andrew McRae Reviewed-by: Mike Frysinger Commit-Queue: Andrew McRae Tested-by: Andrew McRae Auto-Submit: Andrew McRae --- util/presubmit_check.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'util/presubmit_check.sh') diff --git a/util/presubmit_check.sh b/util/presubmit_check.sh index fe4b679494..9429e66a0d 100755 --- a/util/presubmit_check.sh +++ b/util/presubmit_check.sh @@ -19,10 +19,13 @@ if git diff "${upstream_branch}" HEAD | grep -e '^+\(.*CPRINTS(.*\\n"\|++\)' | exit 1 fi +# Retrieve the number of CPUs for a sensible estimate for make -j. +ncpu=$(getconf _NPROCESSORS_ONLN || echo 2) + # Verify that all targets were built and all tests passed after the latest # source code modification. if [[ ! -e .tests-passed ]]; then - echo 'Unit tests have not passed. Please run "make buildall -j".' + echo "Unit tests have not passed. Please run \"make buildall -j ${ncpu}\"." exit 1 fi @@ -51,7 +54,7 @@ changed=$(echo "${changed}" | grep -v docs/) if [[ -n "${changed}" ]]; then echo "Files have changed since last time unit tests passed:" echo "${changed}" | sed -e 's/^/ /' - echo 'Please run "make buildall -j".' + echo "Please run \"make buildall -j ${ncpu}\"." exit 1 fi -- cgit v1.2.1