tests.sh 2.73 KB
Newer Older
1 2
#!/bin/sh
#
3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
Mark Andrews's avatar
Mark Andrews committed
4
#
5 6 7
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 9 10
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
11

12
. ../conf.sh
13 14 15 16 17 18

status=0
n=0

rm -f dig.out.*

Evan Hunt's avatar
Evan Hunt committed
19
DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p ${PORT}"
20 21 22

# Check the example.com. domain

Evan Hunt's avatar
Evan Hunt committed
23
echo_i "checking DNAME at apex works ($n)"
24 25 26 27 28 29
ret=0
$DIG $DIGOPTS +norec foo.example.com. \
	@10.53.0.1 a > dig.out.ns1.test$n || ret=1
grep "status: NOERROR" dig.out.ns1.test$n > /dev/null || ret=1
grep "example.com..*DNAME.*example.net." dig.out.ns1.test$n > /dev/null || ret=1
grep "foo.example.com..*CNAME.*foo.example.net." dig.out.ns1.test$n > /dev/null || ret=1
30
grep "flags:[^;]* aa[ ;]" dig.out.ns1.test$n > /dev/null || ret=1
31
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
32
if [ $ret != 0 ]; then echo_i "failed"; fi
33 34
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
35
echo_i "checking DLZ IXFR=2010062899 (less than serial) ($n)"
36 37 38 39 40 41
ret=0
$DIG $DIGOPTS ixfr=2010062899 example.com @10.53.0.1 +all > dig.out.ns1.test$n 
grep "example.com..*IN.IXFR" dig.out.ns1.test$n > /dev/null || ret=1
grep "example.com..*10.IN.DNAME.example.net." dig.out.ns1.test$n > /dev/null || ret=1
grep "example.com..*10.IN.NS.example.com." dig.out.ns1.test$n > /dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
42
if [ $ret != 0 ]; then echo_i "failed"; fi
43 44
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
45
echo_i "checking DLZ IXFR=2010062900 (equal serial) ($n)"
46 47 48 49 50 51
ret=0
$DIG $DIGOPTS ixfr=2010062900 example.com @10.53.0.1 +all > dig.out.ns1.test$n
grep "example.com..*IN.IXFR" dig.out.ns1.test$n > /dev/null || ret=1
grep "example.com..*10.IN.DNAME.example.net." dig.out.ns1.test$n > /dev/null && ret=1
grep "example.com..*10.IN.NS.example.com." dig.out.ns1.test$n > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
52
if [ $ret != 0 ]; then echo_i "failed"; fi
53 54
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
55
echo_i "checking DLZ IXFR=2010062901 (greater than serial) ($n)"
56 57 58 59 60 61
ret=0
$DIG $DIGOPTS ixfr=2010062901 example.com @10.53.0.1 +all > dig.out.ns1.test$n
grep "example.com..*IN.IXFR" dig.out.ns1.test$n > /dev/null || ret=1
grep "example.com..*10.IN.DNAME.example.net." dig.out.ns1.test$n > /dev/null && ret=1
grep "example.com..*10.IN.NS.example.com." dig.out.ns1.test$n > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
62
if [ $ret != 0 ]; then echo_i "failed"; fi
63 64
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
65
echo_i "checking DLZ with a malformed SOA record"
66 67 68 69
ret=0
$DIG $DIGOPTS broken.com type600 @10.53.0.1 > dig.out.ns1.test$n
grep status: dig.out.ns1.test$n > /dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
70
if [ $ret != 0 ]; then echo_i "failed"; fi
71 72
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
73
echo_i "exit status: $status"
74
[ $status -eq 0 ] || exit 1