xref: /netbsd-src/external/bsd/unbound/dist/testdata/pylib.tdir/pylib.pre (revision 91f7d55fb697b5e0475da4718fa34c3a3ebeac85)
10cd9f4ecSchristos# #-- pylib.pre--#
20cd9f4ecSchristos# source the master var file when it's there
30cd9f4ecSchristos[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
40cd9f4ecSchristos# use .tpkg.var.test for in test variable passing
50cd9f4ecSchristos[ -f .tpkg.var.test ] && source .tpkg.var.test
60cd9f4ecSchristos
70cd9f4ecSchristosPRE="../.."
80cd9f4ecSchristos. ../common.sh
90cd9f4ecSchristos# if no python; exit
100cd9f4ecSchristosif grep "define WITH_PYUNBOUND 1" $PRE/config.h; then
11f42d8de7Schristos	echo "have pyunbound"
120cd9f4ecSchristoselse
13*91f7d55fSchristos	skip_test "no pyunbound"
140cd9f4ecSchristosfi
15f42d8de7Schristos
16f42d8de7Schristos# Copy the required libraries
17f42d8de7Schristoscp $PRE/libunbound/python/unbound.py .
18f42d8de7Schristoscp $PRE/.libs/_unbound* .
19f42d8de7Schristoscp $PRE/.libs/libunbound* .
200cd9f4ecSchristos
210cd9f4ecSchristosget_random_port 2
220cd9f4ecSchristosUNBOUND_PORT=$RND_PORT
230cd9f4ecSchristosFWD_PORT=$(($RND_PORT + 1))
240cd9f4ecSchristosecho "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
250cd9f4ecSchristosecho "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
260cd9f4ecSchristos
270cd9f4ecSchristos# start forwarder
280cd9f4ecSchristosget_ldns_testns
290cd9f4ecSchristos$LDNS_TESTNS -p $FWD_PORT pylib.testns >fwd.log 2>&1 &
300cd9f4ecSchristosFWD_PID=$!
310cd9f4ecSchristosecho "FWD_PID=$FWD_PID" >> .tpkg.var.test
320cd9f4ecSchristos
330cd9f4ecSchristos# modify config file
34f42d8de7Schristossed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < pylib.lookup.conf > ub.lookup.conf
350cd9f4ecSchristos
360cd9f4ecSchristoscat .tpkg.var.test
370cd9f4ecSchristoswait_ldns_testns_up fwd.log
380cd9f4ecSchristos
39