aboutsummaryrefslogtreecommitdiffstats
path: root/travis.sh
diff options
context:
space:
mode:
authorHerbert Thielen <thielen@hs-worms.de>2017-09-08 11:38:27 +0200
committerHerbert Thielen <thielen@hs-worms.de>2017-09-08 11:38:27 +0200
commit8620328bcae4d753bf8bee6a46b01b4e77613934 (patch)
tree3aa4b540ae6e8e7db689b2ca2197c6f4a4381e4c /travis.sh
parentbe94bf501e649dfa6790b3cce2bbe300949b6e74 (diff)
parent894cdb82cb2a1141bde8710a67ea4c5325d1d202 (diff)
downloadgoogletest-8620328bcae4d753bf8bee6a46b01b4e77613934.tar.gz
googletest-8620328bcae4d753bf8bee6a46b01b4e77613934.tar.bz2
googletest-8620328bcae4d753bf8bee6a46b01b4e77613934.zip
Merge branch 'master' into hethi/cleanup-travis-environment
Diffstat (limited to 'travis.sh')
-rwxr-xr-xtravis.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/travis.sh b/travis.sh
index bd226a8d..24a557e9 100755
--- a/travis.sh
+++ b/travis.sh
@@ -1,5 +1,25 @@
#!/usr/bin/env sh
set -evx
+
+# if possible, ask for the precise number of processors,
+# otherwise take 2 processors as reasonable default; see
+# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
+if [ -x /usr/bin/getconf ]; then
+ NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
+else
+ NPROCESSORS=2
+fi
+# as of 2017-09-04 Travis CI reports 32 processors, but GCC build
+# crashes if parallelized too much (maybe memory consumption problem),
+# so limit to 4 processors for the time being.
+if [ $NPROCESSORS -gt 4 ] ; then
+ echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
+ NPROCESSORS=4
+fi
+# Tell make to use the processors. No preceding '-' required.
+MAKEFLAGS="j${NPROCESSORS}"
+export MAKEFLAGS
+
env | sort
mkdir build || true