From d5c795942f6814b604745096b38327e8dbdcd93b Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 20 May 2019 15:24:03 +1000 Subject: [PATCH] check xsl vs xml --- bin/tests/system/conf.sh.in | 3 ++ bin/tests/system/statistics/clean.sh | 1 + bin/tests/system/statistics/ns3/named.conf.in | 8 +++ bin/tests/system/statistics/tests.sh | 52 +++++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 818661062b..f13681cb99 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -100,6 +100,9 @@ CURL=@CURL@ # XMLLINT will be empty if no program was found by configure XMLLINT=@XMLLINT@ +# XSLTPROC will be empty if no program was found by configure +XSLTPROC=@XSLTPROC@ + # PERL will be an empty string if no perl interpreter was found. PERL=@PERL@ diff --git a/bin/tests/system/statistics/clean.sh b/bin/tests/system/statistics/clean.sh index c730331031..9d23604818 100644 --- a/bin/tests/system/statistics/clean.sh +++ b/bin/tests/system/statistics/clean.sh @@ -25,3 +25,4 @@ rm -f curl.out.* rm -f ns*/named.lock rm -f stats*out rm -f ns*/managed-keys.bind* +rm -f xsltproc.out.* diff --git a/bin/tests/system/statistics/ns3/named.conf.in b/bin/tests/system/statistics/ns3/named.conf.in index c3c9208870..73bd5b57f8 100644 --- a/bin/tests/system/statistics/ns3/named.conf.in +++ b/bin/tests/system/statistics/ns3/named.conf.in @@ -22,6 +22,8 @@ options { dnssec-validation yes; notify yes; qname-minimization disabled; + zone-statistics yes; + glue-cache yes; }; statistics-channels { @@ -47,3 +49,9 @@ zone "example" { allow-update { any; }; file "internal.db"; }; + +zone "a-slave" { + type slave; + file "slave.bk"; + masters { 10.53.0.1; }; +}; diff --git a/bin/tests/system/statistics/tests.sh b/bin/tests/system/statistics/tests.sh index ce9d7eab1e..ccbca44996 100644 --- a/bin/tests/system/statistics/tests.sh +++ b/bin/tests/system/statistics/tests.sh @@ -154,6 +154,58 @@ if [ $ret != 0 ]; then echo_i "failed"; fi 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 + # + # 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" +fi +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` +n=`expr $n + 1` + ret=0 echo_i "checking priming queries are counted ($n)" grep "1 priming queries" ns3/named.stats