1#!/bin/sh
2#
3# Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
4#
5# Permission to use, copy, modify, and/or distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15# PERFORMANCE OF THIS SOFTWARE.
16
17# $Id: tests.sh,v 1.2.2.2 2011/03/18 21:27:51 fdupont Exp $
18
19SYSTEMTESTTOP=..
20. $SYSTEMTESTTOP/conf.sh
21
22status=0
23
24echo "I:checking short dname from authoritative"
25ret=0
26$DIG a.short-dname.example @10.53.0.2 a -p 5300 > dig.out.ns2.short || ret=1
27grep "status: NOERROR" dig.out.ns2.short > /dev/null || ret=1
28if [ $ret != 0 ]; then echo "I:failed"; fi
29status=`expr $status + $ret`
30
31echo "I:checking short dname from recursive"
32ret=0
33$DIG a.short-dname.example @10.53.0.4 a -p 5300 > dig.out.ns4.short || ret=1
34grep "status: NOERROR" dig.out.ns4.short > /dev/null || ret=1
35if [ $ret != 0 ]; then echo "I:failed"; fi
36status=`expr $status + $ret`
37
38echo "I:checking long dname from authoritative"
39ret=0
40$DIG a.long-dname.example @10.53.0.2 a -p 5300 > dig.out.ns2.long || ret=1
41grep "status: NOERROR" dig.out.ns2.long > /dev/null || ret=1
42if [ $ret != 0 ]; then echo "I:failed"; fi
43status=`expr $status + $ret`
44
45echo "I:checking long dname from recursive"
46ret=0
47$DIG a.long-dname.example @10.53.0.4 a -p 5300 > dig.out.ns4.long || ret=1
48grep "status: NOERROR" dig.out.ns4.long > /dev/null || ret=1
49if [ $ret != 0 ]; then echo "I:failed"; fi
50status=`expr $status + $ret`
51
52echo "I:checking (too) long dname from authoritative"
53ret=0
54$DIG 01234567890123456789012345678901234567890123456789.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.long-dname.example @10.53.0.2 a -p 5300 > dig.out.ns2.toolong || ret=1
55grep "status: YXDOMAIN" dig.out.ns2.toolong > /dev/null || ret=1
56if [ $ret != 0 ]; then echo "I:failed"; fi
57status=`expr $status + $ret`
58
59echo "I:checking (too) long dname from recursive"
60ret=0
61$DIG 01234567890123456789012345678901234567890123456789.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.long-dname.example @10.53.0.4 a -p 5300 > dig.out.ns4.toolong || ret=1
62grep "status: YXDOMAIN" dig.out.ns4.toolong > /dev/null || ret=1
63if [ $ret != 0 ]; then echo "I:failed"; fi
64status=`expr $status + $ret`
65
66echo "I:exit status: $status"
67
68exit $status
69