]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Update nsupdate test
authorMatthijs Mekking <matthijs@isc.org>
Fri, 30 Apr 2021 09:03:46 +0000 (11:03 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Fri, 30 Apr 2021 12:30:51 +0000 (14:30 +0200)
The nsupdate system test did not record failures from the
'update_test.pl' Perl script. This was because the 'ret' value was
not being saved outside the '{ $PERL ... || ret=1 } cat_i' scope.

Change this piece to store the output in a separate file and then
cat its contents. Now the 'ret' value is being saved.

Also record failures in 'update_test.pl' if sending the update
failed.

Add missing 'n' incrementals to 'nsupdate/test.sh' to keep track of
test numbers.

(cherry picked from commit 5b31811b5f15c7677a3f1a65b8dcc23d4a55f3d4)

bin/tests/system/nsupdate/clean.sh
bin/tests/system/nsupdate/tests.sh
bin/tests/system/nsupdate/update_test.pl

index 26591ec6a2eca56b798c5f46bd2e6095d86f8242..04124d659a838014dc0448d75378c997283efc0b 100644 (file)
@@ -57,6 +57,7 @@ rm -f ns9/_default.tsigkeys
 rm -f ns9/denyname.example.db
 rm -f ns9/example.com.db
 rm -f ns9/in-addr.db
+rm -f perl.update_test.out
 rm -f nsupdate.out*
 rm -f typelist.out.*
 rm -f update.out.*
index 1d49a63de809ff203dbb7da0187c2c0e36c6bc3d..60cf7ee9ab8a1582b8b4b370ffe6f7ca28b36f3e 100755 (executable)
@@ -302,36 +302,43 @@ elif [ "$serial" -gt "$now" ]; then
 fi
 [ $ret = 0 ] || { echo_i "failed"; status=1; }
 
-ret=0
 if $PERL -e 'use Net::DNS;' 2>/dev/null
 then
-    echo_i "running update.pl test"
-    {
-      $PERL update_test.pl -s 10.53.0.1 -p ${PORT} update.nil. || ret=1
-    } | cat_i
+    n=`expr $n + 1`
+    ret=0
+    echo_i "running update.pl test ($n)"
+    $PERL update_test.pl -s 10.53.0.1 -p ${PORT} update.nil. > perl.update_test.out || ret=1
+    [ $ret -eq 1 ] && { echo_i "failed"; status=1; }
+
     if $PERL -e 'use Net::DNS; die "Net::DNS too old ($Net::DNS::VERSION < 1.01)" if ($Net::DNS::VERSION < 1.01)' > /dev/null
     then
-        grep "updating zone 'update.nil/IN': too many NSEC3 iterations (151)" ns1/named.run > /dev/null || ret=1
+       n=`expr $n + 1`
+       ret=0
+       echo_i "check for too many NSEC3 iterations log ($n)"
+       grep "updating zone 'update.nil/IN': too many NSEC3 iterations (151)" ns1/named.run > /dev/null || ret=1
+       [ $ret -eq 1 ] && { echo_i "failed"; status=1; }
     fi
-    [ $ret -eq 1 ] && { echo_i "failed"; status=1; }
 else
     echo_i "The second part of this test requires the Net::DNS library." >&2
 fi
 
+n=`expr $n + 1`
 ret=0
-echo_i "fetching first copy of test zone"
+echo_i "fetching first copy of test zone ($n)"
 $DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
        @10.53.0.1 axfr > dig.out.ns1 || ret=1
 [ $ret = 0 ] || { echo_i "failed"; status=1; }
 
+n=`expr $n + 1`
 ret=0
-echo_i "fetching second copy of test zone"
+echo_i "fetching second copy of test zone ($n)"
 $DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
        @10.53.0.2 axfr > dig.out.ns2 || ret=1
 [ $ret = 0 ] || { echo_i "failed"; status=1; }
 
+n=`expr $n + 1`
 ret=0
-echo_i "comparing zones"
+echo_i "comparing zones ($n)"
 digcomp dig.out.ns1 dig.out.ns2 || ret=1
 [ $ret = 0 ] || { echo_i "failed"; status=1; }
 
@@ -351,21 +358,24 @@ else
 fi
 sleep 10
 
+n=`expr $n + 1`
 ret=0
-echo_i "fetching ns1 after hard restart"
+echo_i "fetching ns1 after hard restart ($n)"
 $DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
        @10.53.0.1 axfr > dig.out.ns1.after || ret=1
 [ $ret = 0 ] || { echo_i "failed"; status=1; }
 
+n=`expr $n + 1`
 ret=0
-echo_i "comparing zones"
+echo_i "comparing zones ($n)"
 digcomp dig.out.ns1 dig.out.ns1.after || ret=1
 [ $ret = 0 ] || { echo_i "failed"; status=1; }
 
 echo_i "begin RT #482 regression test"
 
+n=`expr $n + 1`
 ret=0
-echo_i "update master"
+echo_i "update master ($n)"
 $NSUPDATE -k ns1/ddns.key <<END > /dev/null || ret=1
 server 10.53.0.1 ${PORT}
 update add updated2.example.nil. 600 A 10.10.10.2
@@ -387,8 +397,9 @@ fi
 
 sleep 5
 
+n=`expr $n + 1`
 ret=0
-echo_i "update master again"
+echo_i "update master again ($n)"
 $NSUPDATE -k ns1/ddns.key <<END > /dev/null || ret=1
 server 10.53.0.1 ${PORT}
 update add updated3.example.nil. 600 A 10.10.10.3
@@ -410,7 +421,8 @@ fi
 
 sleep 5
 
-echo_i "check to 'out of sync' message"
+n=`expr $n + 1`
+echo_i "check to 'out of sync' message ($n)"
 if grep "out of sync" ns2/named.run
 then
        echo_i "failed (found 'out of sync')"
index 720a6b89ff588f061ac5dd15750f04f25957a0c8..987c2107631db022b4a204d23b50c7cba44ef199 100644 (file)
@@ -58,7 +58,7 @@ sub assert {
     my ($cond, $explanation) = @_;
     if (!$cond) {
        print "Test Failed: $explanation ***\n";
-       $failures++
+       $failures++;
     }
 }
 
@@ -79,6 +79,7 @@ sub test {
         assert($rcode eq $expected, "expected $expected, got $rcode");
     } else {
        print "Update failed: ", $res->errorstring, "\n";
+       $failures++;
     }
 }