summaryrefslogtreecommitdiffstats
path: root/tests/run.sh
diff options
context:
space:
mode:
authorRuediger Meier2018-03-07 20:12:02 +0100
committerRuediger Meier2018-03-07 20:49:25 +0100
commit5917d17f0de803948f5be44e78fa6228013fb7ad (patch)
tree25194a05d49f68e2114c542227fe11a870142a46 /tests/run.sh
parenttests: dont't timeout flock (diff)
downloadkernel-qcow2-util-linux-5917d17f0de803948f5be44e78fa6228013fb7ad.tar.gz
kernel-qcow2-util-linux-5917d17f0de803948f5be44e78fa6228013fb7ad.tar.xz
kernel-qcow2-util-linux-5917d17f0de803948f5be44e78fa6228013fb7ad.zip
travis: use parallel root checks
Also improve CPU count detection for tests. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/run.sh')
-rwxr-xr-xtests/run.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/run.sh b/tests/run.sh
index b32463e61..4c89b8c1e 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