1*0cd9f4ecSchristos# #-- stat_timer.test --# 2*0cd9f4ecSchristos# source the master var file when it's there 3*0cd9f4ecSchristos[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4*0cd9f4ecSchristos# use .tpkg.var.test for in test variable passing 5*0cd9f4ecSchristos[ -f .tpkg.var.test ] && source .tpkg.var.test 6*0cd9f4ecSchristos 7*0cd9f4ecSchristosPRE="../.." 8*0cd9f4ecSchristos# test if unbound is up 9*0cd9f4ecSchristosecho "> dig www.example.com." 10*0cd9f4ecSchristosdig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile 11*0cd9f4ecSchristosecho "> check answer" 12*0cd9f4ecSchristosif grep "10.20.30.40" outfile; then 13*0cd9f4ecSchristos echo "OK" 14*0cd9f4ecSchristoselse 15*0cd9f4ecSchristos echo "> cat logfiles" 16*0cd9f4ecSchristos cat fwd.log 17*0cd9f4ecSchristos cat unbound.log 18*0cd9f4ecSchristos echo "Not OK" 19*0cd9f4ecSchristos exit 1 20*0cd9f4ecSchristosfi 21*0cd9f4ecSchristos 22*0cd9f4ecSchristos# wait for statistics timer to go off a couple times. 23*0cd9f4ecSchristossleep 5 24*0cd9f4ecSchristos 25*0cd9f4ecSchristosn=`grep "server stats" unbound.log | wc | awk '{print $1}'` 26*0cd9f4ecSchristosecho "counted $n stat lines" 27*0cd9f4ecSchristosif test $n -gt 6; then 28*0cd9f4ecSchristos echo "OK" 29*0cd9f4ecSchristoselse 30*0cd9f4ecSchristos echo "> cat logfiles" 31*0cd9f4ecSchristos cat fwd.log 32*0cd9f4ecSchristos cat unbound.log 33*0cd9f4ecSchristos echo "Not OK" 34*0cd9f4ecSchristos exit 1 35*0cd9f4ecSchristosfi 36*0cd9f4ecSchristos 37*0cd9f4ecSchristosecho "> cat logfiles" 38*0cd9f4ecSchristoscat fwd.log 39*0cd9f4ecSchristoscat unbound.log 40*0cd9f4ecSchristosexit 0 41