tests.sh 5.59 KB
Newer Older
1 2
#!/bin/sh
#
3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
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

Evan Hunt's avatar
Evan Hunt committed
14 15
DIGOPTS="-p ${PORT}"

16 17 18
status=0
n=1

Evan Hunt's avatar
Evan Hunt committed
19
echo_i "check that 'check-integrity yes; check-mx-cname fail;' works ($n)"
20
ret=0
Evan Hunt's avatar
Evan Hunt committed
21
$DIG $DIGOPTS @10.53.0.1 mx mx-cname-fail > dig.out.test$n || ret=1
22 23 24
grep "status: SERVFAIL," dig.out.test$n > /dev/null || ret=1
grep "zone mx-cname-fail/IN: mx-cname-fail/MX 'cname.mx-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
25
if [ $ret != 0 ]; then echo_i "failed"; fi
26 27
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
28
echo_i "check that 'check-integrity yes; check-mx-cname warn;' works ($n)"
29
ret=0
Evan Hunt's avatar
Evan Hunt committed
30
$DIG $DIGOPTS @10.53.0.1 mx mx-cname-warn > dig.out.test$n || ret=1
31 32 33
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone mx-cname-warn/IN: mx-cname-warn/MX 'cname.mx-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
34
if [ $ret != 0 ]; then echo_i "failed"; fi
35 36
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
37
echo_i "check that 'check-integrity yes; check-mx-cname ignore;' works ($n)"
38
ret=0
Evan Hunt's avatar
Evan Hunt committed
39
$DIG $DIGOPTS @10.53.0.1 mx mx-cname-ignore > dig.out.test$n || ret=1
40 41 42
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone mx-cname-ignore/IN: mx-cname-ignore/MX 'cname.mx-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
43
if [ $ret != 0 ]; then echo_i "failed"; fi
44 45
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
46
echo_i "check that 'check-integrity no; check-mx-cname fail;' works ($n)"
47
ret=0
Evan Hunt's avatar
Evan Hunt committed
48
$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-fail > dig.out.test$n || ret=1
49 50 51
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone no-mx-cname-fail/IN: no-mx-cname-fail/MX 'cname.no-mx-cname-fail' is a CNAME (illegal)" ns1/named.run > /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 "check that 'check-integrity no; check-mx-cname warn;' works ($n)"
56
ret=0
Evan Hunt's avatar
Evan Hunt committed
57
$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-warn > dig.out.test$n || ret=1
58 59 60
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone no-mx-cname-warn/IN: no-mx-cname-warn/MX 'cname.no-mx-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
61
if [ $ret != 0 ]; then echo_i "failed"; fi
62 63
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
64
echo_i "check that 'check-integrity no; check-mx-cname ignore;' works ($n)"
65
ret=0
Evan Hunt's avatar
Evan Hunt committed
66
$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-ignore > dig.out.test$n || ret=1
67 68 69
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone no-mx-cname-ignore/IN: no-mx-cname-ignore/MX 'cname.no-mx-cname-ignore' is a CNAME (illegal)" ns1/named.run > /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 "check that 'check-integrity yes; check-srv-cname fail;' works ($n)"
74
ret=0
Evan Hunt's avatar
Evan Hunt committed
75
$DIG $DIGOPTS @10.53.0.1 srv srv-cname-fail > dig.out.test$n || ret=1
76 77 78
grep "status: SERVFAIL," dig.out.test$n > /dev/null || ret=1
grep "zone srv-cname-fail/IN: srv-cname-fail/SRV 'cname.srv-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
79
if [ $ret != 0 ]; then echo_i "failed"; fi
80 81
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
82
echo_i "check that 'check-integrity yes; check-srv-cname warn;' works ($n)"
83
ret=0
Evan Hunt's avatar
Evan Hunt committed
84
$DIG $DIGOPTS @10.53.0.1 srv srv-cname-warn > dig.out.test$n || ret=1
85 86 87
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone srv-cname-warn/IN: srv-cname-warn/SRV 'cname.srv-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
88
if [ $ret != 0 ]; then echo_i "failed"; fi
89 90
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
91
echo_i "check that 'check-integrity yes; check-srv-cname ignore;' works ($n)"
92
ret=0
Evan Hunt's avatar
Evan Hunt committed
93
$DIG $DIGOPTS @10.53.0.1 srv srv-cname-ignore > dig.out.test$n || ret=1
94 95 96
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone srv-cname-ignore/IN: srv-cname-ignore/SRV 'cname.srv-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
97
if [ $ret != 0 ]; then echo_i "failed"; fi
98 99
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
100
echo_i "check that 'check-integrity no; check-srv-cname fail;' works ($n)"
101
ret=0
Evan Hunt's avatar
Evan Hunt committed
102
$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-fail > dig.out.test$n || ret=1
103 104 105
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone no-srv-cname-fail/IN: no-srv-cname-fail/SRV 'cname.no-srv-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
106
if [ $ret != 0 ]; then echo_i "failed"; fi
107 108
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
109
echo_i "check that 'check-integrity no; check-srv-cname warn;' works ($n)"
110
ret=0
Evan Hunt's avatar
Evan Hunt committed
111
$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-warn > dig.out.test$n || ret=1
112 113 114
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone no-srv-cname-warn/IN: no-srv-cname-warn/SRV 'cname.no-srv-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
115
if [ $ret != 0 ]; then echo_i "failed"; fi
116 117
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
118
echo_i "check that 'check-integrity no; check-srv-cname ignore;' works ($n)"
119
ret=0
Evan Hunt's avatar
Evan Hunt committed
120
$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-ignore > dig.out.test$n || ret=1
121 122 123
grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
grep "zone no-srv-cname-ignore/IN: no-srv-cname-ignore/SRV 'cname.no-srv-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
124
if [ $ret != 0 ]; then echo_i "failed"; fi
125 126
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
127
echo_i "exit status: $status"
128
test $status -eq 0 || exit 1