From 754c7de1e91eeb28c6d3766900ead0c3e44fdb85 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 01:51:28 +0200 Subject: Merging upstream version 1:9.16.48. Signed-off-by: Daniel Baumann --- bin/tests/system/statistics/tests.sh | 278 +++++++++++++++++------------------ 1 file changed, 139 insertions(+), 139 deletions(-) (limited to 'bin/tests/system/statistics/tests.sh') diff --git a/bin/tests/system/statistics/tests.sh b/bin/tests/system/statistics/tests.sh index 5e0b237..e4285e9 100644 --- a/bin/tests/system/statistics/tests.sh +++ b/bin/tests/system/statistics/tests.sh @@ -24,257 +24,257 @@ ret=0 n=1 stats=0 rndc_stats() { - _ns=$1 - _ip=$2 + _ns=$1 + _ip=$2 - $RNDCCMD -s $_ip stats > /dev/null 2>&1 || return 1 - [ -f "${_ns}/named.stats" ] || return 1 + $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)) + 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 +$DIGCMD +noauth a.example. @10.53.0.2 any >dig.out.ns2.1 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` -n=`expr $n + 1` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "dumping initial stats for ns2 ($n)" 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` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "verifying adb records in named.stats ($n)" -grep "ADB stats" $last_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` +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" $last_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` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "verifying cache statistics in named.stats ($n)" -grep "Cache Statistics" $last_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` +status=$(expr $status + $ret) +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 +$DIGCMD a.example.info. @10.53.0.2 any >/dev/null 2>&1 rndc_stats ns2 10.53.0.2 || ret=1 -grep "2 Addresses in hash table" $last_stats > /dev/null || 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` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "dumping initial stats for ns3 ($n)" rndc_stats ns3 10.53.0.3 || ret=1 if [ ! "$CYGWIN" ]; then - nsock0nstat=`grep "UDP/IPv4 sockets active" $last_stats | awk '{print $1}'` - [ 0 -ne ${nsock0nstat:-0} ] || ret=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 -status=`expr $status + $ret` -n=`expr $n + 1` +status=$(expr $status + $ret) +n=$(expr $n + 1) echo_i "sending queries to ns3" -$DIGCMD +tries=2 +time=1 +recurse @10.53.0.3 foo.info. any > /dev/null 2>&1 +$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)" getstats() { - rndc_stats ns3 10.53.0.3 || return 1 - grep "2 recursing clients" $last_stats > /dev/null || return 1 + rndc_stats ns3 10.53.0.3 || return 1 + grep "2 recursing clients" $last_stats >/dev/null || return 1 } retry_quiet 5 getstats || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` -n=`expr $n + 1` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "verifying recursing clients output in named.stats ($n)" -grep "2 recursing clients" $last_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` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "verifying active fetches output in named.stats ($n)" -grep "1 active fetches" $last_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` +status=$(expr $status + $ret) +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" $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` - n=`expr $n + 1` + ret=0 + echo_i "verifying active sockets output in named.stats ($n)" + 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) + n=$(expr $n + 1) fi # there should be 1 UDP and no TCP queries. As the TCP counter is zero # no status line is emitted. ret=0 echo_i "verifying queries in progress in named.stats ($n)" -grep "1 UDP queries in progress" $last_stats > /dev/null || ret=1 -grep "TCP queries in progress" $last_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` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "verifying bucket size output ($n)" -grep "bucket size" $last_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` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "checking priming queries are counted ($n)" -grep "priming queries" $last_stats > /dev/null || ret=1 +grep "priming queries" $last_stats >/dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` -n=`expr $n + 1` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "checking that zones with slash are properly shown in XML output ($n)" -if $FEATURETEST --have-libxml2 && [ -x ${CURL} ] ; then - ${CURL} http://10.53.0.1:${EXTRAPORT1}/xml/v3/zones > curl.out.${n} 2>/dev/null || ret=1 - grep '' curl.out.${n} > /dev/null || ret=1 +if $FEATURETEST --have-libxml2 && [ -x ${CURL} ]; then + ${CURL} http://10.53.0.1:${EXTRAPORT1}/xml/v3/zones >curl.out.${n} 2>/dev/null || ret=1 + grep '' curl.out.${n} >/dev/null || ret=1 else - echo_i "skipping test as libxml2 and/or curl was not found" + echo_i "skipping test as libxml2 and/or curl was not found" fi if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` -n=`expr $n + 1` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "checking that zones return their type ($n)" -if $FEATURETEST --have-libxml2 && [ -x ${CURL} ] ; then - ${CURL} http://10.53.0.1:${EXTRAPORT1}/xml/v3/zones > curl.out.${n} 2>/dev/null || ret=1 - grep 'master' curl.out.${n} > /dev/null || ret=1 +if $FEATURETEST --have-libxml2 && [ -x ${CURL} ]; then + ${CURL} http://10.53.0.1:${EXTRAPORT1}/xml/v3/zones >curl.out.${n} 2>/dev/null || ret=1 + grep 'master' curl.out.${n} >/dev/null || ret=1 else - echo_i "skipping test as libxml2 and/or curl was not found" + echo_i "skipping test as libxml2 and/or curl was not found" fi if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` -n=`expr $n + 1` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "checking bind9.xsl vs xml ($n)" -if $FEATURETEST --have-libxml2 && [ -x "${CURL}" ] && [ -x "${XSLTPROC}" ] ; then - $DIGCMD +notcp +recurse @10.53.0.3 soa . > /dev/null 2>&1 - $DIGCMD +notcp +recurse @10.53.0.3 soa example > /dev/null 2>&1 - ${CURL} http://10.53.0.3:${EXTRAPORT1}/xml/v3 > curl.out.${n}.xml 2>/dev/null || ret=1 - ${CURL} http://10.53.0.3:${EXTRAPORT1}/bind9.xsl > curl.out.${n}.xsl 2>/dev/null || ret=1 - ${XSLTPROC} curl.out.${n}.xsl - < curl.out.${n}.xml > xsltproc.out.${n} 2>/dev/null || ret=1 - cp curl.out.${n}.xml stats.xml.out || ret=1 +if $FEATURETEST --have-libxml2 && [ -x "${CURL}" ] && [ -x "${XSLTPROC}" ]; then + $DIGCMD +notcp +recurse @10.53.0.3 soa . >/dev/null 2>&1 + $DIGCMD +notcp +recurse @10.53.0.3 soa example >/dev/null 2>&1 + ${CURL} http://10.53.0.3:${EXTRAPORT1}/xml/v3 >curl.out.${n}.xml 2>/dev/null || ret=1 + ${CURL} http://10.53.0.3:${EXTRAPORT1}/bind9.xsl >curl.out.${n}.xsl 2>/dev/null || ret=1 + ${XSLTPROC} curl.out.${n}.xsl - xsltproc.out.${n} 2>/dev/null || ret=1 + cp curl.out.${n}.xml stats.xml.out || ret=1 - # - # grep for expected sections. - # - grep "

ISC Bind 9 Configuration and Statistics

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Server Status

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Incoming Requests by DNS Opcode

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Incoming Queries by Query Type

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Outgoing Queries per view

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

View " xsltproc.out.${n} >/dev/null || ret=1 - grep "

Server Statistics

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Zone Maintenance Statistics

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Resolver Statistics (Common)

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Resolver Statistics for View " xsltproc.out.${n} >/dev/null || ret=1 - grep "

ADB Statistics for View " xsltproc.out.${n} >/dev/null || ret=1 - grep "

Cache Statistics for View " xsltproc.out.${n} >/dev/null || ret=1 - # grep "

Cache DB RRsets for View " xsltproc.out.${n} >/dev/null || ret=1 - grep "

Traffic Size Statistics

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

UDP Requests Received

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

UDP Responses Sent

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

TCP Requests Received

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

TCP Responses Sent

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Socket I/O Statistics

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Zones for View " xsltproc.out.${n} >/dev/null || ret=1 - grep "

Received QTYPES per view/zone

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

View _default" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Zone example" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Response Codes per view/zone

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

View _default" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Zone example" xsltproc.out.${n} >/dev/null || ret=1 - # grep "

Glue cache statistics

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

View _default" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Zone example" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Network Status

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Task Manager Configuration

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Tasks

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Memory Usage Summary

" xsltproc.out.${n} >/dev/null || ret=1 - grep "

Memory Contexts

" xsltproc.out.${n} >/dev/null || ret=1 + # + # grep for expected sections. + # + grep "

ISC Bind 9 Configuration and Statistics

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Server Status

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Incoming Requests by DNS Opcode

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Incoming Queries by Query Type

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Outgoing Queries per view

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

View " xsltproc.out.${n} >/dev/null || ret=1 + grep "

Server Statistics

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Zone Maintenance Statistics

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Resolver Statistics (Common)

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Resolver Statistics for View " xsltproc.out.${n} >/dev/null || ret=1 + grep "

ADB Statistics for View " xsltproc.out.${n} >/dev/null || ret=1 + grep "

Cache Statistics for View " xsltproc.out.${n} >/dev/null || ret=1 + # grep "

Cache DB RRsets for View " xsltproc.out.${n} >/dev/null || ret=1 + grep "

Traffic Size Statistics

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

UDP Requests Received

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

UDP Responses Sent

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

TCP Requests Received

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

TCP Responses Sent

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Socket I/O Statistics

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Zones for View " xsltproc.out.${n} >/dev/null || ret=1 + grep "

Received QTYPES per view/zone

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

View _default" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Zone example" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Response Codes per view/zone

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

View _default" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Zone example" xsltproc.out.${n} >/dev/null || ret=1 + # grep "

Glue cache statistics

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

View _default" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Zone example" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Network Status

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Task Manager Configuration

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Tasks

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Memory Usage Summary

" xsltproc.out.${n} >/dev/null || ret=1 + grep "

Memory Contexts

" xsltproc.out.${n} >/dev/null || ret=1 else - echo_i "skipping test as libxml2 and/or curl and/or xsltproc was not found" + echo_i "skipping test as libxml2 and/or curl and/or xsltproc was not found" fi if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` -n=`expr $n + 1` +status=$(expr $status + $ret) +n=$(expr $n + 1) ret=0 echo_i "checking bind9.xml socket statistics ($n)" -if $FEATURETEST --have-libxml2 && [ -x "${CURL}" ] && [ -x "${XSLTPROC}" ] ; then - # Socket statistics (expect no errors) - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 +if $FEATURETEST --have-libxml2 && [ -x "${CURL}" ] && [ -x "${XSLTPROC}" ]; then + # Socket statistics (expect no errors) + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 - grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 + grep "0" stats.xml.out >/dev/null || ret=1 else - echo_i "skipping test as libxml2 and/or curl and/or xsltproc was not found" + echo_i "skipping test as libxml2 and/or curl and/or xsltproc was not found" fi if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` -n=`expr $n + 1` +status=$(expr $status + $ret) +n=$(expr $n + 1) echo_i "Check that 'zone-statistics full;' is processed by 'rndc reconfig' ($n)" ret=0 # off by default 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 +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 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 +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 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 +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 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 +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` +status=$(expr $status + $ret) +n=$(expr $n + 1) echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 -- cgit v1.2.3