From: Stephen Morris Date: Fri, 17 Nov 2017 17:29:21 +0000 (+0000) Subject: [rt46602] Miscellaneous changes to existing parallelised tests X-Git-Tag: v9.10.8rc1~84^2~42 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=f5b71b3658cc542e6c7a199bc3115b36339199e0;p=thirdparty%2Fbind9.git [rt46602] Miscellaneous changes to existing parallelised tests 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) --- diff --git a/bin/tests/system/allow_query/clean.sh b/bin/tests/system/allow_query/clean.sh index f86007d11d8..359c6087b8e 100644 --- a/bin/tests/system/allow_query/clean.sh +++ b/bin/tests/system/allow_query/clean.sh @@ -14,12 +14,11 @@ # 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 diff --git a/bin/tests/system/allow_query/setup.sh b/bin/tests/system/allow_query/setup.sh index 4212c394a1a..7c28fab4bb3 100644 --- a/bin/tests/system/allow_query/setup.sh +++ b/bin/tests/system/allow_query/setup.sh @@ -14,10 +14,8 @@ # 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 diff --git a/bin/tests/system/allow_query/tests.sh b/bin/tests/system/allow_query/tests.sh index 946ab8da294..95da6a010d3 100644 --- a/bin/tests/system/allow_query/tests.sh +++ b/bin/tests/system/allow_query/tests.sh @@ -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 diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index e011999133f..0c9af9128f6 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -159,6 +159,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 @@ -166,6 +167,7 @@ else COLOR_FAIL='' COLOR_WARN='' COLOR_PASS='' + COLOR_STEN='' COLOR_INFO='' COLOR_NONE='' fi @@ -182,7 +184,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 () { diff --git a/bin/tests/system/getopts.sh b/bin/tests/system/getopts.sh index cdb0922a532..fd615a4ef14 100644 --- a/bin/tests/system/getopts.sh +++ b/bin/tests/system/getopts.sh @@ -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 } diff --git a/bin/tests/system/rpzrecurse/clean.sh b/bin/tests/system/rpzrecurse/clean.sh index 004401b6bb9..7aaf78c98aa 100644 --- a/bin/tests/system/rpzrecurse/clean.sh +++ b/bin/tests/system/rpzrecurse/clean.sh @@ -14,8 +14,9 @@ # Clean up after rpz tests. +rm -f test.output rm -f dig.out.* -rm -f ns2/named.conf +rm -f ns*/named.conf rm -f ns2/*.local rm -f ns2/*.queries rm -f ns2/named.[0-9]*.conf diff --git a/bin/tests/system/rpzrecurse/setup.sh b/bin/tests/system/rpzrecurse/setup.sh index 8d78fdfb33a..ddb93845e80 100644 --- a/bin/tests/system/rpzrecurse/setup.sh +++ b/bin/tests/system/rpzrecurse/setup.sh @@ -16,15 +16,14 @@ 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 @@ -34,12 +33,15 @@ 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 +copy_setports ns2/named.default.conf ns2/named.conf diff --git a/bin/tests/system/run.sh b/bin/tests/system/run.sh index d3985266952..13e12bafefc 100644 --- a/bin/tests/system/run.sh +++ b/bin/tests/system/run.sh @@ -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