]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Allow forcing colored system test output
authorMichał Kępień <michal@isc.org>
Wed, 21 Feb 2018 13:59:35 +0000 (14:59 +0100)
committerEvan Hunt <each@isc.org>
Sun, 25 Feb 2018 21:34:35 +0000 (13:34 -0800)
As parallel.mk and runsequential.sh both pipe system test output through
"tee" (for the purpose of creating test.output), run.sh invoked from
these two files detects it is not writing to a terminal, which prevents
colored output from being generated.  Allow forcing colored output using
a new command line argument for runall.sh, "-c", which sets an
environment variable (SYSTEMTEST_FORCE_COLOR) causing conf.sh to
unconditionally enable colored output.

The same environment variable can also be used directly to force colored
output when using "make test" instead of runall.sh.

(cherry picked from commit a324031a82a2b312d8f803040dd81eadb554785f)
(cherry picked from commit cbebf7ef5995c7214b63340fd8ac7ef03f8b53d7)
(cherry picked from commit 2f3b3b7affb7754a63ce3a7ca235f685da52fbde)

bin/tests/system/README
bin/tests/system/conf.sh.in
bin/tests/system/runall.sh

index e696ab62b4457bb0d3edaa43bad9e25f13ad8387..87198fab30e5957f2fbc5306275038eb15d441b7 100644 (file)
@@ -125,7 +125,10 @@ Running All The System Tests
 ---
 To run all the system tests, enter the command:
 
-    sh runall.sh [-n] [numproc]
+    sh runall.sh [-c] [-n] [numproc]
+
+The optional flag "-c" forces colored output (by default system test output is
+not printed in color due to run.sh being piped through "tee").
 
 The optional flag "-n" has the same effect as it does for "run.sh" - it causes
 the retention of all output files from all tests.
@@ -154,6 +157,8 @@ to running make, e.g.
 
     SYSTEMTEST_NO_CLEAN=1 make [-j numproc] test
 
+while setting environment variable SYSTEMTEST_FORCE_COLOR to 1 forces system
+test output to be printed in color.
 
 
 Running Multiple System Test Suites Simultaneously
index 3ace9ba8ffc240fd4914cfc42707d0399234acd7..7cfe7b5798427dde689217497e69912d83412c39 100644 (file)
@@ -136,7 +136,7 @@ fi
 #
 # Set up color-coded test output
 #
-if test -t 1 && type tput > /dev/null 2>&1 ; then
+if [ ${SYSTEMTEST_FORCE_COLOR:-0} -eq 1 ] || test -t 1 && type tput > /dev/null 2>&1 ; then
     COLOR_END=`tput setaf 4`    # blue
     COLOR_FAIL=`tput setaf 1`   # red
     COLOR_INFO=`tput bold`      # bold
index 150047e36bff0a755a29f83c38ae7f9ca009569b..010c1eee73b8b4764878ccc04bca4f5f0ffb501d 100644 (file)
@@ -18,7 +18,9 @@
 # Run all the system tests.
 #
 # Usage:
-#    runall.sh [-n] [numprocesses]
+#    runall.sh [-c] [-n] [numprocesses]
+#
+#   -c          Force colored output.
 #
 #   -n          Noclean.  Keep all output files produced by all tests.  These
 #               can later be removed by running "cleanall.sh".
 SYSTEMTESTTOP=.
 . $SYSTEMTESTTOP/conf.sh
 
-usage="Usage: ./runall.sh [-n] [numprocesses]"
+usage="Usage: ./runall.sh [-c] [-n] [numprocesses]"
 
+SYSTEMTEST_FORCE_COLOR=0
 SYSTEMTEST_NO_CLEAN=0
 
-# Handle "-n" switch if present.
+# Handle command line switches if present.
 
-while getopts "n" flag; do
+while getopts "cn" flag; do
     case "$flag" in
+        c) SYSTEMTEST_FORCE_COLOR=1 ;;
         n) SYSTEMTEST_NO_CLEAN=1 ;;
     esac
 done
@@ -62,6 +66,7 @@ fi
 
 # Run the tests.
 
+export SYSTEMTEST_FORCE_COLOR
 export SYSTEMTEST_NO_CLEAN
 
 status=0