Commit 3bb6150c authored by Evan Hunt's avatar Evan Hunt
Browse files

[master] color-coded test output

4745.	[test]		Add color-coded pass/fail messages to system
			tests when running on terminals that support them.
			[RT #45977]
parent 5fbc5c92
4745. [test] Add color-coded pass/fail messages to system
tests when running on terminals that support them.
[RT #45977]
4744. [bug] Suppress trust-anchor-telementry queries if
validation is disabled. [RT #46131]
 
......
......@@ -135,6 +135,43 @@ NZD=@NZD_TOOLS@
. ${TOP}/version
#
# Set up color-coded test output
#
if test -t 1 && type tput > /dev/null; then
COLOR_FAIL=`tput setaf 1` # red
COLOR_WARN=`tput setaf 3` # yellow
COLOR_PASS=`tput setaf 2` # green
COLOR_INFO=`tput bold` # bold
COLOR_NONE=`tput sgr0`
else
# set to empty strings so printf succeeds
COLOR_FAIL=''
COLOR_WARN=''
COLOR_PASS=''
COLOR_INFO=''
COLOR_NONE=''
fi
echofail () {
printf "${COLOR_FAIL}%s${COLOR_NONE}\n" "$*"
}
echowarn () {
printf "${COLOR_WARN}%s${COLOR_NONE}\n" "$*"
}
echopass () {
printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*"
}
echoinfo () {
printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*"
}
#
# Export command paths
#
export ARPANAME
export BIGKEY
export CHECKZONE
......
......@@ -28,22 +28,22 @@ shift
test -d $test || { echo "$0: $test: no such test" >&2; exit 1; }
echo "S:$test:`date`" >&2
echo "T:$test:1:A" >&2
echo "A:System test $test" >&2
echoinfo "S:$test:`date`" >&2
echoinfo "T:$test:1:A" >&2
echoinfo "A:System test $test" >&2
if [ x${PERL:+set} = x ]
then
echo "I:Perl not available. Skipping test." >&2
echo "R:UNTESTED" >&2
echo "E:$test:`date`" >&2
echowarn "I:Perl not available. Skipping test." >&2
echowarn "R:UNTESTED" >&2
echoinfo "E:$test:`date`" >&2
exit 0;
fi
$PERL testsock.pl || {
echo "I:Network interface aliases not set up. Skipping test." >&2;
echo "R:UNTESTED" >&2;
echo "E:$test:`date`" >&2;
echowarn "I:Network interface aliases not set up. Skipping test." >&2;
echowarn "R:UNTESTED" >&2;
echoinfo "E:$test:`date`" >&2;
exit 0;
}
......@@ -55,9 +55,9 @@ result=$?
if [ $result -eq 0 ]; then
: prereqs ok
else
echo "I:Prerequisites for $test missing, skipping test." >&2
[ $result -eq 255 ] && echo "R:SKIPPED" || echo "R:UNTESTED"
echo "E:$test:`date`" >&2
echowarn "I:Prerequisites for $test missing, skipping test." >&2
[ $result -eq 255 ] && echowarn "R:SKIPPED" || echowarn "R:UNTESTED"
echoinfo "E:$test:`date`" >&2
exit 0
fi
......@@ -67,9 +67,9 @@ if
then
: pkcs11 ok
else
echo "I:Need PKCS#11 for $test, skipping test." >&2
echo "R:PKCS11ONLY" >&2
echo "E:$test:`date`" >&2
echowarn "I:Need PKCS#11 for $test, skipping test." >&2
echowarn "R:PKCS11ONLY" >&2
echoinfo "E:$test:`date`" >&2
exit 0
fi
......@@ -80,7 +80,7 @@ then
fi
# Start name servers running
$PERL start.pl $test || { echo "R:FAIL"; echo "E:$test:`date`"; exit 1; }
$PERL start.pl $test || { echofail "R:FAIL"; echoinfo "E:$test:`date`"; exit 1; }
# Run the tests
( cd $test ; $SHELL tests.sh )
......@@ -100,11 +100,11 @@ $PERL stop.pl $test
status=`expr $status + $?`
if [ $status != 0 ]; then
echo "R:FAIL"
echofail "R:FAIL"
# Don't clean up - we need the evidence.
find . -name core -exec chmod 0644 '{}' \;
else
echo "R:PASS"
echopass "R:PASS"
if $clean
then
......@@ -122,6 +122,6 @@ else
fi
fi
echo "E:$test:`date`"
echoinfo "E:$test:`date`"
exit $status
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment