1# #-- stream_tcp.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. ../common.sh 9get_make 10(cd $PRE; $MAKE streamtcp) 11 12# first test a single TCP query. 13echo "> query www.example.com." 14$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN >outfile 2>&1 15if test "$?" -ne 0; then 16 echo "exit status not OK" 17 echo "> cat logfiles" 18 cat outfile 19 cat fwd.log 20 cat unbound.log 21 echo "Not OK" 22 exit 1 23else 24 echo "exit status OK" 25fi 26echo "> cat logfiles" 27cat outfile 28cat fwd.log 29cat unbound.log 30echo "> check answer" 31if grep "10.20.30.40" outfile; then 32 echo "OK" 33else 34 echo "Not OK" 35 exit 1 36fi 37 38# test more 39echo "" 40echo "" 41echo "> query www.example.com www2.example.com www3.example.com" 42$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN www2.example.com. A IN www3.example.com A IN >outfile 2>&1 43if test "$?" -ne 0; then 44 echo "exit status not OK" 45 echo "> cat logfiles" 46 cat outfile 47 cat fwd.log 48 cat unbound.log 49 echo "Not OK" 50 exit 1 51else 52 echo "exit status OK" 53fi 54echo "> cat logfiles" 55cat outfile 56cat fwd.log 57cat unbound.log 58echo "> check answer" 59if grep "10.20.30.40" outfile; then 60 echo "OK" 61else 62 echo "Not OK" 63 exit 1 64fi 65if grep "10.20.30.42" outfile; then 66 echo "OK" 67else 68 echo "Not OK" 69 exit 1 70fi 71 72if grep "10.20.30.43" outfile; then 73 echo "OK" 74else 75 echo "Not OK" 76 exit 1 77fi 78 79exit 0 80