1#!/bin/sh 2# 3# Copyright (C) 2013 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.7 2011/11/06 23:46:40 tbox Exp 18 19SYSTEMTESTTOP=.. 20. $SYSTEMTESTTOP/conf.sh 21 22status=0 23n=0 24 25dotests() { 26 n=`expr $n + 1` 27 echo "I:test with RT, single zone ($n)" 28 ret=0 29 $DIG -t RT rt.rt.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1 30 if [ $ret -eq 1 ] ; then 31 echo "I: failed"; status=1 32 fi 33 34 n=`expr $n + 1` 35 echo "I:test with RT, two zones ($n)" 36 ret=0 37 $DIG -t RT rt.rt2.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1 38 if [ $ret -eq 1 ] ; then 39 echo "I: failed"; status=1 40 fi 41 42 n=`expr $n + 1` 43 echo "I:test with NAPTR, single zone ($n)" 44 ret=0 45 $DIG -t NAPTR nap.naptr.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1 46 if [ $ret -eq 1 ] ; then 47 echo "I: failed"; status=1 48 fi 49 50 n=`expr $n + 1` 51 echo "I:test with NAPTR, two zones ($n)" 52 ret=0 53 $DIG -t NAPTR nap.hang3b.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1 54 if [ $ret -eq 1 ] ; then 55 echo "I: failed"; status=1 56 fi 57 58 n=`expr $n + 1` 59 echo "I:test with LP ($n)" 60 ret=0 61 $DIG -t LP nid2.nid.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1 62 if [ $minimal = no ] ; then 63 grep "L64" dig.out.$n > /dev/null || ret=1 64 grep "L32" dig.out.$n > /dev/null || ret=1 65 else 66 grep "L64" dig.out.$n > /dev/null && ret=1 67 grep "L32" dig.out.$n > /dev/null && ret=1 68 fi 69 if [ $ret -eq 1 ] ; then 70 echo "I: failed"; status=1 71 fi 72 73 n=`expr $n + 1` 74 echo "I:test with NID ($n)" 75 ret=0 76 $DIG -t NID ns1.nid.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1 77 if [ $minimal = no ] ; then 78 # change && to || when we support NID additional processing 79 grep "L64" dig.out.$n > /dev/null && ret=1 80 grep "L32" dig.out.$n > /dev/null && ret=1 81 else 82 grep "L64" dig.out.$n > /dev/null && ret=1 83 grep "L32" dig.out.$n > /dev/null && ret=1 84 fi 85 if [ $ret -eq 1 ] ; then 86 echo "I: failed"; status=1 87 fi 88 89 n=`expr $n + 1` 90 echo "I:test with NID + LP ($n)" 91 ret=0 92 $DIG -t NID nid2.nid.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1 93 if [ $minimal = no ] ; then 94 # change && to || when we support NID additional processing 95 grep "LP" dig.out.$n > /dev/null && ret=1 96 grep "L64" dig.out.$n > /dev/null && ret=1 97 grep "L32" dig.out.$n > /dev/null && ret=1 98 else 99 grep "LP" dig.out.$n > /dev/null && ret=1 100 grep "L64" dig.out.$n > /dev/null && ret=1 101 grep "L32" dig.out.$n > /dev/null && ret=1 102 fi 103 if [ $ret -eq 1 ] ; then 104 echo "I: failed"; status=1 105 fi 106} 107 108echo "I:testing with 'minimal-responses yes;'" 109minimal=yes 110dotests 111 112echo "I:reconfiguring server" 113cp ns1/named2.conf ns1/named.conf 114$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reconfig 2>&1 | sed 's/^/I:ns1 /' 115sleep 2 116 117echo "I:testing with 'minimal-responses no;'" 118minimal=no 119dotests 120 121exit $status 122