1#!/bin/sh 2# 3# Copyright (C) 2004, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") 4# Copyright (C) 2000, 2001 Internet Software Consortium. 5# 6# Permission to use, copy, modify, and/or distribute this software for any 7# purpose with or without fee is hereby granted, provided that the above 8# copyright notice and this permission notice appear in all copies. 9# 10# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 11# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 12# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 13# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 14# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 15# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16# PERFORMANCE OF THIS SOFTWARE. 17 18# $Id$ 19 20SYSTEMTESTTOP=.. 21. $SYSTEMTESTTOP/conf.sh 22 23status=0 24 25DIGOPTS="-p 5300" 26 27echo "I:querying for various representations of an IN A record" 28for i in 1 2 3 4 5 6 7 8 9 10 11 12 29do 30 ret=0 31 $DIG +short $DIGOPTS @10.53.0.1 a$i.example a in > dig.out || ret=1 32 echo 10.0.0.1 | diff - dig.out || ret=1 33 if [ $ret != 0 ] 34 then 35 echo "#$i failed" 36 fi 37 status=`expr $status + $ret` 38done 39 40echo "I:querying for various representations of an IN TXT record" 41for i in 1 2 3 4 5 6 7 42do 43 ret=0 44 $DIG +short $DIGOPTS @10.53.0.1 txt$i.example txt in > dig.out || ret=1 45 echo '"hello"' | diff - dig.out || ret=1 46 if [ $ret != 0 ] 47 then 48 echo "#$i failed" 49 fi 50 status=`expr $status + $ret` 51done 52 53echo "I:querying for various representations of an IN TYPE123 record" 54for i in 1 2 3 55do 56 ret=0 57 $DIG +short $DIGOPTS @10.53.0.1 unk$i.example type123 in > dig.out || ret=1 58 echo '\# 1 00' | diff - dig.out || ret=1 59 if [ $ret != 0 ] 60 then 61 echo "#$i failed" 62 fi 63 status=`expr $status + $ret` 64done 65 66echo "I:querying for NULL record" 67ret=0 68$DIG +short $DIGOPTS @10.53.0.1 null.example null in > dig.out || ret=1 69echo '\# 1 00' | diff - dig.out || ret=1 70[ $ret = 0 ] || echo "I: failed" 71status=`expr $status + $ret` 72 73echo "I:querying for empty NULL record" 74ret=0 75$DIG +short $DIGOPTS @10.53.0.1 empty.example null in > dig.out || ret=1 76echo '\# 0' | diff - dig.out || ret=1 77[ $ret = 0 ] || echo "I: failed" 78status=`expr $status + $ret` 79 80echo "I:querying for various representations of a CLASS10 TYPE1 record" 81for i in 1 2 82do 83 ret=0 84 $DIG +short $DIGOPTS @10.53.0.1 a$i.example a class10 > dig.out || ret=1 85 echo '\# 4 0A000001' | diff - dig.out || ret=1 86 if [ $ret != 0 ] 87 then 88 echo "#$i failed" 89 fi 90 status=`expr $status + $ret` 91done 92 93echo "I:querying for various representations of a CLASS10 TXT record" 94for i in 1 2 3 4 95do 96 ret=0 97 $DIG +short $DIGOPTS @10.53.0.1 txt$i.example txt class10 > dig.out || ret=1 98 echo '"hello"' | diff - dig.out || ret=1 99 if [ $ret != 0 ] 100 then 101 echo "#$i failed" 102 fi 103 status=`expr $status + $ret` 104done 105 106echo "I:querying for various representations of a CLASS10 TYPE123 record" 107for i in 1 2 108do 109 ret=0 110 $DIG +short $DIGOPTS @10.53.0.1 unk$i.example type123 class10 > dig.out || ret=1 111 echo '\# 1 00' | diff - dig.out || ret=1 112 if [ $ret != 0 ] 113 then 114 echo "#$i failed" 115 fi 116 status=`expr $status + $ret` 117done 118 119echo "I:querying for SOAs of zone that should have failed to load" 120for i in 1 2 3 4 121do 122 ret=0 123 $DIG $DIGOPTS @10.53.0.1 broken$i. soa in > dig.out || ret=1 124 grep "SERVFAIL" dig.out > /dev/null || ret=1 125 if [ $ret != 0 ] 126 then 127 echo "#$i failed" 128 fi 129 status=`expr $status + $ret` 130done 131 132echo "I:checking large unknown record loading on master" 133ret=0 134$DIG $DIGOPTS @10.53.0.1 +tcp +short large.example TYPE45234 > dig.out || { ret=1 ; echo I: dig failed ; } 135diff -s large.out dig.out > /dev/null || { ret=1 ; echo "I: diff failed"; } 136[ $ret = 0 ] || echo "I: failed" 137status=`expr $status + $ret` 138 139echo "I:checking large unknown record loading on slave" 140ret=0 141$DIG $DIGOPTS @10.53.0.2 +tcp +short large.example TYPE45234 > dig.out || { ret=1 ; echo I: dig failed ; } 142diff -s large.out dig.out > /dev/null || { ret=1 ; echo "I: diff failed"; } 143[ $ret = 0 ] || echo "I: failed" 144status=`expr $status + $ret` 145 146echo "I:stop and restart slave" 147$PERL $SYSTEMTESTTOP/stop.pl . ns2 148$PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns2 149 150echo "I:checking large unknown record loading on slave" 151ret=0 152$DIG $DIGOPTS @10.53.0.2 +tcp +short large.example TYPE45234 > dig.out || { ret=1 ; echo I: dig failed ; } 153diff -s large.out dig.out > /dev/null || { ret=1 ; echo "I: diff failed"; } 154[ $ret = 0 ] || echo "I: failed" 155status=`expr $status + $ret` 156 157echo "I:exit status: $status" 158exit $status 159