tests.sh 7.4 KB
Newer Older
1
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
Mark Andrews's avatar
Mark Andrews committed
2
#
3 4 5
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
6 7 8
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
Automatic Updater's avatar
Automatic Updater committed
9

10
. ../conf.sh
Mark Andrews's avatar
Mark Andrews committed
11

Evan Hunt's avatar
Evan Hunt committed
12
DIGOPTS="-p ${PORT}"
13
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
Evan Hunt's avatar
Evan Hunt committed
14

15 16 17
status=0
n=0

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
emptyzones="
10.IN-ADDR.ARPA
16.172.IN-ADDR.ARPA
17.172.IN-ADDR.ARPA
18.172.IN-ADDR.ARPA
19.172.IN-ADDR.ARPA
20.172.IN-ADDR.ARPA
21.172.IN-ADDR.ARPA
22.172.IN-ADDR.ARPA
23.172.IN-ADDR.ARPA
24.172.IN-ADDR.ARPA
25.172.IN-ADDR.ARPA
26.172.IN-ADDR.ARPA
27.172.IN-ADDR.ARPA
28.172.IN-ADDR.ARPA
29.172.IN-ADDR.ARPA
30.172.IN-ADDR.ARPA
31.172.IN-ADDR.ARPA
168.192.IN-ADDR.ARPA
64.100.IN-ADDR.ARPA
65.100.IN-ADDR.ARPA
66.100.IN-ADDR.ARPA
67.100.IN-ADDR.ARPA
68.100.IN-ADDR.ARPA
69.100.IN-ADDR.ARPA
70.100.IN-ADDR.ARPA
71.100.IN-ADDR.ARPA
72.100.IN-ADDR.ARPA
73.100.IN-ADDR.ARPA
74.100.IN-ADDR.ARPA
75.100.IN-ADDR.ARPA
76.100.IN-ADDR.ARPA
77.100.IN-ADDR.ARPA
78.100.IN-ADDR.ARPA
79.100.IN-ADDR.ARPA
80.100.IN-ADDR.ARPA
81.100.IN-ADDR.ARPA
82.100.IN-ADDR.ARPA
83.100.IN-ADDR.ARPA
84.100.IN-ADDR.ARPA
85.100.IN-ADDR.ARPA
86.100.IN-ADDR.ARPA
87.100.IN-ADDR.ARPA
88.100.IN-ADDR.ARPA
89.100.IN-ADDR.ARPA
90.100.IN-ADDR.ARPA
91.100.IN-ADDR.ARPA
92.100.IN-ADDR.ARPA
93.100.IN-ADDR.ARPA
94.100.IN-ADDR.ARPA
95.100.IN-ADDR.ARPA
96.100.IN-ADDR.ARPA
97.100.IN-ADDR.ARPA
98.100.IN-ADDR.ARPA
99.100.IN-ADDR.ARPA
100.100.IN-ADDR.ARPA
101.100.IN-ADDR.ARPA
102.100.IN-ADDR.ARPA
103.100.IN-ADDR.ARPA
104.100.IN-ADDR.ARPA
105.100.IN-ADDR.ARPA
106.100.IN-ADDR.ARPA
107.100.IN-ADDR.ARPA
108.100.IN-ADDR.ARPA
109.100.IN-ADDR.ARPA
110.100.IN-ADDR.ARPA
111.100.IN-ADDR.ARPA
112.100.IN-ADDR.ARPA
113.100.IN-ADDR.ARPA
114.100.IN-ADDR.ARPA
115.100.IN-ADDR.ARPA
116.100.IN-ADDR.ARPA
117.100.IN-ADDR.ARPA
118.100.IN-ADDR.ARPA
119.100.IN-ADDR.ARPA
120.100.IN-ADDR.ARPA
121.100.IN-ADDR.ARPA
122.100.IN-ADDR.ARPA
123.100.IN-ADDR.ARPA
124.100.IN-ADDR.ARPA
125.100.IN-ADDR.ARPA
126.100.IN-ADDR.ARPA
127.100.IN-ADDR.ARPA
0.IN-ADDR.ARPA
127.IN-ADDR.ARPA
254.169.IN-ADDR.ARPA
2.0.192.IN-ADDR.ARPA
100.51.198.IN-ADDR.ARPA
113.0.203.IN-ADDR.ARPA
255.255.255.255.IN-ADDR.ARPA
0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
D.F.IP6.ARPA
8.E.F.IP6.ARPA
9.E.F.IP6.ARPA
A.E.F.IP6.ARPA
B.E.F.IP6.ARPA
8.B.D.0.1.0.0.2.IP6.ARPA
EMPTY.AS112.ARPA
HOME.ARPA"

n=`expr $n + 1`
ret=0
count=0
echo_i "Checking expected empty zones were configured ($n)"
for zone in ${emptyzones}
do
	grep "automatic empty zone: $zone" ns1/named.run > /dev/null || {
		echo_i "failed (empty zone $zone missing)"
		ret=1
	}
	count=`expr $count + 1`
done
lines=`grep "automatic empty zone: " ns1/named.run | wc -l`
test $count -eq $lines -a $count -eq 99 || {
	ret=1; echo_i "failed (count mismatch)";
}
if [ $ret != 0 ] ; then status=`expr $status + $ret`; fi

137
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
138 139
echo_i "Checking that reconfiguring empty zones is silent ($n)"
$RNDCCMD 10.53.0.1 reconfig
140 141 142 143 144 145
ret=0
grep "automatic empty zone" ns1/named.run > /dev/null || ret=1
grep "received control channel command 'reconfig'" ns1/named.run > /dev/null || ret=1
grep "reloading configuration succeeded" ns1/named.run > /dev/null || ret=1
sleep 1
grep "zone serial (0) unchanged." ns1/named.run > /dev/null && ret=1
Mark Andrews's avatar
Mark Andrews committed
146
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
147 148

n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
149
echo_i "Checking that reloading empty zones is silent ($n)"
150
rndc_reload ns1 10.53.0.1
151 152 153 154 155 156
ret=0
grep "automatic empty zone" ns1/named.run > /dev/null || ret=1
grep "received control channel command 'reload'" ns1/named.run > /dev/null || ret=1
grep "reloading configuration succeeded" ns1/named.run > /dev/null || ret=1
sleep 1
grep "zone serial (0) unchanged." ns1/named.run > /dev/null && ret=1
Mark Andrews's avatar
Mark Andrews committed
157
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
158

159
HOSTNAME=`$FEATURETEST --gethostname`
160 161
BIND_VERSION_STRING=$($NAMED -V | head -1)
BIND_VERSION=$($NAMED -V | sed -ne 's/^BIND \([^ ]*\).*/\1/p')
Evan Hunt's avatar
Evan Hunt committed
162 163 164

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
165 166
echo_i "Checking that default version works for rndc ($n)"
$RNDCCMD 10.53.0.1 status > rndc.status.ns1.$n 2>&1
167
fgrep "version: $BIND_VERSION_STRING" rndc.status.ns1.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
168
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
169 170 171

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
172 173
echo_i "Checking that custom version works for rndc ($n)"
$RNDCCMD 10.53.0.3 status > rndc.status.ns3.$n 2>&1
174
fgrep "version: $BIND_VERSION_STRING (this is a test of version)" rndc.status.ns3.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
175
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
176 177 178

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
179 180
echo_i "Checking that default version works for query ($n)"
$DIG $DIGOPTS +short version.bind txt ch @10.53.0.1 > dig.out.ns1.$n
181
grep "^\"$BIND_VERSION\"$" dig.out.ns1.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
182
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
183 184 185

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
186 187
echo_i "Checking that custom version works for query ($n)"
$DIG $DIGOPTS +short version.bind txt ch @10.53.0.3 > dig.out.ns3.$n
188
grep "^\"this is a test of version\"$" dig.out.ns3.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
189
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
190 191 192

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
193 194
echo_i "Checking that default hostname works for query ($n)"
$DIG $DIGOPTS +short hostname.bind txt ch @10.53.0.1 > dig.out.ns1.$n
195
grep "^\"$HOSTNAME\"$" dig.out.ns1.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
196
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
197 198 199

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
200 201
echo_i "Checking that custom hostname works for query ($n)"
$DIG $DIGOPTS +short hostname.bind txt ch @10.53.0.3 > dig.out.ns3.$n
202
grep "^\"this.is.a.test.of.hostname\"$" dig.out.ns3.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
203
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
204 205 206

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
207 208
echo_i "Checking that default server-id is none for query ($n)"
$DIG $DIGOPTS id.server txt ch @10.53.0.1 > dig.out.ns1.$n
Evan Hunt's avatar
Evan Hunt committed
209 210
grep "status: NOERROR" dig.out.ns1.$n > /dev/null || ret=1
grep "ANSWER: 0" dig.out.ns1.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
211
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
212 213 214

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
215 216
echo_i "Checking that server-id hostname works for query ($n)"
$DIG $DIGOPTS +short id.server txt ch @10.53.0.2 > dig.out.ns2.$n
217
grep "^\"$HOSTNAME\"$" dig.out.ns2.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
218
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
219 220 221

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
222 223
echo_i "Checking that server-id hostname works for EDNS name server ID request ($n)"
$DIG $DIGOPTS +norec +nsid foo @10.53.0.2 > dig.out.ns2.$n
224
grep "^; NSID: .* (\"$HOSTNAME\")$" dig.out.ns2.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
225
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
226 227 228

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
229 230
echo_i "Checking that custom server-id works for query ($n)"
$DIG $DIGOPTS +short id.server txt ch @10.53.0.3 > dig.out.ns3.$n
231
grep "^\"this.is.a.test.of.server-id\"$" dig.out.ns3.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
232
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
233 234 235

n=`expr $n + 1`
ret=0
Evan Hunt's avatar
Evan Hunt committed
236 237
echo_i "Checking that custom server-id works for EDNS name server ID request ($n)"
$DIG $DIGOPTS +norec +nsid foo @10.53.0.3 > dig.out.ns3.$n
238
grep "^; NSID: .* (\"this.is.a.test.of.server-id\")$" dig.out.ns3.$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
239
if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi
Evan Hunt's avatar
Evan Hunt committed
240

Evan Hunt's avatar
Evan Hunt committed
241
echo_i "exit status: $status"
242
[ $status -eq 0 ] || exit 1