1# #-- hostsfileosx.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 9 10# test if fwder is up 11echo "> dig @127.0.0.1 -p $FWD_PORT www.example.com | tee outfile" 12dig @127.0.0.1 -p $FWD_PORT www.example.com | tee outfile 13if grep "10.20.30.40" outfile; then 14 echo "fwder is up" 15else 16 cat fwd.log 17 echo "fwder not up" 18 exit 1 19fi 20rm outfile 21 22# create asynclook 23get_make 24echo "> (cd $PRE ; $MAKE asynclook)" 25(cd $PRE ; $MAKE asynclook) 26if test ! -x $PRE/asynclook; then 27 echo "cannot build asynclook test program" 28 exit 1 29fi 30(cd $PRE ; $MAKE lock-verify) 31 32# check the locks. 33function locktest() { 34 if test -x $PRE/lock-verify -a -f ublocktrace.0; then 35 $PRE/lock-verify ublocktrace.* 36 if test $? -ne 0; then 37 echo "lock-verify error" 38 exit 1 39 fi 40 fi 41} 42 43 44THR="" 45if grep "undef HAVE_FORK" $PRE/config.h; then 46 THR="-t" 47fi 48 49# test hosts reading (directed at local auth info) 50echo '> $PRE/asynclook $THR -H hostsfileosx.hosts virtual.virtual.virtual.local 2>&1 | tee outfile' 51$PRE/asynclook $THR -H hostsfileosx.hosts virtual.virtual.virtual.local 2>&1 | tee outfile 52if grep "virtual.virtual.virtual.local: 10.20.30.40" outfile; then 53 echo "OK" 54else 55 echo "Not OK" 56 exit 1 57fi 58locktest 59rm outfile 60 61echo "> cat logfiles" 62cat fwd.log 63exit 0 64