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