xref: /netbsd-src/external/bsd/unbound/dist/testdata/tcp_sigpipe.tdir/tcp_sigpipe.pre (revision 0cd9f4ecf44538bbdd5619b5b2081449960ab3e6)
1*0cd9f4ecSchristos# #-- tcp_sigpipe.pre--#
2*0cd9f4ecSchristos# source the master var file when it's there
3*0cd9f4ecSchristos[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
4*0cd9f4ecSchristos# use .tpkg.var.test for in test variable passing
5*0cd9f4ecSchristos[ -f .tpkg.var.test ] && source .tpkg.var.test
6*0cd9f4ecSchristos
7*0cd9f4ecSchristos. ../common.sh
8*0cd9f4ecSchristosget_random_port 2
9*0cd9f4ecSchristosUNBOUND_PORT=$RND_PORT
10*0cd9f4ecSchristosFWD_PORT=$(($RND_PORT + 1))
11*0cd9f4ecSchristosecho "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
12*0cd9f4ecSchristosecho "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
13*0cd9f4ecSchristos
14*0cd9f4ecSchristos# start forwarder
15*0cd9f4ecSchristosget_ldns_testns
16*0cd9f4ecSchristos$LDNS_TESTNS -p $FWD_PORT tcp_sigpipe.testns >fwd.log 2>&1 &
17*0cd9f4ecSchristosFWD_PID=$!
18*0cd9f4ecSchristosecho "FWD_PID=$FWD_PID" >> .tpkg.var.test
19*0cd9f4ecSchristos
20*0cd9f4ecSchristos# make config file
21*0cd9f4ecSchristossed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < tcp_sigpipe.conf > ub.conf
22*0cd9f4ecSchristos# start unbound in the background
23*0cd9f4ecSchristosPRE="../.."
24*0cd9f4ecSchristos$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
25*0cd9f4ecSchristosUNBOUND_PID=$!
26*0cd9f4ecSchristosecho "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
27*0cd9f4ecSchristos
28*0cd9f4ecSchristoscat .tpkg.var.test
29*0cd9f4ecSchristoswait_ldns_testns_up fwd.log
30*0cd9f4ecSchristoswait_unbound_up unbound.log
31*0cd9f4ecSchristos
32