xref: /netbsd-src/external/bsd/unbound/dist/testdata/stub_udp.tdir/stub_udp.pre (revision 0cd9f4ecf44538bbdd5619b5b2081449960ab3e6)
1# #-- stub_udp.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. ../common.sh
7
8get_random_port 2
9UNBOUND_PORT=$RND_PORT
10FWD_PORT=$(($RND_PORT + 1))
11echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
12echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
13
14# start forwarder
15get_ldns_testns
16$LDNS_TESTNS -p $FWD_PORT stub_udp.testns >fwd.log 2>&1 &
17FWD_PID=$!
18echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
19
20# make config file
21sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < stub_udp.conf > ub.conf
22# start unbound in the background
23PRE="../.."
24$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
25UNBOUND_PID=$!
26echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
27
28cat .tpkg.var.test
29
30# wait for forwarder to come up
31wait_ldns_testns_up fwd.log
32
33# wait for unbound to come up
34wait_unbound_up unbound.log
35
36