10cd9f4ecSchristos# #-- pymod_thread.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_PYTHONMODULE 1" $PRE/config.h; then 110cd9f4ecSchristos echo "have python module" 120cd9f4ecSchristoselse 13*91f7d55fSchristos skip_test "no python module" 140cd9f4ecSchristosfi 150cd9f4ecSchristos# get module python local 160cd9f4ecSchristoscp $PRE/pythonmod/unboundmodule.py . 170cd9f4ecSchristos 180cd9f4ecSchristosif test "`uname 2>&1`" = "Darwin"; then 190cd9f4ecSchristos ldnsdir=`grep ldnsdir= ../../Makefile | sed -e 's/ldnsdir=//'` 200cd9f4ecSchristos echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs" 210cd9f4ecSchristos export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs" 220cd9f4ecSchristosfi 230cd9f4ecSchristos 240cd9f4ecSchristosget_random_port 2 250cd9f4ecSchristosUNBOUND_PORT=$RND_PORT 260cd9f4ecSchristosFWD_PORT=$(($RND_PORT + 1)) 270cd9f4ecSchristosecho "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test 280cd9f4ecSchristosecho "FWD_PORT=$FWD_PORT" >> .tpkg.var.test 290cd9f4ecSchristos 300cd9f4ecSchristos# make config file 310cd9f4ecSchristossed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < pymod_thread.conf > ub.conf 320cd9f4ecSchristos 330cd9f4ecSchristos# see if config file verifies 340cd9f4ecSchristosif $PRE/unbound-checkconf ub.conf 2>&1; then 350cd9f4ecSchristos echo "checkconf OK" 360cd9f4ecSchristoselse 370cd9f4ecSchristos echo "checkconf failed" 380cd9f4ecSchristos exit 1 390cd9f4ecSchristosfi 400cd9f4ecSchristos 410cd9f4ecSchristos# start forwarder 420cd9f4ecSchristosget_ldns_testns 430cd9f4ecSchristos$LDNS_TESTNS -p $FWD_PORT pymod_thread.testns >fwd.log 2>&1 & 440cd9f4ecSchristosFWD_PID=$! 450cd9f4ecSchristosecho "FWD_PID=$FWD_PID" >> .tpkg.var.test 460cd9f4ecSchristos 470cd9f4ecSchristos# start unbound in the background 480cd9f4ecSchristos$PRE/unbound -d -c ub.conf >unbound.log 2>&1 & 490cd9f4ecSchristosUNBOUND_PID=$! 500cd9f4ecSchristosecho "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test 510cd9f4ecSchristos 520cd9f4ecSchristoscat .tpkg.var.test 530cd9f4ecSchristoswait_ldns_testns_up fwd.log 540cd9f4ecSchristoswait_unbound_up unbound.log 550cd9f4ecSchristos 56