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 pyunbound" 12else 13 skip_test "no pyunbound" 14fi 15 16# Copy the required libraries 17cp $PRE/libunbound/python/unbound.py . 18cp $PRE/.libs/_unbound* . 19cp $PRE/.libs/libunbound* . 20 21get_random_port 2 22UNBOUND_PORT=$RND_PORT 23FWD_PORT=$(($RND_PORT + 1)) 24echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test 25echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test 26 27# start forwarder 28get_ldns_testns 29$LDNS_TESTNS -p $FWD_PORT pylib.testns >fwd.log 2>&1 & 30FWD_PID=$! 31echo "FWD_PID=$FWD_PID" >> .tpkg.var.test 32 33# modify config file 34sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < pylib.lookup.conf > ub.lookup.conf 35 36cat .tpkg.var.test 37wait_ldns_testns_up fwd.log 38 39