xref: /netbsd-src/external/bsd/unbound/dist/testdata/pymod_thread.tdir/pymod_thread.pre (revision 91f7d55fb697b5e0475da4718fa34c3a3ebeac85)
1# #-- pymod_thread.pre--#
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. ../common.sh
9# if no python; exit
10if grep "define WITH_PYTHONMODULE 1" $PRE/config.h; then
11	echo "have python module"
12else
13	skip_test "no python module"
14fi
15# get module python local
16cp $PRE/pythonmod/unboundmodule.py .
17
18if test "`uname 2>&1`" = "Darwin"; then
19        ldnsdir=`grep ldnsdir= ../../Makefile | sed -e 's/ldnsdir=//'`
20        echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
21        export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
22fi
23
24get_random_port 2
25UNBOUND_PORT=$RND_PORT
26FWD_PORT=$(($RND_PORT + 1))
27echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
28echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
29
30# make config file
31sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < pymod_thread.conf > ub.conf
32
33# see if config file verifies
34if $PRE/unbound-checkconf ub.conf 2>&1; then
35	echo "checkconf OK"
36else
37	echo "checkconf failed"
38	exit 1
39fi
40
41# start forwarder
42get_ldns_testns
43$LDNS_TESTNS -p $FWD_PORT pymod_thread.testns >fwd.log 2>&1 &
44FWD_PID=$!
45echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
46
47# start unbound in the background
48$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
49UNBOUND_PID=$!
50echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
51
52cat .tpkg.var.test
53wait_ldns_testns_up fwd.log
54wait_unbound_up unbound.log
55
56