xref: /netbsd-src/external/bsd/unbound/dist/testdata/pymod_thread.tdir/pymod_thread.test (revision 91f7d55fb697b5e0475da4718fa34c3a3ebeac85)
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="../.."
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
24# generate some load.
25echo "> dig www[1-10].example.com."
26dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile1 &
27dig @localhost -p $UNBOUND_PORT www2.example.com. | tee outfile3 &
28dig @localhost -p $UNBOUND_PORT www3.example.com. | tee outfile2 &
29dig @localhost -p $UNBOUND_PORT www4.example.com. | tee outfile4 &
30dig @localhost -p $UNBOUND_PORT www5.example.com. | tee outfile5 &
31dig @localhost -p $UNBOUND_PORT www6.example.com. | tee outfile6 &
32dig @localhost -p $UNBOUND_PORT www7.example.com. | tee outfile7 &
33dig @localhost -p $UNBOUND_PORT www8.example.com. | tee outfile8 &
34dig @localhost -p $UNBOUND_PORT www9.example.com. | tee outfile9 &
35dig @localhost -p $UNBOUND_PORT www10.example.com. | tee outfile10 &
36
37wait  # wait for all jobs to complete.
38
39echo "> cat logfiles"
40cat fwd.log
41cat unbound.log
42echo "> check answer"
43for x in outfile1 outfile2 outfile3 outfile4 outfile5; do
44if grep "192.168.1.1" $x; then
45	echo "$x OK"
46else
47	echo "$x Not OK"
48	exit 1
49fi
50done
51
52for x in outfile6 outfile7 outfile8 outfile9 outfile10; do
53if grep "192.168.1.1" $x; then
54	echo "$x OK"
55else
56	echo "$x Not OK"
57	exit 1
58fi
59done
60
61exit 0
62