📄 tests.sh
字号:
#!/bin/sh## Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")# Copyright (C) 2000, 2001 Internet Software Consortium.## Permission to use, copy, modify, and distribute this software for any# purpose with or without fee is hereby granted, provided that the above# copyright notice and this permission notice appear in all copies.## THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR# PERFORMANCE OF THIS SOFTWARE.# $Id: tests.sh,v 1.22.206.1 2004/03/06 10:22:18 marka Exp $SYSTEMTESTTOP=... $SYSTEMTESTTOP/conf.shstatus=0echo "I:fetching first copy of zone before update"$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1echo "I:fetching second copy of zone before update"$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ @10.53.0.1 axfr -p 5300 > dig.out.ns2 || status=1echo "I:comparing pre-update copies to known good data"$PERL ../digcomp.pl knowngood.ns1.before dig.out.ns1 || status=1$PERL ../digcomp.pl knowngood.ns1.before dig.out.ns2 || status=1echo "I:updating zone"# nsupdate will print a ">" prompt to stdout as it gets each input line.$NSUPDATE <<END > /dev/null || status=1server 10.53.0.1 5300update add updated.example.nil. 600 A 10.10.10.1update add updated.example.nil. 600 TXT Fooupdate delete t.example.nil.ENDecho "I:sleeping 15 seconds for server to incorporate changes"sleep 15echo "I:fetching first copy of zone after update"$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1echo "I:fetching second copy of zone after update"$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ @10.53.0.2 axfr -p 5300 > dig.out.ns2 || status=1echo "I:comparing post-update copies to known good data"$PERL ../digcomp.pl knowngood.ns1.after dig.out.ns1 || status=1$PERL ../digcomp.pl knowngood.ns1.after dig.out.ns2 || status=1if $PERL -e 'use Net::DNS;' 2>/dev/nullthen echo "I:running update.pl test" $PERL update_test.pl -s 10.53.0.1 -p 5300 update.nil. || status=1else echo "I:The second part of this test requires the Net::DNS library." >&2fiecho "I:fetching first copy of test zone"$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ @10.53.0.1 axfr -p 5300 > dig.out.ns1 || status=1echo "I:fetching second copy of test zone"$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ @10.53.0.2 axfr -p 5300 > dig.out.ns2 || status=1echo "I:comparing zones"$PERL ../digcomp.pl dig.out.ns1 dig.out.ns2 || status=1echo "I:SIGKILL and restart server ns1"cd ns1kill -KILL `cat named.pid`rm named.pidcd ..sleep 10if $PERL $SYSTEMTESTTOP/start.pl --noclean . ns1then echo "I:restarted server ns1" else echo "I:could not restart server ns1" exit 1fisleep 10echo "I:fetching ns1 after hard restart"$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd example.nil.\ @10.53.0.1 axfr -p 5300 > dig.out.ns1.after || status=1echo "I:comparing zones"$PERL ../digcomp.pl dig.out.ns1 dig.out.ns1.after || status=1echo "I:begin RT #482 regression test"echo "I:update master"$NSUPDATE <<END > /dev/null || status=1server 10.53.0.1 5300update add updated2.example.nil. 600 A 10.10.10.2update add updated2.example.nil. 600 TXT Barupdate delete c.example.nil.sendENDsleep 5echo "I:SIGHUP slave"kill -HUP `cat ns2/named.pid`sleep 5echo "I:update master again"$NSUPDATE <<END > /dev/null || status=1server 10.53.0.1 5300update add updated3.example.nil. 600 A 10.10.10.3update add updated3.example.nil. 600 TXT Zapupdate delete d.example.nil.sendENDsleep 5echo "I:SIGHUP slave again"kill -HUP `cat ns2/named.pid`sleep 5if grep "out of sync" ns2/named.runthen status=1fiecho "I:end RT #482 regression test"echo "I:testing that rndc stop updates the master file"$NSUPDATE <<END > /dev/null || status=1server 10.53.0.1 5300update add updated4.example.nil. 600 A 10.10.10.3sendEND$PERL $SYSTEMTESTTOP/stop.pl --use-rndc . ns1# Removing the journal file and restarting the server means# that the data served by the new server process are exactly# those dumped to the master file by "rndc stop".rm -f ns1/*jnl$PERL $SYSTEMTESTTOP/start.pl --noclean . ns1$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd updated4.example.nil.\ @10.53.0.1 a -p 5300 > dig.out.ns1 || status=1$PERL ../digcomp.pl knowngood.ns1.afterstop dig.out.ns1 || status=1echo "I:exit status: $status"exit $status
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -