summaryrefslogtreecommitdiff
path: root/testdata/pymod_thread.tdir/pymod_thread.pre
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2018-05-12 11:55:17 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2018-05-12 11:55:17 +0000
commita6c5280ea59f940be13fd6eb0f94ab8360d3d6c9 (patch)
treecbe088761a83cf2025bbdf36e1574f38c3e988f5 /testdata/pymod_thread.tdir/pymod_thread.pre
parent8c2647a7dc721c8e5349bd194b8e8e178412057e (diff)
Notes
Diffstat (limited to 'testdata/pymod_thread.tdir/pymod_thread.pre')
-rw-r--r--testdata/pymod_thread.tdir/pymod_thread.pre56
1 files changed, 56 insertions, 0 deletions
diff --git a/testdata/pymod_thread.tdir/pymod_thread.pre b/testdata/pymod_thread.tdir/pymod_thread.pre
new file mode 100644
index 0000000000000..c16362a0b3fb3
--- /dev/null
+++ b/testdata/pymod_thread.tdir/pymod_thread.pre
@@ -0,0 +1,56 @@
+# #-- pymod_thread.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_PYTHONMODULE 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 .
+
+if test "`uname 2>&1`" = "Darwin"; then
+ ldnsdir=`grep ldnsdir= ../../Makefile | sed -e 's/ldnsdir=//'`
+ echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
+ export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs"
+fi
+
+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
+
+# make config file
+sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < pymod_thread.conf > ub.conf
+
+# see if config file verifies
+if $PRE/unbound-checkconf ub.conf 2>&1; then
+ echo "checkconf OK"
+else
+ echo "checkconf failed"
+ exit 1
+fi
+
+# start forwarder
+get_ldns_testns
+$LDNS_TESTNS -p $FWD_PORT pymod_thread.testns >fwd.log 2>&1 &
+FWD_PID=$!
+echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
+
+# start unbound in the background
+$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
+UNBOUND_PID=$!
+echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
+
+cat .tpkg.var.test
+wait_ldns_testns_up fwd.log
+wait_unbound_up unbound.log
+