From 10f4cd066fbc3b84ae917f21ef608ed5759159a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 6 Dec 2019 11:07:28 +0100 Subject: [PATCH] Use $n to keep diagnostic output of every individual test separate --- bin/tests/system/forward/tests.sh | 86 +++++++++++++++---------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/bin/tests/system/forward/tests.sh b/bin/tests/system/forward/tests.sh index 17f8631ead..2cd09e0628 100644 --- a/bin/tests/system/forward/tests.sh +++ b/bin/tests/system/forward/tests.sh @@ -24,71 +24,71 @@ n=0 n=$((n+1)) echo_i "checking that a forward zone overrides global forwarders ($n)" ret=0 -$DIG $DIGOPTS +noadd +noauth txt.example1. txt @$hidden > dig.out.hidden || ret=1 -$DIG $DIGOPTS +noadd +noauth txt.example1. txt @$f1 > dig.out.f1 || ret=1 -digcomp dig.out.hidden dig.out.f1 || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example1. txt @$hidden > dig.out.$n.hidden || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example1. txt @$f1 > dig.out.$n.f1 || ret=1 +digcomp dig.out.$n.hidden dig.out.$n.f1 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=$((n+1)) echo_i "checking that a forward first zone no forwarders recurses ($n)" ret=0 -$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$root > dig.out.root || ret=1 -$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$f1 > dig.out.f1 || ret=1 -digcomp dig.out.root dig.out.f1 || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$root > dig.out.$n.root || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$f1 > dig.out.$n.f1 || ret=1 +digcomp dig.out.$n.root dig.out.$n.f1 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=$((n+1)) echo_i "checking that a forward only zone no forwarders fails ($n)" ret=0 -$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$root > dig.out.root || ret=1 -$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$f1 > dig.out.f1 || ret=1 -digcomp dig.out.root dig.out.f1 || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$root > dig.out.$n.root || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$f1 > dig.out.$n.f1 || ret=1 +digcomp dig.out.$n.root dig.out.$n.f1 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=$((n+1)) echo_i "checking that global forwarders work ($n)" ret=0 -$DIG $DIGOPTS +noadd +noauth txt.example4. txt @$hidden > dig.out.hidden || ret=1 -$DIG $DIGOPTS +noadd +noauth txt.example4. txt @$f1 > dig.out.f1 || ret=1 -digcomp dig.out.hidden dig.out.f1 || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example4. txt @$hidden > dig.out.$n.hidden || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example4. txt @$f1 > dig.out.$n.f1 || ret=1 +digcomp dig.out.$n.hidden dig.out.$n.f1 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=$((n+1)) echo_i "checking that a forward zone works ($n)" ret=0 -$DIG $DIGOPTS +noadd +noauth txt.example1. txt @$hidden > dig.out.hidden || ret=1 -$DIG $DIGOPTS +noadd +noauth txt.example1. txt @$f2 > dig.out.f2 || ret=1 -digcomp dig.out.hidden dig.out.f2 || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example1. txt @$hidden > dig.out.$n.hidden || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example1. txt @$f2 > dig.out.$n.f2 || ret=1 +digcomp dig.out.$n.hidden dig.out.$n.f2 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=$((n+1)) echo_i "checking that forwarding doesn't spontaneously happen ($n)" ret=0 -$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$root > dig.out.root || ret=1 -$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$f2 > dig.out.f2 || ret=1 -digcomp dig.out.root dig.out.f2 || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$root > dig.out.$n.root || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example2. txt @$f2 > dig.out.$n.f2 || ret=1 +digcomp dig.out.$n.root dig.out.$n.f2 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=$((n+1)) echo_i "checking that a forward zone with no specified policy works ($n)" ret=0 -$DIG $DIGOPTS +noadd +noauth txt.example3. txt @$hidden > dig.out.hidden || ret=1 -$DIG $DIGOPTS +noadd +noauth txt.example3. txt @$f2 > dig.out.f2 || ret=1 -digcomp dig.out.hidden dig.out.f2 || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example3. txt @$hidden > dig.out.$n.hidden || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example3. txt @$f2 > dig.out.$n.f2 || ret=1 +digcomp dig.out.$n.hidden dig.out.$n.f2 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=$((n+1)) echo_i "checking that a forward only doesn't recurse ($n)" ret=0 -$DIG $DIGOPTS txt.example5. txt @$f2 > dig.out.f2 || ret=1 -grep "SERVFAIL" dig.out.f2 > /dev/null || ret=1 +$DIG $DIGOPTS txt.example5. txt @$f2 > dig.out.$n.f2 || ret=1 +grep "SERVFAIL" dig.out.$n.f2 > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -97,11 +97,11 @@ echo_i "checking for negative caching of forwarder response ($n)" # prime the cache, shutdown the forwarder then check that we can # get the answer from the cache. restart forwarder. ret=0 -$DIG $DIGOPTS nonexist. txt @10.53.0.5 > dig.out.f2 || ret=1 -grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1 +$DIG $DIGOPTS nonexist. txt @10.53.0.5 > dig.out.$n.f2 || ret=1 +grep "status: NXDOMAIN" dig.out.$n.f2 > /dev/null || ret=1 $PERL ../stop.pl forward ns4 || ret=1 -$DIG $DIGOPTS nonexist. txt @10.53.0.5 > dig.out.f2 || ret=1 -grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1 +$DIG $DIGOPTS nonexist. txt @10.53.0.5 > dig.out.$n.f2 || ret=1 +grep "status: NXDOMAIN" dig.out.$n.f2 > /dev/null || ret=1 $PERL ../start.pl --restart --noclean --port ${PORT} forward ns4 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -111,10 +111,10 @@ echo_i "checking that forward only zone overrides empty zone ($n)" ret=0 # retry loop in case the server restart above causes transient failure for try in 0 1 2 3 4 5 6 7 8 9; do - $DIG $DIGOPTS 1.0.10.in-addr.arpa TXT @10.53.0.4 > dig.out.f2 - grep "status: NOERROR" dig.out.f2 > /dev/null || ret=1 - $DIG $DIGOPTS 2.0.10.in-addr.arpa TXT @10.53.0.4 > dig.out.f2 - grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1 + $DIG $DIGOPTS 1.0.10.in-addr.arpa TXT @10.53.0.4 > dig.out.$n.f2 + grep "status: NOERROR" dig.out.$n.f2 > /dev/null || ret=1 + $DIG $DIGOPTS 2.0.10.in-addr.arpa TXT @10.53.0.4 > dig.out.$n.f2 + grep "status: NXDOMAIN" dig.out.$n.f2 > /dev/null || ret=1 [ "$ret" -eq 0 ] && break sleep 1 done @@ -124,14 +124,14 @@ status=`expr $status + $ret` n=$((n+1)) echo_i "checking that DS lookups for grafting forward zones are isolated ($n)" ret=0 -$DIG $DIGOPTS grafted A @10.53.0.4 > dig.out.q1 -$DIG $DIGOPTS grafted DS @10.53.0.4 > dig.out.q2 -$DIG $DIGOPTS grafted A @10.53.0.4 > dig.out.q3 -$DIG $DIGOPTS grafted AAAA @10.53.0.4 > dig.out.q4 -grep "status: NOERROR" dig.out.q1 > /dev/null || ret=1 -grep "status: NXDOMAIN" dig.out.q2 > /dev/null || ret=1 -grep "status: NOERROR" dig.out.q3 > /dev/null || ret=1 -grep "status: NOERROR" dig.out.q4 > /dev/null || ret=1 +$DIG $DIGOPTS grafted A @10.53.0.4 > dig.out.$n.q1 +$DIG $DIGOPTS grafted DS @10.53.0.4 > dig.out.$n.q2 +$DIG $DIGOPTS grafted A @10.53.0.4 > dig.out.$n.q3 +$DIG $DIGOPTS grafted AAAA @10.53.0.4 > dig.out.$n.q4 +grep "status: NOERROR" dig.out.$n.q1 > /dev/null || ret=1 +grep "status: NXDOMAIN" dig.out.$n.q2 > /dev/null || ret=1 +grep "status: NOERROR" dig.out.$n.q3 > /dev/null || ret=1 +grep "status: NOERROR" dig.out.$n.q4 > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -160,7 +160,7 @@ echo "//" | $SENDCMD # and is delegated from the root to check whether the forwarder will be retried # when a delegation is encountered after falling back to full recursive # resolution. -$DIG $DIGOPTS txt.example7. txt @$f1 > dig.out.f1 || ret=1 +$DIG $DIGOPTS txt.example7. txt @$f1 > dig.out.$n.f1 || ret=1 # The forwarder for the "example7" zone should only be queried once. sent=`tr -d '\r' < ns3/named.run | sed -n '/sending packet to 10.53.0.6/,/^$/p' | grep ";txt.example7.*IN.*TXT" | wc -l` if [ $sent -ne 1 ]; then ret=1; fi @@ -170,7 +170,7 @@ status=`expr $status + $ret` n=$((n+1)) echo_i "checking that priming queries are not forwarded ($n)" ret=0 -$DIG $DIGOPTS +noadd +noauth txt.example1. txt @10.53.0.7 > dig.out.f7 || ret=1 +$DIG $DIGOPTS +noadd +noauth txt.example1. txt @10.53.0.7 > dig.out.$n.f7 || ret=1 sent=`tr -d '\r' < ns7/named.run | sed -n '/sending packet to 10.53.0.1/,/^$/p' | grep ";.*IN.*NS" | wc -l` [ $sent -eq 1 ] || ret=1 sent=`grep "10.53.0.7#.* (.): query '\./NS/IN' approved" ns4/named.run | wc -l` @@ -183,8 +183,8 @@ status=`expr $status + $ret` n=$((n+1)) echo_i "checking recovery from forwarding to a non-recursive server ($n)" ret=0 -$DIG $DIGOPTS xxx.sld.tld txt @10.53.0.8 > dig.out.f8 -grep "status: NOERROR" dig.out.f8 > /dev/null || ret=1 +$DIG $DIGOPTS xxx.sld.tld txt @10.53.0.8 > dig.out.$n.f8 +grep "status: NOERROR" dig.out.$n.f8 > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret`