summaryrefslogtreecommitdiff
path: root/testdata/pylib.tdir/pylib.pre
diff options
context:
space:
mode:
Diffstat (limited to 'testdata/pylib.tdir/pylib.pre')
-rw-r--r--testdata/pylib.tdir/pylib.pre36
1 files changed, 36 insertions, 0 deletions
diff --git a/testdata/pylib.tdir/pylib.pre b/testdata/pylib.tdir/pylib.pre
new file mode 100644
index 000000000000..01ca2b896280
--- /dev/null
+++ b/testdata/pylib.tdir/pylib.pre
@@ -0,0 +1,36 @@
+# #-- pylib.pre--#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# use .tpkg.var.test for in test variable passing
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+
+PRE="../.."
+. ../common.sh
+# if no python; exit
+if grep "define WITH_PYUNBOUND 1" $PRE/config.h; then
+ echo "have python module"
+else
+ echo "no python module"
+ exit 0
+fi
+# get module python local
+cp $PRE/pythonmod/unboundmodule.py .
+
+get_random_port 2
+UNBOUND_PORT=$RND_PORT
+FWD_PORT=$(($RND_PORT + 1))
+echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
+echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
+
+# start forwarder
+get_ldns_testns
+$LDNS_TESTNS -p $FWD_PORT pylib.testns >fwd.log 2>&1 &
+FWD_PID=$!
+echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
+
+# modify config file
+sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < pylib.conf > ub.conf
+
+cat .tpkg.var.test
+wait_ldns_testns_up fwd.log
+