1# #-- fwd_udptmout.test --# 2# source the master var file when it's there 3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4# use .tpkg.var.test for in test variable passing 5[ -f .tpkg.var.test ] && source .tpkg.var.test 6 7PRE="../.." 8# do the test 9 10# skip the single query test 11# so that all three queries get timeouts during the later test. 12# 13#echo "> dig www1.example.com." 14#dig @localhost -p $UNBOUND_PORT www1.example.com. | tee outfile 15#echo "> cat logfiles" 16#cat fwd.log 17#cat unbound.log 18#echo "> check answer for single query" 19#if grep "10.20.30.40" outfile; then 20 #echo "OK" 21#else 22 #echo "Not OK" 23 #exit 1 24#fi 25 26echo "> do queries" 27dig @localhost -p $UNBOUND_PORT www1.example.com. >outfile1 & 28digpid1=$! 29dig @localhost -p $UNBOUND_PORT www2.example.com. >outfile2 & 30digpid2=$! 31dig @localhost -p $UNBOUND_PORT www3.example.com. >outfile3 & 32digpid3=$! 33dig @localhost -p $UNBOUND_PORT www4.example.com. >outfile4 & 34digpid4=$! 35dig @localhost -p $UNBOUND_PORT www5.example.com. >outfile5 & 36digpid5=$! 37dig @localhost -p $UNBOUND_PORT www6.example.com. >outfile6 & 38digpid6=$! 39 40sleep 15 41 42# some slow systems need more for processing 43if grep "10.20.30.40" outfile1 >/dev/null; then :; else sleep 2; fi 44if grep "10.20.30.50" outfile2 >/dev/null; then :; else sleep 2; fi 45if grep "10.20.30.60" outfile3 >/dev/null; then :; else sleep 2; fi 46if grep "10.20.30.70" outfile4 >/dev/null; then :; else sleep 2; fi 47if grep "10.20.30.80" outfile5 >/dev/null; then :; else sleep 2; fi 48if grep "10.20.30.90" outfile6 >/dev/null; then :; else sleep 2; fi 49 50kill -9 $digpid1 51kill -9 $digpid2 52kill -9 $digpid3 53kill -9 $digpid4 54kill -9 $digpid5 55kill -9 $digpid6 56 57echo "> cat outfile1" 58cat outfile1 59echo "> cat outfile2" 60cat outfile2 61echo "> cat outfile3" 62cat outfile3 63echo "> cat outfile4" 64cat outfile4 65echo "> cat outfile5" 66cat outfile5 67echo "> cat outfile6" 68cat outfile6 69echo "> cat logfiles" 70cat fwd.log 71cat unbound.log 72echo "> check answers for queries" 73if grep "10.20.30.40" outfile1; then 74 echo "1 is OK" 75else 76 echo "1 is not OK" 77 exit 1 78fi 79if grep "10.20.30.50" outfile2; then 80 echo "2 is OK" 81else 82 echo "2 is not OK" 83 exit 1 84fi 85if grep "10.20.30.60" outfile3; then 86 echo "3 is OK" 87else 88 echo "3 is not OK" 89 exit 1 90fi 91if grep "10.20.30.70" outfile4; then 92 echo "4 is OK" 93else 94 echo "4 is not OK" 95 exit 1 96fi 97if grep "10.20.30.80" outfile5; then 98 echo "5 is OK" 99else 100 echo "5 is not OK" 101 exit 1 102fi 103if grep "10.20.30.90" outfile6; then 104 echo "6 is OK" 105else 106 echo "6 is not OK" 107 exit 1 108fi 109 110exit 0 111