1#!/bin/sh
2#
3# Copyright (C) 2004, 2007, 2012  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.9 2007/09/14 01:46:05 marka Exp
19
20SYSTEMTESTTOP=..
21. $SYSTEMTESTTOP/conf.sh
22
23status=0
24
25echo "I:test 2-element sortlist statement"
26cat <<EOF >test1.good
27a.example.		300	IN	A	192.168.3.1
28a.example.		300	IN	A	192.168.1.1
29a.example.		300	IN	A	1.1.1.5
30a.example.		300	IN	A	1.1.1.1
31a.example.		300	IN	A	1.1.1.3
32a.example.		300	IN	A	1.1.1.2
33a.example.		300	IN	A	1.1.1.4
34EOF
35$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd a.example. \
36	@10.53.0.1 -b 10.53.0.1 -p 5300 >test1.dig
37# Note that this can't use digcomp.pl because here, the ordering of the
38# result RRs is significant.
39diff test1.dig test1.good || status=1
40
41echo "I:test 1-element sortlist statement and undocumented BIND 8 features"
42	cat <<EOF >test2.good
43b.example.		300	IN	A	10.53.0.$n
44EOF
45
46$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd \
47	b.example. @10.53.0.1 -b 10.53.0.2 -p 5300 | sed 1q | \
48        egrep '10.53.0.(2|3)$' > test2.out &&
49$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd \
50	b.example. @10.53.0.1 -b 10.53.0.3 -p 5300 | sed 1q | \
51        egrep '10.53.0.(2|3)$' >> test2.out &&
52$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd \
53	b.example. @10.53.0.1 -b 10.53.0.4 -p 5300 | sed 1q | \
54        egrep '10.53.0.4$' >> test2.out &&
55$DIG +tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd \
56	b.example. @10.53.0.1 -b 10.53.0.5 -p 5300 | sed 1q | \
57        egrep '10.53.0.5$' >> test2.out || status=1
58
59echo "I:exit status: $status"
60exit $status
61