Updated GNU parallel detection
Thanks to @rico-chet for the detection code!pull/1559/head
parent
9269c4445d
commit
543e49b759
9
test/run
9
test/run
|
|
@ -16,7 +16,13 @@ else
|
||||||
test_dirs=( "$1" )
|
test_dirs=( "$1" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v parallel &> /dev/null
|
# Make sure that the `parallel` command is installed,
|
||||||
|
# AND that it is the GNU version of `parallel`.
|
||||||
|
# If that is the case, try to guess the number of CPU cores,
|
||||||
|
# so we can run `bats` in parallel processing mode, which is a lot faster.
|
||||||
|
if command -v parallel &> /dev/null \
|
||||||
|
&& parallel -V &> /dev/null \
|
||||||
|
&& { parallel -V 2> /dev/null | grep -q '^GNU\>'; }
|
||||||
then
|
then
|
||||||
# Expect to run at least on a dual-core CPU; slightly degraded performance
|
# Expect to run at least on a dual-core CPU; slightly degraded performance
|
||||||
# shouldn't matter otherwise.
|
# shouldn't matter otherwise.
|
||||||
|
|
@ -37,5 +43,6 @@ then
|
||||||
exec "$bats_executable" ${CI:+--tap} --jobs ${test_jobs_effective} \
|
exec "$bats_executable" ${CI:+--tap} --jobs ${test_jobs_effective} \
|
||||||
"${test_dirs[@]}"
|
"${test_dirs[@]}"
|
||||||
else
|
else
|
||||||
|
# Run `bats` in single-threaded mode.
|
||||||
exec "$bats_executable" ${CI:+--tap} "${test_dirs[@]}"
|
exec "$bats_executable" ${CI:+--tap} "${test_dirs[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue