2012-05-14 10:06:05 -07:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2018-02-23 09:53:12 +01:00
|
|
|
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2012-06-29 11:39:47 +10:00
|
|
|
#
|
2016-06-27 14:56:38 +10:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2018-02-23 09:53:12 +01:00
|
|
|
#
|
|
|
|
# See the COPYRIGHT file distributed with this work for additional
|
|
|
|
# information regarding copyright ownership.
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
SYSTEMTESTTOP=..
|
|
|
|
. $SYSTEMTESTTOP/conf.sh
|
|
|
|
|
|
|
|
DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
|
2018-02-20 15:43:27 -08:00
|
|
|
DIGCMD="$DIG $DIGOPTS -p ${PORT}"
|
|
|
|
RNDCCMD="$RNDC -p ${CONTROLPORT} -c ../common/rndc.conf"
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
status=0
|
2015-06-29 18:33:18 +05:30
|
|
|
|
2012-05-14 10:06:05 -07:00
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
n=1
|
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "fetching a.example from ns2's initial configuration ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
$DIGCMD +noauth a.example. @10.53.0.2 any > dig.out.ns2.1 || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
ret=0
|
2018-03-19 14:24:32 +11:00
|
|
|
echo_i "dumping initial stats for ns2 ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
$RNDCCMD -s 10.53.0.2 stats > /dev/null 2>&1
|
2018-03-19 14:24:32 +11:00
|
|
|
[ -f ns2/named.stats ] || ret=1
|
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
|
status=`expr $status + $ret`
|
|
|
|
n=`expr $n + 1`
|
|
|
|
|
|
|
|
ret=0
|
|
|
|
echo_i "verifying adb records in named.stats ($n)"
|
|
|
|
grep "ADB stats" ns2/named.stats > /dev/null || ret=1
|
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
|
status=`expr $status + $ret`
|
|
|
|
n=`expr $n + 1`
|
|
|
|
|
|
|
|
echo_i "checking for 1 entry in adb hash table in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "1 Addresses in hash table" ns2/named.stats > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "verifying cache statistics in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "Cache Statistics" ns2/named.stats > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
2015-07-09 21:18:42 -07:00
|
|
|
ret=0
|
2018-03-19 14:24:32 +11:00
|
|
|
echo_i "checking for 2 entries in adb hash table in named.stats ($n)"
|
|
|
|
$DIGCMD a.example.info. @10.53.0.2 any > /dev/null 2>&1
|
2012-05-14 10:06:05 -07:00
|
|
|
$RNDCCMD -s 10.53.0.2 stats > /dev/null 2>&1
|
|
|
|
grep "2 Addresses in hash table" ns2/named.stats > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
ret=0
|
2018-03-19 14:24:32 +11:00
|
|
|
echo_i "dumping initial stats for ns3 ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
rm -f ns3/named.stats
|
|
|
|
$RNDCCMD -s 10.53.0.3 stats > /dev/null 2>&1
|
|
|
|
[ -f ns3/named.stats ] || ret=1
|
2016-10-19 17:18:42 +02:00
|
|
|
[ "$CYGWIN" ] || \
|
2015-07-09 21:18:42 -07:00
|
|
|
nsock0nstat=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'`
|
2018-03-19 22:31:22 +11:00
|
|
|
[ 0 -ne ${nsock0nstat:-0} ] || ret=1
|
2018-03-19 14:24:32 +11:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
|
|
status=`expr $status + $ret`
|
|
|
|
n=`expr $n + 1`
|
2015-07-09 21:18:42 -07:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "sending queries to ns3"
|
2012-05-14 10:06:05 -07:00
|
|
|
$DIGCMD +tries=2 +time=1 +recurse @10.53.0.3 foo.info. any > /dev/null 2>&1
|
2018-03-19 14:24:32 +11:00
|
|
|
|
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "dumping updated stats for ns3 ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
rm -f ns3/named.stats
|
|
|
|
$RNDCCMD -s 10.53.0.3 stats > /dev/null 2>&1
|
|
|
|
[ -f ns3/named.stats ] || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "verifying recursing clients output in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "2 recursing clients" ns3/named.stats > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "verifying active fetches output in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "1 active fetches" ns3/named.stats > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
|
|
|
|
2016-10-19 17:18:42 +02:00
|
|
|
if [ ! "$CYGWIN" ]; then
|
|
|
|
ret=0
|
2018-03-19 14:24:32 +11:00
|
|
|
echo_i "verifying active sockets output in named.stats ($n)"
|
|
|
|
nsock1nstat=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'`
|
2016-10-19 17:18:42 +02:00
|
|
|
[ `expr $nsock1nstat - $nsock0nstat` -eq 1 ] || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2016-10-19 17:18:42 +02:00
|
|
|
status=`expr $status + $ret`
|
|
|
|
n=`expr $n + 1`
|
|
|
|
fi
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
# there should be 1 UDP and no TCP queries. As the TCP counter is zero
|
|
|
|
# no status line is emitted.
|
2018-03-19 14:24:32 +11:00
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "verifying queries in progress in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "1 UDP queries in progress" ns3/named.stats > /dev/null || ret=1
|
|
|
|
grep "TCP queries in progress" ns3/named.stats > /dev/null && ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "verifying bucket size output ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "bucket size" ns3/named.stats > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2012-05-14 10:06:05 -07:00
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
2015-06-29 18:33:18 +05:30
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking that zones with slash are properly shown in XML output ($n)"
|
2016-10-31 16:53:37 -07:00
|
|
|
if $FEATURETEST --have-libxml2 && [ -x ${CURL} ] ; then
|
2018-03-19 23:11:33 +11:00
|
|
|
${CURL} http://10.53.0.1:${EXTRAPORT1}/xml/v3/zones > curl.out.${n} 2>/dev/null || ret=1
|
|
|
|
grep '<zone name="32/1.0.0.127-in-addr.example" rdataclass="IN">' curl.out.${n} > /dev/null || ret=1
|
2015-06-29 18:33:18 +05:30
|
|
|
else
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "skipping test as libxml2 and/or curl was not found"
|
2015-06-29 18:33:18 +05:30
|
|
|
fi
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2015-06-29 18:33:18 +05:30
|
|
|
status=`expr $status + $ret`
|
2018-03-19 14:24:32 +11:00
|
|
|
n=`expr $n + 1`
|
2015-06-29 18:33:18 +05:30
|
|
|
|
2015-10-28 09:45:46 +11:00
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking that zones return their type ($n)"
|
2016-10-31 16:53:37 -07:00
|
|
|
if $FEATURETEST --have-libxml2 && [ -x ${CURL} ] ; then
|
2018-02-20 15:43:27 -08:00
|
|
|
${CURL} http://10.53.0.1:${EXTRAPORT1}/xml/v3/zones > curl.out.${t} 2>/dev/null || ret=1
|
2015-10-28 09:45:46 +11:00
|
|
|
grep '<zone name="32/1.0.0.127-in-addr.example" rdataclass="IN"><type>master</type>' curl.out.${t} > /dev/null || ret=1
|
|
|
|
else
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "skipping test as libxml2 and/or curl was not found"
|
2015-10-28 09:45:46 +11:00
|
|
|
fi
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2015-10-28 09:45:46 +11:00
|
|
|
status=`expr $status + $ret`
|
2018-03-19 14:24:32 +11:00
|
|
|
n=`expr $n + 1`
|
2015-10-28 09:45:46 +11:00
|
|
|
|
2017-10-26 21:38:43 -07:00
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking priming queries are counted ($n)"
|
2017-10-26 21:38:43 -07:00
|
|
|
grep "1 priming queries" ns3/named.stats
|
2018-02-20 15:43:27 -08:00
|
|
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
2017-10-26 21:38:43 -07:00
|
|
|
status=`expr $status + $ret`
|
2018-03-19 14:24:32 +11:00
|
|
|
n=`expr $n + 1`
|
2017-10-26 21:38:43 -07:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "exit status: $status"
|
2016-06-14 13:48:39 +10:00
|
|
|
[ $status -eq 0 ] || exit 1
|