]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/tcp_idle_timeout.tdir/tcp_idle_timeout.test
Vendor import of Unbound 1.8.0.
[FreeBSD/FreeBSD.git] / testdata / tcp_idle_timeout.tdir / tcp_idle_timeout.test
1 # #-- tcp_idle_timeout.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
7
8 # Run up unbound with a 2s idle timeout. Try a normal TCP query, check it works, and then check that a connection with a 4s send delay fails.
9
10
11 if uname | grep MINGW >/dev/null; then
12         echo "no job control in shell on windows. end test"
13         exit 0
14 fi
15
16 PRE="../.."
17 . ../common.sh
18 get_make
19 (cd $PRE; $MAKE streamtcp)
20
21 # first test a single TCP query with no delay.
22 echo "> query www.example.com."
23 $PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN >outfile 2>&1
24 if test "$?" -ne 0; then
25         echo "exit status not OK"
26         echo "> cat logfiles"
27         cat outfile
28         cat fwd.log 
29         cat unbound.log
30         echo "Not OK"
31         exit 1
32 else
33         echo "exit status OK"
34 fi
35 echo "> cat logfiles"
36 cat outfile
37 cat fwd.log 
38 cat unbound.log
39 echo "> check answer"
40 if grep "10.20.30.40" outfile; then
41         echo "OK"
42 else
43         echo "Not OK"
44         exit 1
45 fi
46
47 # now test query with delay should fail.
48 echo "> query www.example.com."
49 $PRE/streamtcp -d 4 -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN >outfile 2>&1
50 if test "$?" -eq 0; then
51         echo "exit status OK"
52         echo "> cat logfiles"
53         cat outfile
54         cat fwd.log 
55         cat unbound.log
56         echo "Not OK"
57         exit 1
58 else
59         echo "exit status not OK"
60 fi
61 echo "> cat logfiles"
62 cat outfile
63 cat fwd.log 
64 cat unbound.log
65 echo "OK"
66
67 exit 0