1# #-- stat_timer.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# test if unbound is up
9echo "> dig www.example.com."
10dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
11echo "> check answer"
12if grep "10.20.30.40" outfile; then
13	echo "OK"
14else
15	echo "> cat logfiles"
16	cat fwd.log
17	cat unbound.log
18	echo "Not OK"
19	exit 1
20fi
21
22# wait for statistics timer to go off a couple times.
23sleep 5
24
25n=`grep "server stats" unbound.log | wc | awk '{print $1}'`
26echo "counted $n stat lines"
27if test $n -gt 6; then
28	echo "OK"
29else
30	echo "> cat logfiles"
31	cat fwd.log
32	cat unbound.log
33	echo "Not OK"
34	exit 1
35fi
36
37echo "> cat logfiles"
38cat fwd.log
39cat unbound.log
40exit 0
41