Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / bin / tests / system / views / tests.sh
blobdb164b6c32da6ad1d349cd1d982b2ca872f7e24e
1 #!/bin/sh
3 # Copyright (C) 2004, 2007, 2012-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.30 2007/06/19 23:47:06 tbox Exp
20 SYSTEMTESTTOP=..
21 . $SYSTEMTESTTOP/conf.sh
23 status=0
25 echo "I:fetching a.example from ns2's initial configuration"
26 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noauth \
27 a.example. @10.53.0.2 any -p 5300 > dig.out.ns2.1 || status=1
28 grep ";" dig.out.ns2.1 # XXXDCL why is this here?
30 echo "I:fetching a.example from ns3's initial configuration"
31 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noauth \
32 a.example. @10.53.0.3 any -p 5300 > dig.out.ns3.1 || status=1
33 grep ";" dig.out.ns3.1 # XXXDCL why is this here?
35 echo "I:copying in new configurations for ns2 and ns3"
36 rm -f ns2/named.conf ns3/named.conf ns2/example.db
37 cp -f ns2/named2.conf ns2/named.conf
38 cp -f ns3/named2.conf ns3/named.conf
39 cp -f ns2/example2.db ns2/example.db
41 echo "I:reloading ns2 and ns3 with rndc"
42 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
43 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload 2>&1 | sed 's/^/I:ns3 /'
45 echo "I:sleeping for 20 seconds"
46 sleep 20
48 echo "I:fetching a.example from ns2's 10.53.0.4, source address 10.53.0.4"
49 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noauth \
50 -b 10.53.0.4 a.example. @10.53.0.4 any -p 5300 > dig.out.ns4.2 \
51 || status=1
52 grep ";" dig.out.ns4.2 # XXXDCL why is this here?
54 echo "I:fetching a.example from ns2's 10.53.0.2, source address 10.53.0.2"
55 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noauth \
56 -b 10.53.0.2 a.example. @10.53.0.2 any -p 5300 > dig.out.ns2.2 \
57 || status=1
58 grep ";" dig.out.ns2.2 # XXXDCL why is this here?
60 echo "I:fetching a.example from ns3's 10.53.0.3, source address defaulted"
61 $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noauth \
62 @10.53.0.3 a.example. any -p 5300 > dig.out.ns3.2 || status=1
63 grep ";" dig.out.ns3.2 # XXXDCL why is this here?
65 echo "I:comparing ns3's initial a.example to one from reconfigured 10.53.0.2"
66 $PERL ../digcomp.pl dig.out.ns3.1 dig.out.ns2.2 || status=1
68 echo "I:comparing ns3's initial a.example to one from reconfigured 10.53.0.3"
69 $PERL ../digcomp.pl dig.out.ns3.1 dig.out.ns3.2 || status=1
71 echo "I:comparing ns2's initial a.example to one from reconfigured 10.53.0.4"
72 $PERL ../digcomp.pl dig.out.ns2.1 dig.out.ns4.2 || status=1
74 echo "I:comparing ns2's initial a.example to one from reconfigured 10.53.0.3"
75 echo "I:(should be different)"
76 if $PERL ../digcomp.pl dig.out.ns2.1 dig.out.ns3.2 >/dev/null
77 then
78 echo "I:no differences found. something's wrong."
79 status=1
82 echo "I:updating cloned zone in internal view"
83 $NSUPDATE << EOF
84 server 10.53.0.2 5300
85 zone clone
86 update add b.clone. 300 in a 10.1.0.3
87 send
88 EOF
89 echo "I:sleeping to allow update to take effect"
90 sleep 5
92 echo "I:verifying update affected both views"
93 ret=0
94 one=`$DIG +tcp +short -p 5300 -b 10.53.0.2 @10.53.0.2 b.clone a`
95 two=`$DIG +tcp +short -p 5300 -b 10.53.0.4 @10.53.0.2 b.clone a`
96 if [ "$one" != "$two" ]; then
97 echo "'$one' does not match '$two'"
98 ret=1
100 if [ $ret != 0 ]; then echo "I:failed"; fi
101 status=`expr $status + $ret`
103 echo "I:verifying forwarder in cloned zone works"
104 ret=0
105 one=`$DIG +tcp +short -p 5300 -b 10.53.0.2 @10.53.0.2 child.clone txt`
106 two=`$DIG +tcp +short -p 5300 -b 10.53.0.4 @10.53.0.2 child.clone txt`
107 three=`$DIG +tcp +short -p 5300 @10.53.0.3 child.clone txt`
108 four=`$DIG +tcp +short -p 5300 @10.53.0.5 child.clone txt`
109 echo "$three" | grep NS3 > /dev/null || { ret=1; echo "expected response from NS3 got '$three'"; }
110 echo "$four" | grep NS5 > /dev/null || { ret=1; echo "expected response from NS5 got '$four'"; }
111 if [ "$one" = "$two" ]; then
112 echo "'$one' matches '$two'"
113 ret=1
115 if [ "$one" != "$three" ]; then
116 echo "'$one' does not match '$three'"
117 ret=1
119 if [ "$two" != "$four" ]; then
120 echo "'$two' does not match '$four'"
121 ret=1
123 if [ $ret != 0 ]; then echo "I:failed"; fi
124 status=`expr $status + $ret`
126 if $SHELL ../testcrypto.sh
127 then
128 echo "I:verifying inline zones work with views"
129 ret=0
130 $DIG @10.53.0.2 -p 5300 -b 10.53.0.2 +dnssec DNSKEY inline > dig.out.internal
131 $DIG @10.53.0.2 -p 5300 -b 10.53.0.5 +dnssec DNSKEY inline > dig.out.external
132 grep "ANSWER: 4," dig.out.internal > /dev/null || ret=1
133 grep "ANSWER: 4," dig.out.external > /dev/null || ret=1
134 int=`awk '$4 == "DNSKEY" { print $8 }' dig.out.internal | sort`
135 ext=`awk '$4 == "DNSKEY" { print $8 }' dig.out.external | sort`
136 test "$int" != "$ext" || ret=1
137 if [ $ret != 0 ]; then echo "I:failed"; fi
138 status=`expr $status + $ret`
141 echo "I:exit status: $status"
142 exit $status