1#!/bin/sh 2# 3# Copyright (C) 2012 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.1.4.11 2012/02/01 16:54:32 each Exp 18 19SYSTEMTESTTOP=.. 20. $SYSTEMTESTTOP/conf.sh 21 22DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd" 23DIGCMD="$DIG $DIGOPTS -p 5300" 24RNDCCMD="$RNDC -p 9953 -c ../common/rndc.conf" 25 26status=0 27ret=0 28echo "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 30if [ $ret != 0 ]; then echo "I: failed"; fi 31status=`expr $status + $ret` 32 33ret=0 34echo "I:verifying adb records in named.stats" 35$RNDCCMD -s 10.53.0.2 stats > /dev/null 2>&1 36echo "I: checking for 1 entry in adb hash table" 37grep "1 Addresses in hash table" ns2/named.stats > /dev/null || ret=1 38if [ $ret != 0 ]; then echo "I:failed"; fi 39status=`expr $status + $ret` 40 41ret=0 42echo "I: verifying cache statistics in named.stats" 43grep "Cache Statistics" ns2/named.stats > /dev/null || ret=1 44if [ $ret != 0 ]; then echo "I:failed"; fi 45status=`expr $status + $ret` 46 47ret=0 48echo "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 51grep "2 Addresses in hash table" ns2/named.stats > /dev/null || ret=1 52if [ $ret != 0 ]; then echo "I: failed"; fi 53status=`expr $status + $ret` 54 55ret=0 56echo "I:dumping initial stats for ns3" 57rm -f ns3/named.stats 58$RNDCCMD -s 10.53.0.3 stats > /dev/null 2>&1 59[ -f ns3/named.stats ] || ret=1 60nsock0=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'` 61echo "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 64echo "I:dumping updated stats for ns3" 65rm -f ns3/named.stats 66$RNDCCMD -s 10.53.0.3 stats > /dev/null 2>&1 67[ -f ns3/named.stats ] || ret=1 68if [ $ret != 0 ]; then echo "I: failed"; fi 69status=`expr $status + $ret` 70 71ret=0 72echo "I: verifying recursing clients output" 73grep "2 recursing clients" ns3/named.stats > /dev/null || ret=1 74if [ $ret != 0 ]; then echo "I: failed"; fi 75status=`expr $status + $ret` 76 77ret=0 78echo "I: verifying active fetches output" 79grep "1 active fetches" ns3/named.stats > /dev/null || ret=1 80if [ $ret != 0 ]; then echo "I: failed"; fi 81status=`expr $status + $ret` 82 83ret=0 84echo "I: verifying active sockets output" 85nsock1=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'` 86[ `expr $nsock1 - $nsock0` -eq 1 ] || ret=1 87if [ $ret != 0 ]; then echo "I: failed"; fi 88status=`expr $status + $ret` 89 90ret=0 91# there should be 1 UDP and no TCP queries. As the TCP counter is zero 92# no status line is emitted. 93echo "I: verifying queries in progress" 94grep "1 UDP queries in progress" ns3/named.stats > /dev/null || ret=1 95grep "TCP queries in progress" ns3/named.stats > /dev/null && ret=1 96if [ $ret != 0 ]; then echo "I: failed"; fi 97status=`expr $status + $ret` 98 99ret=0 100echo "I: verifying bucket size output" 101grep "bucket size" ns3/named.stats > /dev/null || ret=1 102if [ $ret != 0 ]; then echo "I: failed"; fi 103status=`expr $status + $ret` 104 105echo "I:exit status: $status" 106exit $status 107