-for test in $TESTS; do
- $TEST_TIMEOUT_CMD ./$test "$@" &
- wait $!
- # If the test failed without producing results, then it aborted,
- # so we should abort, too.
+if test -z "$NOTMUCH_TEST_SERIALIZE" && command -v parallel >/dev/null ; then
+ test -t 1 && export COLORS_WITHOUT_TTY=t || :
+ 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