]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt46602] Error messages before start of test are output to stderr
authorStephen Morris <stephen@isc.org>
Wed, 20 Dec 2017 15:50:03 +0000 (15:50 +0000)
committerEvan Hunt <each@isc.org>
Sun, 25 Feb 2018 17:27:12 +0000 (09:27 -0800)
Error messages concerning the invocation of run.sh are output to
stderr.  Messages after the test has started are output to stdout.

(cherry picked from commit 244d1c30e20c927ffdbc2ca305e04675cbd3ac4d)
(cherry picked from commit ff5349b3b3dbcd1e6efa332468c7464ffcf9202c)
(cherry picked from commit 5a1b50c023e65015b0c04a10040450a7c5f9b236)

bin/tests/system/run.sh

index 265198e2c5e1d902d6d74e3beae8f576a7a58385..0394d1263b9a213a9b1cb2b7b6548c5398401140 100644 (file)
@@ -39,12 +39,18 @@ while getopts "rnp:d:" flag; do
 done
 shift `expr $OPTIND - 1`
 
-test $# -gt 0 || { echo "usage: $0 [-k|-n|-p <PORT>] test-directory" >&2; exit 1; }
+if [ $# -eq 0 ]; then
+    echofail "Usage: $0 [-k] [-n] [-p <PORT>] [-r] test-directory [test-options]" >&2;
+    exit 1
+fi
 
 test=$1
 shift
 
-test -d $test || { echofail "$0: $test: no such test" >&2; exit 1; }
+if [ ! -d test ]; then
+    echofail "$0: $test: no such test" >&2
+    exit 1
+fi
 
 # Define the number of ports allocated for each test, and the lowest and
 # highest valid values for the "-p" option.
@@ -61,10 +67,10 @@ maxvalid=`expr 65535 - $numport + 1`
 
 test "$baseport" -eq "$baseport" > /dev/null 2>&1
 if [ $? -ne 0 ]; then
-    echofail "Must specify a numeric value for the port"
+    echofail "$0: $test: must specify a numeric value for the port" >&2
     exit 1
 elif [ $baseport -lt $minvalid -o $baseport -gt $maxvalid  ]; then
-    echofail "The specified port must be in the range $minvalid to $maxvalid" >&2
+    echofail "$0: $test: the specified port must be in the range $minvalid to $maxvalid" >&2
     exit 1
 fi
 
@@ -117,7 +123,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"
-    echoend "E:$test:`date $dateargs`" >&2
+    echoend "E:$test:`date $dateargs`"
     exit 0
 fi
 
@@ -159,11 +165,11 @@ $PERL stop.pl $test
 status=`expr $status + $?`
 
 if [ $status != 0 ]; then
-       echofail "R:$test:FAIL"
-       # Don't clean up - we need the evidence.
-       find . -name core -exec chmod 0644 '{}' \;
+    echofail "R:$test:FAIL"
+    # Do not clean up - we need the evidence.
+    find . -name core -exec chmod 0644 '{}' \;
 else
-       echopass "R:$test:PASS"
+    echopass "R:$test:PASS"
     if $clean
     then
         rm -f $SYSTEMTESTTOP/random.data