]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
cacheclean test: take into account that we can have multiple RRs at one name
authorWitold Kręcicki <wpk@isc.org>
Thu, 5 Jul 2018 12:47:40 +0000 (14:47 +0200)
committerMichał Kępień <michal@isc.org>
Tue, 17 Jul 2018 09:31:09 +0000 (11:31 +0200)
bin/tests/system/cacheclean/tests.sh

index 92e0bf5969faff03e644a0dc3bec56b287ee5d98..7a51ae025cd04d8f5903e5437faa6536b414a1e9 100755 (executable)
@@ -98,8 +98,8 @@ echo_i "reset and check that records are correctly cached initially ($n)"
 ret=0
 load_cache
 dump_cache
-nrecords=`grep flushtest.example ns2/named_dump.db.$n | grep -v '^;' | egrep '(TXT|ANY)'|  wc -l`
-[ $nrecords -eq 17 ] || { ret=1; echo_i "found $nrecords records expected 17"; }
+nrecords=`grep -v '^;' ns2/named_dump.db.$n | perl -nle 'if (/flushtest\.example/ || (/^\t/ && $out)) {$out=1;} else {$out=0;} print if ($out);' | egrep '(TXT|ANY)'|  wc -l`
+[ $nrecords -eq 18 ] || { ret=1; echo_i "found $nrecords records expected 18"; }
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
@@ -108,7 +108,7 @@ echo_i "check flushing of the full cache ($n)"
 ret=0
 clear_cache
 dump_cache
-nrecords=`grep flushtest.example ns2/named_dump.db.$n | grep -v '^;' | wc -l`
+nrecords=`grep -v '^;' ns2/named_dump.db.$n | perl -nle 'if (/flushtest\.example/ || (/^\t/ && $out)) {$out=1;} else {$out=0;} print if ($out);' | wc -l`
 [ $nrecords -eq 0 ] || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
@@ -192,7 +192,7 @@ n=`expr $n + 1`
 echo_i "check the number of cached records remaining ($n)"
 ret=0
 dump_cache
-nrecords=`grep flushtest.example ns2/named_dump.db.$n | grep -v '^;' | egrep '(TXT|ANY)' |  wc -l`
+nrecords=`grep -v '^;' ns2/named_dump.db.$n | perl -nle 'if (/flushtest\.example/ || (/^\t/ && $out)) {$out=1;} else {$out=0;} print if ($out);' | egrep '(TXT|ANY)' |  wc -l`
 [ $nrecords -eq 17 ] || { ret=1; echo_i "found $nrecords records expected 17"; }
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
@@ -210,7 +210,7 @@ n=`expr $n + 1`
 echo_i "check the number of cached records remaining ($n)"
 ret=0
 dump_cache
-nrecords=`grep flushtest.example ns2/named_dump.db.$n | grep -v '^;' | egrep '(TXT|ANY)' |  wc -l`
+nrecords=`grep -v '^;' ns2/named_dump.db.$n | perl -nle 'if (/flushtest\.example/ || (/^\t/ && $out)) {$out=1;} else {$out=0;} print if ($out);' | egrep '(TXT|ANY)' |  wc -l`
 [ $nrecords -eq 1 ] || { ret=1; echo_i "found $nrecords records expected 1"; }
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`