]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt46602] Miscellaneous tidying up of code cherry-picked from experimental branch
authorStephen Morris <stephen@isc.org>
Wed, 15 Nov 2017 18:44:54 +0000 (18:44 +0000)
committerStephen Morris <stephen@isc.org>
Fri, 16 Feb 2018 14:57:51 +0000 (14:57 +0000)
bin/tests/system/allow_query/setup.sh
bin/tests/system/allow_query/tests.sh
bin/tests/system/getopts.sh
bin/tests/system/serve-stale/setup.sh
bin/tests/system/serve-stale/tests.sh

index b267da98e67454d0348065f8d67d36364e1a5515..53f030681b27eae11b58259f4ba851897faaec87 100644 (file)
@@ -10,6 +10,6 @@
 
 . ../getopts.sh
 
-sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ../common/controls.conf.in > ns2/controls.conf
-sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named01.conf.in > ns2/named.conf
+copy_config ../common/controls.conf.in ns2/controls.conf
+copy_config  ns2/named01.conf.in ns2/named.conf
 echo "${port}" > ns2/named.port
index 7cfbdbbd6d7b52b5d55d7628b04469d3ee4cc799..b8a7ea2749bdae7dacf07a32e69117fae51f9ed1 100644 (file)
@@ -51,8 +51,7 @@
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
-
-. ../getopts.sh
+. $SYSTEMTESTTOP/getopts.sh
 
 DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p ${port}"
 
@@ -76,7 +75,7 @@ status=`expr $status + $ret`
 
 # Test 2 - explicit any, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named02.conf.in > ns2/named.conf
+copy_config ns2/named02.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -90,7 +89,7 @@ status=`expr $status + $ret`
 
 # Test 3 - none, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named03.conf.in > ns2/named.conf
+copy_config ns2/named03.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -104,7 +103,7 @@ status=`expr $status + $ret`
 
 # Test 4 - address allowed, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named04.conf.in > ns2/named.conf
+copy_config ns2/named04.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -118,7 +117,7 @@ status=`expr $status + $ret`
 
 # Test 5 - address not allowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named05.conf.in > ns2/named.conf
+copy_config ns2/named05.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -132,7 +131,7 @@ status=`expr $status + $ret`
 
 # Test 6 - address disallowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named06.conf.in > ns2/named.conf
+copy_config ns2/named06.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -146,7 +145,7 @@ status=`expr $status + $ret`
 
 # Test 7 - acl allowed, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named07.conf.in > ns2/named.conf
+copy_config ns2/named07.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -160,7 +159,7 @@ status=`expr $status + $ret`
 
 # Test 8 - acl not allowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named08.conf.in > ns2/named.conf
+copy_config ns2/named08.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -175,7 +174,7 @@ status=`expr $status + $ret`
 
 # Test 9 - acl disallowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named09.conf.in > ns2/named.conf
+copy_config ns2/named09.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -189,7 +188,7 @@ status=`expr $status + $ret`
 
 # Test 10 - key allowed, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named10.conf.in > ns2/named.conf
+copy_config ns2/named10.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -203,7 +202,7 @@ status=`expr $status + $ret`
 
 # Test 11 - key not allowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named11.conf.in > ns2/named.conf
+copy_config ns2/named11.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -217,7 +216,7 @@ status=`expr $status + $ret`
 
 # Test 12 - key disallowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named12.conf.in > ns2/named.conf
+copy_config ns2/named12.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -234,7 +233,7 @@ status=`expr $status + $ret`
 n=20
 # Test 21 - views default, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named21.conf.in > ns2/named.conf
+copy_config ns2/named21.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -248,7 +247,7 @@ status=`expr $status + $ret`
 
 # Test 22 - views explicit any, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named22.conf.in > ns2/named.conf
+copy_config ns2/named22.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -262,7 +261,7 @@ status=`expr $status + $ret`
 
 # Test 23 - views none, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named23.conf.in > ns2/named.conf
+copy_config ns2/named23.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -276,7 +275,7 @@ status=`expr $status + $ret`
 
 # Test 24 - views address allowed, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named24.conf.in > ns2/named.conf
+copy_config ns2/named24.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -290,7 +289,7 @@ status=`expr $status + $ret`
 
 # Test 25 - views address not allowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named25.conf.in > ns2/named.conf
+copy_config ns2/named25.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -304,7 +303,7 @@ status=`expr $status + $ret`
 
 # Test 26 - views address disallowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named26.conf.in > ns2/named.conf
+copy_config ns2/named26.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -318,7 +317,7 @@ status=`expr $status + $ret`
 
 # Test 27 - views acl allowed, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named27.conf.in > ns2/named.conf
+copy_config ns2/named27.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -332,7 +331,7 @@ status=`expr $status + $ret`
 
 # Test 28 - views acl not allowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named28.conf.in > ns2/named.conf
+copy_config ns2/named28.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -346,7 +345,7 @@ status=`expr $status + $ret`
 
 # Test 29 - views acl disallowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named29.conf.in > ns2/named.conf
+copy_config ns2/named29.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -360,7 +359,7 @@ status=`expr $status + $ret`
 
 # Test 30 - views key allowed, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named30.conf.in > ns2/named.conf
+copy_config ns2/named30.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -374,7 +373,7 @@ status=`expr $status + $ret`
 
 # Test 31 - views key not allowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named31.conf.in > ns2/named.conf
+copy_config ns2/named31.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -388,7 +387,7 @@ status=`expr $status + $ret`
 
 # Test 32 - views key disallowed, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named32.conf.in > ns2/named.conf
+copy_config ns2/named32.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -402,7 +401,7 @@ status=`expr $status + $ret`
 
 # Test 33 - views over options, views allow, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named33.conf.in > ns2/named.conf
+copy_config ns2/named33.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -416,7 +415,7 @@ status=`expr $status + $ret`
 
 # Test 34 - views over options, views disallow, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named34.conf.in > ns2/named.conf
+copy_config ns2/named34.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -434,7 +433,7 @@ n=40
 
 # Test 41 - zone default, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named40.conf.in > ns2/named.conf
+copy_config ns2/named40.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -558,7 +557,7 @@ status=`expr $status + $ret`
 
 # Test 53 - zones over options, zones allow, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named53.conf.in > ns2/named.conf
+copy_config ns2/named53.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -572,7 +571,7 @@ status=`expr $status + $ret`
 
 # Test 54 - zones over options, zones disallow, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named54.conf.in > ns2/named.conf
+copy_config ns2/named54.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -586,7 +585,7 @@ status=`expr $status + $ret`
 
 # Test 55 - zones over views, zones allow, query allowed
 n=`expr $n + 1`
-$SEDPORTS < ns2/named55.conf.in > ns2/named.conf
+copy_config ns2/named55.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -600,7 +599,7 @@ status=`expr $status + $ret`
 
 # Test 56 - zones over views, zones disallow, query refused
 n=`expr $n + 1`
-$SEDPORTS < ns2/named56.conf.in > ns2/named.conf
+copy_config ns2/named56.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
@@ -614,7 +613,7 @@ status=`expr $status + $ret`
 
 # Test 57 - zones over views, zones disallow, query refused (allow-query-on)
 n=`expr $n + 1`
-$SEDPORTS < ns2/named57.conf.in > ns2/named.conf
+copy_config ns2/named57.conf.in ns2/named.conf
 rndc_reload
 sleep 5
 
index af61ae281b6bed2f9d3a1c96e9f90a8e201e1345..cdb0922a53204d72954c2ac8a8be199f9c5a466d 100644 (file)
@@ -21,4 +21,8 @@ done
 shift $(($OPTIND - 1))
 OPTIND=1
 
-SEDPORTS="sed -e s/@PORT@/${port}/g -e s/@CONTROLPORT@/${controlport}/g"
+# 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() {
+    sed -e "s/@PORT@/${port}/g" -e "s/@CONTROLPORT@/${controlport}/g" < $1 > $2
+}
index 4e9363967de5679b1126dc70b0f430c60e9df185..5526340990932b533abe933414d4873f8176b0a6 100644 (file)
@@ -7,11 +7,11 @@
 
 . ../getopts.sh
 
-$SEDPORTS < ns1/named1.conf.in > ns1/named.conf
+copy_config ns1/named1.conf.in ns1/named.conf
 echo "${port}" > ns1/named.port
 
-$SEDPORTS < ans2/ans.pl.in > ans2/ans.pl
+copy_config ans2/ans.pl.in ans2/ans.pl
 echo "${port}" > ans2/named.port
 
-$SEDPORTS < ns3/named.conf.in > ns3/named.conf
+copy_config ns3/named.conf.in ns3/named.conf
 echo "${port}" > ns3/named.port
index 1cd8151193c07654c346d197515bb1269bae1de0..c7e2d0f30ce49a67e37f19259dd4b98354bef3ef 100755 (executable)
@@ -8,18 +8,7 @@
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
-
-. ../getopts.sh
-
-TESTNAME="$(basename $(pwd))"
-
-while getopts "p:c:" flag; do
-    case "$flag" in
-       p) port=$OPTARG ;;
-       c) controlport=$OPTARG ;;
-       *) exit 1 ;;
-    esac
-done
+. $SYSTEMTESTTOP/getopts.sh
 
 RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${controlport} -s"