tests.sh revision 1.1.1.5
1#!/bin/sh
2
3# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4#
5# SPDX-License-Identifier: MPL-2.0
6#
7# This Source Code Form is subject to the terms of the Mozilla Public
8# License, v. 2.0.  If a copy of the MPL was not distributed with this
9# file, you can obtain one at https://mozilla.org/MPL/2.0/.
10#
11# See the COPYRIGHT file distributed with this work for additional
12# information regarding copyright ownership.
13
14set -e
15
16. ../conf.sh
17
18DIGOPTS="-p ${PORT}"
19
20status=0
21n=0
22
23ret=0
24n=$((n + 1))
25echo_i "test master file \$INCLUDE semantics ($n)"
26$DIG $DIGOPTS +nostats +nocmd include. axfr @10.53.0.1 >dig.out.$n
27
28echo_i "test master file BIND 8 compatibility TTL and \$TTL semantics ($n)"
29$DIG $DIGOPTS +nostats +nocmd ttl2. axfr @10.53.0.1 >>dig.out.$n
30
31echo_i "test of master file RFC1035 TTL and \$TTL semantics ($n)"
32$DIG $DIGOPTS +nostats +nocmd ttl2. axfr @10.53.0.1 >>dig.out.$n
33
34diff dig.out.$n knowngood.dig.out || status=1
35if [ $ret != 0 ]; then echo_i "failed"; fi
36status=$((status + ret))
37
38ret=0
39n=$((n + 1))
40echo_i "test that the nameserver is running with a missing master file ($n)"
41$DIG $DIGOPTS +tcp +noall +answer example soa @10.53.0.2 >dig.out.$n
42grep SOA dig.out.$n >/dev/null || ret=1
43if [ $ret != 0 ]; then echo_i "failed"; fi
44status=$((status + ret))
45
46ret=0
47n=$((n + 1))
48echo_i "test that the nameserver returns SERVFAIL for a missing master file ($n)"
49$DIG $DIGOPTS +tcp +all missing soa @10.53.0.2 >dig.out.$n
50grep "status: SERVFAIL" dig.out.$n >/dev/null || ret=1
51if [ $ret != 0 ]; then echo_i "failed"; fi
52status=$((status + ret))
53
54ret=0
55n=$((n + 1))
56echo_i "test owner inheritance after "'$INCLUDE'" ($n)"
57$CHECKZONE -Dq example zone/inheritownerafterinclude.db >checkzone.out$n
58diff checkzone.out$n zone/inheritownerafterinclude.good || ret=1
59if [ $ret != 0 ]; then echo_i "failed"; fi
60status=$((status + ret))
61
62echo_i "exit status: $status"
63[ $status -eq 0 ] || exit 1
64