Print test error messages in color when stderr is a terminal
When stderr is a terminal and supports color, print error messages from tests in red to make them stand out from the surrounding output.
This commit is contained in:
parent
1d9e9c2ed6
commit
65d3b5989b
@ -63,8 +63,14 @@ for t in $@; do
|
||||
fail_count=$((fail_count+1))
|
||||
;;
|
||||
*)
|
||||
echo "Test harness error: ${t} w/ MALLOC_CONF=\"${MALLOC_CONF}\"" 1>&2
|
||||
echo "Use prefix to debug, e.g. JEMALLOC_TEST_PREFIX=\"gdb --args\" sh test/test.sh ${t}" 1>&2
|
||||
color_start=''
|
||||
color_end=''
|
||||
if [ -t 2 ] && tput colors >/dev/null 2>&1; then
|
||||
color_start='\033[31m'
|
||||
color_end='\033[0m'
|
||||
fi
|
||||
printf "${color_start}Test harness error: %s w/ MALLOC_CONF=\"%s\"${color_end}\n" "${t}" "${MALLOC_CONF}" 1>&2
|
||||
printf "${color_start}Use prefix to debug, e.g. JEMALLOC_TEST_PREFIX=\"gdb --args\" sh test/test.sh %s${color_end}\n" "${t}" 1>&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user