1# Copyright (C) 2005, 2007, 2010, 2011  Internet Systems Consortium, Inc. ("ISC")
2#
3# Permission to use, copy, modify, and/or distribute this software for any
4# purpose with or without fee is hereby granted, provided that the above
5# copyright notice and this permission notice appear in all copies.
6#
7# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
8# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
10# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
12# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13# PERFORMANCE OF THIS SOFTWARE.
14
15# $Id: tests.sh,v 1.5.114.3 2011/11/07 00:31:48 marka Exp $
16
17SYSTEMTESTTOP=..
18. $SYSTEMTESTTOP/conf.sh
19
20status=0
21
22echo "I: checking that named-checkconf handles a known good config"
23ret=0
24$CHECKCONF good.conf > /dev/null 2>&1 || ret=1
25if [ $ret != 0 ]; then echo "I:failed"; fi
26status=`expr $status + $ret`
27
28echo "I: checking that named-checkconf prints a known good config"
29ret=0
30awk 'BEGIN { ok = 0; } /cut here/ { ok = 1; getline } ok == 1 { print }' good.conf > good.conf.in
31[ -s good.conf.in ] || ret=1
32$CHECKCONF -p good.conf.in | grep -v '^good.conf.in:' > good.conf.out 2>&1 || ret=1
33cmp good.conf.in good.conf.out || ret=1
34if [ $ret != 0 ]; then echo "I:failed"; fi
35status=`expr $status + $ret`
36
37echo "I: checking that named-checkconf handles a known bad config"
38ret=0
39$CHECKCONF bad.conf > /dev/null 2>&1 && ret=1
40if [ $ret != 0 ]; then echo "I:failed"; fi
41status=`expr $status + $ret`
42
43echo "I: checking named-checkconf dnssec warnings"
44ret=0
45$CHECKCONF dnssec.1 2>&1 | grep 'validation yes.*enable no' > /dev/null || ret=1
46$CHECKCONF dnssec.2 2>&1 | grep 'auto-dnssec may only be ' > /dev/null || ret=1
47$CHECKCONF dnssec.2 2>&1 | grep 'validation auto.*enable no' > /dev/null || ret=1
48$CHECKCONF dnssec.2 2>&1 | grep 'validation yes.*enable no' > /dev/null || ret=1
49# this one should have no warnings
50$CHECKCONF dnssec.3 2>&1 | grep '.*' && ret=1
51if [ $ret != 0 ]; then echo "I:failed"; fi
52status=`expr $status + $ret`
53
54echo "I:exit status: $status"
55exit $status
56