Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / bind / dist / bin / tests / system / rrsetorder / tests.sh
blob4f27f119b491ef6f912b1fadffb89f081a581d99
1 #!/bin/sh
3 # Copyright (C) 2006-2008 Internet Systems Consortium, Inc. ("ISC")
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.
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.
17 # Id: tests.sh,v 1.8 2008/10/09 21:27:52 each Exp
19 SYSTEMTESTTOP=..
20 . $SYSTEMTESTTOP/conf.sh
22 status=0
24 if grep "^#define DNS_RDATASET_FIXED" $TOP/config.h > /dev/null 2>&1 ; then
25 test_fixed=true
26 else
27 echo "I: Order 'fixed' disabled at compile time"
28 test_fixed=false
34 if $test_fixed; then
35 echo "I: Checking order fixed (master)"
36 ret=0
37 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
39 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
40 -p 5300 @10.53.0.1 fixed.example > dig.out.fixed || ret=1
41 cmp -s dig.out.fixed dig.out.fixed.good || ret=1
42 done
43 if [ $ret != 0 ]; then echo "I:failed"; fi
44 status=`expr $status + $ret`
50 echo "I: Checking order cyclic (master)"
51 ret=0
52 matches=0
53 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
55 j=`expr $i % 4`
56 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
57 -p 5300 @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
58 if [ $i -le 4 ]; then
59 cp dig.out.cyclic dig.out.$j
60 else
61 cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
63 done
64 cmp -s dig.out.0 dig.out.1 && ret=1
65 cmp -s dig.out.0 dig.out.2 && ret=1
66 cmp -s dig.out.0 dig.out.3 && ret=1
67 cmp -s dig.out.1 dig.out.2 && ret=1
68 cmp -s dig.out.1 dig.out.3 && ret=1
69 cmp -s dig.out.2 dig.out.3 && ret=1
70 if [ $matches -ne 16 ]; then ret=1; fi
71 if [ $ret != 0 ]; then echo "I:failed"; fi
72 status=`expr $status + $ret`
74 echo "I: Checking order random (master)"
75 ret=0
76 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
78 eval match$i=0
79 done
80 for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
82 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
83 -p 5300 @10.53.0.1 random.example > dig.out.random || ret=1
84 match=0
85 for j in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
87 eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
88 if [ $match -eq 1 ]; then break; fi
89 done
90 if [ $match -eq 0 ]; then ret=1; fi
91 done
92 match=0
93 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
95 eval "match=\`expr \$match + \$match$i\`"
96 done
97 echo "I: Random selection return $match of 24 possible orders in 36 samples"
98 if [ $match -lt 8 ]; then echo ret=1; fi
99 if [ $ret != 0 ]; then echo "I:failed"; fi
100 status=`expr $status + $ret`
105 if $test_fixed; then
106 echo "I: Checking order fixed (slave)"
107 ret=0
108 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
110 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
111 -p 5300 @10.53.0.2 fixed.example > dig.out.fixed || ret=1
112 cmp -s dig.out.fixed dig.out.fixed.good || ret=1
113 done
114 if [ $ret != 0 ]; then echo "I:failed"; fi
115 status=`expr $status + $ret`
121 echo "I: Checking order cyclic (slave)"
122 ret=0
123 matches=0
124 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
126 j=`expr $i % 4`
127 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
128 -p 5300 @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
129 if [ $i -le 4 ]; then
130 cp dig.out.cyclic dig.out.$j
131 else
132 cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
134 done
135 cmp -s dig.out.0 dig.out.1 && ret=1
136 cmp -s dig.out.0 dig.out.2 && ret=1
137 cmp -s dig.out.0 dig.out.3 && ret=1
138 cmp -s dig.out.1 dig.out.2 && ret=1
139 cmp -s dig.out.1 dig.out.3 && ret=1
140 cmp -s dig.out.2 dig.out.3 && ret=1
141 if [ $matches -ne 16 ]; then ret=1; fi
142 if [ $ret != 0 ]; then echo "I:failed"; fi
143 status=`expr $status + $ret`
145 echo "I: Checking order random (slave)"
146 ret=0
147 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
149 eval match$i=0
150 done
151 for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
153 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
154 -p 5300 @10.53.0.2 random.example > dig.out.random || ret=1
155 match=0
156 for j in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
158 eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
159 if [ $match -eq 1 ]; then break; fi
160 done
161 if [ $match -eq 0 ]; then ret=1; fi
162 done
163 match=0
164 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
166 eval "match=\`expr \$match + \$match$i\`"
167 done
168 echo "I: Random selection return $match of 24 possible orders in 36 samples"
169 if [ $match -lt 8 ]; then echo ret=1; fi
170 if [ $ret != 0 ]; then echo "I:failed"; fi
171 status=`expr $status + $ret`
173 echo "I: Shutting down slave"
175 (cd ..; sh stop.sh rrsetorder ns2 )
177 echo "I: Checking for slave's on disk copy of zone"
179 if [ ! -f ns2/root.bk ]
180 then
181 echo "I:failed";
182 status=`expr $status + 1`
185 echo "I: Re-starting slave"
187 (cd ..; sh start.sh --noclean rrsetorder ns2 )
192 if $test_fixed; then
193 echo "I: Checking order fixed (slave loaded from disk)"
194 ret=0
195 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
197 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
198 -p 5300 @10.53.0.2 fixed.example > dig.out.fixed || ret=1
199 cmp -s dig.out.fixed dig.out.fixed.good || ret=1
200 done
201 if [ $ret != 0 ]; then echo "I:failed"; fi
202 status=`expr $status + $ret`
208 echo "I: Checking order cyclic (slave loaded from disk)"
209 ret=0
210 matches=0
211 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
213 j=`expr $i % 4`
214 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
215 -p 5300 @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
216 if [ $i -le 4 ]; then
217 cp dig.out.cyclic dig.out.$j
218 else
219 cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
221 done
222 cmp -s dig.out.0 dig.out.1 && ret=1
223 cmp -s dig.out.0 dig.out.2 && ret=1
224 cmp -s dig.out.0 dig.out.3 && ret=1
225 cmp -s dig.out.1 dig.out.2 && ret=1
226 cmp -s dig.out.1 dig.out.3 && ret=1
227 cmp -s dig.out.2 dig.out.3 && ret=1
228 if [ $matches -ne 16 ]; then ret=1; fi
229 if [ $ret != 0 ]; then echo "I:failed"; fi
230 status=`expr $status + $ret`
232 echo "I: Checking order random (slave loaded from disk)"
233 ret=0
234 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
236 eval match$i=0
237 done
238 for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
240 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
241 -p 5300 @10.53.0.2 random.example > dig.out.random || ret=1
242 match=0
243 for j in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
245 eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
246 if [ $match -eq 1 ]; then break; fi
247 done
248 if [ $match -eq 0 ]; then ret=1; fi
249 done
250 match=0
251 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
253 eval "match=\`expr \$match + \$match$i\`"
254 done
255 echo "I: Random selection return $match of 24 possible orders in 36 samples"
256 if [ $match -lt 8 ]; then echo ret=1; fi
257 if [ $ret != 0 ]; then echo "I:failed"; fi
258 status=`expr $status + $ret`
263 if $test_fixed; then
264 echo "I: Checking order fixed (cache)"
265 ret=0
266 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
268 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
269 -p 5300 @10.53.0.3 fixed.example > dig.out.fixed || ret=1
270 cmp -s dig.out.fixed dig.out.fixed.good || ret=1
271 done
272 if [ $ret != 0 ]; then echo "I:failed"; fi
273 status=`expr $status + $ret`
279 echo "I: Checking order cyclic (cache)"
280 ret=0
281 matches=0
282 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
284 j=`expr $i % 4`
285 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
286 -p 5300 @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
287 if [ $i -le 4 ]; then
288 cp dig.out.cyclic dig.out.$j
289 else
290 cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
292 done
293 cmp -s dig.out.0 dig.out.1 && ret=1
294 cmp -s dig.out.0 dig.out.2 && ret=1
295 cmp -s dig.out.0 dig.out.3 && ret=1
296 cmp -s dig.out.1 dig.out.2 && ret=1
297 cmp -s dig.out.1 dig.out.3 && ret=1
298 cmp -s dig.out.2 dig.out.3 && ret=1
299 if [ $matches -ne 16 ]; then ret=1; fi
300 if [ $ret != 0 ]; then echo "I:failed"; fi
301 status=`expr $status + $ret`
303 echo "I: Checking order random (cache)"
304 ret=0
305 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
307 eval match$i=0
308 done
309 for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 9
311 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
312 -p 5300 @10.53.0.3 random.example > dig.out.random || ret=1
313 match=0
314 for j in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
316 eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
317 if [ $match -eq 1 ]; then break; fi
318 done
319 if [ $match -eq 0 ]; then ret=1; fi
320 done
321 match=0
322 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
324 eval "match=\`expr \$match + \$match$i\`"
325 done
326 echo "I: Random selection return $match of 24 possible orders in 36 samples"
327 if [ $match -lt 8 ]; then echo ret=1; fi
328 if [ $ret != 0 ]; then echo "I:failed"; fi
330 status=`expr $status + $ret`
331 echo "I:exit status: $status"
332 exit $status