xref: /netbsd-src/external/bsd/unbound/dist/testdata/fwd_waitudp.tdir/fwd_waitudp.test (revision 901e7e84758515fbf39dfc064cb0b45ab146d8b0)
1# #-- fwd_waitudp.test --#
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# do the test
9
10# skip the single query test
11# so that all three queries get timeouts during the later test.
12#
13#echo "> dig www1.example.com."
14#dig @localhost -p $UNBOUND_PORT www1.example.com. | tee outfile
15#echo "> cat logfiles"
16#cat fwd.log
17#cat unbound.log
18#echo "> check answer for single query"
19#if grep "10.20.30.40" outfile; then
20	#echo "OK"
21#else
22	#echo "Not OK"
23	#exit 1
24#fi
25
26echo "> do three queries"
27dig @localhost -p $UNBOUND_PORT www1.example.com. >outfile1 &
28digpid1=$!
29dig @localhost -p $UNBOUND_PORT www2.example.com. >outfile2 &
30digpid2=$!
31dig @localhost -p $UNBOUND_PORT www3.example.com. >outfile3 &
32digpid3=$!
33sleep 15
34kill -9 $digpid1
35kill -9 $digpid2
36kill -9 $digpid3
37
38echo "> cat outfile1"
39cat outfile1
40echo "> cat outfile2"
41cat outfile2
42echo "> cat outfile3"
43cat outfile3
44echo "> cat logfiles"
45cat fwd.log
46cat unbound.log
47echo "> check answers for three queries"
48if grep "10.20.30.40" outfile1; then
49	echo "1 is OK"
50else
51	echo "1 is not OK"
52	exit 1
53fi
54if grep "10.20.30.50" outfile2; then
55	echo "2 is OK"
56else
57	echo "2 is not OK"
58	exit 1
59fi
60if grep "10.20.30.60" outfile3; then
61	echo "3 is OK"
62else
63	echo "3 is not OK"
64	exit 1
65fi
66
67exit 0
68