]> 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)
committerEvan Hunt <each@isc.org>
Sun, 25 Feb 2018 17:22:13 +0000 (09:22 -0800)
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.

(cherry picked from commit 78f2b9ca01143dd20b543a8ea360338f28c4ba78)
(cherry picked from commit 01eb4d7c973e53dc06e434d137640c1c5acde455)
(cherry picked from commit f5b71b3658cc542e6c7a199bc3115b36339199e0)

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/run.sh

index f86007d11d8eb695f6bc7c81b62d8e61cba8a178..359c6087b8ef430913428a76f0c78ca53df13e47 100644 (file)
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: clean.sh,v 1.2 2010/11/16 01:37:36 sar Exp $
-
 #
 # 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 4212c394a1abd86d83e2e6addf47891b4e554d9e..7c28fab4bb3cfa567419074c93ae0cffeaa7b8cf 100644 (file)
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: setup.sh,v 1.2 2010/11/16 01:37:36 sar Exp $
-
 . ../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 946ab8da294bfa7a3383a4ba3db776df6b7b1db1..95da6a010d3517d905d918df7e8e35f3c48d3118 100644 (file)
@@ -14,8 +14,6 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: tests.sh,v 1.3 2010/12/02 23:22:41 marka Exp $
-
 # Test of allow-query statement.
 # allow-query takes an address match list and can be included in either the
 # options statement or in the zone statement.  This test assumes that the
@@ -83,7 +81,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
 
@@ -97,7 +95,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
 
@@ -111,7 +109,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
 
@@ -125,7 +123,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
 
@@ -139,7 +137,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
 
@@ -153,7 +151,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
 
@@ -167,7 +165,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
 
@@ -182,7 +180,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
 
@@ -196,7 +194,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
 
@@ -210,7 +208,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
 
@@ -224,7 +222,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
 
@@ -241,7 +239,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
 
@@ -255,7 +253,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
 
@@ -269,7 +267,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
 
@@ -283,7 +281,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
 
@@ -297,7 +295,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
 
@@ -311,7 +309,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
 
@@ -325,7 +323,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
 
@@ -339,7 +337,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
 
@@ -353,7 +351,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
 
@@ -367,7 +365,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
 
@@ -381,7 +379,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
 
@@ -395,7 +393,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
 
@@ -409,7 +407,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
 
@@ -423,7 +421,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
 
@@ -441,7 +439,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
 
@@ -565,7 +563,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
 
@@ -579,7 +577,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
 
@@ -593,7 +591,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
 
@@ -607,7 +605,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
 
@@ -621,7 +619,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 594ece5a23a5c31da68ab9cfa08f90a685316e87..b19a6a62bf0560263f367868c4bccfce947396d1 100644 (file)
@@ -139,6 +139,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
@@ -146,6 +147,7 @@ else
     COLOR_FAIL=''
     COLOR_WARN=''
     COLOR_PASS=''
+    COLOR_STEN=''
     COLOR_INFO=''
     COLOR_NONE=''
 fi
@@ -162,7 +164,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 d3985266952f57cd9f313ec1b0ce09ae1da2ceda..13e12bafefcf36092288c9ef62aaa2b5ef08eda9 100644 (file)
@@ -77,7 +77,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
@@ -85,7 +85,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;
@@ -97,7 +97,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