]> git.notmuchmail.org Git - notmuch/blobdiff - test/notmuch-test
test-lib.sh: colors to test output when parallel(1) is run on tty
[notmuch] / test / notmuch-test
index dbca39ca935633feb0a7af28a0dae03384046939..8e483383f79d67aa7d87c04949e51407ddb7542d 100755 (executable)
@@ -42,6 +42,7 @@ fi
 trap 'e=$?; kill $!; exit $e' HUP INT TERM
 # Run the tests
 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
@@ -49,6 +50,11 @@ if test -z "$NOTMUCH_TEST_SERIALIZE" && command -v parallel >/dev/null ; then
         echo "INFO: running tests with moreutils parallel"
         $TEST_TIMEOUT_CMD parallel -- $TESTS
     fi
+    RES=$?
+    if [[ $RES != 0 ]]; then
+        echo "parallel test suite returned error code $RES"
+        exit $RES
+    fi
 else
     for test in $TESTS; do
         $TEST_TIMEOUT_CMD $test "$@" &