]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
save named.stats files
authorMark Andrews <marka@isc.org>
Wed, 21 Jul 2021 07:09:53 +0000 (17:09 +1000)
committerMark Andrews <marka@isc.org>
Mon, 2 Aug 2021 07:05:06 +0000 (17:05 +1000)
bin/tests/system/statistics/clean.sh
bin/tests/system/statistics/tests.sh

index a99e3bab973f0e6c0d828d597816a7fc1288caea..1caa97b11306c2ff39f89c94a08ae62f4c51a010 100644 (file)
@@ -27,3 +27,4 @@ rm -f ns*/named.lock
 rm -f stats*out
 rm -f ns*/managed-keys.bind*
 rm -f xsltproc.out.*
+rm -f named.stats.*
index aed7bba1d2f714553077800de76fe4e7a7bc5264..f60f6dd1361f2168bf3faa622c864d2e4c4e91c0 100644 (file)
@@ -19,6 +19,18 @@ status=0
 
 ret=0
 n=1
+stats=0
+rndc_stats() {
+       _ns=$1
+       _ip=$2
+
+       $RNDCCMD -s $_ip stats > /dev/null 2>&1 || return 1
+       [ -f "${_ns}/named.stats" ] || return 1
+
+       last_stats=named.stats.$_ns-$stats-$n
+       mv ${_ns}/named.stats $last_stats
+       stats=$((stats+1))
+}
 
 echo_i "fetching a.example from ns2's initial configuration ($n)"
 $DIGCMD +noauth a.example. @10.53.0.2 any > dig.out.ns2.1 || ret=1
@@ -28,28 +40,27 @@ n=`expr $n + 1`
 
 ret=0
 echo_i "dumping initial stats for ns2 ($n)"
-$RNDCCMD -s 10.53.0.2 stats > /dev/null 2>&1
-[ -f ns2/named.stats ] || ret=1
+rndc_stats ns2 10.53.0.2 || 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
+grep "ADB stats" $last_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)"
-grep "1 Addresses in hash table" ns2/named.stats > /dev/null || ret=1
+grep "1 Addresses in hash table" $last_stats > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
 
 ret=0
 echo_i "verifying cache statistics in named.stats ($n)"
-grep "Cache Statistics" ns2/named.stats > /dev/null || ret=1
+grep "Cache Statistics" $last_stats > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
@@ -57,19 +68,17 @@ n=`expr $n + 1`
 ret=0
 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
-$RNDCCMD -s 10.53.0.2 stats > /dev/null 2>&1
-grep "2 Addresses in hash table" ns2/named.stats > /dev/null || ret=1
+rndc_stats ns2 10.53.0.2 || ret=1
+grep "2 Addresses in hash table" $last_stats > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
 
 ret=0
 echo_i "dumping initial stats for ns3 ($n)"
-rm -f ns3/named.stats
-$RNDCCMD -s 10.53.0.3 stats > /dev/null 2>&1
-[ -f ns3/named.stats ] || ret=1
+rndc_stats ns3 10.53.0.3 || ret=1
 if [ ! "$CYGWIN" ]; then
-    nsock0nstat=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'`
+    nsock0nstat=`grep "UDP/IPv4 sockets active" $last_stats | awk '{print $1}'`
     [ 0 -ne ${nsock0nstat:-0} ] || ret=1
 fi
 if [ $ret != 0 ]; then echo_i "failed"; fi
@@ -81,23 +90,21 @@ $DIGCMD +tries=2 +time=1 +recurse @10.53.0.3 foo.info. any > /dev/null 2>&1
 
 ret=0
 echo_i "dumping updated stats for ns3 ($n)"
-rm -f ns3/named.stats
-$RNDCCMD -s 10.53.0.3 stats > /dev/null 2>&1
-[ -f ns3/named.stats ] || ret=1
+rndc_stats ns3 10.53.0.3 || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
 
 ret=0
 echo_i "verifying recursing clients output in named.stats ($n)"
-grep "2 recursing clients" ns3/named.stats > /dev/null || ret=1
+grep "2 recursing clients" $last_stats > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
 
 ret=0
 echo_i "verifying active fetches output in named.stats ($n)"
-grep "1 active fetches" ns3/named.stats > /dev/null || ret=1
+grep "1 active fetches" $last_stats > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
@@ -105,7 +112,7 @@ n=`expr $n + 1`
 if [ ! "$CYGWIN" ]; then
     ret=0
     echo_i "verifying active sockets output in named.stats ($n)"
-    nsock1nstat=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'`
+    nsock1nstat=`grep "UDP/IPv4 sockets active" $last_stats | awk '{print $1}'`
     [ `expr ${nsock1nstat:-0} - ${nsock0nstat:-0}` -eq 1 ] || ret=1
     if [ $ret != 0 ]; then echo_i "failed"; fi
     status=`expr $status + $ret`
@@ -116,15 +123,15 @@ fi
 # no status line is emitted.
 ret=0
 echo_i "verifying queries in progress in named.stats ($n)"
-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
+grep "1 UDP queries in progress" $last_stats > /dev/null || ret=1
+grep "TCP queries in progress" $last_stats > /dev/null && ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
 
 ret=0
 echo_i "verifying bucket size output ($n)"
-grep "bucket size" ns3/named.stats > /dev/null || ret=1
+grep "bucket size" $last_stats > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
@@ -233,7 +240,7 @@ n=`expr $n + 1`
 
 ret=0
 echo_i "checking priming queries are counted ($n)"
-grep "1 priming queries" ns3/named.stats
+grep "1 priming queries" $last_stats
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
@@ -241,39 +248,26 @@ n=`expr $n + 1`
 echo_i "Check that 'zone-statistics full;' is processed by 'rndc reconfig' ($n)"
 ret=0
 # off by default
-rm -f ns2/named.stats
-$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /'
-sleep 1
-cp ns2/named.stats ns2/named.stats-stage1-$n
-sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage1-$n | grep -F '[example]' > /dev/null && ret=0
+rndc_stats ns2 10.53.0.2 || ret=1
+sed -n '/Per Zone Query Statistics/,/^++/p' $last_stats | grep -F '[example]' > /dev/null && ret=0
 # turn on
 copy_setports ns2/named2.conf.in ns2/named.conf
 rndc_reconfig ns2 10.53.0.2
-rm -f ns2/named.stats
-$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /'
-sleep 1
-cp ns2/named.stats ns2/named.stats-stage2-$n
-sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage2-$n | grep -F '[example]' > /dev/null || ret=1
+rndc_stats ns2 10.53.0.2 || ret=1
+sed -n '/Per Zone Query Statistics/,/^++/p' $last_stats | grep -F '[example]' > /dev/null || ret=1
 # turn off
 copy_setports ns2/named.conf.in ns2/named.conf
 rndc_reconfig ns2 10.53.0.2
-rm -f ns2/named.stats
-$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /'
-sleep 1
-cp ns2/named.stats ns2/named.stats-stage3-$n
-sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage3-$n | grep -F '[example]' > /dev/null && ret=0
+rndc_stats ns2 10.53.0.2 || ret=1
+sed -n '/Per Zone Query Statistics/,/^++/p' $last_stats | grep -F '[example]' > /dev/null && ret=0
 # turn on
 copy_setports ns2/named2.conf.in ns2/named.conf
 rndc_reconfig ns2 10.53.0.2
-rm -f ns2/named.stats
-$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /'
-sleep 1
-cp ns2/named.stats ns2/named.stats-stage4-$n
-sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage4-$n | grep -F '[example]' > /dev/null || ret=1
+rndc_stats ns2 10.53.0.2 || ret=1
+sed -n '/Per Zone Query Statistics/,/^++/p' $last_stats | grep -F '[example]' > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
 
-
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1