Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / bin / tests / system / rrsetorder / tests.sh
blob2047fc2e62031be9057b8961d0efb9d6657dc1d2
1 #!/bin/sh
3 # Copyright (C) 2006-2008, 2011, 2012, 2014 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 SYSTEMTESTTOP=..
18 . $SYSTEMTESTTOP/conf.sh
20 status=0
22 if grep "^#define DNS_RDATASET_FIXED" $TOP/config.h > /dev/null 2>&1 ; then
23 test_fixed=true
24 else
25 echo "I: Order 'fixed' disabled at compile time"
26 test_fixed=false
32 if $test_fixed; then
33 echo "I: Checking order fixed (master)"
34 ret=0
35 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
37 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
38 -p 5300 @10.53.0.1 fixed.example > dig.out.fixed || ret=1
39 cmp -s dig.out.fixed dig.out.fixed.good || ret=1
40 done
41 if [ $ret != 0 ]; then echo "I:failed"; fi
42 status=`expr $status + $ret`
43 else
44 echo "I: Checking order fixed behaves as cyclic when disabled (master)"
45 ret=0
46 matches=0
47 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
49 j=`expr $i % 4`
50 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
51 -p 5300 @10.53.0.1 fixed.example > dig.out.fixed || ret=1
52 if [ $i -le 4 ]; then
53 cp dig.out.fixed dig.out.$j
54 else
55 cmp -s dig.out.fixed dig.out.$j && matches=`expr $matches + 1`
57 done
58 cmp -s dig.out.0 dig.out.1 && ret=1
59 cmp -s dig.out.0 dig.out.2 && ret=1
60 cmp -s dig.out.0 dig.out.3 && ret=1
61 cmp -s dig.out.1 dig.out.2 && ret=1
62 cmp -s dig.out.1 dig.out.3 && ret=1
63 cmp -s dig.out.2 dig.out.3 && ret=1
64 if [ $matches -ne 16 ]; then ret=1; fi
65 if [ $ret != 0 ]; then echo "I:failed"; fi
66 status=`expr $status + $ret`
72 echo "I: Checking order cyclic (master + additional)"
73 ret=0
74 matches=0
75 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
77 j=`expr $i % 4`
78 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
79 -p 5300 @10.53.0.1 cyclic.example > dig.out.cyclic || ret=1
80 if [ $i -le 4 ]; then
81 cp dig.out.cyclic dig.out.$j
82 else
83 cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
85 done
86 cmp -s dig.out.0 dig.out.1 && ret=1
87 cmp -s dig.out.0 dig.out.2 && ret=1
88 cmp -s dig.out.0 dig.out.3 && ret=1
89 cmp -s dig.out.1 dig.out.2 && ret=1
90 cmp -s dig.out.1 dig.out.3 && ret=1
91 cmp -s dig.out.2 dig.out.3 && ret=1
92 if [ $matches -ne 16 ]; then ret=1; fi
93 if [ $ret != 0 ]; then echo "I:failed"; fi
94 status=`expr $status + $ret`
99 echo "I: Checking order cyclic (master)"
100 ret=0
101 matches=0
102 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
104 j=`expr $i % 4`
105 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
106 -p 5300 @10.53.0.1 cyclic2.example > dig.out.cyclic2 || ret=1
107 if [ $i -le 4 ]; then
108 cp dig.out.cyclic2 dig.out.$j
109 else
110 cmp -s dig.out.cyclic2 dig.out.$j && matches=`expr $matches + 1`
112 done
113 cmp -s dig.out.0 dig.out.1 && ret=1
114 cmp -s dig.out.0 dig.out.2 && ret=1
115 cmp -s dig.out.0 dig.out.3 && ret=1
116 cmp -s dig.out.1 dig.out.2 && ret=1
117 cmp -s dig.out.1 dig.out.3 && ret=1
118 cmp -s dig.out.2 dig.out.3 && ret=1
119 if [ $matches -ne 16 ]; then ret=1; fi
120 if [ $ret != 0 ]; then echo "I:failed"; fi
121 status=`expr $status + $ret`
122 echo "I: Checking order random (master)"
123 ret=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 21 22 23 24
126 eval match$i=0
127 done
128 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
130 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
131 -p 5300 @10.53.0.1 random.example > dig.out.random || ret=1
132 match=0
133 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
135 eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
136 if [ $match -eq 1 ]; then break; fi
137 done
138 if [ $match -eq 0 ]; then ret=1; fi
139 done
140 match=0
141 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
143 eval "match=\`expr \$match + \$match$i\`"
144 done
145 echo "I: Random selection return $match of 24 possible orders in 36 samples"
146 if [ $match -lt 8 ]; then echo ret=1; fi
147 if [ $ret != 0 ]; then echo "I:failed"; fi
148 status=`expr $status + $ret`
153 if $test_fixed; then
154 echo "I: Checking order fixed (slave)"
155 ret=0
156 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
158 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
159 -p 5300 @10.53.0.2 fixed.example > dig.out.fixed || ret=1
160 cmp -s dig.out.fixed dig.out.fixed.good || ret=1
161 done
162 if [ $ret != 0 ]; then echo "I:failed"; fi
163 status=`expr $status + $ret`
169 echo "I: Checking order cyclic (slave + additional)"
170 ret=0
171 matches=0
172 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
174 j=`expr $i % 4`
175 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
176 -p 5300 @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
177 if [ $i -le 4 ]; then
178 cp dig.out.cyclic dig.out.$j
179 else
180 cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
182 done
183 cmp -s dig.out.0 dig.out.1 && ret=1
184 cmp -s dig.out.0 dig.out.2 && ret=1
185 cmp -s dig.out.0 dig.out.3 && ret=1
186 cmp -s dig.out.1 dig.out.2 && ret=1
187 cmp -s dig.out.1 dig.out.3 && ret=1
188 cmp -s dig.out.2 dig.out.3 && ret=1
189 if [ $matches -ne 16 ]; then ret=1; fi
190 if [ $ret != 0 ]; then echo "I:failed"; fi
191 status=`expr $status + $ret`
196 echo "I: Checking order cyclic (slave)"
197 ret=0
198 matches=0
199 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
201 j=`expr $i % 4`
202 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
203 -p 5300 @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
204 if [ $i -le 4 ]; then
205 cp dig.out.cyclic2 dig.out.$j
206 else
207 cmp -s dig.out.cyclic2 dig.out.$j && matches=`expr $matches + 1`
209 done
210 cmp -s dig.out.0 dig.out.1 && ret=1
211 cmp -s dig.out.0 dig.out.2 && ret=1
212 cmp -s dig.out.0 dig.out.3 && ret=1
213 cmp -s dig.out.1 dig.out.2 && ret=1
214 cmp -s dig.out.1 dig.out.3 && ret=1
215 cmp -s dig.out.2 dig.out.3 && ret=1
216 if [ $matches -ne 16 ]; then ret=1; fi
217 if [ $ret != 0 ]; then echo "I:failed"; fi
218 status=`expr $status + $ret`
220 echo "I: Checking order random (slave)"
221 ret=0
222 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
224 eval match$i=0
225 done
226 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
228 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
229 -p 5300 @10.53.0.2 random.example > dig.out.random || ret=1
230 match=0
231 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
233 eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
234 if [ $match -eq 1 ]; then break; fi
235 done
236 if [ $match -eq 0 ]; then ret=1; fi
237 done
238 match=0
239 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
241 eval "match=\`expr \$match + \$match$i\`"
242 done
243 echo "I: Random selection return $match of 24 possible orders in 36 samples"
244 if [ $match -lt 8 ]; then echo ret=1; fi
245 if [ $ret != 0 ]; then echo "I:failed"; fi
246 status=`expr $status + $ret`
248 echo "I: Shutting down slave"
250 (cd ..; $SHELL stop.sh rrsetorder ns2 )
252 echo "I: Checking for slave's on disk copy of zone"
254 if [ ! -f ns2/root.bk ]
255 then
256 echo "I:failed";
257 status=`expr $status + 1`
260 echo "I: Re-starting slave"
262 (cd ..; $SHELL start.sh --noclean rrsetorder ns2 )
267 if $test_fixed; then
268 echo "I: Checking order fixed (slave loaded from disk)"
269 ret=0
270 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
272 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
273 -p 5300 @10.53.0.2 fixed.example > dig.out.fixed || ret=1
274 cmp -s dig.out.fixed dig.out.fixed.good || ret=1
275 done
276 if [ $ret != 0 ]; then echo "I:failed"; fi
277 status=`expr $status + $ret`
283 echo "I: Checking order cyclic (slave + additional, loaded from disk)"
284 ret=0
285 matches=0
286 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
288 j=`expr $i % 4`
289 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
290 -p 5300 @10.53.0.2 cyclic.example > dig.out.cyclic || ret=1
291 if [ $i -le 4 ]; then
292 cp dig.out.cyclic dig.out.$j
293 else
294 cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
296 done
297 cmp -s dig.out.0 dig.out.1 && ret=1
298 cmp -s dig.out.0 dig.out.2 && ret=1
299 cmp -s dig.out.0 dig.out.3 && ret=1
300 cmp -s dig.out.1 dig.out.2 && ret=1
301 cmp -s dig.out.1 dig.out.3 && ret=1
302 cmp -s dig.out.2 dig.out.3 && ret=1
303 if [ $matches -ne 16 ]; then ret=1; fi
304 if [ $ret != 0 ]; then echo "I:failed"; fi
305 status=`expr $status + $ret`
310 echo "I: Checking order cyclic (slave loaded from disk)"
311 ret=0
312 matches=0
313 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
315 j=`expr $i % 4`
316 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
317 -p 5300 @10.53.0.2 cyclic2.example > dig.out.cyclic2 || ret=1
318 if [ $i -le 4 ]; then
319 cp dig.out.cyclic2 dig.out.$j
320 else
321 cmp -s dig.out.cyclic2 dig.out.$j && matches=`expr $matches + 1`
323 done
324 cmp -s dig.out.0 dig.out.1 && ret=1
325 cmp -s dig.out.0 dig.out.2 && ret=1
326 cmp -s dig.out.0 dig.out.3 && ret=1
327 cmp -s dig.out.1 dig.out.2 && ret=1
328 cmp -s dig.out.1 dig.out.3 && ret=1
329 cmp -s dig.out.2 dig.out.3 && ret=1
330 if [ $matches -ne 16 ]; then ret=1; fi
331 if [ $ret != 0 ]; then echo "I:failed"; fi
332 status=`expr $status + $ret`
334 echo "I: Checking order random (slave loaded from disk)"
335 ret=0
336 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
338 eval match$i=0
339 done
340 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
342 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
343 -p 5300 @10.53.0.2 random.example > dig.out.random || ret=1
344 match=0
345 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
347 eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
348 if [ $match -eq 1 ]; then break; fi
349 done
350 if [ $match -eq 0 ]; then ret=1; fi
351 done
352 match=0
353 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
355 eval "match=\`expr \$match + \$match$i\`"
356 done
357 echo "I: Random selection return $match of 24 possible orders in 36 samples"
358 if [ $match -lt 8 ]; then echo ret=1; fi
359 if [ $ret != 0 ]; then echo "I:failed"; fi
360 status=`expr $status + $ret`
365 if $test_fixed; then
366 echo "I: Checking order fixed (cache)"
367 ret=0
368 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
370 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
371 -p 5300 @10.53.0.3 fixed.example > dig.out.fixed || ret=1
372 cmp -s dig.out.fixed dig.out.fixed.good || ret=1
373 done
374 if [ $ret != 0 ]; then echo "I:failed"; fi
375 status=`expr $status + $ret`
381 echo "I: Checking order cyclic (cache + additional)"
382 ret=0
383 # prime acache
384 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
385 -p 5300 @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
386 matches=0
387 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
389 j=`expr $i % 4`
390 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
391 -p 5300 @10.53.0.3 cyclic.example > dig.out.cyclic || ret=1
392 if [ $i -le 4 ]; then
393 cp dig.out.cyclic dig.out.$j
394 else
395 cmp -s dig.out.cyclic dig.out.$j && matches=`expr $matches + 1`
397 done
398 cmp -s dig.out.0 dig.out.1 && ret=1
399 cmp -s dig.out.0 dig.out.2 && ret=1
400 cmp -s dig.out.0 dig.out.3 && ret=1
401 cmp -s dig.out.1 dig.out.2 && ret=1
402 cmp -s dig.out.1 dig.out.3 && ret=1
403 cmp -s dig.out.2 dig.out.3 && ret=1
404 if [ $matches -ne 16 ]; then ret=1; fi
405 if [ $ret != 0 ]; then echo "I:failed"; fi
406 status=`expr $status + $ret`
411 echo "I: Checking order cyclic (cache)"
412 ret=0
413 # prime acache
414 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
415 -p 5300 @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
416 matches=0
417 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
419 j=`expr $i % 4`
420 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
421 -p 5300 @10.53.0.3 cyclic2.example > dig.out.cyclic2 || ret=1
422 if [ $i -le 4 ]; then
423 cp dig.out.cyclic2 dig.out.$j
424 else
425 cmp -s dig.out.cyclic2 dig.out.$j && matches=`expr $matches + 1`
427 done
428 cmp -s dig.out.0 dig.out.1 && ret=1
429 cmp -s dig.out.0 dig.out.2 && ret=1
430 cmp -s dig.out.0 dig.out.3 && ret=1
431 cmp -s dig.out.1 dig.out.2 && ret=1
432 cmp -s dig.out.1 dig.out.3 && ret=1
433 cmp -s dig.out.2 dig.out.3 && ret=1
434 if [ $matches -ne 16 ]; then ret=1; fi
435 if [ $ret != 0 ]; then echo "I:failed"; fi
436 status=`expr $status + $ret`
438 echo "I: Checking order random (cache)"
439 ret=0
440 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
442 eval match$i=0
443 done
444 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
446 $DIG +nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short \
447 -p 5300 @10.53.0.3 random.example > dig.out.random || ret=1
448 match=0
449 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
451 eval "cmp -s dig.out.random dig.out.random.good$j && match$j=1 match=1"
452 if [ $match -eq 1 ]; then break; fi
453 done
454 if [ $match -eq 0 ]; then ret=1; fi
455 done
456 match=0
457 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
459 eval "match=\`expr \$match + \$match$i\`"
460 done
461 echo "I: Random selection return $match of 24 possible orders in 36 samples"
462 if [ $match -lt 8 ]; then echo ret=1; fi
463 if [ $ret != 0 ]; then echo "I:failed"; fi
465 status=`expr $status + $ret`
466 echo "I:exit status: $status"
467 exit $status