From c344e1d768ec079d86fb488ba29610a4f9bbcbc5 Mon Sep 17 00:00:00 2001 From: Stephen Morris Date: Fri, 15 Dec 2017 18:36:53 +0000 Subject: [PATCH] [rt46603] Provide echostart() and echoend() to output test start/end messages. --- bin/tests/system/conf.sh.in | 33 ++++++++++++++++++++++----------- bin/tests/system/run.sh | 20 ++++++++++---------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index a439ced142..9150187775 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -157,20 +157,23 @@ NZD=@NZD_TOOLS@ # Set up color-coded test output # if test -t 1 && type tput > /dev/null 2>&1 ; then + COLOR_END=`tput setaf 4` # blue COLOR_FAIL=`tput setaf 1` # red - COLOR_WARN=`tput setaf 3` # yellow - COLOR_PASS=`tput setaf 2` # green - COLOR_STEN=`tput setaf 4` # blue - for start/end messages COLOR_INFO=`tput bold` # bold COLOR_NONE=`tput sgr0` + COLOR_PASS=`tput setaf 2` # green + COLOR_START=`tput setaf 4` # blue + COLOR_WARN=`tput setaf 3` # yellow else # set to empty strings so printf succeeds + COLOR_END='' COLOR_FAIL='' - COLOR_WARN='' - COLOR_PASS='' - COLOR_STEN='' COLOR_INFO='' COLOR_NONE='' + COLOR_PASS='' + COLOR_START='' + COLOR_STEN='' + COLOR_WARN='' fi if type printf > /dev/null 2>&1 @@ -185,11 +188,13 @@ then printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*" } echoinfo () { - COLOR=$COLOR_INFO - case "$1" in - S:*|E:*) COLOR=${COLOR}${COLOR_STEN} ;; # Start/end messages - esac - printf "${COLOR}%s${COLOR_NONE}\n" "$*" + printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*" + } + echostart () { + printf "${COLOR_START}%s${COLOR_NONE}\n" "$*" + } + echoend () { + printf "${COLOR_END}%s${COLOR_NONE}\n" "$*" } else echofail () { @@ -204,6 +209,12 @@ else echoinfo () { echo "$*" } + echostart () { + echo "$*" + } + echoend () { + echo "$*" + } fi TESTNAME="`basename $PWD`" diff --git a/bin/tests/system/run.sh b/bin/tests/system/run.sh index abab48d30e..5b1ef95776 100644 --- a/bin/tests/system/run.sh +++ b/bin/tests/system/run.sh @@ -79,16 +79,16 @@ export LOWPORT=$baseport export HIGHPORT=`expr $baseport + $numport - 1` -echoinfo "S:$test:`date $dateargs`" -echoinfo "T:$test:1:A" -echoinfo "A:$test:System test $test" -echoinfo "I:$test:PORTRANGE:${LOWPORT} - ${HIGHPORT}" +echostart "S:$test:`date $dateargs`" +echoinfo "T:$test:1:A" +echoinfo "A:$test:System test $test" +echoinfo "I:$test:PORTRANGE:${LOWPORT} - ${HIGHPORT}" if [ x${PERL:+set} = x ] then echowarn "I:$test:Perl not available. Skipping test." echowarn "R:$test:UNTESTED" - echoinfo "E:$test:`date $dateargs`" + echoend "E:$test:`date $dateargs`" exit 0; fi @@ -101,7 +101,7 @@ if [ $result -eq 0 ]; then else echowarn "I:$test:Prerequisites missing, skipping test." [ $result -eq 255 ] && echowarn "R:$test:SKIPPED" || echowarn "R:$test:UNTESTED" - echoinfo "E:$test:`date $dateargs`" >&2 + echoend "E:$test:`date $dateargs`" >&2 exit 0 fi @@ -109,7 +109,7 @@ fi $PERL testsock.pl -p $PORT || { echowarn "I:$test:Network interface aliases not set up. Skipping test." echowarn "R:$test:UNTESTED" - echoinfo "E:$test:`date $dateargs`" + echoend "E:$test:`date $dateargs`" exit 0; } @@ -121,7 +121,7 @@ then else echowarn "I:$test:Need PKCS#11, skipping test." echowarn "R:$test:PKCS11ONLY" - echoinfo "E:$test:`date $dateargs`" + echoend "E:$test:`date $dateargs`" exit 0 fi @@ -132,7 +132,7 @@ then fi # Start name servers running -$PERL start.pl --port $PORT $test || { echofail "R:$test:FAIL"; echoinfo "E:$test:`date $dateargs`"; exit 1; } +$PERL start.pl --port $PORT $test || { echofail "R:$test:FAIL"; echoend "E:$test:`date $dateargs`"; exit 1; } # Run the tests ( cd $test ; $SHELL tests.sh "$@" ) @@ -170,6 +170,6 @@ else fi fi -echoinfo "E:$test:`date $dateargs`" +echoend "E:$test:`date $dateargs`" exit $status