Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / bin / tests / system / upforwd / tests.sh
blobf6c1b907cd0ac34dad0f6a2db74759d221446dad
1 #!/bin/sh
3 # Copyright (C) 2004, 2007, 2011-2014 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000, 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: tests.sh,v 1.13 2011/10/13 22:18:05 marka Exp
20 # ns1 = stealth master
21 # ns2 = slave with update forwarding disabled; not currently used
22 # ns3 = slave with update forwarding enabled
24 SYSTEMTESTTOP=..
25 . $SYSTEMTESTTOP/conf.sh
27 status=0
28 n=1
30 sleep 5
32 echo "I:waiting for servers to be ready for testing ($n)"
33 for i in 1 2 3 4 5 6 7 8 9 10
35 ret=0
36 $DIG +tcp example. @10.53.0.1 soa -p 5300 > dig.out.ns1 || ret=1
37 grep "status: NOERROR" dig.out.ns1 > /dev/null || ret=1
38 $DIG +tcp example. @10.53.0.2 soa -p 5300 > dig.out.ns2 || ret=1
39 grep "status: NOERROR" dig.out.ns2 > /dev/null || ret=1
40 $DIG +tcp example. @10.53.0.3 soa -p 5300 > dig.out.ns3 || ret=1
41 grep "status: NOERROR" dig.out.ns3 > /dev/null || ret=1
42 test $ret = 0 && break
43 sleep 1
44 done
45 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
46 n=`expr $n + 1`
48 echo "I:fetching master copy of zone before update ($n)"
49 ret=0
50 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
51 @10.53.0.1 axfr -p 5300 > dig.out.ns1 || ret=1
52 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
53 n=`expr $n + 1`
55 echo "I:fetching slave 1 copy of zone before update ($n)"
56 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
57 @10.53.0.2 axfr -p 5300 > dig.out.ns2 || ret=1
58 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
59 n=`expr $n + 1`
61 echo "I:fetching slave 2 copy of zone before update ($n)"
62 ret=0
63 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
64 @10.53.0.3 axfr -p 5300 > dig.out.ns3 || ret=1
65 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
66 n=`expr $n + 1`
68 echo "I:comparing pre-update copies to known good data ($n)"
69 ret=0
70 $PERL ../digcomp.pl knowngood.before dig.out.ns1 || ret=1
71 $PERL ../digcomp.pl knowngood.before dig.out.ns2 || ret=1
72 $PERL ../digcomp.pl knowngood.before dig.out.ns3 || ret=1
73 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
75 echo "I:updating zone (signed) ($n)"
76 ret=0
77 $NSUPDATE -y update.example:c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K -- - <<EOF || ret=1
78 server 10.53.0.3 5300
79 update add updated.example. 600 A 10.10.10.1
80 update add updated.example. 600 TXT Foo
81 send
82 EOF
83 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
84 n=`expr $n + 1`
86 echo "I:sleeping 15 seconds for server to incorporate changes"
87 sleep 15
89 echo "I:fetching master copy of zone after update ($n)"
90 ret=0
91 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
92 @10.53.0.1 axfr -p 5300 > dig.out.ns1 || ret=1
93 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
94 n=`expr $n + 1`
96 echo "I:fetching slave 1 copy of zone after update ($n)"
97 ret=0
98 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
99 @10.53.0.2 axfr -p 5300 > dig.out.ns2 || ret=1
100 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
102 echo "I:fetching slave 2 copy of zone after update ($n)"
103 ret=0
104 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
105 @10.53.0.3 axfr -p 5300 > dig.out.ns3 || ret=1
106 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
107 n=`expr $n + 1`
109 echo "I:comparing post-update copies to known good data ($n)"
110 ret=0
111 $PERL ../digcomp.pl knowngood.after1 dig.out.ns1 || ret=1
112 $PERL ../digcomp.pl knowngood.after1 dig.out.ns2 || ret=1
113 $PERL ../digcomp.pl knowngood.after1 dig.out.ns3 || ret=1
114 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
116 echo "I:checking 'forwarding update for zone' is logged ($n)"
117 ret=0
118 grep "forwarding update for zone 'example/IN'" ns3/named.run > /dev/null || ret=1
119 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
120 n=`expr $n + 1`
122 echo "I:updating zone (unsigned) ($n)"
123 ret=0
124 $NSUPDATE -- - <<EOF || ret=1
125 server 10.53.0.3 5300
126 update add unsigned.example. 600 A 10.10.10.1
127 update add unsigned.example. 600 TXT Foo
128 send
130 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
131 n=`expr $n + 1`
133 echo "I:sleeping 15 seconds for server to incorporate changes"
134 sleep 15
136 echo "I:fetching master copy of zone after update ($n)"
137 ret=0
138 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
139 @10.53.0.1 axfr -p 5300 > dig.out.ns1 || ret=1
140 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
142 echo "I:fetching slave 1 copy of zone after update ($n)"
143 ret=0
144 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
145 @10.53.0.2 axfr -p 5300 > dig.out.ns2 || ret=1
146 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
147 n=`expr $n + 1`
149 echo "I:fetching slave 2 copy of zone after update ($n)"
150 ret=0
151 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.\
152 @10.53.0.3 axfr -p 5300 > dig.out.ns3 || ret=1
153 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
155 echo "I:comparing post-update copies to known good data ($n)"
156 ret=0
157 $PERL ../digcomp.pl knowngood.after2 dig.out.ns1 || ret=1
158 $PERL ../digcomp.pl knowngood.after2 dig.out.ns2 || ret=1
159 $PERL ../digcomp.pl knowngood.after2 dig.out.ns3 || ret=1
160 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
161 n=`expr $n + 1`
163 echo "I:checking update forwarding to dead master ($n)"
164 count=0
165 ret=0
166 while [ $count -lt 5 -a $ret -eq 0 ]
169 $NSUPDATE -- - <<EOF
170 server 10.53.0.3 5300
171 zone nomaster
172 update add unsigned.nomaster. 600 A 10.10.10.1
173 update add unsigned.nomaster. 600 TXT Foo
174 send
176 ) > /dev/null 2>&1 &
177 $DIG +notcp +noadd +noauth nomaster.\
178 @10.53.0.3 soa -p 5300 > dig.out.ns3 || ret=1
179 grep "status: NOERROR" dig.out.ns3 > /dev/null || ret=1
180 count=`expr $count + 1`
181 done
182 if [ $ret != 0 ] ; then echo "I:failed"; status=`expr $status + $ret`; fi
183 n=`expr $n + 1`
185 if test -f keyname
186 then
187 echo "I:checking update forwarding to with sig0 ($n)"
188 ret=0
189 keyname=`cat keyname`
190 $NSUPDATE -k $keyname.private -- - <<EOF
191 server 10.53.0.3 5300
192 zone example2
193 update add unsigned.example2. 600 A 10.10.10.1
194 update add unsigned.example2. 600 TXT Foo
195 send
197 $DIG unsigned.example2 A @10.53.0.1 -p 5300 > dig.out.ns1.test$n
198 grep "status: NOERROR" dig.out.ns1.test$n > /dev/null || ret=1
199 if [ $ret != 0 ] ; then echo "I:failed"; fi
200 status=`expr $status + $ret`
201 n=`expr $n + 1`
204 echo "I:exit status: $status"
205 exit $status