]> git.tue.mpg.de Git - paraslash.git/commitdiff
test-lib: Write error output to stderr.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 7 May 2023 14:16:10 +0000 (16:16 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 14 Jun 2023 19:17:42 +0000 (21:17 +0200)
This way one can run

make test > /dev/null

to suppress normal output but still see test failures, if any.

t/test-lib.sh

index f98d76c741e4dd6aa54e30639585d03a793a6c4a..1ba70632a95d585de16eb5b0e961291fe4ca83f1 100644 (file)
@@ -17,9 +17,12 @@ get_audio_file_paths()
 
 say_color()
 {
+       local severity=$1
+
+       shift
        if [[ "$o_nocolor" != "true" && -n "$1" ]]; then
                export TERM=$ORIGINAL_TERM
-               case "$1" in
+               case "$severity" in
                        error) tput $C_BOLD; tput $C_SETAF 1;;
                        skip)  tput $C_SETAF 5;;
                        ok)
@@ -32,8 +35,11 @@ say_color()
                                tput $C_SETAF 6;;
                esac
        fi
-       shift
-       printf "%s\n" "$*"
+       if [[ "$severity" == 'error' ]]; then
+               printf "%s\n" "$*" 1>&2
+       else
+               printf "%s\n" "$*"
+       fi
        if [[ "$o_nocolor" != "true" && -n "$1" ]]; then
                tput $C_SGR0
                export TERM=dumb