]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/tcp_req_size.tdir/tcp_req_size.test
Vendor import of Unbound 1.10.1.
[FreeBSD/FreeBSD.git] / testdata / tcp_req_size.tdir / tcp_req_size.test
1 # #-- tcp_req_size.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 PRE="../.."
8 . ../common.sh
9 get_make
10 (cd $PRE; $MAKE streamtcp)
11
12 # this test query should just work (server is up)
13 echo "> query www1.example.net."
14 $PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www1.example.net. A IN >outfile 2>&1
15 cat outfile
16 if test "$?" -ne 0; then
17         echo "exit status not OK"
18         echo "> cat logfiles"
19         cat outfile
20         cat fwd.log 
21         cat unbound.log
22         echo "Not OK"
23         exit 1
24 fi
25 if grep "www1.example.net" outfile | grep "1.2.3.1"; then
26         echo "content OK"
27 else
28         echo "result contents not OK"
29         echo "> cat logfiles"
30         cat outfile
31         cat fwd.log 
32         cat unbound.log
33         echo "result contents not OK"
34         exit 1
35 fi
36 echo "OK"
37
38 # out of order requests, the example.com elements take 2 seconds to wait.
39 # www3.example.com present twice, answered twice.
40 # this queues one answer in the wait buffers, and that exceeds the buffer.
41 echo ""
42 echo "> query www1.example.net. www3.example.com. www2.example.net. www3.example.com. www3.example.net."
43 $PRE/streamtcp -a -f 127.0.0.1@$UNBOUND_PORT www1.example.net. A IN www3.example.com. A IN www2.example.net A IN www3.example.com. A IN www3.example.net A IN >outfile 2>&1
44 cat outfile
45 if test "$?" -ne 0; then
46         echo "exit status not OK"
47         echo "> cat logfiles"
48         cat outfile
49         cat fwd.log 
50         cat unbound.log
51         echo "Not OK"
52         exit 1
53 fi
54 if grep "www1.example.net" outfile | grep "1.2.3.1"; then
55         echo "content OK"
56 else
57         echo "result contents not OK"
58         echo "> cat logfiles"
59         cat outfile
60         cat fwd.log 
61         cat unbound.log
62         echo "result contents not OK"
63         exit 1
64 fi
65 if grep "www2.example.net" outfile | grep "1.2.3.2"; then
66         echo "content OK"
67 else
68         echo "result contents not OK"
69         echo "> cat logfiles"
70         cat outfile
71         cat fwd.log 
72         cat unbound.log
73         echo "result contents not OK"
74         exit 1
75 fi
76 if grep "www3.example.net" outfile | grep "1.2.3.3"; then
77         echo "content OK"
78 else
79         echo "result contents not OK"
80         echo "> cat logfiles"
81         cat outfile
82         cat fwd.log 
83         cat unbound.log
84         echo "result contents not OK"
85         exit 1
86 fi
87 if grep "stream closed" outfile; then
88         echo "content OK"
89 else
90         echo "result contents not OK"
91         echo "> cat logfiles"
92         cat outfile
93         cat fwd.log 
94         cat unbound.log
95         echo "result contents not OK"
96         exit 1
97 fi
98 echo "OK"
99
100 # check that the server is still up
101 echo ""
102 echo "> query www1.example.net. (again check if server up)"
103 $PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www1.example.net. A IN >outfile 2>&1
104 cat outfile
105 if test "$?" -ne 0; then
106         echo "exit status not OK"
107         echo "> cat logfiles"
108         cat outfile
109         cat fwd.log
110         cat unbound.log
111         echo "Not OK"
112         exit 1
113 fi
114 if grep "www1.example.net" outfile | grep "1.2.3.1"; then
115         echo "content OK"
116 else
117         echo "result contents not OK"
118         echo "> cat logfiles"
119         cat outfile
120         cat fwd.log
121         cat unbound.log
122         echo "result contents not OK"
123         exit 1
124 fi
125
126 echo "OK"
127 exit 0