]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt46602] Adjust rpzrecurse for dynamic port usage
authorOndřej Surý <ondrej@sury.org>
Wed, 18 Oct 2017 12:56:26 +0000 (14:56 +0200)
committerStephen Morris <stephen@isc.org>
Fri, 16 Feb 2018 14:57:51 +0000 (14:57 +0000)
Resolve conflict in run.sh during cherry-pick from an experimental branch.

14 files changed:
bin/tests/system/Makefile.in
bin/tests/system/conf.sh.in
bin/tests/system/conf.sh.win32
bin/tests/system/getopts.sh
bin/tests/system/rpzrecurse/.gitignore
bin/tests/system/rpzrecurse/ans5/ans.pl.in [moved from bin/tests/system/rpzrecurse/ans5/ans.pl with 96% similarity]
bin/tests/system/rpzrecurse/ns1/named.conf.in [moved from bin/tests/system/rpzrecurse/ns1/named.conf with 98% similarity]
bin/tests/system/rpzrecurse/ns2/named.conf.header.in [moved from bin/tests/system/rpzrecurse/ns2/named.conf.header with 89% similarity]
bin/tests/system/rpzrecurse/ns3/named1.conf.in [moved from bin/tests/system/rpzrecurse/ns3/named1.conf with 90% similarity]
bin/tests/system/rpzrecurse/ns3/named2.conf.in [moved from bin/tests/system/rpzrecurse/ns3/named2.conf with 90% similarity]
bin/tests/system/rpzrecurse/ns4/named.conf.in [moved from bin/tests/system/rpzrecurse/ns4/named.conf with 97% similarity]
bin/tests/system/rpzrecurse/setup.sh
bin/tests/system/rpzrecurse/tests.sh
bin/tests/system/run.sh

index 16a5f6c96b1fae2547571997ba419891fa057c87..484bccf2fb25fe82d8a5457203216badb67bd659 100644 (file)
@@ -45,16 +45,14 @@ feature-test@EXEEXT@: feature-test.@O@
 
 check: test
 
-TESTS = allow_query serve-stale
+TESTS = allow_query serve-stale rpzrecurse
 
 test: subdirs $(TESTS)
        if test -f ./runall.sh; then $(SHELL) ./runall.sh; fi
 
-serve-stale:
-       $(SHELL) ./run.sh -p 5304 -c 9954 $@
-
-allow_query:
-       $(SHELL) ./run.sh -p 5305 -c 9955 $@
+$(TESTS):
+       PORT=$$((32767+$$RANDOM)); \
+       $(SHELL) ./run.sh -p $$(($$PORT)) -c $$(($$PORT+1)) $@
 
 testclean clean distclean::
        if test -f ./cleanall.sh; then sh ./cleanall.sh; fi
index d76a817ddad8ec6c9d2296a2d7409b8551c6b249..bc553905c8d6e6889995b156c9a59e4390b3070d 100644 (file)
@@ -82,7 +82,7 @@ SUBDIRS="acl additional addzone auth autosign builtin
         logfileconfig masterfile masterformat metadata mkeys
         names notify nslookup nsupdate nzd2nzf padding pending
         pipelined @PKCS11_TEST@ reclimit redirect resolver rndc
-        rpz rpzrecurse rrchecker rrl rrsetorder rsabigexponent
+        rpz rrchecker rrl rrsetorder rsabigexponent
         runtime sfcache smartsign sortlist spf staticstub
         statistics statschannel stub synthfromdnssec tcp tkey tools
         tsig tsiggss unknown upforwd verify views wildcard xfer
index 2d48882289c26715de3d9e471cba832f0ef7a58d..492fbb81d21008bcecbd204c7fb42d02ffe0bc50 100644 (file)
@@ -79,7 +79,7 @@ KRB5_CONFIG=NUL
 # The "stress" test is not run by default since it creates enough
 # load on the machine to make it unusable to other users.
 # v6synth
-SUBDIRS="acl additional addzone allow_query autosign builtin
+SUBDIRS="acl additional addzone autosign builtin
         cacheclean case catz
         checkconf @CHECKDS@ checknames checkzone cookie @COVERAGE@
         database digdelv dlv dlvauto dlz dlzexternal dname
@@ -89,7 +89,7 @@ SUBDIRS="acl additional addzone allow_query autosign builtin
         keepalive @KEYMGR@ legacy limits logfileconfig masterfile
         masterformat metadata mkeys names notify nslookup nsupdate
         nzd2nzf padding pending pipelined @PKCS11_TEST@ reclimit
-        redirect resolver rndc rpz rpzrecurse rrchecker rrl
+        redirect resolver rndc rpz rrchecker rrl
         rrsetorder rsabigexponent runtime sfcache smartsign sortlist
         spf staticstub statistics statschannel stub tcp tkey tsig
         tsiggss unknown upforwd verify views wildcard xfer xferquota
index cd8d5b0e14394c6b8d44bcb2061e5a49fe55f29b..af61ae281b6bed2f9d3a1c96e9f90a8e201e1345 100644 (file)
@@ -10,7 +10,7 @@
 port=5300
 controlport=9953
 
-while getopts "p:c:" flag; do
+while getopts ":p:c:" flag; do
     case "$flag" in
        p) port=$OPTARG ;;
        c) controlport=$OPTARG ;;
@@ -19,5 +19,6 @@ while getopts "p:c:" flag; do
     esac
 done
 shift $(($OPTIND - 1))
+OPTIND=1
 
 SEDPORTS="sed -e s/@PORT@/${port}/g -e s/@CONTROLPORT@/${controlport}/g"
index 6154e068775a047fadfba2738b4934d2ff055330..ed45f426ce1098bd9c106bb36470089582a38445 100644 (file)
@@ -1,2 +1,11 @@
-/rpz
-/rpz.o
+/ns1/named.conf
+/ns2/named.conf.header
+/ns2/named.conf
+/ns3/named.conf
+/ns4/named.conf
+/ans5/ans.pl
+/ans5/ans.pid
+/dnsrps-slave.conf
+/dnsrps.conf
+/dnsrpzd.conf
+session.key
similarity index 96%
rename from bin/tests/system/rpzrecurse/ans5/ans.pl
rename to bin/tests/system/rpzrecurse/ans5/ans.pl.in
index 481b794cc83e7f25c0dc91edd03e33b7f7407279..1e04f88c0456b99b9d6ebc9b1af472599d32ac69 100644 (file)
@@ -12,7 +12,7 @@ use Net::DNS;
 use Net::DNS::Packet;
 
 my $sock = IO::Socket::INET->new(LocalAddr => "10.53.0.5",
-   LocalPort => 5300, Proto => "udp") or die "$!";
+   LocalPort => @PORT@, Proto => "udp") or die "$!";
 
 my $pidf = new IO::File "ans.pid", "w" or die "cannot open pid file: $!";
 print $pidf "$$\n" or die "cannot write pid file: $!";
similarity index 98%
rename from bin/tests/system/rpzrecurse/ns1/named.conf
rename to bin/tests/system/rpzrecurse/ns1/named.conf.in
index d1b1319be33fd6e3eb9106219115c1b6675bdfef..ddd7b1c54ae4f88fce8c8a629376318e8d397b09 100644 (file)
@@ -10,7 +10,7 @@ options {
        query-source address 10.53.0.1;
        notify-source 10.53.0.1;
        transfer-source 10.53.0.1;
-       port 5300;
+       port @PORT@;
        session-keyfile "session.key";
        pid-file "named.pid";
        listen-on { 10.53.0.1; };
similarity index 89%
rename from bin/tests/system/rpzrecurse/ns2/named.conf.header
rename to bin/tests/system/rpzrecurse/ns2/named.conf.header.in
index 3fdd026b9fc2b4bbd4458dbf993dc374dbc83850..ec60cb540fe8f06e662ff63a82efb8481cb6beb7 100644 (file)
@@ -12,7 +12,7 @@ options {
        query-source address 10.53.0.2;
        notify-source 10.53.0.2;
        transfer-source 10.53.0.2;
-       port 5300;
+       port @PORT@;
        session-keyfile "session.key";
        pid-file "named.pid";
        listen-on { 10.53.0.2; };
@@ -30,6 +30,6 @@ key rndc_key {
 };
 
 controls {
-       inet 10.53.0.2 port 9953 allow { any; } keys { rndc_key; };
+       inet 10.53.0.2 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
similarity index 90%
rename from bin/tests/system/rpzrecurse/ns3/named1.conf
rename to bin/tests/system/rpzrecurse/ns3/named1.conf.in
index c98c8c9182b1c0a2783c525d4d15ff0dd09a1873..5572ddbd88e66b1f35322afed57adc2bfc0df4f3 100644 (file)
@@ -9,14 +9,14 @@
 include "../../common/rndc.key";
 
 controls {
-       inet 10.53.0.3 port 9953 allow { any; } keys { rndc_key; };
+       inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
 options {
        query-source address 10.53.0.3;
        notify-source 10.53.0.3;
        transfer-source 10.53.0.3;
-       port 5300;
+       port @PORT@;
        session-keyfile "session.key";
        pid-file "named.pid";
        listen-on { 10.53.0.3; };
similarity index 90%
rename from bin/tests/system/rpzrecurse/ns3/named2.conf
rename to bin/tests/system/rpzrecurse/ns3/named2.conf.in
index f7b9e9ef615d5fc1332d03431b8e512ca599751a..5fb8f010f7ab95af0faa2e89e518fba7101867fc 100644 (file)
@@ -9,14 +9,14 @@
 include "../../common/rndc.key";
 
 controls {
-       inet 10.53.0.3 port 9953 allow { any; } keys { rndc_key; };
+       inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
 options {
        query-source address 10.53.0.3;
        notify-source 10.53.0.3;
        transfer-source 10.53.0.3;
-       port 5300;
+       port @PORT@;
        pid-file "named.pid";
        listen-on { 10.53.0.3; };
        listen-on-v6 { none; };
similarity index 97%
rename from bin/tests/system/rpzrecurse/ns4/named.conf
rename to bin/tests/system/rpzrecurse/ns4/named.conf.in
index f76d7bce1cebfe4baf611adb6ed39bd933501c81..0473d5c2039111c230d994819f7ae4ae2672a68d 100644 (file)
@@ -12,7 +12,7 @@ options {
        query-source address 10.53.0.4;
        notify-source 10.53.0.4;
        transfer-source 10.53.0.4;
-       port 5300;
+       port @PORT@;
        session-keyfile "session.key";
        pid-file "named.pid";
        listen-on { 10.53.0.4; };
index 795d357acd9ca9c9c644ec826ab910db83b2fe79..dba93e35d2f6afd4cc405d5952e2e59029149d03 100644 (file)
@@ -13,6 +13,8 @@ set -e
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
 
+. ../getopts.sh
+
 USAGE="$0: [-xD]"
 DEBUG=
 while getopts "xD" c; do
@@ -32,8 +34,16 @@ fi
 [ ${NOCLEAN:-unset} = unset ] && $SHELL clean.sh $DEBUG
 
 $PERL testgen.pl
+$SEDPORTS < ns1/named.conf.in > ns1/named.conf
+echo "${port}" > ns1/named.port
+$SEDPORTS < ns2/named.conf.header.in > ns2/named.conf.header
+echo "${port}" > ns2/named.port
 cp -f ns2/named.default.conf ns2/named.conf
-cp -f ns3/named1.conf ns3/named.conf
+$SEDPORTS < ns3/named1.conf.in > ns3/named.conf
+echo "${port}" > ns3/named.port
+$SEDPORTS < ns4/named.conf.in > ns4/named.conf
+echo "${port}" > ns4/named.port
+$SEDPORTS < ans5/ans.pl.in > ans5/ans.pl
 
 # decide whether to test DNSRPS
 $SHELL ../rpz/ckdnsrps.sh $TEST_DNSRPS $DEBUG
index 38032175523d0c4272c356626d9803a8fad597a7..f35159c0ad62ac4ca538a6ca494f995203223291 100644 (file)
@@ -38,18 +38,18 @@ trap 'exit 1' 1 2 15
 
 
 DNSRPSCMD=../rpz/dnsrps
-RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p 9953 -s"
+RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
 
 # $1 = test name (such as 1a, 1b, etc. for which named.$1.conf exists)
 run_server() {
     TESTNAME=$1
 
-    echo "I:stopping resolver"
+    echo_i "stopping resolver"
     $PERL $SYSTEMTESTTOP/stop.pl . ns2
 
     sleep 1
 
-    echo "I:starting resolver using named.$TESTNAME.conf"
+    echo_i "starting resolver using named.$TESTNAME.conf"
     cp -f ns2/named.$TESTNAME.conf ns2/named.conf
     $PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns2
     sleep 3
@@ -60,7 +60,7 @@ run_query() {
     LINE=$2
 
     NAME=`sed -n -e "$LINE,"'$p' ns2/$TESTNAME.queries | head -n 1`
-    $DIG $DIGOPTS $NAME a @10.53.0.2 -p 5300 -b 127.0.0.1 > dig.out.${t}
+    $DIG $DIGOPTS $NAME a @10.53.0.2 -p ${PORT} -b 127.0.0.1 > dig.out.${t}
     grep "status: SERVFAIL" dig.out.${t} > /dev/null 2>&1 && return 1
     return 0
 }
@@ -73,10 +73,10 @@ expect_norecurse() {
 
     NAME=`sed -n -e "$LINE,"'$p' ns2/$TESTNAME.queries | head -n 1`
     t=`expr $t + 1`
-    echo "I:testing $NAME doesn't recurse (${t})"
+    echo_i "testing $NAME doesn't recurse (${t})"
     add_test_marker 10.53.0.2
     run_query $TESTNAME $LINE || {
-       echo "I:test ${t} failed"
+       echo_i "test ${t} failed"
        status=1
     }
 }
@@ -89,10 +89,10 @@ expect_recurse() {
 
     NAME=`sed -n -e "$LINE,"'$p' ns2/$TESTNAME.queries | head -n 1`
     t=`expr $t + 1`
-    echo "I:testing $NAME recurses (${t})"
+    echo_i "testing $NAME recurses (${t})"
     add_test_marker 10.53.0.2
     run_query $TESTNAME $LINE && {
-       echo "I:test ${t} failed"
+       echo_i "test ${t} failed"
        status=1
     }
 }
@@ -118,17 +118,17 @@ do
   case $mode in
   native)
     if [ ${DNSRPS_TEST_MODE:-unset} = unset -a -e dnsrps-only ] ; then
-     echo "I:'dnsrps-only' found: skipping native RPZ sub-test"
+     echo_i "'dnsrps-only' found: skipping native RPZ sub-test"
      continue
     fi
     ;;
   dnsrps)
     if [ ${DNSRPS_TEST_MODE:-unset} = unset -a -e dnsrps-off ] ; then
-      echo "I:'dnsrps-off' found: skipping DNSRPS sub-test"
+      echo_i "'dnsrps-off' found: skipping DNSRPS sub-test"
       continue
     fi
     if grep '^#skip' dnsrps.conf > /dev/null ; then
-      echo "I:DNSRPS sub-test skipped"
+      echo_i "DNSRPS sub-test skipped"
       continue
     fi
     $SHELL ./setup.sh -N -D $DEBUG
@@ -143,20 +143,20 @@ do
   sed -n 's/^## /I:/p' dnsrps.conf
 
   t=`expr $t + 1`
-  echo "I:testing that l1.l0 exists without RPZ (${t})"
+  echo_i "testing that l1.l0 exists without RPZ (${t})"
   add_test_marker 10.53.0.2
-  $DIG $DIGOPTS l1.l0 ns @10.53.0.2 -p 5300 > dig.out.${t}
+  $DIG $DIGOPTS l1.l0 ns @10.53.0.2 -p ${PORT} > dig.out.${t}
   grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
-    echo "I:test ${t} failed"
+    echo_i "test ${t} failed"
     status=1
   }
 
   t=`expr $t + 1`
-  echo "I:testing that l2.l1.l0 returns SERVFAIL without RPZ (${t})"
+  echo_i "testing that l2.l1.l0 returns SERVFAIL without RPZ (${t})"
   add_test_marker 10.53.0.2
-  $DIG $DIGOPTS l2.l1.l0 ns @10.53.0.2 -p 5300 > dig.out.${t}
+  $DIG $DIGOPTS l2.l1.l0 ns @10.53.0.2 -p ${PORT} > dig.out.${t}
   grep "status: SERVFAIL" dig.out.${t} > /dev/null 2>&1 || {
-    echo "I:test ${t} failed"
+    echo_i "test ${t} failed"
     status=1
   }
 
@@ -210,7 +210,7 @@ do
     run_server 4$n
     ni=$1
     t=`expr $t + 1`
-    echo "I:testing that ${ni} of 33 queries skip recursion (${t})"
+    echo_i "testing that ${ni} of 33 queries skip recursion (${t})"
     add_test_marker 10.53.0.2
     c=0
     for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \
@@ -221,7 +221,7 @@ do
     done
     skipped=`expr 33 - $c`
     if [ $skipped != $ni ]; then
-      echo "I:test $t failed (actual=$skipped, expected=$ni)"
+      echo_i "test $t failed (actual=$skipped, expected=$ni)"
       status=1
     fi
     shift
@@ -239,15 +239,15 @@ do
   if [ ! "$CYGWIN" -o -n "$PSSUSPEND" ]
   then
     # Group 6
-    echo "I:check recursive behavior consistency during policy update races"
+    echo_i "check recursive behavior consistency during policy update races"
     run_server 6a
     sleep 1
     t=`expr $t + 1`
-    echo "I:running dig to cache CNAME record (${t})"
+    echo_i "running dig to cache CNAME record (${t})"
     add_test_marker 10.53.0.1 10.53.0.2
-    $DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org CNAME > dig.out.${t}
+    $DIG $DIGOPTS @10.53.0.2 -p ${PORT} www.test.example.org CNAME > dig.out.${t}
     sleep 1
-    echo "I:suspending authority server"
+    echo_i "suspending authority server"
     PID=`cat ns1/named.pid`
     if [ "$CYGWIN" ]
     then
@@ -255,23 +255,23 @@ do
     else
       $KILL -STOP $PID
     fi
-    echo "I:adding an NSDNAME policy"
+    echo_i "adding an NSDNAME policy"
     cp ns2/db.6a.00.policy.local ns2/saved.policy.local
     cp ns2/db.6b.00.policy.local ns2/db.6a.00.policy.local
-    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
     test -f dnsrpzd.pid && $KILL -USR1 `cat dnsrpzd.pid`
     sleep 1
     t=`expr $t + 1`
-    echo "I:running dig to follow CNAME (blocks, so runs in the background) (${t})"
+    echo_i "running dig to follow CNAME (blocks, so runs in the background) (${t})"
     add_test_marker 10.53.0.2
-    $DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org A > dig.out.${t} &
+    $DIG $DIGOPTS @10.53.0.2 -p ${PORT} www.test.example.org A > dig.out.${t} &
     sleep 1
-    echo "I:removing the NSDNAME policy"
+    echo_i "removing the NSDNAME policy"
     cp ns2/db.6c.00.policy.local ns2/db.6a.00.policy.local
-    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
     test -f dnsrpzd.pid && $KILL -USR1 `cat dnsrpzd.pid`
     sleep 1
-    echo "I:resuming authority server"
+    echo_i "resuming authority server"
     PID=`cat ns1/named.pid`
     if [ "$CYGWIN" ]
     then
@@ -287,20 +287,20 @@ do
       grep "status: .*," dig.out.${t} > /dev/null 2>&1 && break
     done
     grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
-      echo "I:test ${t} failed"
+      echo_i "test ${t} failed"
       status=1
     }
 
-    echo "I:check recursive behavior consistency during policy removal races"
+    echo_i "check recursive behavior consistency during policy removal races"
     cp ns2/saved.policy.local ns2/db.6a.00.policy.local
     run_server 6a
     sleep 1
     t=`expr $t + 1`
-    echo "I:running dig to cache CNAME record (${t})"
+    echo_i "running dig to cache CNAME record (${t})"
     add_test_marker 10.53.0.1 10.53.0.2
-    $DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org CNAME > dig.out.${t}
+    $DIG $DIGOPTS @10.53.0.2 -p ${PORT} www.test.example.org CNAME > dig.out.${t}
     sleep 1
-    echo "I:suspending authority server"
+    echo_i "suspending authority server"
     PID=`cat ns1/named.pid`
     if [ "$CYGWIN" ]
     then
@@ -308,22 +308,22 @@ do
     else
       $KILL -STOP $PID
     fi
-    echo "I:adding an NSDNAME policy"
+    echo_i "adding an NSDNAME policy"
     cp ns2/db.6b.00.policy.local ns2/db.6a.00.policy.local
-    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
     test -f dnsrpzd.pid && $KILL -USR1 `cat dnsrpzd.pid`
     sleep 1
     t=`expr $t + 1`
-    echo "I:running dig to follow CNAME (blocks, so runs in the background) (${t})"
+    echo_i "running dig to follow CNAME (blocks, so runs in the background) (${t})"
     add_test_marker 10.53.0.2
-    $DIG $DIGOPTS @10.53.0.2 -p 5300 www.test.example.org A > dig.out.${t} &
+    $DIG $DIGOPTS @10.53.0.2 -p ${PORT} www.test.example.org A > dig.out.${t} &
     sleep 1
-    echo "I:removing the policy zone"
+    echo_i "removing the policy zone"
     cp ns2/named.default.conf ns2/named.conf
-    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reconfig 2>&1 | sed 's/^/I:ns2 /'
+    $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/I:ns2 /'
     test -f dnsrpzd.pid && $KILL -USR1 `cat dnsrpzd.pid`
     sleep 1
-    echo "I:resuming authority server"
+    echo_i "resuming authority server"
     PID=`cat ns1/named.pid`
     if [ "$CYGWIN" ]
     then
@@ -338,160 +338,160 @@ do
       grep "status: .*," dig.out.${t} > /dev/null 2>&1 && break
     done
     grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
-      echo "I:test ${t} failed"
+      echo_i "test ${t} failed"
       status=1
     }
   fi
 
   # Check CLIENT-IP behavior
   t=`expr $t + 1`
-  echo "I:testing CLIENT-IP behavior (${t})"
+  echo_i "testing CLIENT-IP behavior (${t})"
   add_test_marker 10.53.0.2
   run_server clientip
-  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.4 > dig.out.${t}
   grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
-    echo "I:test $t failed: query failed"
+    echo_i "test $t failed: query failed"
     status=1
   }
   grep "^l2.l1.l0.[    ]*[0-9]*[       ]*IN[   ]*A[    ]*10.53.0.2" dig.out.${t} > /dev/null 2>&1 || {
-    echo "I:test $t failed: didn't get expected answer"
+    echo_i "test $t failed: didn't get expected answer"
     status=1
   }
 
   # Check CLIENT-IP behavior #2
   t=`expr $t + 1`
-  echo "I:testing CLIENT-IP behavior #2 (${t})"
+  echo_i "testing CLIENT-IP behavior #2 (${t})"
   add_test_marker 10.53.0.2
   run_server clientip2
-  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.1 > dig.out.${t}.1
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.1 > dig.out.${t}.1
   grep "status: SERVFAIL" dig.out.${t}.1 > /dev/null 2>&1 || {
-    echo "I:test $t failed: query failed"
+    echo_i "test $t failed: query failed"
     status=1
   }
-  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.2 > dig.out.${t}.2
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.2 > dig.out.${t}.2
   grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null 2>&1 || {
-    echo "I:test $t failed: query failed"
+    echo_i "test $t failed: query failed"
     status=1
   }
-  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.3 > dig.out.${t}.3
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.3 > dig.out.${t}.3
   grep "status: NOERROR" dig.out.${t}.3 > /dev/null 2>&1 || {
-    echo "I:test $t failed: query failed"
+    echo_i "test $t failed: query failed"
     status=1
   }
   grep "^l2.l1.l0.[    ]*[0-9]*[       ]*IN[   ]*A[    ]*10.53.0.1" dig.out.${t}.3 > /dev/null 2>&1 || {
-    echo "I:test $t failed: didn't get expected answer"
+    echo_i "test $t failed: didn't get expected answer"
     status=1
   }
-  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}.4
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.4 > dig.out.${t}.4
   grep "status: SERVFAIL" dig.out.${t}.4 > /dev/null 2>&1 || {
-    echo "I:test $t failed: query failed"
+    echo_i "test $t failed: query failed"
     status=1
   }
 
   # Check RPZ log clause
   t=`expr $t + 1`
-  echo "I:testing RPZ log clause (${t})"
+  echo_i "testing RPZ log clause (${t})"
   add_test_marker 10.53.0.2
   run_server log
   cur=`awk 'BEGIN {l=0} /^/ {l++} END { print l }' ns2/named.run`
-  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.4 > dig.out.${t}
-  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.3 >> dig.out.${t}
-  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p 5300 -b 10.53.0.2 >> dig.out.${t}
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.4 > dig.out.${t}
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.3 >> dig.out.${t}
+  $DIG $DIGOPTS l2.l1.l0 a @10.53.0.2 -p ${PORT} -b 10.53.0.2 >> dig.out.${t}
   sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.4.0.53.10.rpz-client-ip.log1" > /dev/null && {
-    echo "I: failed: unexpected rewrite message for policy zone log1 was logged"
+    echo_i " failed: unexpected rewrite message for policy zone log1 was logged"
     status=1
   }
   sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.3.0.53.10.rpz-client-ip.log2" > /dev/null || {
-    echo "I: failed: expected rewrite message for policy zone log2 was not logged"
+    echo_i " failed: expected rewrite message for policy zone log2 was not logged"
     status=1
   }
   sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-Data rewrite l2.l1.l0 via 32.2.0.53.10.rpz-client-ip.log3" > /dev/null || {
-    echo "I: failed: expected rewrite message for policy zone log3 was not logged"
+    echo_i " failed: expected rewrite message for policy zone log3 was not logged"
     status=1
   }
 
   # Check wildcard behavior
 
   t=`expr $t + 1`
-  echo "I:testing wildcard behavior with 1 RPZ zone (${t})"
+  echo_i "testing wildcard behavior with 1 RPZ zone (${t})"
   add_test_marker 10.53.0.2
   run_server wildcard1
-  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
+  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p ${PORT} > dig.out.${t}.1
   grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
-    echo "I:test ${t} failed"
+    echo_i "test ${t} failed"
     status=1
   }
-  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
+  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p ${PORT} > dig.out.${t}.2
   grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null || {
-    echo "I:test ${t} failed"
+    echo_i "test ${t} failed"
     status=1
   }
 
   t=`expr $t + 1`
-  echo "I:testing wildcard behavior with 2 RPZ zones (${t})"
+  echo_i "testing wildcard behavior with 2 RPZ zones (${t})"
   add_test_marker 10.53.0.2
   run_server wildcard2
-  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
+  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p ${PORT} > dig.out.${t}.1
   grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
-    echo "I:test ${t} failed"
+    echo_i "test ${t} failed"
     status=1
   }
-  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
+  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p ${PORT} > dig.out.${t}.2
   grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null || {
-    echo "I:test ${t} failed"
+    echo_i "test ${t} failed"
     status=1
   }
 
   t=`expr $t + 1`
-  echo "I:testing wildcard behavior with 1 RPZ zone and no non-wildcard triggers (${t})"
+  echo_i "testing wildcard behavior with 1 RPZ zone and no non-wildcard triggers (${t})"
   add_test_marker 10.53.0.2
   run_server wildcard3
-  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.1
+  $DIG $DIGOPTS www.test1.example.net a @10.53.0.2 -p ${PORT} > dig.out.${t}.1
   grep "status: NXDOMAIN" dig.out.${t}.1 > /dev/null || {
-    echo "I:test ${t} failed"
+    echo_i "test ${t} failed"
     status=1
   }
-  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p 5300 > dig.out.${t}.2
+  $DIG $DIGOPTS test1.example.net a @10.53.0.2 -p ${PORT} > dig.out.${t}.2
   grep "status: NOERROR" dig.out.${t}.2 > /dev/null || {
-    echo "I:test ${t} failed"
+    echo_i "test ${t} failed"
     status=1
   }
 
   t=`expr $t + 1`
-  echo "I:checking 'nsip-wait-recurse no' is faster than 'nsip-wait-recurse yes' ($t)"
+  echo_i "checking 'nsip-wait-recurse no' is faster than 'nsip-wait-recurse yes' ($t)"
   add_test_marker 10.53.0.2
-  echo "I:timing 'nsip-wait-recurse yes' (default)"
+  echo_i "timing 'nsip-wait-recurse yes' (default)"
   ret=0
   t1=`$PERL -e 'print time()."\n";'`
-  $DIG -p 5300 @10.53.0.3 foo.child.example.tld a > dig.out.yes.$t
+  $DIG -p ${PORT} @10.53.0.3 foo.child.example.tld a > dig.out.yes.$t
   t2=`$PERL -e 'print time()."\n";'`
   p1=`expr $t2 - $t1`
-  echo "I:elasped time $p1 seconds"
+  echo_i "elasped time $p1 seconds"
 
-  $RNDC  -c ../common/rndc.conf -s 10.53.0.3 -p 9953 flush
+  $RNDC  -c ../common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} flush
   cp -f ns3/named2.conf ns3/named.conf
-  $RNDC  -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload > /dev/null
+  $RNDC  -c ../common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} reload > /dev/null
 
-  echo "I:timing 'nsip-wait-recurse no'"
+  echo_i "timing 'nsip-wait-recurse no'"
   t3=`$PERL -e 'print time()."\n";'`
-  $DIG -p 5300 @10.53.0.3 foo.child.example.tld a > dig.out.no.$t
+  $DIG -p ${PORT} @10.53.0.3 foo.child.example.tld a > dig.out.no.$t
   t4=`$PERL -e 'print time()."\n";'`
   p2=`expr $t4 - $t3`
-  echo "I:elasped time $p2 seconds"
+  echo_i "elasped time $p2 seconds"
 
   if test $p1 -le $p2; then ret=1; fi
-  if test $ret != 0; then echo "I:failed"; fi
+  if test $ret != 0; then echo_i "failed"; fi
   status=`expr $status + $ret`
 
   [ $status -ne 0 ] && pf=fail || pf=pass
   case $mode in
   native)
     native=$status
-    echo "I:status (native RPZ sub-test): $status ($pf)";;
+    echo_i "status (native RPZ sub-test): $status ($pf)";;
   dnsrps)
     dnsrps=$status
-    echo "I:status (DNSRPS sub-test): $status ($pf)";;
-  *) echo "I:invalid test mode";;
+    echo_i "status (DNSRPS sub-test): $status ($pf)";;
+  *) echo_i "invalid test mode";;
   esac
 done
 status=`expr ${native:-0} + ${dnsrps:-0}`
index 908a91a052a97379514c446c81bac0d2b7eb3aca..f26743cf4ad78663975ae6354aa09cf0373e71bb 100644 (file)
@@ -38,9 +38,6 @@ if [ "$((${controlport}+0))" -ne "${controlport}" ] || [ "${controlport}" -le 10
     echo "Specified control port '$controlport' must be numeric (1024,65535>" >&2; exit 1;
 fi
 
-echo "PORT: ${port}"
-echo "CONTROLPORT: ${controlport}"
-
 shift $(($OPTIND - 1))
 
 test $# -gt 0 || { echo "usage: $0 [-k|-n|-p <PORT>] test-directory" >&2; exit 1; }
@@ -48,11 +45,13 @@ test $# -gt 0 || { echo "usage: $0 [-k|-n|-p <PORT>] test-directory" >&2; exit 1
 test=$1
 shift
 
-test -d $test || { echo "$0: $test: no such test" >&2; exit 1; }
+test -d $test || { echofail "$0: $test: no such test" >&2; exit 1; }
 
 echoinfo "S:$test:`date $dateargs`" >&2
 echoinfo "T:$test:1:A" >&2
-echoinfo "A:System test $test" >&2
+echoinfo "A:$test:System test $test" >&2
+echoinfo "I:$test:PORT:${port}" >&2
+echoinfo "I:$test:CONTROLPORT:${controlport}" >&2
 
 if [ x${PERL:+set} = x ]
 then
@@ -63,7 +62,7 @@ then
 fi
 
 # Check for test-specific prerequisites.
-test ! -f $test/prereq.sh || ( cd $test && $SHELL prereq.sh -c "$controlport" -p "$port" "$@" )
+test ! -f $test/prereq.sh || ( cd $test && $SHELL prereq.sh -c "$controlport" -p "$port" -- "$@" )
 result=$?
 
 if [ $result -eq 0 ]; then
@@ -98,14 +97,14 @@ fi
 # Set up any dynamically generated test data
 if test -f $test/setup.sh
 then
-   ( cd $test && $SHELL setup.sh -c "$controlport" -p "$port" "$@" )
+   ( cd $test && $SHELL setup.sh -c "$controlport" -p "$port" -- "$@" )
 fi
 
 # Start name servers running
-$PERL start.pl -p $port $test || { echofail "R:$test:$FAIL"; echoinfo "E:$test:`date $dateargs`"; exit 1; }
+$PERL start.pl -p $port $test || { echofail "R:$test:FAIL"; echoinfo "E:$test:`date $dateargs`"; exit 1; }
 
 # Run the tests
-( cd $test ; $SHELL tests.sh -c "$controlport" -p "$port" "$@" )
+( cd $test ; $SHELL tests.sh -c "$controlport" -p "$port" -- "$@" )
 
 status=$?
 
@@ -132,7 +131,7 @@ else
         rm -f $SYSTEMTESTTOP/random.data
         if test -f $test/clean.sh
         then
-                       ( cd $test && $SHELL clean.sh "-p" "$port" "$@" )
+                       ( cd $test && $SHELL clean.sh "-p" "$port" -- "$@" )
         fi
         if test -d ../../../.git
         then