tests.sh revision 1.1.1.3
1# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 2# 3# This Source Code Form is subject to the terms of the Mozilla Public 4# License, v. 2.0. If a copy of the MPL was not distributed with this 5# file, You can obtain one at http://mozilla.org/MPL/2.0/. 6# 7# See the COPYRIGHT file distributed with this work for additional 8# information regarding copyright ownership. 9 10SYSTEMTESTTOP=.. 11. $SYSTEMTESTTOP/conf.sh 12 13DIGOPTS="-p ${PORT}" 14RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" 15SEND="$PERL $SYSTEMTESTTOP/send.pl 10.53.0.4 ${EXTRAPORT1}" 16status=0 17n=0 18 19n=`expr $n + 1` 20echo_i "checking short DNAME from authoritative ($n)" 21ret=0 22$DIG $DIGOPTS a.short-dname.example @10.53.0.2 a > dig.out.ns2.short || ret=1 23grep "status: NOERROR" dig.out.ns2.short > /dev/null || ret=1 24if [ $ret != 0 ]; then echo_i "failed"; fi 25status=`expr $status + $ret` 26 27n=`expr $n + 1` 28echo_i "checking short DNAME from recursive ($n)" 29ret=0 30$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 31$DIG $DIGOPTS a.short-dname.example @10.53.0.7 a > dig.out.ns4.short || ret=1 32grep "status: NOERROR" dig.out.ns4.short > /dev/null || ret=1 33if [ $ret != 0 ]; then echo_i "failed"; fi 34status=`expr $status + $ret` 35 36n=`expr $n + 1` 37echo_i "checking long DNAME from authoritative ($n)" 38ret=0 39$DIG $DIGOPTS a.long-dname.example @10.53.0.2 a > dig.out.ns2.long || ret=1 40grep "status: NOERROR" dig.out.ns2.long > /dev/null || ret=1 41if [ $ret != 0 ]; then echo_i "failed"; fi 42status=`expr $status + $ret` 43 44n=`expr $n + 1` 45echo_i "checking long DNAME from recursive ($n)" 46ret=0 47$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 48$DIG $DIGOPTS a.long-dname.example @10.53.0.7 a > dig.out.ns4.long || ret=1 49grep "status: NOERROR" dig.out.ns4.long > /dev/null || ret=1 50if [ $ret != 0 ]; then echo_i "failed"; fi 51status=`expr $status + $ret` 52 53n=`expr $n + 1` 54echo_i "checking (too) long DNAME from authoritative ($n)" 55ret=0 56$DIG $DIGOPTS 01234567890123456789012345678901234567890123456789.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.long-dname.example @10.53.0.2 a > dig.out.ns2.toolong || ret=1 57grep "status: YXDOMAIN" dig.out.ns2.toolong > /dev/null || ret=1 58if [ $ret != 0 ]; then echo_i "failed"; fi 59status=`expr $status + $ret` 60 61n=`expr $n + 1` 62echo_i "checking (too) long DNAME from recursive with cached DNAME ($n)" 63ret=0 64$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 65$DIG $DIGOPTS 01234567890123456789012345678901234567890123456789.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.long-dname.example @10.53.0.7 a > dig.out.ns4.cachedtoolong || ret=1 66grep "status: YXDOMAIN" dig.out.ns4.cachedtoolong > /dev/null || ret=1 67grep '^long-dname\.example\..*DNAME.*long' dig.out.ns4.cachedtoolong > /dev/null || ret=1 68if [ $ret != 0 ]; then echo_i "failed"; fi 69status=`expr $status + $ret` 70 71n=`expr $n + 1` 72echo_i "checking (too) long DNAME from recursive without cached DNAME ($n)" 73ret=0 74$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 75$DIG $DIGOPTS 01234567890123456789012345678901234567890123456789.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglonglong.longlonglonglonglonglonglonglonglonglonglonglonglonglong.toolong-dname.example @10.53.0.7 a > dig.out.ns4.uncachedtoolong || ret=1 76grep "status: YXDOMAIN" dig.out.ns4.uncachedtoolong > /dev/null || ret=1 77grep '^toolong-dname\.example\..*DNAME.*long' dig.out.ns4.uncachedtoolong > /dev/null || ret=1 78if [ $ret != 0 ]; then echo_i "failed"; fi 79status=`expr $status + $ret` 80 81n=`expr $n + 1` 82echo_i "checking CNAME to DNAME from authoritative ($n)" 83ret=0 84$DIG $DIGOPTS cname.example @10.53.0.2 a > dig.out.ns2.cname 85grep "status: NOERROR" dig.out.ns2.cname > /dev/null || ret=1 86if [ $ret != 0 ]; then echo_i "failed"; fi 87status=`expr $status + $ret` 88 89n=`expr $n + 1` 90echo_i "checking CNAME to DNAME from recursive" 91ret=0 92$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 93$DIG $DIGOPTS cname.example @10.53.0.7 a > dig.out.ns4.cname 94grep "status: NOERROR" dig.out.ns4.cname > /dev/null || ret=1 95grep '^cname.example.' dig.out.ns4.cname > /dev/null || ret=1 96grep '^cnamedname.example.' dig.out.ns4.cname > /dev/null || ret=1 97grep '^a.cnamedname.example.' dig.out.ns4.cname > /dev/null || ret=1 98grep '^a.target.example.' dig.out.ns4.cname > /dev/null || ret=1 99if [ $ret != 0 ]; then echo_i "failed"; fi 100status=`expr $status + $ret` 101 102n=`expr $n + 1` 103echo_i "checking DNAME is returned with synthesized CNAME before DNAME ($n)" 104ret=0 105$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 106$DIG $DIGOPTS @10.53.0.7 name.synth-then-dname.example.broken A > dig.out.test$n 107grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 108grep '^name.synth-then-dname\.example\.broken\..*CNAME.*name.$' dig.out.test$n > /dev/null || ret=1 109grep '^synth-then-dname\.example\.broken\..*DNAME.*\.$' dig.out.test$n > /dev/null || ret=1 110if [ $ret != 0 ]; then echo_i "failed"; fi 111status=`expr $status + $ret` 112 113n=`expr $n + 1` 114echo_i "checking DNAME is returned with CNAME to synthesized CNAME before DNAME ($n)" 115ret=0 116$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 117$DIG $DIGOPTS @10.53.0.7 cname-to-synth2-then-dname.example.broken A > dig.out.test$n 118grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1 119grep '^cname-to-synth2-then-dname\.example\.broken\..*CNAME.*name\.synth2-then-dname\.example\.broken.$' dig.out.test$n > /dev/null || ret=1 120grep '^name\.synth2-then-dname\.example\.broken\..*CNAME.*name.$' dig.out.test$n > /dev/null || ret=1 121grep '^synth2-then-dname\.example\.broken\..*DNAME.*\.$' dig.out.test$n > /dev/null || ret=1 122if [ $ret != 0 ]; then echo_i "failed"; fi 123status=`expr $status + $ret` 124 125n=`expr $n + 1` 126echo_i "checking CNAME loops are detected ($n)" 127ret=0 128$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 129$DIG $DIGOPTS @10.53.0.7 loop.example > dig.out.test$n 130grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 131grep "ANSWER: 17" dig.out.test$n > /dev/null || ret=1 132if [ $ret != 0 ]; then echo_i "failed"; fi 133status=`expr $status + $ret` 134 135n=`expr $n + 1` 136echo_i "checking CNAME to external delegated zones is handled ($n)" 137ret=0 138$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 139$DIG $DIGOPTS @10.53.0.7 a.example > dig.out.test$n 140grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 141grep "ANSWER: 2" dig.out.test$n > /dev/null || ret=1 142if [ $ret != 0 ]; then echo_i "failed"; fi 143status=`expr $status + $ret` 144 145n=`expr $n + 1` 146echo_i "checking CNAME to internal delegated zones is handled ($n)" 147ret=0 148$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 149$DIG $DIGOPTS @10.53.0.7 b.example > dig.out.test$n 150grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1 151grep "ANSWER: 2" dig.out.test$n > /dev/null || ret=1 152if [ $ret != 0 ]; then echo_i "failed"; fi 153status=`expr $status + $ret` 154 155n=`expr $n + 1` 156echo_i "checking CNAME to signed external delegation is handled ($n)" 157ret=0 158$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 159$DIG $DIGOPTS @10.53.0.7 c.example > dig.out.$n 160grep "status: NOERROR" dig.out.$n > /dev/null || ret=1 161if [ $ret != 0 ]; then echo_i "failed"; fi 162status=`expr $status + $ret` 163 164n=`expr $n + 1` 165echo_i "checking CNAME to signed internal delegation is handled ($n)" 166ret=0 167$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 168$DIG $DIGOPTS @10.53.0.7 d.example > dig.out.$n 169grep "status: NOERROR" dig.out.$n > /dev/null || ret=1 170if [ $ret != 0 ]; then echo_i "failed"; fi 171status=`expr $status + $ret` 172 173n=`expr $n + 1` 174echo_i "checking CNAME chains in various orders ($n)" 175ret=0 176$RNDCCMD 10.53.0.7 null --- start test$n - step 1 --- 2>&1 | sed 's/^/ns7 /' | cat_i 177echo "cname,cname,cname|1,2,3,4,s1,s2,s3,s4" | $SEND 178$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.1.$n 2>&1 179grep 'status: NOERROR' dig.out.1.$n > /dev/null 2>&1 || ret=1 180grep 'ANSWER: 2' dig.out.1.$n > /dev/null 2>&1 || ret=1 181$RNDCCMD 10.53.0.7 null --- start test$n - step 2 --- 2>&1 | sed 's/^/ns7 /' | cat_i 182$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 183echo "cname,cname,cname|1,1,2,2,3,4,s4,s3,s1" | $SEND 184$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.2.$n 2>&1 185grep 'status: NOERROR' dig.out.2.$n > /dev/null 2>&1 || ret=1 186grep 'ANSWER: 2' dig.out.2.$n > /dev/null 2>&1 || ret=1 187$RNDCCMD 10.53.0.7 null --- start test$n - step 3 --- 2>&1 | sed 's/^/ns7 /' | cat_i 188$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 189echo "cname,cname,cname|2,1,3,4,s3,s1,s2,s4" | $SEND 190$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.3.$n 2>&1 191grep 'status: NOERROR' dig.out.3.$n > /dev/null 2>&1 || ret=1 192grep 'ANSWER: 2' dig.out.3.$n > /dev/null 2>&1 || ret=1 193$RNDCCMD 10.53.0.7 null --- start test$n - step 4 --- 2>&1 | sed 's/^/ns7 /' | cat_i 194$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 195echo "cname,cname,cname|4,3,2,1,s4,s3,s2,s1" | $SEND 196$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.4.$n 2>&1 197grep 'status: NOERROR' dig.out.4.$n > /dev/null 2>&1 || ret=1 198grep 'ANSWER: 2' dig.out.4.$n > /dev/null 2>&1 || ret=1 199echo "cname,cname,cname|4,3,2,1,s4,s3,s2,s1" | $SEND 200$RNDCCMD 10.53.0.7 null --- start test$n - step 5 --- 2>&1 | sed 's/^/ns7 /' | cat_i 201$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 202$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.5.$n 2>&1 203grep 'status: NOERROR' dig.out.5.$n > /dev/null 2>&1 || ret=1 204grep 'ANSWER: 2' dig.out.5.$n > /dev/null 2>&1 || ret=1 205$RNDCCMD 10.53.0.7 null --- start test$n - step 6 --- 2>&1 | sed 's/^/ns7 /' | cat_i 206$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 207echo "cname,cname,cname|4,3,3,3,s1,s1,1,3,4" | $SEND 208$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.6.$n 2>&1 209grep 'status: NOERROR' dig.out.6.$n > /dev/null 2>&1 || ret=1 210grep 'ANSWER: 2' dig.out.6.$n > /dev/null 2>&1 || ret=1 211if [ $ret != 0 ]; then echo_i "failed"; fi 212status=`expr $status + $ret` 213 214n=`expr $n + 1` 215echo_i "checking that only the initial CNAME is cached ($n)" 216ret=0 217$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 218echo "cname,cname,cname|1,2,3,4,s1,s2,s3,s4" | $SEND 219$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 220$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.1.$n 2>&1 221sleep 1 222$DIG $DIGOPTS +noall +answer @10.53.0.7 cname1.domain.nil > dig.out.2.$n 2>&1 223ttl=`awk '{print $2}' dig.out.2.$n` 224[ "$ttl" -eq 86400 ] || ret=1 225if [ $ret != 0 ]; then echo_i "failed"; fi 226status=`expr $status + $ret` 227 228n=`expr $n + 1` 229echo_i "checking DNAME chains in various orders ($n)" 230ret=0 231$RNDCCMD 10.53.0.7 null --- start test$n - step 1 --- 2>&1 | sed 's/^/ns7 /' | cat_i 232$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 233echo "dname,dname|5,4,3,2,1,s5,s4,s3,s2,s1" | $SEND 234$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.1.$n 2>&1 235grep 'status: NOERROR' dig.out.1.$n > /dev/null 2>&1 || ret=1 236grep 'ANSWER: 3' dig.out.1.$n > /dev/null 2>&1 || ret=1 237$RNDCCMD 10.53.0.7 null --- start test$n - step 2 --- 2>&1 | sed 's/^/ns7 /' | cat_i 238$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 239echo "dname,dname|5,4,3,2,1,s5,s4,s3,s2,s1" | $SEND 240$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.2.$n 2>&1 241grep 'status: NOERROR' dig.out.2.$n > /dev/null 2>&1 || ret=1 242grep 'ANSWER: 3' dig.out.2.$n > /dev/null 2>&1 || ret=1 243$RNDCCMD 10.53.0.7 null --- start test$n - step 3 --- 2>&1 | sed 's/^/ns7 /' | cat_i 244$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 245echo "dname,dname|2,3,s1,s2,s3,s4,1" | $SEND 246$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.3.$n 2>&1 247grep 'status: NOERROR' dig.out.3.$n > /dev/null 2>&1 || ret=1 248grep 'ANSWER: 3' dig.out.3.$n > /dev/null 2>&1 || ret=1 249$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 250if [ $ret != 0 ]; then echo_i "failed"; fi 251status=`expr $status + $ret` 252 253n=`expr $n + 1` 254echo_i "checking external CNAME/DNAME chains in various orders ($n)" 255ret=0 256$RNDCCMD 10.53.0.7 null --- start test$n - step 1 --- 2>&1 | sed 's/^/ns7 /' | cat_i 257echo "xname,dname|1,2,3,4,s1,s2,s3,s4" | $SEND 258$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.1.$n 2>&1 259grep 'status: NOERROR' dig.out.1.$n > /dev/null 2>&1 || ret=1 260grep 'ANSWER: 2' dig.out.1.$n > /dev/null 2>&1 || ret=1 261$RNDCCMD 10.53.0.7 null --- start test$n - step 2 --- 2>&1 | sed 's/^/ns7 /' | cat_i 262$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 263echo "xname,dname|s2,2,s1,1,4,s4,3" | $SEND 264$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.2.$n 2>&1 265grep 'status: NOERROR' dig.out.2.$n > /dev/null 2>&1 || ret=1 266grep 'ANSWER: 2' dig.out.2.$n > /dev/null 2>&1 || ret=1 267$RNDCCMD 10.53.0.7 null --- start test$n - step 3 --- 2>&1 | sed 's/^/ns7 /' | cat_i 268$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 269echo "xname,dname|s2,2,2,2" | $SEND 270$DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.3.$n 2>&1 271grep 'status: SERVFAIL' dig.out.3.$n > /dev/null 2>&1 || ret=1 272$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 273if [ $ret != 0 ]; then echo_i "failed"; fi 274status=`expr $status + $ret` 275 276n=`expr $n + 1` 277echo_i "checking explicit DNAME query ($n)" 278ret=0 279$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 280$DIG $DIGOPTS @10.53.0.7 dname short-dname.example > dig.out.7.$n 2>&1 281grep 'status: NOERROR' dig.out.7.$n > /dev/null 2>&1 || ret=1 282if [ $ret != 0 ]; then echo_i "failed"; fi 283status=`expr $status + $ret` 284 285n=`expr $n + 1` 286echo_i "checking DNAME via ANY query ($n)" 287ret=0 288$RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i 289$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i 290$DIG $DIGOPTS @10.53.0.7 any short-dname.example > dig.out.7.$n 2>&1 291grep 'status: NOERROR' dig.out.7.$n > /dev/null 2>&1 || ret=1 292if [ $ret != 0 ]; then echo_i "failed"; fi 293status=`expr $status + $ret` 294 295echo_i "exit status: $status" 296[ $status -eq 0 ] || exit 1 297