mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
tests: run all tests in parallel, if available
If either the moreutils or GNU parallel utility are available, run all tests in parallel. On my eight core machine this makes for a ~x7 speed-up in the full test suite (1m24s -> 12s). The design of the test suite makes this parallelization trivial.
This commit is contained in:
parent
591388ccd1
commit
908d930d22
1 changed files with 20 additions and 10 deletions
|
@ -40,6 +40,15 @@ fi
|
|||
|
||||
trap 'e=$?; kill $!; exit $e' HUP INT TERM
|
||||
# Run the tests
|
||||
if command -v parallel >/dev/null ; then
|
||||
if parallel -h | grep -q GNU ; then
|
||||
echo "INFO: running tests with GNU parallel"
|
||||
printf '%s\n' $TESTS | $TEST_TIMEOUT_CMD parallel
|
||||
else
|
||||
echo "INFO: running tests with moreutils parallel"
|
||||
$TEST_TIMEOUT_CMD parallel -- $TESTS
|
||||
fi
|
||||
else
|
||||
for test in $TESTS; do
|
||||
$TEST_TIMEOUT_CMD $test "$@" &
|
||||
wait $!
|
||||
|
@ -51,6 +60,7 @@ for test in $TESTS; do
|
|||
exit $RES
|
||||
fi
|
||||
done
|
||||
fi
|
||||
trap - HUP INT TERM
|
||||
|
||||
# Report results
|
||||
|
|
Loading…
Reference in a new issue