xref: /netbsd-src/external/bsd/unbound/dist/testdata/doh_downstream.tdir/doh_downstream.pre (revision 9fb66d812c00ebfb445c0b47dea128f32aa6fe96)
1# #-- doh_downstream.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
9if grep "define HAVE_NGHTTP2 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
10
11get_random_port 2
12UNBOUND_PORT=$RND_PORT
13FWD_PORT=$(($RND_PORT + 1))
14echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
15echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
16
17# start forwarder
18get_ldns_testns
19$LDNS_TESTNS -p $FWD_PORT doh_downstream.testns >fwd.log 2>&1 &
20FWD_PID=$!
21echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
22
23# make config file
24sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < doh_downstream.conf > ub.conf
25# start unbound in the background
26$PRE/unbound -vvvv -d -c ub.conf >unbound.log 2>&1 &
27UNBOUND_PID=$!
28echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
29
30cat .tpkg.var.test
31wait_ldns_testns_up fwd.log
32wait_unbound_up unbound.log
33
34