xref: /netbsd-src/external/bsd/unbound/dist/testdata/pymod_thread.tdir/pymod_thread.test (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1# #-- pymod_thread.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="../.."
8if grep "define WITH_PYTHONMODULE 1" $PRE/config.h; then
9	echo "have python module"
10else
11	echo "no python module"
12	exit 0
13fi
14
15if test "`uname 2>&1`" = "Darwin"; then
16        ldnsdir=`grep ldnsdir= ../../Makefile | sed -e 's/ldnsdir=//'`
17        echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
18        export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
19fi
20
21# see if config file verifies
22if $PRE/unbound-checkconf ub.conf; then
23	echo "checkconf OK"
24else
25	echo "checkconf failed"
26	exit 1
27fi
28
29# do the test
30# generate some load.
31echo "> dig www[1-10].example.com."
32dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile1 &
33dig @localhost -p $UNBOUND_PORT www2.example.com. | tee outfile3 &
34dig @localhost -p $UNBOUND_PORT www3.example.com. | tee outfile2 &
35dig @localhost -p $UNBOUND_PORT www4.example.com. | tee outfile4 &
36dig @localhost -p $UNBOUND_PORT www5.example.com. | tee outfile5 &
37dig @localhost -p $UNBOUND_PORT www6.example.com. | tee outfile6 &
38dig @localhost -p $UNBOUND_PORT www7.example.com. | tee outfile7 &
39dig @localhost -p $UNBOUND_PORT www8.example.com. | tee outfile8 &
40dig @localhost -p $UNBOUND_PORT www9.example.com. | tee outfile9 &
41dig @localhost -p $UNBOUND_PORT www10.example.com. | tee outfile10 &
42
43wait  # wait for all jobs to complete.
44
45echo "> cat logfiles"
46cat fwd.log
47cat unbound.log
48echo "> check answer"
49for x in outfile1 outfile2 outfile3 outfile4 outfile5; do
50if grep "192.168.1.1" $x; then
51	echo "$x OK"
52else
53	echo "$x Not OK"
54	exit 1
55fi
56done
57
58for x in outfile6 outfile7 outfile8 outfile9 outfile10; do
59if grep "192.168.1.1" $x; then
60	echo "$x OK"
61else
62	echo "$x Not OK"
63	exit 1
64fi
65done
66
67exit 0
68