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