diff options
author | Andrew McRae <amcrae@google.com> | 2020-08-20 15:27:33 +1000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-20 09:29:15 +0000 |
commit | 049b77cf3749acf629e9c3c74650e0f92399f64c (patch) | |
tree | b52a4ead26f8a7c496e2cf248556013b21edec89 /util/presubmit_check.sh | |
parent | 381ff0ad0a67fe74eeb41d4fdfc08de710349fd6 (diff) | |
download | chrome-ec-049b77cf3749acf629e9c3c74650e0f92399f64c.tar.gz |
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 <amcrae@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2366324
Reviewed-by: Andrew McRae <amcrae@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Andrew McRae <amcrae@chromium.org>
Tested-by: Andrew McRae <amcrae@chromium.org>
Auto-Submit: Andrew McRae <amcrae@chromium.org>
Diffstat (limited to 'util/presubmit_check.sh')
-rwxr-xr-x | util/presubmit_check.sh | 7 |
1 files changed, 5 insertions, 2 deletions
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 |