From fd8d52fbdd14733534220270def95b6bf7875f97 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Mon, 18 Sep 2017 14:15:55 -0700 Subject: [PATCH] [v9_11] add I: when echoing information about failed tests (cherry picked from commit 49740fb0f26e97ee90b0463782aad4a81b2b538f) --- bin/tests/system/dnstap/tests.sh | 212 ++++++++++++++++++++----------- 1 file changed, 138 insertions(+), 74 deletions(-) diff --git a/bin/tests/system/dnstap/tests.sh b/bin/tests/system/dnstap/tests.sh index 06fc24a942..95c74a4eee 100644 --- a/bin/tests/system/dnstap/tests.sh +++ b/bin/tests/system/dnstap/tests.sh @@ -15,20 +15,20 @@ status=0 for bad in bad-*.conf do - ret=0 - echo "I: checking that named-checkconf detects error in $bad" - $CHECKCONF $bad > /dev/null 2>&1 - if [ $? != 1 ]; then echo "I:failed"; ret=1; fi - status=`expr $status + $ret` + ret=0 + echo "I: checking that named-checkconf detects error in $bad" + $CHECKCONF $bad > /dev/null 2>&1 + if [ $? != 1 ]; then echo "I:failed"; ret=1; fi + status=`expr $status + $ret` done for good in good-*.conf do - ret=0 - echo "I: checking that named-checkconf detects no error in $good" - $CHECKCONF $good > /dev/null 2>&1 - if [ $? != 0 ]; then echo "I:failed"; ret=1; fi - status=`expr $status + $ret` + ret=0 + echo "I: checking that named-checkconf detects no error in $good" + $CHECKCONF $good > /dev/null 2>&1 + if [ $? != 0 ]; then echo "I:failed"; ret=1; fi + status=`expr $status + $ret` done $DIG +short @10.53.0.3 -p 5300 a.example > dig.out @@ -94,13 +94,16 @@ rr3=`$DNSTAPREAD ns3/dnstap.out.save | grep "RR " | wc -l` echo "I: checking UDP message counts" ret=0 [ $udp1 -eq 0 ] || { - echo "ns1 $udp1 expected 0" ; ret=1 + echo "I:ns1 $udp1 expected 0" + ret=1 } [ $udp2 -eq 2 ] || { - echo "ns2 $udp2 expected 2" ; ret=1 + echo "I:ns2 $udp2 expected 2" + ret=1 } [ $udp3 -eq 4 ] || { - echo "ns3 $udp3 expected 4" ; ret=1 + echo "I:ns3 $udp3 expected 4" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -108,13 +111,16 @@ status=`expr $status + $ret` echo "I: checking TCP message counts" ret=0 [ $tcp1 -eq 6 ] || { - echo "ns1 $tcp1 expected 6" ; ret=1 + echo "I:ns1 $tcp1 expected 6" + ret=1 } [ $tcp2 -eq 2 ] || { - echo "ns2 $tcp2 expected 2" ; ret=1 + echo "I:ns2 $tcp2 expected 2" + ret=1 } [ $tcp3 -eq 6 ] || { - echo "ns3 $tcp3 expected 6" ; ret=1 + echo "I:ns3 $tcp3 expected 6" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -122,13 +128,16 @@ status=`expr $status + $ret` echo "I: checking AUTH_QUERY message counts" ret=0 [ $aq1 -eq 2 ] || { - echo "ns1 $aq1 exepcted 2" ; ret=1 + echo "I:ns1 $aq1 exepcted 2" + ret=1 } [ $aq2 -eq 1 ] || { - echo "ns2 $aq2 expected 1" ; ret=1 + echo "I:ns2 $aq2 expected 1" + ret=1 } [ $aq3 -eq 0 ] || { - echo "ns3 $aq3 expected 0" ; ret=1 + echo "I:ns3 $aq3 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -136,13 +145,16 @@ status=`expr $status + $ret` echo "I: checking AUTH_RESPONSE message counts" ret=0 [ $ar1 -eq 2 ] || { - echo "ns1 $ar1 expected 2" ; ret=1 + echo "I:ns1 $ar1 expected 2" + ret=1 } [ $ar2 -eq 1 ] || { - echo "ns2 $ar2 expected 1" ; ret=1 + echo "I:ns2 $ar2 expected 1" + ret=1 } [ $ar3 -eq 0 ] || { - echo "ns3 $ar3 expected 0" ; ret=1 + echo "I:ns3 $ar3 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -150,13 +162,16 @@ status=`expr $status + $ret` echo "I: checking CLIENT_QUERY message counts" ret=0 [ $cq1 -eq 1 ] || { - echo "ns1 $cq1 expected 1" ; ret=1 + echo "I:ns1 $cq1 expected 1" + ret=1 } [ $cq2 -eq 1 ] || { - echo "ns2 $cq2 expected 1" ; ret=1 + echo "I:ns2 $cq2 expected 1" + ret=1 } [ $cq3 -eq 2 ] || { - echo "ns3 $cq3 expected 2" ; ret=1 + echo "I:ns3 $cq3 expected 2" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -164,13 +179,16 @@ status=`expr $status + $ret` echo "I: checking CLIENT_RESPONSE message counts" ret=0 [ $cr1 -eq 1 ] || { - echo "ns1 $cr1 expected 1" ; ret=1 + echo "I:ns1 $cr1 expected 1" + ret=1 } [ $cr2 -eq 1 ] || { - echo "ns2 $cr2 expected 1" ; ret=1 + echo "I:ns2 $cr2 expected 1" + ret=1 } [ $cr3 -eq 2 ] || { - echo "ns3 $cr3 expected 2" ; ret=1 + echo "I:ns3 $cr3 expected 2" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -178,13 +196,16 @@ status=`expr $status + $ret` echo "I: checking RESOLVER_QUERY message counts" ret=0 [ $rq1 -eq 0 ] || { - echo "ns1 $rq1 expected 0" ; ret=1 + echo "I:ns1 $rq1 expected 0" + ret=1 } [ $rq2 -eq 0 ] || { - echo "ns2 $rq2 expected 0" ; ret=1 + echo "I:ns2 $rq2 expected 0" + ret=1 } [ $rq3 -eq 3 ] || { - echo "ns3 $rq3 expected 3" ; ret=1 + echo "I:ns3 $rq3 expected 3" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -192,13 +213,16 @@ status=`expr $status + $ret` echo "I: checking RESOLVER_RESPONSE message counts" ret=0 [ $rr1 -eq 0 ] || { - echo "ns1 $rr1 expected 0" ; ret=1 + echo "I:ns1 $rr1 expected 0" + ret=1 } [ $rr2 -eq 0 ] || { - echo "ns2 $rr2 expected 0" ; ret=1 + echo "I:ns2 $rr2 expected 0" + ret=1 } [ $rr3 -eq 3 ] || { - echo "ns3 $rr3 expected 3" ; ret=1 + echo "I:ns3 $rr3 expected 3" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -235,13 +259,16 @@ rr3=`$DNSTAPREAD ns3/dnstap.out | grep "RR " | wc -l` echo "I: checking UDP message counts" ret=0 [ $udp1 -eq 0 ] || { - echo "ns1 $udp1 expected 0" ; ret=1 + echo "I:ns1 $udp1 expected 0" + ret=1 } [ $udp2 -eq 0 ] || { - echo "ns2 $udp2 expected 0" ; ret=1 + echo "I:ns2 $udp2 expected 0" + ret=1 } [ $udp3 -eq 2 ] || { - echo "ns3 $udp3 expected 2" ; ret=1 + echo "I:ns3 $udp3 expected 2" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -249,13 +276,16 @@ status=`expr $status + $ret` echo "I: checking TCP message counts" ret=0 [ $tcp1 -eq 0 ] || { - echo "ns1 $tcp1 expected 0" ; ret=1 + echo "I:ns1 $tcp1 expected 0" + ret=1 } [ $tcp2 -eq 0 ] || { - echo "ns2 $tcp2 expected 0" ; ret=1 + echo "I:ns2 $tcp2 expected 0" + ret=1 } [ $tcp3 -eq 0 ] || { - echo "ns3 $tcp3 expected 0" ; ret=1 + echo "I:ns3 $tcp3 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -263,13 +293,16 @@ status=`expr $status + $ret` echo "I: checking AUTH_QUERY message counts" ret=0 [ $aq1 -eq 0 ] || { - echo "ns1 $aq1 exepcted 0" ; ret=1 + echo "I:ns1 $aq1 exepcted 0" + ret=1 } [ $aq2 -eq 0 ] || { - echo "ns2 $aq2 expected 0" ; ret=1 + echo "I:ns2 $aq2 expected 0" + ret=1 } [ $aq3 -eq 0 ] || { - echo "ns3 $aq3 expected 0" ; ret=1 + echo "I:ns3 $aq3 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -277,13 +310,16 @@ status=`expr $status + $ret` echo "I: checking AUTH_RESPONSE message counts" ret=0 [ $ar1 -eq 0 ] || { - echo "ns1 $ar1 expected 0" ; ret=1 + echo "I:ns1 $ar1 expected 0" + ret=1 } [ $ar2 -eq 0 ] || { - echo "ns2 $ar2 expected 0" ; ret=1 + echo "I:ns2 $ar2 expected 0" + ret=1 } [ $ar3 -eq 0 ] || { - echo "ns3 $ar3 expected 0" ; ret=1 + echo "I:ns3 $ar3 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -291,13 +327,16 @@ status=`expr $status + $ret` echo "I: checking CLIENT_QUERY message counts" ret=0 [ $cq1 -eq 0 ] || { - echo "ns1 $cq1 expected 0" ; ret=1 + echo "I:ns1 $cq1 expected 0" + ret=1 } [ $cq2 -eq 0 ] || { - echo "ns2 $cq2 expected 0" ; ret=1 + echo "I:ns2 $cq2 expected 0" + ret=1 } [ $cq3 -eq 1 ] || { - echo "ns3 $cq3 expected 1" ; ret=1 + echo "I:ns3 $cq3 expected 1" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -305,13 +344,16 @@ status=`expr $status + $ret` echo "I: checking CLIENT_RESPONSE message counts" ret=0 [ $cr1 -eq 0 ] || { - echo "ns1 $cr1 expected 0" ; ret=1 + echo "I:ns1 $cr1 expected 0" + ret=1 } [ $cr2 -eq 0 ] || { - echo "ns2 $cr2 expected 0" ; ret=1 + echo "I:ns2 $cr2 expected 0" + ret=1 } [ $cr3 -eq 1 ] || { - echo "ns3 $cr3 expected 1" ; ret=1 + echo "I:ns3 $cr3 expected 1" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -319,13 +361,16 @@ status=`expr $status + $ret` echo "I: checking RESOLVER_QUERY message counts" ret=0 [ $rq1 -eq 0 ] || { - echo "ns1 $rq1 expected 0" ; ret=1 + echo "I:ns1 $rq1 expected 0" + ret=1 } [ $rq2 -eq 0 ] || { - echo "ns2 $rq2 expected 0" ; ret=1 + echo "I:ns2 $rq2 expected 0" + ret=1 } [ $rq3 -eq 0 ] || { - echo "ns3 $rq3 expected 0" ; ret=1 + echo "I:ns3 $rq3 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -333,13 +378,16 @@ status=`expr $status + $ret` echo "I: checking RESOLVER_RESPONSE message counts" ret=0 [ $rr1 -eq 0 ] || { - echo "ns1 $rr1 expected 0" ; ret=1 + echo "I:ns1 $rr1 expected 0" + ret=1 } [ $rr2 -eq 0 ] || { - echo "ns2 $rr2 expected 0" ; ret=1 + echo "I:ns2 $rr2 expected 0" + ret=1 } [ $rr3 -eq 0 ] || { - echo "ns3 $rr3 expected 0" ; ret=1 + echo "I:ns3 $rr3 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -376,7 +424,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking UDP message counts" ret=0 [ $udp4 -eq 2 ] || { - echo "ns4 $udp4 expected 2" ; ret=1 + echo "I:ns4 $udp4 expected 2" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -384,7 +433,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking TCP message counts" ret=0 [ $tcp4 -eq 0 ] || { - echo "ns4 $tcp4 expected 0" ; ret=1 + echo "I:ns4 $tcp4 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -392,7 +442,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking AUTH_QUERY message counts" ret=0 [ $aq4 -eq 0 ] || { - echo "ns4 $aq4 expected 0" ; ret=1 + echo "I:ns4 $aq4 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -400,7 +451,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking AUTH_RESPONSE message counts" ret=0 [ $ar4 -eq 0 ] || { - echo "ns4 $ar4 expected 0" ; ret=1 + echo "I:ns4 $ar4 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -408,7 +460,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking CLIENT_QUERY message counts" ret=0 [ $cq4 -eq 1 ] || { - echo "ns4 $cq4 expected 1" ; ret=1 + echo "I:ns4 $cq4 expected 1" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -416,7 +469,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking CLIENT_RESPONSE message counts" ret=0 [ $cr4 -eq 1 ] || { - echo "ns4 $cr4 expected 1" ; ret=1 + echo "I:ns4 $cr4 expected 1" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -424,7 +478,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking RESOLVER_QUERY message counts" ret=0 [ $rq4 -eq 0 ] || { - echo "ns4 $rq4 expected 0" ; ret=1 + echo "I:ns4 $rq4 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -432,7 +487,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking RESOLVER_RESPONSE message counts" ret=0 [ $rr4 -eq 0 ] || { - echo "ns4 $rr4 expected 0" ; ret=1 + echo "I:ns4 $rr4 expected 0" + ret=1 } mv dnstap.out dnstap.out.save $FSTRM_CAPTURE -t protobuf:dnstap.Dnstap -u ns4/dnstap.out \ @@ -457,7 +513,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking UDP message counts" ret=0 [ $udp4 -eq 2 ] || { - echo "ns4 $udp4 expected 2" ; ret=1 + echo "I:ns4 $udp4 expected 2" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -465,7 +522,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking TCP message counts" ret=0 [ $tcp4 -eq 0 ] || { - echo "ns4 $tcp4 expected 0" ; ret=1 + echo "I:ns4 $tcp4 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -473,7 +531,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking AUTH_QUERY message counts" ret=0 [ $aq4 -eq 0 ] || { - echo "ns4 $aq4 expected 0" ; ret=1 + echo "I:ns4 $aq4 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -481,7 +540,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking AUTH_RESPONSE message counts" ret=0 [ $ar4 -eq 0 ] || { - echo "ns4 $ar4 expected 0" ; ret=1 + echo "I:ns4 $ar4 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -489,7 +549,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking CLIENT_QUERY message counts" ret=0 [ $cq4 -eq 1 ] || { - echo "ns4 $cq4 expected 1" ; ret=1 + echo "I:ns4 $cq4 expected 1" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -497,7 +558,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking CLIENT_RESPONSE message counts" ret=0 [ $cr4 -eq 1 ] || { - echo "ns4 $cr4 expected 1" ; ret=1 + echo "I:ns4 $cr4 expected 1" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -505,7 +567,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking RESOLVER_QUERY message counts" ret=0 [ $rq4 -eq 0 ] || { - echo "ns4 $rq4 expected 0" ; ret=1 + echo "I:ns4 $rq4 expected 0" + ret=1 } if [ $ret != 0 ]; then echo "I: failed"; fi status=`expr $status + $ret` @@ -513,7 +576,8 @@ if [ -n "$FSTRM_CAPTURE" ] ; then echo "I: checking RESOLVER_RESPONSE message counts" ret=0 [ $rr4 -eq 0 ] || { - echo "ns4 $rr4 expected 0" ; ret=1 + echo "I:ns4 $rr4 expected 0" + ret=1 } fi