From: Ruediger Meier Date: Wed, 7 Mar 2018 19:12:02 +0000 (+0100) Subject: travis: use parallel root checks X-Git-Tag: v2.32~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5917d17f0de803948f5be44e78fa6228013fb7ad;p=thirdparty%2Futil-linux.git travis: use parallel root checks Also improve CPU count detection for tests. Signed-off-by: Ruediger Meier --- diff --git a/.travis-functions.sh b/.travis-functions.sh index d92927e77a..1bf55662f8 100755 --- a/.travis-functions.sh +++ b/.travis-functions.sh @@ -68,7 +68,7 @@ function check_nonroot function check_root { - local opts="$MAKE_CHECK_OPTS --parallel=1 --show-diff" + local opts="$MAKE_CHECK_OPTS --show-diff" xconfigure \ --enable-all-programs \ diff --git a/tests/run.sh b/tests/run.sh index b32463e615..4c89b8c1e1 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -27,8 +27,21 @@ paraller_jobs=1 function num_cpus() { - if lscpu -p &>/dev/null; then - lscpu -p | grep -cv '^#' + local num + + # coreutils + if num=$(nproc --all 2>/dev/null); then + : + # BSD, OSX + elif num=$(sysctl -n hw.ncpu 2>/dev/null); then + : + else + num=$(grep -c "^processor" /proc/cpuinfo 2>/dev/null) + fi + + # translate garbage output to "1" + if test "$num" -gt "0" 2>/dev/null ;then + echo "$num" else echo 1 fi