mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
[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.
This commit is contained in:
parent
0e779e67ff
commit
c5c6933718
12 changed files with 128 additions and 100 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -158,6 +158,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
|
||||
|
|
@ -165,6 +166,7 @@ else
|
|||
COLOR_FAIL=''
|
||||
COLOR_WARN=''
|
||||
COLOR_PASS=''
|
||||
COLOR_STEN=''
|
||||
COLOR_INFO=''
|
||||
COLOR_NONE=''
|
||||
fi
|
||||
|
|
@ -181,7 +183,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 () {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,14 +6,21 @@
|
|||
|
||||
# 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*
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@ 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";;
|
||||
-) break;;
|
||||
*) echo "$USAGE" 1>&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
|
@ -29,20 +29,27 @@ if test "$#" -ne 0; then
|
|||
echo "$USAGE" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
OPTIND=1
|
||||
|
||||
$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
|
||||
|
|
|
|||
|
|
@ -46,15 +46,20 @@ if [ -z "$DNSRPS_TEST_MODE" ]; then
|
|||
echo_i "'dnsrps-only' found: skipping native RPZ sub-test"
|
||||
else
|
||||
echo_i "running native RPZ sub-test"
|
||||
$SHELL ./$0 -- -D1 $ARGS || status=1
|
||||
# The "--" between the port specificatiion switches and the argumens
|
||||
# to this script are required bacuse of the two-stage parsing: the
|
||||
# ports are parsed with the "getopt" statement in getopts.sh, and
|
||||
# the "-D" switch with the "getopt" statement in this file. This
|
||||
# parsing also requires that the port switches must be specified first.
|
||||
$SHELL ./$0 -p ${port} -- -D1 $ARGS || status=1
|
||||
fi
|
||||
|
||||
if [ -e dnsrps-off ]; then
|
||||
echo_i "'dnsrps-off' found: skipping DNSRPS sub-test"
|
||||
else
|
||||
echo_i "attempting to configure servers with DNSRPS..."
|
||||
$SHELL ./setup.sh -- -D $DEBUG
|
||||
sed -n 's/^## /I:/p' dnsrps.conf
|
||||
$SHELL ./setup.sh -p ${port} -- -D $DEBUG
|
||||
echo_i `sed -n 's/^## /I:/p' dnsrps.conf`
|
||||
if grep '^#fail' dnsrps.conf >/dev/null; then
|
||||
echo_i "exit status: 1"
|
||||
exit 1
|
||||
|
|
@ -65,7 +70,7 @@ if [ -z "$DNSRPS_TEST_MODE" ]; then
|
|||
$RNDCCMD 10.53.0.2 flush
|
||||
$RNDCCMD 10.53.0.3 flush
|
||||
echo_i "running DNSRPS sub-test"
|
||||
$SHELL ./$0 -D2 $ARGS || status=1
|
||||
$SHELL ./$0 -p ${port} -- -D2 $ARGS || status=1
|
||||
else
|
||||
echo_i "DNSRPS sub-test skipped"
|
||||
fi
|
||||
|
|
@ -77,25 +82,25 @@ fi
|
|||
|
||||
# $1 = test name (such as 1a, 1b, etc. for which named.$1.conf exists)
|
||||
run_server() {
|
||||
TESTNAME=$1
|
||||
TEST_NAME=$1
|
||||
|
||||
echo_i "stopping resolver"
|
||||
$PERL $SYSTEMTESTTOP/stop.pl . ns2
|
||||
|
||||
sleep 1
|
||||
|
||||
echo_i "starting resolver using named.$TESTNAME.conf"
|
||||
cp -f ns2/named.$TESTNAME.conf ns2/named.conf
|
||||
echo_i "starting resolver using named.$TEST_NAME.conf"
|
||||
copy_setports ns2/named.$TEST_NAME.conf ns2/named.conf
|
||||
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns2
|
||||
sleep 3
|
||||
}
|
||||
|
||||
run_query() {
|
||||
TESTNAME=$1
|
||||
TEST_NAME=$1
|
||||
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}
|
||||
NAME=`sed -n -e "$LINE,"'$p' ns2/$TEST_NAME.queries | head -n 1`
|
||||
$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
|
||||
}
|
||||
|
|
@ -103,13 +108,13 @@ run_query() {
|
|||
# $1 = test name (such as 1a, 1b, etc. for which $1.queries exists)
|
||||
# $2 = line number in query file to test (the name to query is taken from this line)
|
||||
expect_norecurse() {
|
||||
TESTNAME=$1
|
||||
TEST_NAME=$1
|
||||
LINE=$2
|
||||
|
||||
NAME=`sed -n -e "$LINE,"'$p' ns2/$TESTNAME.queries | head -n 1`
|
||||
NAME=`sed -n -e "$LINE,"'$p' ns2/$TEST_NAME.queries | head -n 1`
|
||||
t=`expr $t + 1`
|
||||
echo_i "testing $NAME doesn't recurse (${t})"
|
||||
run_query $TESTNAME $LINE || {
|
||||
run_query $TEST_NAME $LINE || {
|
||||
echo_i "test ${t} failed"
|
||||
status=1
|
||||
}
|
||||
|
|
@ -118,13 +123,13 @@ expect_norecurse() {
|
|||
# $1 = test name (such as 1a, 1b, etc. for which $1.queries exists)
|
||||
# $2 = line number in query file to test (the name to query is taken from this line)
|
||||
expect_recurse() {
|
||||
TESTNAME=$1
|
||||
TEST_NAME=$1
|
||||
LINE=$2
|
||||
|
||||
NAME=`sed -n -e "$LINE,"'$p' ns2/$TESTNAME.queries | head -n 1`
|
||||
NAME=`sed -n -e "$LINE,"'$p' ns2/$TEST_NAME.queries | head -n 1`
|
||||
t=`expr $t + 1`
|
||||
echo_i "testing $NAME recurses (${t})"
|
||||
run_query $TESTNAME $LINE && {
|
||||
run_query $TEST_NAME $LINE && {
|
||||
echo_i "test ${t} failed"
|
||||
status=1
|
||||
}
|
||||
|
|
@ -135,7 +140,7 @@ sed -n 's/^## /I:/p' dnsrps.conf
|
|||
|
||||
t=`expr $t + 1`
|
||||
echo_i "testing that l1.l0 exists without RPZ (${t})"
|
||||
$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"
|
||||
status=1
|
||||
|
|
@ -143,7 +148,7 @@ grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || {
|
|||
|
||||
t=`expr $t + 1`
|
||||
echo_i "testing that l2.l1.l0 returns SERVFAIL without RPZ (${t})"
|
||||
$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"
|
||||
status=1
|
||||
|
|
@ -229,7 +234,7 @@ run_server 6a
|
|||
sleep 1
|
||||
t=`expr $t + 1`
|
||||
echo_i "running dig to cache CNAME record (${t})"
|
||||
$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"
|
||||
if [ "$CYGWIN" ]; then
|
||||
|
|
@ -242,16 +247,16 @@ kill -TSTP $PID
|
|||
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 /'
|
||||
echo_i "`$RNDCCMD 10.53.0.2 reload 6a.00.policy.local 2>&1 | sed 's/^/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})"
|
||||
$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"
|
||||
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 /'
|
||||
echo_i "`$RNDCCMD 10.53.0.2 reload 6a.00.policy.local 2>&1 | sed 's/^/ns2 /'`"
|
||||
test -f dnsrpzd.pid && kill -USR1 `cat dnsrpzd.pid`
|
||||
sleep 1
|
||||
echo_i "resuming authority server"
|
||||
|
|
@ -277,7 +282,7 @@ run_server 6a
|
|||
sleep 1
|
||||
t=`expr $t + 1`
|
||||
echo_i "running dig to cache CNAME record (${t})"
|
||||
$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"
|
||||
if [ "$CYGWIN" ]; then
|
||||
|
|
@ -289,16 +294,16 @@ fi
|
|||
kill -TSTP $PID
|
||||
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 /'
|
||||
echo_i "`$RNDCCMD 10.53.0.2 reload 6a.00.policy.local 2>&1 | sed 's/^/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})"
|
||||
$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"
|
||||
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 /'
|
||||
$RNDCCMD 10.53.0.2 reconfig 2>&1 | sed 's/^/I:ns2 /'
|
||||
test -f dnsrpzd.pid && kill -USR1 `cat dnsrpzd.pid`
|
||||
sleep 1
|
||||
echo_i "resuming authority server"
|
||||
|
|
@ -322,7 +327,7 @@ done
|
|||
t=`expr $t + 1`
|
||||
echo_i "testing CLIENT-IP behavior (${t})"
|
||||
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"
|
||||
status=1
|
||||
|
|
@ -336,17 +341,17 @@ grep "^l2.l1.l0.[ ]*[0-9]*[ ]*IN[ ]*A[ ]*10.53.0.2" dig.out.${t} > /dev/null
|
|||
t=`expr $t + 1`
|
||||
echo_i "testing CLIENT-IP behavior #2 (${t})"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
status=1
|
||||
|
|
@ -355,7 +360,7 @@ grep "^l2.l1.l0.[ ]*[0-9]*[ ]*IN[ ]*A[ ]*10.53.0.1" dig.out.${t}.3 > /dev/nu
|
|||
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"
|
||||
status=1
|
||||
|
|
@ -366,9 +371,9 @@ t=`expr $t + 1`
|
|||
echo_i "testing RPZ log clause (${t})"
|
||||
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"
|
||||
status=1
|
||||
|
|
@ -387,12 +392,12 @@ sed -n "$cur,"'$p' < ns2/named.run | grep "view recursive: rpz CLIENT-IP Local-D
|
|||
t=`expr $t + 1`
|
||||
echo_i "testing wildcard behavior with 1 RPZ zone (${t})"
|
||||
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"
|
||||
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"
|
||||
status=1
|
||||
|
|
@ -401,12 +406,12 @@ grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null || {
|
|||
t=`expr $t + 1`
|
||||
echo_i "testing wildcard behavior with 2 RPZ zones (${t})"
|
||||
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"
|
||||
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"
|
||||
status=1
|
||||
|
|
@ -415,12 +420,12 @@ grep "status: NXDOMAIN" dig.out.${t}.2 > /dev/null || {
|
|||
t=`expr $t + 1`
|
||||
echo_i "testing wildcard behavior with 1 RPZ zone and no non-wildcard triggers (${t})"
|
||||
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"
|
||||
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"
|
||||
status=1
|
||||
|
|
@ -431,18 +436,18 @@ echo_i "checking 'nsip-wait-recurse no' is faster than 'nsip-wait-recurse yes' (
|
|||
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"
|
||||
|
||||
$RNDCCMD flush
|
||||
copy_config ns3/named2.conf ns3/named.conf
|
||||
$RNDCCMD reload > /dev/null
|
||||
$RNDCCMD 10.53.0.3 flush
|
||||
copy_setports ns3/named2.conf.in ns3/named.conf
|
||||
$RNDCCMD 10.53.0.3 reload > /dev/null
|
||||
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue