1# #-- tcp_sigpipe.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
7if uname | grep MINGW >/dev/null; then
8	echo "no job control in shell on windows. end test"
9	exit 0
10fi
11
12PRE="../.."
13. ../common.sh
14get_make
15(cd $PRE; $MAKE streamtcp)
16
17# first test a single TCP query.
18echo "> query www.example.com."
19$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN >outfile 2>&1 &
20kill -PIPE $UNBOUND_PID
21wait
22if test "$?" -ne 0; then
23	echo "exit status not OK"
24	echo "> cat logfiles"
25	cat outfile
26	cat fwd.log
27	cat unbound.log
28	echo "Not OK"
29	exit 1
30else
31	echo "exit status OK"
32fi
33echo "> cat logfiles"
34cat outfile
35cat fwd.log
36cat unbound.log
37echo "> check answer"
38if grep "10.20.30.40" outfile; then
39	echo "OK"
40else
41	echo "Not OK"
42	exit 1
43fi
44
45exit 0
46