1#!/bin/sh
2#
3# Copyright (C) 2004, 2007, 2011-2013  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.22 2012/02/03 23:46:58 tbox Exp
19
20SYSTEMTESTTOP=..
21. $SYSTEMTESTTOP/conf.sh
22
23status=0
24echo "I:waiting for nameserver to load"
25for i in 0 1 2 3 4 5 6 7 8 9
26do
27	ret=0
28	for zone in . example1 e.example1 example2 10.10.10.in-addr.arpa \
29	    ip6.int ip6.arpa
30	do
31		$DIG +tcp -p 5300 @10.53.0.1 soa $zone > dig.out
32		grep "status: NOERROR" dig.out > /dev/null || ret=1
33		grep "ANSWER: 1," dig.out > /dev/null || ret=1
34	done
35	test $ret = 0 && break
36	sleep 1
37done
38if [ $ret != 0 ]; then echo "I:failed"; fi
39status=`expr $status + $ret`
40
41echo "I:using resolv.conf"
42ret=0
43for i in 0 1 2 3 4 5 6 7 8 9
44do
45	grep ' running$' lwresd1/lwresd.run > /dev/null && break
46	sleep 1
47done
48./lwtest || ret=1
49if [ $ret != 0 ]; then
50	echo "I:failed"
51fi
52status=`expr $status + $ret`
53
54$PERL $SYSTEMTESTTOP/stop.pl . lwresd1
55
56mv lwresd1/lwresd.run lwresd1/lwresd.run.resolv
57
58$PERL $SYSTEMTESTTOP/start.pl . lwresd1 -- "-m record,size,mctx -c lwresd.conf -d 99 -g"
59
60echo "I:using lwresd.conf"
61ret=0
62for i in 0 1 2 3 4 5 6 7 8 9
63do
64	grep ' running$' lwresd1/lwresd.run > /dev/null && break
65	sleep 1
66done
67./lwtest || ret=1
68if [ $ret != 0 ]; then
69	echo "I:failed"
70fi
71status=`expr $status + $ret`
72
73echo "I:exit status: $status"
74exit $status
75