tests.sh 7.27 KB
Newer Older
1
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
Mark Andrews's avatar
Mark Andrews committed
2
#
3 4 5
# 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/.
6 7 8
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
9 10 11 12 13 14 15 16 17

SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh

status=0
n=1

for db in zones/good*.db
do
Evan Hunt's avatar
Evan Hunt committed
18
	echo_i "checking $db ($n)"
19
	ret=0
20 21 22 23
	case $db in
	zones/good-gc-msdcs.db)
		$CHECKZONE -k fail -i local example $db > test.out.$n 2>&1 || ret=1
		;;
24 25 26
	zones/good-dns-sd-reverse.db)
		$CHECKZONE -k fail -i local 0.0.0.0.in-addr.arpa $db > test.out.$n 2>&1 || ret=1
		;;
27 28 29 30
	*)
		$CHECKZONE -i local example $db > test.out.$n 2>&1 || ret=1
		;;
	esac
31
	n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
32
	if [ $ret != 0 ]; then echo_i "failed"; fi
33 34 35
	status=`expr $status + $ret`
done

36 37
for db in zones/bad*.db
do
Evan Hunt's avatar
Evan Hunt committed
38
	echo_i "checking $db ($n)"
39
	ret=0 v=0
40 41
	case $db in
	zones/bad-dns-sd-reverse.db)
42
		$CHECKZONE -k fail -i local 0.0.0.0.in-addr.arpa $db > test.out.$n 2>&1 || v=$?
43 44
		;;
	*)
45
                $CHECKZONE -i local example $db > test.out.$n 2>&1 || v=$?
46 47
		;;
	esac
48
	test $v = 1 || ret=1
49
	n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
50
	if [ $ret != 0 ]; then echo_i "failed"; fi
51 52 53
	status=`expr $status + $ret`
done

Evan Hunt's avatar
Evan Hunt committed
54
echo_i "checking with journal file ($n)"
55 56 57
ret=0
$CHECKZONE -D -o test.orig.db test zones/test1.db > /dev/null 2>&1 || ret=1
$CHECKZONE -D -o test.changed.db test zones/test2.db > /dev/null 2>&1 || ret=1
58
$MAKEJOURNAL test test.orig.db test.changed.db test.orig.db.jnl 2>&1 || ret=1
59 60 61 62 63 64 65
jlines=`$JOURNALPRINT test.orig.db.jnl | wc -l`
[ $jlines = 3 ] || ret=1
$CHECKZONE -D -j -o test.out1.db test test.orig.db > /dev/null 2>&1 || ret=1
cmp -s test.changed.db test.out1.db || ret=1
mv -f test.orig.db.jnl test.journal
$CHECKZONE -D -J test.journal -o test.out2.db test test.orig.db > /dev/null 2>&1 || ret=1
cmp -s test.changed.db test.out2.db || ret=1
66
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
67
if [ $ret != 0 ]; then echo_i "failed"; fi
68 69
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
70
echo_i "checking with spf warnings ($n)"
71 72 73
ret=0
$CHECKZONE example zones/spf.db > test.out1.$n 2>&1 || ret=1
$CHECKZONE -T ignore example zones/spf.db > test.out2.$n 2>&1 || ret=1
Mark Andrews's avatar
Mark Andrews committed
74 75 76 77 78 79
grep "'x.example' found type SPF" test.out1.$n > /dev/null && ret=1
grep "'y.example' found type SPF" test.out1.$n > /dev/null || ret=1
grep "'example' found type SPF" test.out1.$n > /dev/null && ret=1
grep "'x.example' found type SPF" test.out2.$n > /dev/null && ret=1
grep "'y.example' found type SPF" test.out2.$n > /dev/null && ret=1
grep "'example' found type SPF" test.out2.$n > /dev/null && ret=1
80
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
81
if [ $ret != 0 ]; then echo_i "failed"; fi
82 83
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
84
echo_i "checking with max ttl (text) ($n)"
Evan Hunt's avatar
Evan Hunt committed
85 86 87 88
ret=0
$CHECKZONE -l 300 example zones/good1.db > test.out1.$n 2>&1 && ret=1
$CHECKZONE -l 600 example zones/good1.db > test.out2.$n 2>&1 || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
89
if [ $ret != 0 ]; then echo_i "failed"; fi
Evan Hunt's avatar
Evan Hunt committed
90 91
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
92
echo_i "checking with max ttl (raw) ($n)"
Evan Hunt's avatar
Evan Hunt committed
93 94 95 96
ret=0
$CHECKZONE -f raw -l 300 example good1.db.raw > test.out1.$n 2>&1 && ret=1
$CHECKZONE -f raw -l 600 example good1.db.raw > test.out2.$n 2>&1 || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
97
if [ $ret != 0 ]; then echo_i "failed"; fi
Evan Hunt's avatar
Evan Hunt committed
98 99
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
100
echo_i "checking with max ttl (map) ($n)"
Evan Hunt's avatar
Evan Hunt committed
101 102 103 104
ret=0
$CHECKZONE -f map -l 300 example good1.db.map > test.out1.$n 2>&1 && ret=1
$CHECKZONE -f map -l 600 example good1.db.map > test.out2.$n 2>&1 || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
105
if [ $ret != 0 ]; then echo_i "failed"; fi
Evan Hunt's avatar
Evan Hunt committed
106 107
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
108
echo_i "checking for no 'inherited owner' warning on '\$INCLUDE file' with no new \$ORIGIN ($n)"
109 110 111 112
ret=0
$CHECKZONE example zones/nowarn.inherited.owner.db > test.out1.$n 2>&1 || ret=1
grep "inherited.owner" test.out1.$n > /dev/null && ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
113
if [ $ret != 0 ]; then echo_i "failed"; fi
114 115
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
116
echo_i "checking for 'inherited owner' warning on '\$ORIGIN + \$INCLUDE file' ($n)"
117 118 119 120
ret=0
$CHECKZONE example zones/warn.inherit.origin.db > test.out1.$n 2>&1 || ret=1
grep "inherited.owner" test.out1.$n > /dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
121
if [ $ret != 0 ]; then echo_i "failed"; fi
122 123
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
124
echo_i "checking for 'inherited owner' warning on '\$INCLUDE file origin' ($n)"
125 126 127 128
ret=0
$CHECKZONE example zones/warn.inherited.owner.db > test.out1.$n 2>&1 || ret=1
grep "inherited.owner" test.out1.$n > /dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
129
if [ $ret != 0 ]; then echo_i "failed"; fi
130 131
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
132
echo_i "checking that raw zone with bad class is handled ($n)"
133 134 135 136
ret=0
$CHECKZONE -f raw example zones/bad-badclass.raw > test.out.$n 2>&1 && ret=1
grep "failed: bad class" test.out.$n >/dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
137
if [ $ret != 0 ]; then echo_i "failed"; fi
138 139
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
140
echo_i "checking that expirations that loop using serial arithmetic are handled ($n)"
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
ret=0
q=-q
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
test $ret -eq 1 || $CHECKZONE $q dyn.example.net zones/crashzone.db || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
166
if [ $ret != 0 ]; then echo_i "failed"; fi
167 168
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
169
echo_i "checking that nameserver below DNAME is reported even with occulted address record present ($n)"
170 171 172 173
ret=0
$CHECKZONE example.com zones/ns-address-below-dname.db > test.out.$n 2>&1 && ret=1
grep "is below a DNAME" test.out.$n >/dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
174
if [ $ret != 0 ]; then echo_i "failed"; fi
175 176
status=`expr $status + $ret`

Evan Hunt's avatar
Evan Hunt committed
177
echo_i "checking that delegating nameserver below DNAME is reported even with occulted address record present ($n)"
178 179 180 181
ret=0
$CHECKZONE example.com zones/delegating-ns-address-below-dname.db > test.out.$n 2>&1 || ret=1
grep "is below a DNAME" test.out.$n >/dev/null || ret=1
n=`expr $n + 1`
Evan Hunt's avatar
Evan Hunt committed
182
if [ $ret != 0 ]; then echo_i "failed"; fi
183 184
status=`expr $status + $ret`

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