]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt46602] Miscellaneous changes to existing parallelised tests
authorStephen Morris <stephen@isc.org>
Fri, 17 Nov 2017 17:29:21 +0000 (17:29 +0000)
committerStephen Morris <stephen@isc.org>
Fri, 16 Feb 2018 14:57:51 +0000 (14:57 +0000)
Currently these tests are allow_query, rpzrecurse and serve-stale

1. Function to copy files and set port numbers renamed from copy_config
to copy_setports, as this is used to change the ports in Perl and Python
test scripts as well.
2. Changes to rpzrecurse/tests.sh to handle two calls to getopts (one to
parse port numbers, the other to parse rpzrecurse-specific options). Also
fixed various commands to use correct ports.
3. Updates to "clean.sh" scripts to ensure that all files created in the
test are removed.

bin/tests/system/allow_query/clean.sh
bin/tests/system/allow_query/setup.sh
bin/tests/system/allow_query/tests.sh
bin/tests/system/conf.sh.in
bin/tests/system/getopts.sh
bin/tests/system/rpzrecurse/clean.sh
bin/tests/system/rpzrecurse/setup.sh
bin/tests/system/run.sh
bin/tests/system/serve-stale/clean.sh
bin/tests/system/serve-stale/setup.sh
bin/tests/system/serve-stale/tests.sh

index 15c4ee833ad3f00e101d91366e0e47d672b469b8..0301c3d1e2cc451b04ac410018eb7931ed8b3601 100644 (file)
@@ -12,6 +12,7 @@
 # Clean up after allow query tests.
 #
 
+rm -f test.output
 rm -f dig.out.*
 rm -f ns2/named.conf ns2/named.port ns2/controls.conf
 rm -f */named.memstats
index 53f030681b27eae11b58259f4ba851897faaec87..3e14f3533a0170037bea0fcb3104b8bf06a69000 100644 (file)
@@ -10,6 +10,6 @@
 
 . ../getopts.sh
 
-copy_config ../common/controls.conf.in ns2/controls.conf
-copy_config  ns2/named01.conf.in ns2/named.conf
+copy_setports ../common/controls.conf.in ns2/controls.conf
+copy_setports  ns2/named01.conf.in ns2/named.conf
 echo "${port}" > ns2/named.port
index b8a7ea2749bdae7dacf07a32e69117fae51f9ed1..58a4c37369ea6fa95a176398546c58388b572444 100644 (file)
@@ -75,7 +75,7 @@ status=`expr $status + $ret`
 
 # Test 2 - explicit any, query allowed
 n=`expr $n + 1`
-copy_config ns2/named02.conf.in ns2/named.conf
+copy_setports ns2/named02.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -89,7 +89,7 @@ status=`expr $status + $ret`
 
 # Test 3 - none, query refused
 n=`expr $n + 1`
-copy_config ns2/named03.conf.in ns2/named.conf
+copy_setports ns2/named03.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -103,7 +103,7 @@ status=`expr $status + $ret`
 
 # Test 4 - address allowed, query allowed
 n=`expr $n + 1`
-copy_config ns2/named04.conf.in ns2/named.conf
+copy_setports ns2/named04.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -117,7 +117,7 @@ status=`expr $status + $ret`
 
 # Test 5 - address not allowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named05.conf.in ns2/named.conf
+copy_setports ns2/named05.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -131,7 +131,7 @@ status=`expr $status + $ret`
 
 # Test 6 - address disallowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named06.conf.in ns2/named.conf
+copy_setports ns2/named06.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -145,7 +145,7 @@ status=`expr $status + $ret`
 
 # Test 7 - acl allowed, query allowed
 n=`expr $n + 1`
-copy_config ns2/named07.conf.in ns2/named.conf
+copy_setports ns2/named07.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -159,7 +159,7 @@ status=`expr $status + $ret`
 
 # Test 8 - acl not allowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named08.conf.in ns2/named.conf
+copy_setports ns2/named08.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -174,7 +174,7 @@ status=`expr $status + $ret`
 
 # Test 9 - acl disallowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named09.conf.in ns2/named.conf
+copy_setports ns2/named09.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -188,7 +188,7 @@ status=`expr $status + $ret`
 
 # Test 10 - key allowed, query allowed
 n=`expr $n + 1`
-copy_config ns2/named10.conf.in ns2/named.conf
+copy_setports ns2/named10.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -202,7 +202,7 @@ status=`expr $status + $ret`
 
 # Test 11 - key not allowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named11.conf.in ns2/named.conf
+copy_setports ns2/named11.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -216,7 +216,7 @@ status=`expr $status + $ret`
 
 # Test 12 - key disallowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named12.conf.in ns2/named.conf
+copy_setports ns2/named12.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -233,7 +233,7 @@ status=`expr $status + $ret`
 n=20
 # Test 21 - views default, query allowed
 n=`expr $n + 1`
-copy_config ns2/named21.conf.in ns2/named.conf
+copy_setports ns2/named21.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -247,7 +247,7 @@ status=`expr $status + $ret`
 
 # Test 22 - views explicit any, query allowed
 n=`expr $n + 1`
-copy_config ns2/named22.conf.in ns2/named.conf
+copy_setports ns2/named22.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -261,7 +261,7 @@ status=`expr $status + $ret`
 
 # Test 23 - views none, query refused
 n=`expr $n + 1`
-copy_config ns2/named23.conf.in ns2/named.conf
+copy_setports ns2/named23.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -275,7 +275,7 @@ status=`expr $status + $ret`
 
 # Test 24 - views address allowed, query allowed
 n=`expr $n + 1`
-copy_config ns2/named24.conf.in ns2/named.conf
+copy_setports ns2/named24.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -289,7 +289,7 @@ status=`expr $status + $ret`
 
 # Test 25 - views address not allowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named25.conf.in ns2/named.conf
+copy_setports ns2/named25.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -303,7 +303,7 @@ status=`expr $status + $ret`
 
 # Test 26 - views address disallowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named26.conf.in ns2/named.conf
+copy_setports ns2/named26.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -317,7 +317,7 @@ status=`expr $status + $ret`
 
 # Test 27 - views acl allowed, query allowed
 n=`expr $n + 1`
-copy_config ns2/named27.conf.in ns2/named.conf
+copy_setports ns2/named27.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -331,7 +331,7 @@ status=`expr $status + $ret`
 
 # Test 28 - views acl not allowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named28.conf.in ns2/named.conf
+copy_setports ns2/named28.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -345,7 +345,7 @@ status=`expr $status + $ret`
 
 # Test 29 - views acl disallowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named29.conf.in ns2/named.conf
+copy_setports ns2/named29.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -359,7 +359,7 @@ status=`expr $status + $ret`
 
 # Test 30 - views key allowed, query allowed
 n=`expr $n + 1`
-copy_config ns2/named30.conf.in ns2/named.conf
+copy_setports ns2/named30.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -373,7 +373,7 @@ status=`expr $status + $ret`
 
 # Test 31 - views key not allowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named31.conf.in ns2/named.conf
+copy_setports ns2/named31.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -387,7 +387,7 @@ status=`expr $status + $ret`
 
 # Test 32 - views key disallowed, query refused
 n=`expr $n + 1`
-copy_config ns2/named32.conf.in ns2/named.conf
+copy_setports ns2/named32.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -401,7 +401,7 @@ status=`expr $status + $ret`
 
 # Test 33 - views over options, views allow, query allowed
 n=`expr $n + 1`
-copy_config ns2/named33.conf.in ns2/named.conf
+copy_setports ns2/named33.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -415,7 +415,7 @@ status=`expr $status + $ret`
 
 # Test 34 - views over options, views disallow, query refused
 n=`expr $n + 1`
-copy_config ns2/named34.conf.in ns2/named.conf
+copy_setports ns2/named34.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -433,7 +433,7 @@ n=40
 
 # Test 41 - zone default, query allowed
 n=`expr $n + 1`
-copy_config ns2/named40.conf.in ns2/named.conf
+copy_setports ns2/named40.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -557,7 +557,7 @@ status=`expr $status + $ret`
 
 # Test 53 - zones over options, zones allow, query allowed
 n=`expr $n + 1`
-copy_config ns2/named53.conf.in ns2/named.conf
+copy_setports ns2/named53.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -571,7 +571,7 @@ status=`expr $status + $ret`
 
 # Test 54 - zones over options, zones disallow, query refused
 n=`expr $n + 1`
-copy_config ns2/named54.conf.in ns2/named.conf
+copy_setports ns2/named54.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -585,7 +585,7 @@ status=`expr $status + $ret`
 
 # Test 55 - zones over views, zones allow, query allowed
 n=`expr $n + 1`
-copy_config ns2/named55.conf.in ns2/named.conf
+copy_setports ns2/named55.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -599,7 +599,7 @@ status=`expr $status + $ret`
 
 # Test 56 - zones over views, zones disallow, query refused
 n=`expr $n + 1`
-copy_config ns2/named56.conf.in ns2/named.conf
+copy_setports ns2/named56.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -613,7 +613,7 @@ status=`expr $status + $ret`
 
 # Test 57 - zones over views, zones disallow, query refused (allow-query-on)
 n=`expr $n + 1`
-copy_config ns2/named57.conf.in ns2/named.conf
+copy_setports ns2/named57.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
index 9bbfe2ceb17bf477f7df6e146b182e646e21cef6..2c65b721d724d5c0a60816f66e666b70011f2f55 100644 (file)
@@ -160,6 +160,7 @@ if test -t 1 && type tput > /dev/null 2>&1 ; then
     COLOR_FAIL=`tput setaf 1`   # red
     COLOR_WARN=`tput setaf 3`   # yellow
     COLOR_PASS=`tput setaf 2`   # green
+    COLOR_STEN=`tput setaf 4`   # blue
     COLOR_INFO=`tput bold`      # bold
     COLOR_NONE=`tput sgr0`
 else
@@ -167,6 +168,7 @@ else
     COLOR_FAIL=''
     COLOR_WARN=''
     COLOR_PASS=''
+    COLOR_STEN=''
     COLOR_INFO=''
     COLOR_NONE=''
 fi
@@ -183,7 +185,11 @@ then
                printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*"
        }
        echoinfo () {
-               printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*"
+               COLOR=$COLOR_INFO
+               case "$1" in 
+                       S:*|E:*) COLOR=${COLOR}${COLOR_STEN} ;; # Start/end messages
+               esac
+               printf "${COLOR}%s${COLOR_NONE}\n" "$*"
        }
 else
        echofail () {
index cdb0922a53204d72954c2ac8a8be199f9c5a466d..fd615a4ef146e4c4fe9030ed6518d8b8f087bea0 100644 (file)
@@ -5,7 +5,7 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-# shell script snippet, must be sourced
+# Shell script snippet, must be sourced
 
 port=5300
 controlport=9953
@@ -18,11 +18,12 @@ while getopts ":p:c:" flag; do
        *) exit 1 ;;
     esac
 done
+
 shift $(($OPTIND - 1))
 OPTIND=1
 
 # Convenience function to copy configuration file, replacing the port numbers
 # during the copy - more readable than embedding a "sed" command in the script.
-copy_config() {
+copy_setports() {
     sed -e "s/@PORT@/${port}/g" -e "s/@CONTROLPORT@/${controlport}/g" < $1 > $2
 }
index ea04f0b879885886f06af6786d851c2c00432983..d339d67e30bbdb0bc2674c2de6b35d50a1191564 100644 (file)
@@ -6,15 +6,22 @@
 
 # Clean up after rpz tests.
 
+rm -f test.output
 rm -f dig.out.*
+
 rm -f ns*/named.lock
 rm -f ns*/named.memstats
 rm -f ns*/*.run
+rm -f ns*/named.port
+rm -f ns*/*core *core
+rm -f ns*/named.conf
+
 rm -f ns2/*.local
 rm -f ns2/*.queries
 rm -f ns2/named.[0-9]*.conf
-rm -f ns2/named.conf
-rm -f ns3/named.conf
-rm -f ns*/*core *core
+rm -f ns2/named.conf.header
+
+rm -f ans4/ans.pl
+
 rm -f dnsrps*.conf dnsrpzd*
 rm -f ns*/session.key
index dba93e35d2f6afd4cc405d5952e2e59029149d03..a1c890d5ff3247c05d4966218f5e778172b85f92 100644 (file)
@@ -12,15 +12,14 @@ set -e
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
-
-. ../getopts.sh
+. $SYSTEMTESTTOP/getopts.sh
 
 USAGE="$0: [-xD]"
 DEBUG=
 while getopts "xD" c; do
     case $c in
        x) set -x; DEBUG=-x;;
-        D) TEST_DNSRPS="-D";;
+       D) TEST_DNSRPS="-D";;
        N) NOCLEAN=set;;
        *) echo "$USAGE" 1>&2; exit 1;;
     esac
@@ -30,20 +29,27 @@ if test "$#" -ne 0; then
     echo "$USAGE" 1>&2
     exit 1
 fi
+OPTIND=1
 
 [ ${NOCLEAN:-unset} = unset ] && $SHELL clean.sh $DEBUG
 
 $PERL testgen.pl
-$SEDPORTS < ns1/named.conf.in > ns1/named.conf
+
+copy_setports ns1/named.conf.in ns1/named.conf
 echo "${port}" > ns1/named.port
-$SEDPORTS < ns2/named.conf.header.in > ns2/named.conf.header
+
+copy_setports ns2/named.conf.header.in ns2/named.conf.header
 echo "${port}" > ns2/named.port
-cp -f ns2/named.default.conf ns2/named.conf
-$SEDPORTS < ns3/named1.conf.in > ns3/named.conf
+
+copy_setports ns2/named.default.conf ns2/named.conf
+
+copy_setports ns3/named1.conf.in ns3/named.conf
 echo "${port}" > ns3/named.port
-$SEDPORTS < ns4/named.conf.in > ns4/named.conf
+
+copy_setports ns4/named.conf.in ns4/named.conf
 echo "${port}" > ns4/named.port
-$SEDPORTS < ans5/ans.pl.in > ans5/ans.pl
+
+copy_setports ans5/ans.pl.in ans5/ans.pl
 
 # decide whether to test DNSRPS
 $SHELL ../rpz/ckdnsrps.sh $TEST_DNSRPS $DEBUG
index f26743cf4ad78663975ae6354aa09cf0373e71bb..e30e120227c601aeaf1a6c82764e4757f30fb6d3 100644 (file)
@@ -68,7 +68,7 @@ result=$?
 if [ $result -eq 0 ]; then
     : prereqs ok
 else
-    echowarn "I:Prerequisites for $test missing, skipping test." >&2
+    echowarn "I:$test:Prerequisites missing, skipping test." >&2
     [ $result -eq 255 ] && echowarn "R:$test:SKIPPED" || echowarn "R:$test:UNTESTED"
     echoinfo "E:$test:`date $dateargs`" >&2
     exit 0
@@ -76,7 +76,7 @@ fi
 
 # Test sockets after the prerequisites has been setup
 $PERL testsock.pl -p "${port}" || {
-    echowarn "I:Network interface aliases not set up.  Skipping test." >&2;
+    echowarn "I:$test:Network interface aliases not set up.  Skipping test." >&2;
     echowarn "R:$test:UNTESTED" >&2;
     echoinfo "E:$test:`date $dateargs`" >&2;
     exit 0;
@@ -88,7 +88,7 @@ if
 then
     : pkcs11 ok
 else
-    echowarn "I:Need PKCS#11 for $test, skipping test." >&2
+    echowarn "I:$test:Need PKCS#11, skipping test." >&2
     echowarn "R:$test:PKCS11ONLY" >&2
     echoinfo "E:$test:`date $dateargs`" >&2
     exit 0
index 5d073079d346c0036f7fb5659549de258e166e7e..e2efb77bf2576282d2431bbac0b9eec57d98636e 100644 (file)
@@ -4,6 +4,7 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+rm -f test.output
 rm -f dig.out.test*
 rm -f ns1/named.conf ns1/named.port
 rm -f ans2/ans.pl ans2/named.port
index 5526340990932b533abe933414d4873f8176b0a6..1e05053348e347aaa029fadf2864102b377b6429 100644 (file)
@@ -7,11 +7,11 @@
 
 . ../getopts.sh
 
-copy_config ns1/named1.conf.in ns1/named.conf
+copy_setports ns1/named1.conf.in ns1/named.conf
 echo "${port}" > ns1/named.port
 
-copy_config ans2/ans.pl.in ans2/ans.pl
+copy_setports ans2/ans.pl.in ans2/ans.pl
 echo "${port}" > ans2/named.port
 
-copy_config ns3/named.conf.in ns3/named.conf
+copy_setports ns3/named.conf.in ns3/named.conf
 echo "${port}" > ns3/named.port
index c7e2d0f30ce49a67e37f19259dd4b98354bef3ef..7985433326ba2648ac000bec6729b224cca0bf91 100755 (executable)
@@ -335,7 +335,7 @@ status=`expr $status + $ret`
 n=`expr $n + 1`
 echo_i "updating ns1/named.conf ($n)"
 ret=0
-$SEDPORTS < ns1/named2.conf.in > ns1/named.conf
+copy_setports ns1/named2.conf.in ns1/named.conf
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`