tests.sh revision dafcb997e390efa4423883dafd100c975c4095d6
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#!/bin/sh
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
499b34cea04a46823d003d4c0520c8b03e8513cbBrian Wellington# Copyright (C) 2000, 2001 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence#
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer# Permission to use, copy, modify, and distribute this software for any
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer# purpose with or without fee is hereby granted, provided that the above
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer# copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence#
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
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# PERFORMANCE OF THIS SOFTWARE.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# $Id: tests.sh,v 1.23 2004/03/05 05:01:55 marka Exp $
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c3c6770e537ea916265c78d0294ad108233e17c1Michael SawyerSYSTEMTESTTOP=..
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer. $SYSTEMTESTTOP/conf.sh
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyerstatus=0
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrenceecho "I:fetching first copy of zone before update"
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrenceecho "I:fetching second copy of zone before update"
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer @10.53.0.1 axfr -p 5300 > dig.out.ns2 || status=1
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrenceecho "I:comparing pre-update copies to known good data"
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer$PERL ../digcomp.pl knowngood.ns1.before dig.out.ns1 || status=1
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer$PERL ../digcomp.pl knowngood.ns1.before dig.out.ns2 || status=1
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrenceecho "I:updating zone"
fdebae839745f79a7550aeb49d15a930523ec483David Lawrence# nsupdate will print a ">" prompt to stdout as it gets each input line.
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafsson$NSUPDATE <<END > /dev/null || status=1
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafssonserver 10.53.0.1 5300
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafssonupdate add updated.example.nil. 600 A 10.10.10.1
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafssonupdate add updated.example.nil. 600 TXT Foo
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafssonupdate delete t.example.nil.
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafsson
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas GustafssonEND
fdebae839745f79a7550aeb49d15a930523ec483David Lawrenceecho "I:sleeping 15 seconds for server to incorporate changes"
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyersleep 15
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrenceecho "I:fetching first copy of zone after update"
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrenceecho "I:fetching second copy of zone after update"
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
2de413d956c9f065958aaeebf5cd3a420e55939cMichael Sawyer @10.53.0.2 axfr -p 5300 > dig.out.ns2 || status=1
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrenceecho "I:comparing post-update copies to known good data"
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer$PERL ../digcomp.pl knowngood.ns1.after dig.out.ns1 || status=1
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer$PERL ../digcomp.pl knowngood.ns1.after dig.out.ns2 || status=1
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyerif $PERL -e 'use Net::DNS;' 2>/dev/null
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyerthen
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer echo "I:running update.pl test"
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer $PERL update_test.pl -s 10.53.0.1 -p 5300 update.nil. || status=1
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyerelse
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer echo "I:The second part of this test requires the Net::DNS library." >&2
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyerfi
c5272fb3303425f794dab68f734f6a2a45dce01eMichael Sawyer
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyerecho "I:fetching first copy of test zone"
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyerecho "I:fetching second copy of test zone"
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
2de413d956c9f065958aaeebf5cd3a420e55939cMichael Sawyer @10.53.0.2 axfr -p 5300 > dig.out.ns2 || status=1
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyerecho "I:comparing zones"
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer$PERL ../digcomp.pl dig.out.ns1 dig.out.ns2 || status=1
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyerecho "I:SIGKILL and restart server ns1"
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafssoncd ns1
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafssonkill -KILL `cat named.pid`
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafssonrm named.pid
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafssoncd ..
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafssonsleep 10
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafssonif
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson $PERL $SYSTEMTESTTOP/start.pl --noclean . ns1
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafssonthen
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson echo "I:restarted server ns1"
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafssonelse
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson echo "I:could not restart server ns1"
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafsson exit 1
3ad7f12f7439471a0922ed3952221e93aef9db69Andreas Gustafssonfi
0759eb6a0dab024873df528b0ffad804ea31615dMichael Sawyersleep 10
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyerecho "I:fetching ns1 after hard restart"
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer @10.53.0.1 axfr -p 5300 > dig.out.ns1.after || status=1
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyerecho "I:comparing zones"
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer$PERL ../digcomp.pl dig.out.ns1 dig.out.ns1.after || status=1
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonecho "I:begin RT #482 regression test"
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonecho "I:update master"
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson$NSUPDATE <<END > /dev/null || status=1
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonserver 10.53.0.1 5300
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonupdate add updated2.example.nil. 600 A 10.10.10.2
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonupdate add updated2.example.nil. 600 TXT Bar
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonupdate delete c.example.nil.
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonsend
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas GustafssonEND
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonsleep 5
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonecho "I:SIGHUP slave"
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonkill -HUP `cat ns2/named.pid`
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonsleep 5
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonecho "I:update master again"
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson$NSUPDATE <<END > /dev/null || status=1
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonserver 10.53.0.1 5300
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonupdate add updated3.example.nil. 600 A 10.10.10.3
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonupdate add updated3.example.nil. 600 TXT Zap
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonupdate delete d.example.nil.
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonsend
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas GustafssonEND
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonsleep 5
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonecho "I:SIGHUP slave again"
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonkill -HUP `cat ns2/named.pid`
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonsleep 5
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonif grep "out of sync" ns2/named.run
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonthen
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson status=1
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonfi
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonecho "I:end RT #482 regression test"
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellingtonecho "I:testing that rndc stop updates the master file"
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellington$NSUPDATE <<END > /dev/null || status=1
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellingtonserver 10.53.0.1 5300
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellingtonupdate add updated4.example.nil. 600 A 10.10.10.3
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellingtonsend
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian WellingtonEND
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellington$PERL $SYSTEMTESTTOP/stop.pl --use-rndc . ns1
f0a1134d331b2aa871306c73d2787960918eaab1Andreas Gustafsson# Removing the journal file and restarting the server means
f0a1134d331b2aa871306c73d2787960918eaab1Andreas Gustafsson# that the data served by the new server process are exactly
f0a1134d331b2aa871306c73d2787960918eaab1Andreas Gustafsson# those dumped to the master file by "rndc stop".
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellingtonrm -f ns1/*jnl
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellington$PERL $SYSTEMTESTTOP/start.pl --noclean . ns1
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellington$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd updated4.example.nil.\
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellington @10.53.0.1 a -p 5300 > dig.out.ns1 || status=1
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellington$PERL ../digcomp.pl knowngood.ns1.afterstop dig.out.ns1 || status=1
e2f470bebb3a0c107bc4ac86c6920c21e50e83e0Brian Wellington
1e8c2e72e7d0f48ac37b9b15712e638631b3b619Brian Wellingtonecho "I:exit status: $status"
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyerexit $status