xref: /netbsd-src/external/bsd/unbound/dist/testdata/pylib.tdir/pylib.pre (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1# #-- pylib.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_PYUNBOUND 1" $PRE/config.h; then
11	echo "have python module"
12else
13	echo "no python module"
14	exit 0
15fi
16# get module python local
17cp $PRE/pythonmod/unboundmodule.py .
18
19get_random_port 2
20UNBOUND_PORT=$RND_PORT
21FWD_PORT=$(($RND_PORT + 1))
22echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
23echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
24
25# start forwarder
26get_ldns_testns
27$LDNS_TESTNS -p $FWD_PORT pylib.testns >fwd.log 2>&1 &
28FWD_PID=$!
29echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
30
31# modify config file
32sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < pylib.conf > ub.conf
33
34cat .tpkg.var.test
35wait_ldns_testns_up fwd.log
36
37