xref: /netbsd-src/external/bsd/unbound/dist/testdata/pymod.tdir/pymod.test (revision 91f7d55fb697b5e0475da4718fa34c3a3ebeac85)
1*0cd9f4ecSchristos# #-- pymod.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
9*0cd9f4ecSchristosif test "`uname 2>&1`" = "Darwin"; then
10*0cd9f4ecSchristos        ldnsdir=`grep ldnsdir= ../../Makefile | sed -e 's/ldnsdir=//'`
11*0cd9f4ecSchristos        echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
12*0cd9f4ecSchristos        export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
13*0cd9f4ecSchristosfi
14*0cd9f4ecSchristos
15*0cd9f4ecSchristos# see if config file verifies
16*0cd9f4ecSchristosif $PRE/unbound-checkconf ub.conf; then
17*0cd9f4ecSchristos	echo "checkconf OK"
18*0cd9f4ecSchristoselse
19*0cd9f4ecSchristos	echo "checkconf failed"
20*0cd9f4ecSchristos	exit 1
21*0cd9f4ecSchristosfi
22*0cd9f4ecSchristos
23*0cd9f4ecSchristos# do the test
24*0cd9f4ecSchristosecho "> dig www.example.com."
25*0cd9f4ecSchristosdig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
26*0cd9f4ecSchristosecho "> cat logfiles"
27*0cd9f4ecSchristoscat fwd.log
28*0cd9f4ecSchristoscat unbound.log
29*0cd9f4ecSchristosecho "> check answer"
30*0cd9f4ecSchristosif grep "10.20.30.40" outfile; then
31*0cd9f4ecSchristos	echo "OK"
32*0cd9f4ecSchristoselse
33*0cd9f4ecSchristos	echo "Not OK"
34*0cd9f4ecSchristos	exit 1
35*0cd9f4ecSchristosfi
36*0cd9f4ecSchristos
37*0cd9f4ecSchristosecho "> dig www2.example.com."
38*0cd9f4ecSchristosdig @localhost -p $UNBOUND_PORT www2.example.com. | tee outfile
39*0cd9f4ecSchristosecho "> cat logfiles"
40*0cd9f4ecSchristoscat fwd.log
41*0cd9f4ecSchristoscat unbound.log
42*0cd9f4ecSchristosecho "> check answer"
43*0cd9f4ecSchristosif grep "192.168.1.1" outfile; then
44*0cd9f4ecSchristos	echo "OK"
45*0cd9f4ecSchristoselse
46*0cd9f4ecSchristos	echo "Not OK"
47*0cd9f4ecSchristos	exit 1
48*0cd9f4ecSchristosfi
49*0cd9f4ecSchristos
50*0cd9f4ecSchristosexit 0
51