Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / bind / dist / bin / tests / system / xfer / tests.sh
blob6a42428e149f0c74564b38c94504e3b5a320510f
1 #!/bin/sh
3 # Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000, 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: tests.sh,v 1.31 2007/06/19 23:47:07 tbox Exp
20 SYSTEMTESTTOP=..
21 . $SYSTEMTESTTOP/conf.sh
23 DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
25 status=0
27 echo "I:testing basic zone transfer functionality"
28 $DIG $DIGOPTS example. \
29 @10.53.0.2 axfr -p 5300 > dig.out.ns2 || status=1
30 grep ";" dig.out.ns2
33 # Spin to allow the zone to tranfer.
35 for i in 1 2 3 4 5
37 tmp=0
38 $DIG $DIGOPTS example. \
39 @10.53.0.3 axfr -p 5300 > dig.out.ns3 || tmp=1
40 grep ";" dig.out.ns3 > /dev/null
41 if test $? -ne 0 ; then break; fi
42 echo "I: plain zone re-transfer"
43 sleep 5
44 done
45 if test $tmp -eq 1 ; then status=1; fi
46 grep ";" dig.out.ns3
48 $PERL ../digcomp.pl dig1.good dig.out.ns2 || status=1
50 $PERL ../digcomp.pl dig1.good dig.out.ns3 || status=1
52 echo "I:testing TSIG signed zone transfers"
53 $DIG $DIGOPTS tsigzone. \
54 @10.53.0.2 axfr -y tsigzone.:1234abcd8765 -p 5300 \
55 > dig.out.ns2 || status=1
56 grep ";" dig.out.ns2
59 # Spin to allow the zone to tranfer.
61 for i in 1 2 3 4 5
63 tmp=0
64 $DIG $DIGOPTS tsigzone. \
65 @10.53.0.3 axfr -y tsigzone.:1234abcd8765 -p 5300 \
66 > dig.out.ns3 || tmp=1
67 grep ";" dig.out.ns3 > /dev/null
68 if test $? -ne 0 ; then break; fi
69 echo "I: plain zone re-transfer"
70 sleep 5
71 done
72 if test $tmp -eq 1 ; then status=1; fi
73 grep ";" dig.out.ns3
75 $PERL ../digcomp.pl dig.out.ns2 dig.out.ns3 || status=1
77 echo "I:testing ixfr-from-differences"
79 $PERL -i -p -e '
80 s/0\.0\.0\.0/0.0.0.1/;
81 s/1397051952/1397051953/
82 ' ns2/example.db
84 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
86 sleep 5
88 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload 2>&1 | sed 's/^/I:ns3 /'
90 sleep 5
92 $DIG $DIGOPTS example. \
93 @10.53.0.3 axfr -p 5300 > dig.out.ns3 || status=1
94 grep ";" dig.out.ns3
96 $PERL ../digcomp.pl dig2.good dig.out.ns3 || status=1
98 # ns3 has a journal iff it received an IXFR.
99 test -f ns3/example.bk.jnl || status=1
101 echo "I:exit status: $status"
102 exit $status