tests.sh revision 1.1.1.1
1# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2#
3# This Source Code Form is subject to the terms of the Mozilla Public
4# License, v. 2.0. If a copy of the MPL was not distributed with this
5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6#
7# See the COPYRIGHT file distributed with this work for additional
8# information regarding copyright ownership.
9
10SYSTEMTESTTOP=..
11. $SYSTEMTESTTOP/conf.sh
12
13DIGOPTS="-p ${PORT}"
14
15status=0
16n=0
17
18n=`expr $n + 1`
19echo_i "check lookups against TTL=0 records ($n)"
20i=0
21passes=10
22$DIG $DIGOPTS @10.53.0.2 axfr example | grep -v "^ds0" |
23awk '$2 == "0" { print "-q", $1, $4; print "-q", "zzz"$1, $4;}' > query.list
24while [ $i -lt $passes ]
25do
26	ret=0
27	$DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.1.test$n &
28	$DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.2.test$n &
29	$DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.3.test$n &
30	$DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.4.test$n &
31	$DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.5.test$n &
32	$DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.6.test$n &
33	wait
34	grep "status: SERVFAIL" dig.out$i.1.test$n && ret=1
35	grep "status: SERVFAIL" dig.out$i.2.test$n && ret=1
36	grep "status: SERVFAIL" dig.out$i.3.test$n && ret=1
37	grep "status: SERVFAIL" dig.out$i.4.test$n && ret=1
38	grep "status: SERVFAIL" dig.out$i.5.test$n && ret=1
39	grep "status: SERVFAIL" dig.out$i.6.test$n && ret=1
40	[ $ret = 1 ] && break
41	i=`expr $i + 1`
42	echo_i "successfully completed pass $i of $passes"
43done
44if [ $ret != 0 ]; then echo_i "failed"; fi
45status=`expr $status + $ret`
46
47n=`expr $n + 1`
48echo_i "check repeated recursive lookups of non recurring TTL=0 responses get new values ($n)"
49count=`(
50$DIG $DIGOPTS +short @10.53.0.3 foo.increment
51$DIG $DIGOPTS +short @10.53.0.3 foo.increment
52$DIG $DIGOPTS +short @10.53.0.3 foo.increment
53$DIG $DIGOPTS +short @10.53.0.3 foo.increment
54$DIG $DIGOPTS +short @10.53.0.3 foo.increment
55$DIG $DIGOPTS +short @10.53.0.3 foo.increment
56$DIG $DIGOPTS +short @10.53.0.3 foo.increment
57) | sort -u | wc -l `
58if [ $count -ne 7 ] ; then echo_i "failed (count=$count)"; ret=1; fi
59status=`expr $status + $ret`
60
61n=`expr $n + 1`
62echo_i "check lookups against TTL=1 records ($n)"
63i=0
64passes=10
65while [ $i -lt $passes ]
66do
67	ret=0
68	$DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.1.test$n
69	$DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.2.test$n
70	$DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.3.test$n
71	$DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.4.test$n
72	$DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.5.test$n
73	$DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.6.test$n
74	grep "status: SERVFAIL" dig.out$i.1.test$n && ret=1
75	grep "status: SERVFAIL" dig.out$i.2.test$n && ret=1
76	grep "status: SERVFAIL" dig.out$i.3.test$n && ret=1
77	grep "status: SERVFAIL" dig.out$i.4.test$n && ret=1
78	grep "status: SERVFAIL" dig.out$i.5.test$n && ret=1
79	grep "status: SERVFAIL" dig.out$i.6.test$n && ret=1
80	[ $ret = 1 ] && break
81	i=`expr $i + 1`
82	echo_i "successfully completed pass $i of $passes"
83	$PERL -e 'select(undef, undef, undef, 0.3);'
84done
85if [ $ret != 0 ]; then echo_i "failed"; fi
86status=`expr $status + $ret`
87
88echo_i "exit status: $status"
89[ $status -eq 0 ] || exit 1
90