tests.sh revision 5a75f61dd413720c16d229b24ebba6bd6ecdb738
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# Copyright (C) 2004, 2007, 2011 Internet Systems Consortium, Inc. ("ISC")
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# Copyright (C) 2001 Internet Software Consortium.
8b7304a34c751e519ede7d00b77f1f962c0a37e4David Lawrence# Permission to use, copy, modify, and/or distribute this software for any
8b7304a34c751e519ede7d00b77f1f962c0a37e4David Lawrence# purpose with or without fee is hereby granted, provided that the above
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
8b7304a34c751e519ede7d00b77f1f962c0a37e4David Lawrence# PERFORMANCE OF THIS SOFTWARE.
754cb8a2b33fa6cfaa15d6470f66e5fb0eab4764Automatic Updater# $Id: tests.sh,v 1.8 2011/08/23 00:59:23 each Exp $
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny MayerRNDCOPTS="-c ../common/rndc.conf -s 10.53.0.2 -p 9953"
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny MayerDIGOPTS="+nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm \
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer +nostat @10.53.0.2 -p 5300"
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer# fill the cache with nodes from flushtest.example zone
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt top1.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second1.top1.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt third1.second1.top1.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt third2.second1.top1.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second2.top1.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second3.top1.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second1.top2.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second2.top2.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second3.top2.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt top3.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second1.top3.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt third1.second1.top3.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt third2.second1.top3.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt third1.second2.top3.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt third2.second2.top3.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second3.top3.flushtest.example > /dev/null 2>1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS a third1.second1.top1.flushtest.example > /dev/null
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt top4.flushtest.example > /dev/null
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer $DIG $DIGOPTS txt second2.top3.flushtest.example > /dev/null
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer # sleep one second ensure the TTLs will be lower on cached data
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer ttl=`$DIG $DIGOPTS +noanswer +auth "$@" | awk '{print $2}'`
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerecho "I:check correctness of routine cache cleaning"
68c2ccc953059f389cefc0f8a5ce0f83be7458c9Danny Mayer$DIG $DIGOPTS -f dig.batch > dig.out.ns2 || status=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer$PERL ../digcomp.pl dig.out.ns2 knowngood.dig.out || status=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerecho "I:reset and check that records are correctly cached initially"
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayernrecords=`grep flushtest.example ns2/named_dump.db | grep -v '^;' | wc -l`
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerecho "I:check flushing of the full cache"
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayernrecords=`grep flushtest.example ns2/named_dump.db | grep -v '^;' | wc -l`
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerecho "I:check flushing of individual nodes"
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer# interior node
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer# leaf node, under the interior node (should still exist)
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt third2.second1.top1.flushtest.example || ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer$RNDC $RNDCOPTS flushname third2.second1.top1.flushtest.example
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt third2.second1.top1.flushtest.example && ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer# another leaf node, with both positive and negative cache entries
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache a third1.second1.top1.flushtest.example || ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt third1.second1.top1.flushtest.example || ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer$RNDC $RNDCOPTS flushname third1.second1.top1.flushtest.example
bb48ac4f813537a060579615a52f9c7963f5e3c4Danny Mayerin_cache a third1.second1.top1.flushtest.example && ret=1
bb48ac4f813537a060579615a52f9c7963f5e3c4Danny Mayerin_cache txt third1.second1.top1.flushtest.example && ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerecho "I:check flushing a nonexistent name"
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer$RNDC $RNDCOPTS flushname fake.flushtest.example || ret=1
e76d4c91bfadf823f04dcca1c1c5bcc14c67671dAndreas Gustafssonecho "I:check flushing of namespaces"
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer# flushing leaf node should leave the interior node:
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt third1.second1.top1.flushtest.example || ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer$RNDC $RNDCOPTS flushtree third1.second1.top1.flushtest.example
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt third1.second1.top1.flushtest.example && ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt second1.top1.flushtest.example || ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt third2.second1.top1.flushtest.example || ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer$RNDC $RNDCOPTS flushtree second1.top1.flushtest.example
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt second1.top1.flushtest.example && ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt third2.second1.top1.flushtest.example && ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer# flushing from an empty node should still remove all its children
68c2ccc953059f389cefc0f8a5ce0f83be7458c9Danny Mayerin_cache txt second1.top2.flushtest.example || ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt second1.top2.flushtest.example && ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt second2.top2.flushtest.example && ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerin_cache txt second3.top2.flushtest.example && ret=1
68c2ccc953059f389cefc0f8a5ce0f83be7458c9Danny Mayerecho "I:check flushing a nonexistent namespace"
68c2ccc953059f389cefc0f8a5ce0f83be7458c9Danny Mayer$RNDC $RNDCOPTS flushtree fake.flushtest.example || ret=1
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerecho "I:check the number of cached records remaining"
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayernrecords=`grep flushtest.example ns2/named_dump.db | grep -v '^;' | wc -l`
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerecho "I:exit status: $status"