Initial import of bind-9.7.1-P2
[kai/bind9.git] / bin / tests / system / zonechecks / tests.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2004, 2007, 2009  Internet Systems Consortium, Inc. ("ISC")
4 #
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 # AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 # PERFORMANCE OF THIS SOFTWARE.
16
17 # $Id: tests.sh,v 1.6 2009/12/04 22:06:37 tbox Exp $
18
19 SYSTEMTESTTOP=..
20 . $SYSTEMTESTTOP/conf.sh
21
22 status=0
23
24 #
25 echo "I: checking that we detect a NS which refers to a CNAME"
26 if $CHECKZONE . cname.db > cname.out 2>&1
27 then
28         echo "I:failed (status)"; status=1
29 else
30         if grep "is a CNAME" cname.out > /dev/null
31         then
32                 :
33         else
34                 echo "I:failed (message)"; status=1
35         fi
36 fi
37
38 #
39 echo "I: checking that we detect a NS which is below a DNAME"
40 if $CHECKZONE . dname.db > dname.out 2>&1
41 then
42         echo "I:failed (status)"; status=1
43 else
44         if grep "is below a DNAME" dname.out > /dev/null
45         then
46                 :
47         else
48                 echo "I:failed (message)"; status=1
49         fi
50 fi
51
52 #
53 echo "I: checking that we detect a NS which has no address records (A/AAAA)"
54 if $CHECKZONE . noaddress.db > noaddress.out
55 then
56         echo "I:failed (status)"; status=1
57 else
58         if grep "has no address records" noaddress.out > /dev/null
59         then
60                 :
61         else
62                 echo "I:failed (message)"; status=1
63         fi
64 fi
65
66 #
67 echo "I: checking that we detect a NS which has no records"
68 if $CHECKZONE . nxdomain.db > nxdomain.out
69 then
70         echo "I:failed (status)"; status=1
71 else
72         if grep "has no address records" noaddress.out > /dev/null
73         then
74                 :
75         else
76                 echo "I:failed (message)"; status=1
77         fi
78 fi
79
80 #
81 echo "I: checking that we detect a NS which looks like a A record (fail)"
82 if $CHECKZONE -n fail . a.db > a.out 2>&1
83 then
84         echo "I:failed (status)"; status=1
85 else
86         if grep "appears to be an address" a.out > /dev/null
87         then
88                 :
89         else
90                 echo "I:failed (message)"; status=1
91         fi
92 fi
93
94 #
95 echo "I: checking that we detect a NS which looks like a A record (warn=default)"
96 if $CHECKZONE . a.db > a.out 2>&1
97 then
98         if grep "appears to be an address" a.out > /dev/null
99         then
100                 :
101         else
102                 echo "I:failed (message)"; status=1
103         fi
104 else
105         echo "I:failed (status)"; status=1
106 fi
107
108 #
109 echo "I: checking that we detect a NS which looks like a A record (ignore)"
110 if $CHECKZONE -n ignore . a.db > a.out 2>&1
111 then
112         if grep "appears to be an address" a.out > /dev/null
113         then
114                 echo "I:failed (message)"; status=1
115         else
116                 :
117         fi
118 else
119         echo "I:failed (status)"; status=1
120 fi
121
122 #
123 echo "I: checking that we detect a NS which looks like a AAAA record (fail)"
124 if $CHECKZONE -n fail . aaaa.db > aaaa.out 2>&1
125 then
126         echo "I:failed (status)"; status=1
127 else
128         if grep "appears to be an address" aaaa.out > /dev/null
129         then
130                 :
131         else
132                 echo "I:failed (message)"; status=1
133         fi
134 fi
135
136 #
137 echo "I: checking that we detect a NS which looks like a AAAA record (warn=default)"
138 if $CHECKZONE . aaaa.db > aaaa.out 2>&1
139 then
140         if grep "appears to be an address" aaaa.out > /dev/null
141         then
142                 :
143         else
144                 echo "I:failed (message)"; status=1
145         fi
146 else
147         echo "I:failed (status)"; status=1
148 fi
149
150 #
151 echo "I: checking that we detect a NS which looks like a AAAA record (ignore)"
152 if $CHECKZONE -n ignore . aaaa.db > aaaa.out 2>&1
153 then
154         if grep "appears to be an address" aaaa.out > /dev/null
155         then
156                 echo "I:failed (message)"; status=1
157         else
158                 :
159         fi
160 else
161         echo "I:failed (status)"; status=1
162 fi
163 echo "I:exit status: $status"
164 exit $status