summaryrefslogtreecommitdiff
path: root/external/bsd/unbound/dist/testdata/pymod.tdir/pymod.test
blob: 43bf6e65f87f9a8044a2738680be31fddcdd4d5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# #-- pymod.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test

PRE="../.."
if grep "define WITH_PYTHONMODULE 1" $PRE/config.h; then
	echo "have python module"
else
	echo "no python module"
	exit 0
fi

if test "`uname 2>&1`" = "Darwin"; then
        ldnsdir=`grep ldnsdir= ../../Makefile | sed -e 's/ldnsdir=//'`
        echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
        export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
fi

# see if config file verifies
if $PRE/unbound-checkconf ub.conf; then
	echo "checkconf OK"
else
	echo "checkconf failed"
	exit 1
fi

# do the test
echo "> dig www.example.com."
dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
echo "> cat logfiles"
cat fwd.log 
cat unbound.log
echo "> check answer"
if grep "10.20.30.40" outfile; then
	echo "OK"
else
	echo "Not OK"
	exit 1
fi

echo "> dig www2.example.com."
dig @localhost -p $UNBOUND_PORT www2.example.com. | tee outfile
echo "> cat logfiles"
cat fwd.log 
cat unbound.log
echo "> check answer"
if grep "192.168.1.1" outfile; then
	echo "OK"
else
	echo "Not OK"
	exit 1
fi

exit 0