1#!/bin/sh
2#
3# Copyright (C) 2004, 2007  Internet Systems Consortium, Inc. ("ISC")
4# Copyright (C) 2000, 2001  Internet Software Consortium.
5#
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.
9#
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.
17
18# $Id: tests.sh,v 1.6 2007/06/19 23:47:01 tbox Exp $
19
20SYSTEMTESTTOP=..
21. $SYSTEMTESTTOP/conf.sh
22
23status=0
24
25rm -f dig.out.*
26
27DIGOPTS="+norec +tcp +noadd +nosea +nostat +noquest +nocmd -p 5300"
28
29# Check the example. domain
30
31$DIG $DIGOPTS example. @10.53.0.1 soa > dig.out.ns1.test || ret=1
32echo "I:checking that first zone transfer worked"
33ret=0
34try=0
35while test $try -lt 120
36do
37	$DIG $DIGOPTS example. @10.53.0.2 soa > dig.out.ns2.test || ret=1
38	if grep SERVFAIL dig.out.ns2.test > /dev/null
39	then
40		try=`expr $try + 1`
41		sleep 1
42	else
43		$PERL ../digcomp.pl dig.out.ns1.test dig.out.ns2.test || ret=1
44		break;
45	fi
46done
47echo "I:try $try"
48if [ $ret != 0 ]; then echo "I:failed"; fi
49status=`expr $status + $ret`
50
51echo "I:checking that second zone transfer worked"
52ret=0
53try=0
54while test $try -lt 120
55do
56	$DIG $DIGOPTS example. @10.53.0.3 soa > dig.out.ns3.test || ret=1
57	if grep SERVFAIL dig.out.ns3.test > /dev/null
58	then
59		try=`expr $try + 1`
60		sleep 1
61	else
62		$PERL ../digcomp.pl dig.out.ns1.test dig.out.ns3.test || ret=1
63		break;
64	fi
65done
66echo "I:try $try"
67if [ $ret != 0 ]; then echo "I:failed"; fi
68status=`expr $status + $ret`
69
70echo "I:exit status: $status"
71exit $status
72