]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Run compilation and tests with multiple threads (#610)
authorAlexander Lanin <alex@lanin.de>
Sun, 5 Jul 2020 19:00:05 +0000 (21:00 +0200)
committerGitHub <noreply@github.com>
Sun, 5 Jul 2020 19:00:05 +0000 (21:00 +0200)
ci/build

index 9cc44297d23f9e3b46940a632ea6dd7643cfc344..5b79f27718eb7151bb7a8fb0789212908edc212c 100755 (executable)
--- a/ci/build
+++ b/ci/build
@@ -11,11 +11,15 @@ fi
 if [ -n "${SPECIAL:-}" ]; then
     exec "ci/$SPECIAL"
 else
+    [ -z ${JOBS+x} ] && JOBS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
+    [ -z ${JOBS+x} ] && JOBS=2
+
     mkdir -p ${BUILDDIR:-build}
     cd ${BUILDDIR:-build}
-    ${CMAKE_PREFIX:-} cmake "${CCACHE_LOC:-..}" ${CMAKE_PARAMS:-}
+    ${CMAKE_PREFIX:-} cmake ${CMAKE_PARAMS:-} ${CCACHE_LOC:-..}
     # 4 jobs seem to be a reasonable default for Travis.
-    ${CMAKE_PREFIX:-} cmake --build . ${BUILDEXTRAFLAGS:-} -- -j4
+    ${CMAKE_PREFIX:-} cmake --build . ${BUILDEXTRAFLAGS:-} -- -j${JOBS}
     # Warning: Rare random failures when running with -j4.
-    [ "${RUN_TESTS:-1}" -ne "1" ] || ctest --output-on-failure -j1
+    [ "${RUN_TESTS:-1}" -ne "1" ] || ctest --output-on-failure -j${JOBS}
 fi
+exit 0