query_count=$(awk '/QUERY/ {print $1}' ns2/named.stats)
txt_count=$(awk '/TXT/ {print $1}' ns2/named.stats)
noerror_count=$(awk '/NOERROR/ {print $1}' ns2/named.stats)
-if [ $PERL_XML ]; then
+if [ "$PERL_XML" ]; then
file=$($PERL fetch.pl -p ${EXTRAPORT1} xml/v3/server)
mv $file xml.stats
$PERL server-xml.pl >xml.fmtstats 2>/dev/null
xml_noerror_count=${xml_noerror_count:-0}
[ "$noerror_count" -eq "$xml_noerror_count" ] || ret=1
fi
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
file=$($PERL fetch.pl -p ${EXTRAPORT1} json/v1/server)
mv $file json.stats
$PERL server-json.pl >json.fmtstats 2>/dev/null
ret=0
echo_i "checking malloced memory statistics xml/json ($n)"
-if [ $PERL_XML ]; then
+if [ "$PERL_XML" ]; then
file=$($PERL fetch.pl -p ${EXTRAPORT1} xml/v3/mem)
mv $file xml.mem
$PERL mem-xml.pl $file >xml.fmtmem
grep "'InUse' => '[0-9][0-9]*'" xml.fmtmem >/dev/null || ret=1
grep "'inuse' => '[0-9][0-9]*'" xml.fmtmem >/dev/null || ret=1
fi
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
file=$($PERL fetch.pl -p ${EXTRAPORT1} json/v1/mem)
mv $file json.mem
grep '"inuse":[0-9][0-9]*,' json.mem >/dev/null || ret=1
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after zone maintenance at startup ($n)"
-if [ $PERL_XML ]; then
+if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
getzones json 0 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after dynamic update ($n)"
-if [ $PERL_XML ]; then
+if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
getzones json 0 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
cat zones.expect | sort >zones.expect.$n
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
-if [ $PERL_XML ]; then
+if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
getzones json 0 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after zone maintenance at startup ($n)"
-if [ $PERL_XML ]; then
+if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
getzones json 2 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after dynamic update ($n)"
-if [ $PERL_XML ]; then
+if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
getzones json 2 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
rm -f zones.expect
# Fetch and check the dnssec sign statistics.
echo_i "fetching zone '$zone' stats data after dnssec-policy change ($n)"
-if [ $PERL_XML ]; then
+if [ "$PERL_XML" ]; then
getzones xml $zone x$n || ret=1
cmp zones.out.x$n zones.expect.$n || ret=1
fi
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
getzones json 2 j$n || ret=1
cmp zones.out.j$n zones.expect.$n || ret=1
fi
n=$((n + 1))
_wait_for_transfers() {
- getxfrins xml x$n || return 1
- getxfrins json j$n || return 1
-
- # XML is encoded in one line, use awk to separate each transfer with a newline
-
- # We expect 4 transfers
- count=$(awk '{ gsub("<xfrin ", "\n<xfrin ") } 1' xfrins.xml.x$n | grep -c -E '<state>(Zone Transfer Request|First Data|Receiving AXFR Data)</state>')
- if [ $count != 4 ]; then return 1; fi
- count=$(grep -c -E '"state":"(Zone Transfer Request|First Data|Receiving AXFR Data)"' xfrins.json.j$n)
- if [ $count != 4 ]; then return 1; fi
-
- # We expect 3 of 4 to be retransfers
- count=$(awk '{ gsub("<xfrin ", "\n<xfrin ") } 1' xfrins.xml.x$n | grep -c -F '<firstrefresh>No</firstrefresh>')
- if [ $count != 3 ]; then return 1; fi
- count=$(grep -c -F '"firstrefresh":"No"' xfrins.json.j$n)
- if [ $count != 3 ]; then return 1; fi
-
- # We expect 1 of 4 to be a new transfer
- count=$(awk '{ gsub("<xfrin ", "\n<xfrin ") } 1' xfrins.xml.x$n | grep -c -F '<firstrefresh>Yes</firstrefresh>')
- if [ $count != 1 ]; then return 1; fi
- count=$(grep -c -F '"firstrefresh":"Yes"' xfrins.json.j$n)
- if [ $count != 1 ]; then return 1; fi
+ if [ "$PERL_XML" ]; then
+ getxfrins xml x$n || return 1
+
+ # XML is encoded in one line, use awk to separate each transfer
+ # with a newline
+
+ # We expect 4 transfers
+ count=$(awk '{ gsub("<xfrin ", "\n<xfrin ") } 1' xfrins.xml.x$n | grep -c -E '<state>(Zone Transfer Request|First Data|Receiving AXFR Data)</state>')
+ if [ $count != 4 ]; then return 1; fi
+
+ # We expect 3 of 4 to be retransfers
+ count=$(awk '{ gsub("<xfrin ", "\n<xfrin ") } 1' xfrins.xml.x$n | grep -c -F '<firstrefresh>No</firstrefresh>')
+ if [ $count != 3 ]; then return 1; fi
+
+ # We expect 1 of 4 to be a new transfer
+ count=$(awk '{ gsub("<xfrin ", "\n<xfrin ") } 1' xfrins.xml.x$n | grep -c -F '<firstrefresh>Yes</firstrefresh>')
+ if [ $count != 1 ]; then return 1; fi
+ fi
+
+ if [ "$PERL_JSON" ]; then
+ getxfrins json j$n || return 1
+
+ # We expect 4 transfers
+ count=$(grep -c -E '"state":"(Zone Transfer Request|First Data|Receiving AXFR Data)"' xfrins.json.j$n)
+ if [ $count != 4 ]; then return 1; fi
+
+ # We expect 3 of 4 to be retransfers
+ count=$(grep -c -F '"firstrefresh":"No"' xfrins.json.j$n)
+ if [ $count != 3 ]; then return 1; fi
+
+ # We expect 1 of 4 to be a new transfer
+ count=$(grep -c -F '"firstrefresh":"Yes"' xfrins.json.j$n)
+ if [ $count != 1 ]; then return 1; fi
+ fi
}
# We have now less than one second to catch the zone transfers in progress
status=$((status + ret))
n=$((n + 1))
-if [ $PERL_JSON ]; then
+if [ "$PERL_JSON" ]; then
echo_i "Checking zone transfer transports ($n)"
ret=0
cp xfrins.json.j$((n - 2)) xfrins.json.j$n