3 # Copyright (C) 2012 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.1.4.11 2012/02/01 16:54:32 each Exp
20 .
$SYSTEMTESTTOP/conf.sh
22 DIGOPTS
="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
23 DIGCMD
="$DIG $DIGOPTS -p 5300"
24 RNDCCMD
="$RNDC -p 9953 -c ../common/rndc.conf"
28 echo "I:fetching a.example from ns2's initial configuration"
29 $DIGCMD +noauth a.example. @
10.53.0.2 any
> dig.out.ns2.1 || ret
=1
30 if [ $ret != 0 ]; then echo "I: failed"; fi
31 status
=`expr $status + $ret`
34 echo "I:verifying adb records in named.stats"
35 $RNDCCMD -s 10.53.0.2 stats
> /dev
/null
2>&1
36 echo "I: checking for 1 entry in adb hash table"
37 grep "1 Addresses in hash table" ns
2/named.stats
> /dev
/null || ret
=1
38 if [ $ret != 0 ]; then echo "I:failed"; fi
39 status
=`expr $status + $ret`
42 echo "I: verifying cache statistics in named.stats"
43 grep "Cache Statistics" ns
2/named.stats
> /dev
/null || ret
=1
44 if [ $ret != 0 ]; then echo "I:failed"; fi
45 status
=`expr $status + $ret`
48 echo "I: checking for 2 entries in adb hash table"
49 $DIGCMD a.example.info. @
10.53.0.2 any
> /dev
/null
2>&1
50 $RNDCCMD -s 10.53.0.2 stats
> /dev
/null
2>&1
51 grep "2 Addresses in hash table" ns
2/named.stats
> /dev
/null || ret
=1
52 if [ $ret != 0 ]; then echo "I: failed"; fi
53 status
=`expr $status + $ret`
56 echo "I:dumping initial stats for ns3"
58 $RNDCCMD -s 10.53.0.3 stats
> /dev
/null
2>&1
59 [ -f ns
3/named.stats
] || ret
=1
60 nsock0
=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'`
61 echo "I:sending queries to ns3"
62 $DIGCMD +tries
=2 +time=1 +recurse @
10.53.0.3 foo.info. any
> /dev
/null
2>&1
63 #$DIGCMD +tries=2 +time=1 +recurse @10.53.0.3 foo.info. any
64 echo "I:dumping updated stats for ns3"
66 $RNDCCMD -s 10.53.0.3 stats
> /dev
/null
2>&1
67 [ -f ns
3/named.stats
] || ret
=1
68 if [ $ret != 0 ]; then echo "I: failed"; fi
69 status
=`expr $status + $ret`
72 echo "I: verifying recursing clients output"
73 grep "2 recursing clients" ns
3/named.stats
> /dev
/null || ret
=1
74 if [ $ret != 0 ]; then echo "I: failed"; fi
75 status
=`expr $status + $ret`
78 echo "I: verifying active fetches output"
79 grep "1 active fetches" ns
3/named.stats
> /dev
/null || ret
=1
80 if [ $ret != 0 ]; then echo "I: failed"; fi
81 status
=`expr $status + $ret`
84 echo "I: verifying active sockets output"
85 nsock1
=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'`
86 [ `expr $nsock1 - $nsock0` -eq 1 ] || ret
=1
87 if [ $ret != 0 ]; then echo "I: failed"; fi
88 status
=`expr $status + $ret`
91 # there should be 1 UDP and no TCP queries. As the TCP counter is zero
92 # no status line is emitted.
93 echo "I: verifying queries in progress"
94 grep "1 UDP queries in progress" ns
3/named.stats
> /dev
/null || ret
=1
95 grep "TCP queries in progress" ns
3/named.stats
> /dev
/null
&& ret
=1
96 if [ $ret != 0 ]; then echo "I: failed"; fi
97 status
=`expr $status + $ret`
100 echo "I: verifying bucket size output"
101 grep "bucket size" ns
3/named.stats
> /dev
/null || ret
=1
102 if [ $ret != 0 ]; then echo "I: failed"; fi
103 status
=`expr $status + $ret`
105 echo "I:exit status: $status"