summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xutil/presubmit_check.sh7
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