diff --git a/bin/tests/system/cacheclean/clean.sh b/bin/tests/system/cacheclean/clean.sh index 2a17346393..39396277ed 100644 --- a/bin/tests/system/cacheclean/clean.sh +++ b/bin/tests/system/cacheclean/clean.sh @@ -16,5 +16,5 @@ rm -f dig.out.ns2 rm -f dig.out.expire rm -f */named.memstats rm -f */named.run -rm -f ns2/named_dump.db +rm -f ns2/named_dump.db.* rm -f ns*/named.lock diff --git a/bin/tests/system/cacheclean/tests.sh b/bin/tests/system/cacheclean/tests.sh index 2c6f2ccac2..56f96e667c 100644 --- a/bin/tests/system/cacheclean/tests.sh +++ b/bin/tests/system/cacheclean/tests.sh @@ -12,6 +12,7 @@ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 +n=0 RNDCOPTS="-c ../common/rndc.conf -s 10.53.0.2 -p 9953" DIGOPTS="+nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm \ @@ -55,9 +56,13 @@ EOF } dump_cache () { - rm -f ns2/named_dump.db $RNDC $RNDCOPTS dumpdb -cache _default - sleep 1 + for i in 0 1 2 3 4 5 6 7 8 9 + do + grep '^; Dump complete$' ns2/named_dump.db > /dev/null && break + sleep 1 + done + mv ns2/named_dump.db ns2/named_dump.db.$n } clear_cache () { @@ -75,36 +80,41 @@ in_cache () { return 0 } -echo "I:check correctness of routine cache cleaning" +n=`expr $n + 1` +echo "I:check correctness of routine cache cleaning ($n)" $DIG $DIGOPTS +tcp +keepopen -b 10.53.0.7 -f dig.batch > dig.out.ns2 || status=1 grep ";" dig.out.ns2 $PERL ../digcomp.pl --lc dig.out.ns2 knowngood.dig.out || status=1 -echo "I:only one tcp socket was used" +n=`expr $n + 1` +echo "I:only one tcp socket was used ($n)" tcpclients=`awk '$3 == "client" && $5 ~ /10.53.0.7#[0-9]*:/ {print $5}' ns2/named.run | sort | uniq -c | wc -l` test $tcpclients -eq 1 || { status=1; echo "I:failed"; } -echo "I:reset and check that records are correctly cached initially" +n=`expr $n + 1` +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 | grep -v '^;' | egrep '(TXT|ANY)'| wc -l` +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"; } if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check flushing of the full cache" +n=`expr $n + 1` +echo "I:check flushing of the full cache ($n)" ret=0 clear_cache dump_cache -nrecords=`grep flushtest.example ns2/named_dump.db | grep -v '^;' | wc -l` +nrecords=`grep flushtest.example ns2/named_dump.db.$n | grep -v '^;' | wc -l` [ $nrecords -eq 0 ] || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check flushing of individual nodes (interior node)" +n=`expr $n + 1` +echo "I:check flushing of individual nodes (interior node) ($n)" ret=0 clear_cache load_cache @@ -115,7 +125,8 @@ in_cache txt top1.flushtest.example && ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check flushing of individual nodes (leaf node, under the interior node)" +n=`expr $n + 1` +echo "I:check flushing of individual nodes (leaf node, under the interior node) ($n)" ret=0 # leaf node, under the interior node (should still exist) in_cache txt third2.second1.top1.flushtest.example || ret=1 @@ -124,7 +135,8 @@ in_cache txt third2.second1.top1.flushtest.example && ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check flushing of individual nodes (another leaf node, with both positive and negative cache entries)" +n=`expr $n + 1` +echo "I:check flushing of individual nodes (another leaf node, with both positive and negative cache entries) ($n)" ret=0 # another leaf node, with both positive and negative cache entries in_cache a third1.second1.top1.flushtest.example || ret=1 @@ -135,13 +147,15 @@ in_cache txt third1.second1.top1.flushtest.example && ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check flushing a nonexistent name" +n=`expr $n + 1` +echo "I:check flushing a nonexistent name ($n)" ret=0 $RNDC $RNDCOPTS flushname fake.flushtest.example || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check flushing of namespaces" +n=`expr $n + 1` +echo "I:check flushing of namespaces ($n)" ret=0 clear_cache load_cache @@ -167,21 +181,24 @@ in_cache txt second3.top2.flushtest.example && ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check flushing a nonexistent namespace" +n=`expr $n + 1` +echo "I:check flushing a nonexistent namespace ($n)" ret=0 $RNDC $RNDCOPTS flushtree fake.flushtest.example || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check the number of cached records remaining" +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 | grep -v '^;' | egrep '(TXT|ANY)' | wc -l` +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"; } if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check the check that flushname of a partial match works." +n=`expr $n + 1` +echo "I:check the check that flushname of a partial match works ($n)" ret=0 in_cache txt second2.top1.flushtest.example || ret=1 $RNDC $RNDCOPTS flushtree example @@ -189,33 +206,39 @@ in_cache txt second2.top1.flushtest.example && ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check the number of cached records remaining" +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 | grep -v '^;' | egrep '(TXT|ANY)' | wc -l` +nrecords=`grep flushtest.example ns2/named_dump.db.$n | grep -v '^;' | 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` -echo "I:check flushtree clears adb correctly" +n=`expr $n + 1` +echo "I:check flushtree clears adb correctly ($n)" ret=0 load_cache dump_cache -awk '/plain success\/timeout/ {getline; getline; if ($2 == "ns.flushtest.example") exit(0); exit(1); }' ns2/named_dump.db || ret=1 +mv ns2/named_dump.db.$n ns2/named_dump.db.$n.a +sed -n '/plain success\/timeout/,/Unassociated entries/p' ns2/named_dump.db.$n.a | grep 'ns.flushtest.example' > /dev/null 2>&1 || ret=1 $RNDC $RNDCOPTS flushtree flushtest.example || ret=1 dump_cache -awk '/plain success\/timeout/ {getline; getline; if ($2 == "ns.flushtest.example") exit(1); exit(0); }' ns2/named_dump.db || ret=1 +mv ns2/named_dump.db.$n ns2/named_dump.db.$n.b +sed -n '/plain success\/timeout/,/Unassociated entries/p' ns2/named_dump.db.$n.b | grep 'ns.flushtest.example' > /dev/null 2>&1 && ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check expire option returned from master zone" +n=`expr $n + 1` +echo "I:check expire option returned from master zone ($n)" ret=0 $DIG @10.53.0.1 -p 5300 +expire soa expire-test > dig.out.expire grep EXPIRE: dig.out.expire > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:check expire option returned from slave zone" +n=`expr $n + 1` +echo "I:check expire option returned from slave zone ($n)" ret=0 $DIG @10.53.0.2 -p 5300 +expire soa expire-test > dig.out.expire grep EXPIRE: dig.out.expire > /dev/null || ret=1