1 # #-- doh_downstream_post.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
9 if grep "define HAVE_NGHTTP2 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
11 (cd $PRE; $MAKE dohclient)
14 # this test query should just work (server is up)
15 echo "> query www1.example.net."
16 $PRE/dohclient -P -s 127.0.0.1 -p $UNBOUND_PORT www1.example.net. A IN >outfile 2>&1
18 if test "$?" -ne 0; then
19 echo "exit status not OK"
27 if grep "www1.example.net" outfile | grep "1.2.3.1"; then
30 echo "result contents not OK"
35 echo "result contents not OK"
40 # multiple requests (from localdata)
41 echo "> query www1.example.net. www2.example.net. www3.example.net."
42 $PRE/dohclient -P -s 127.0.0.1 -p $UNBOUND_PORT www1.example.net. A IN www2.example.net A IN www3.example.net A IN >outfile 2>&1
44 if test "$?" -ne 0; then
45 echo "exit status not OK"
53 if grep "www1.example.net" outfile | grep "1.2.3.1"; then
56 echo "result contents not OK"
61 echo "result contents not OK"
64 if grep "www2.example.net" outfile | grep "1.2.3.2"; then
67 echo "result contents not OK"
72 echo "result contents not OK"
75 if grep "www3.example.net" outfile | grep "1.2.3.3"; then
78 echo "result contents not OK"
83 echo "result contents not OK"
87 # out of order requests, the example.com elements take 2 seconds to wait.
89 echo "> query www1.example.net. www.example.com. www2.example.net. www2.example.com. www3.example.net."
90 $PRE/dohclient -P -s 127.0.0.1 -p $UNBOUND_PORT www1.example.net. A IN www.example.com. A IN www2.example.net A IN www2.example.com. A IN www3.example.net A IN >outfile 2>&1
92 if test "$?" -ne 0; then
93 echo "exit status not OK"
101 if grep "www1.example.net" outfile | grep "1.2.3.1"; then
104 echo "result contents not OK"
105 echo "> cat logfiles"
109 echo "result contents not OK"
112 if grep "www2.example.net" outfile | grep "1.2.3.2"; then
115 echo "result contents not OK"
116 echo "> cat logfiles"
120 echo "result contents not OK"
123 if grep "www3.example.net" outfile | grep "1.2.3.3"; then
126 echo "result contents not OK"
127 echo "> cat logfiles"
131 echo "result contents not OK"
134 if grep "www.example.com" outfile | grep "10.20.30.40"; then
137 echo "result contents not OK"
138 echo "> cat logfiles"
142 echo "result contents not OK"
145 if grep "www2.example.com" outfile | grep "10.20.30.42"; then
148 echo "result contents not OK"
149 echo "> cat logfiles"
153 echo "result contents not OK"
157 # out of order requests, the example.com elements take 2 seconds to wait.
158 # www.example.com present twice, answered twice.
160 echo "> query www1.example.net. www.example.com. www2.example.net. www.example.com. www3.example.net."
161 $PRE/dohclient -P -s 127.0.0.1 -p $UNBOUND_PORT www1.example.net. A IN www.example.com. A IN www2.example.net A IN www.example.com. A IN www3.example.net A IN >outfile 2>&1
163 if test "$?" -ne 0; then
164 echo "exit status not OK"
165 echo "> cat logfiles"
172 if grep "www1.example.net" outfile | grep "1.2.3.1"; then
175 echo "result contents not OK"
176 echo "> cat logfiles"
180 echo "result contents not OK"
183 if grep "www2.example.net" outfile | grep "1.2.3.2"; then
186 echo "result contents not OK"
187 echo "> cat logfiles"
191 echo "result contents not OK"
194 if grep "www3.example.net" outfile | grep "1.2.3.3"; then
197 echo "result contents not OK"
198 echo "> cat logfiles"
202 echo "result contents not OK"
205 if grep "www.example.com" outfile | grep "10.20.30.40"; then
208 echo "result contents not OK"
209 echo "> cat logfiles"
213 echo "result contents not OK"
217 # out of order requests, the example.com elements take 2 seconds to wait.
218 # www3.example.com present twice, answered twice.
220 echo "> query www1.example.net. www3.example.com. www2.example.net. www3.example.com. www3.example.net."
221 $PRE/dohclient -P -s 127.0.0.1 -p $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
223 if test "$?" -ne 0; then
224 echo "exit status not OK"
225 echo "> cat logfiles"
232 if grep "www1.example.net" outfile | grep "1.2.3.1"; then
235 echo "result contents not OK"
236 echo "> cat logfiles"
240 echo "result contents not OK"
243 if grep "www2.example.net" outfile | grep "1.2.3.2"; then
246 echo "result contents not OK"
247 echo "> cat logfiles"
251 echo "result contents not OK"
254 if grep "www3.example.net" outfile | grep "1.2.3.3"; then
257 echo "result contents not OK"
258 echo "> cat logfiles"
262 echo "result contents not OK"
265 if grep "www3.example.com" outfile | grep "10.20.30.43"; then
268 echo "result contents not OK"
269 echo "> cat logfiles"
273 echo "result contents not OK"
278 echo "> query www4.example.com. www3.example.net."
279 $PRE/dohclient -P -s 127.0.0.1 -p $UNBOUND_PORT www4.example.com. A IN www3.example.net A IN >outfile 2>&1
281 if test "$?" -ne 0; then
282 echo "exit status not OK"
283 echo "> cat logfiles"
290 if grep "www3.example.net" outfile | grep "1.2.3.3"; then
293 echo "result contents not OK"
294 echo "> cat logfiles"
298 echo "result contents not OK"
301 if grep "www4.example.com" outfile | grep "10.20.30.44"; then
304 echo "result contents not OK"
305 echo "> cat logfiles"
309 echo "result contents not OK"
315 echo "> query a1.example.com. - a90.example.com."
316 $PRE/dohclient -P -s 127.0.0.1 -p $UNBOUND_PORT www6.example.com. A IN a1.a.example.com. A IN a2.a.example.com. A IN a3.a.example.com. A IN a4.a.example.com. A IN a5.a.example.com. A IN a6.a.example.com. A IN a7.a.example.com. A IN a8.a.example.com. A IN a9.a.example.com. A IN a10.a.example.com. A IN a11.a.example.com. A IN a12.a.example.com. A IN a13.a.example.com. A IN a14.a.example.com. A IN a15.a.example.com. A IN a16.a.example.com. A IN a17.a.example.com. A IN a18.a.example.com. A IN a19.a.example.com. A IN a20.a.example.com. A IN a21.a.example.com. A IN a22.a.example.com. A IN a23.a.example.com. A IN a24.a.example.com. A IN a25.a.example.com. A IN a26.a.example.com. A IN a27.a.example.com. A IN a28.a.example.com. A IN a29.a.example.com. A IN a30.a.example.com. A IN a31.a.example.com. A IN a32.a.example.com. A IN a33.a.example.com. A IN a34.a.example.com. A IN a35.a.example.com. A IN a36.a.example.com. A IN a37.a.example.com. A IN a38.a.example.com. A IN a39.a.example.com. A IN a40.a.example.com. A IN a41.a.example.com. A IN a42.a.example.com. A IN a43.a.example.com. A IN a44.a.example.com. A IN a45.a.example.com. A IN a46.a.example.com. A IN a47.a.example.com. A IN a48.a.example.com. A IN a49.a.example.com. A IN a50.a.example.com. A IN a51.a.example.com. A IN a52.a.example.com. A IN a53.a.example.com. A IN a54.a.example.com. A IN a55.a.example.com. A IN a56.a.example.com. A IN a57.a.example.com. A IN a58.a.example.com. A IN a59.a.example.com. A IN a60.a.example.com. A IN a61.a.example.com. A IN a62.a.example.com. A IN a63.a.example.com. A IN a64.a.example.com. A IN a65.a.example.com. A IN a66.a.example.com. A IN a67.a.example.com. A IN a68.a.example.com. A IN a69.a.example.com. A IN a70.a.example.com. A IN a71.a.example.com. A IN a72.a.example.com. A IN a73.a.example.com. A IN a74.a.example.com. A IN a75.a.example.com. A IN a76.a.example.com. A IN a77.a.example.com. A IN a78.a.example.com. A IN a79.a.example.com. A IN a80.a.example.com. A IN a81.a.example.com. A IN a82.a.example.com. A IN a83.a.example.com. A IN a84.a.example.com. A IN a85.a.example.com. A IN a86.a.example.com. A IN a87.a.example.com. A IN a88.a.example.com. A IN a89.a.example.com. A IN a90.a.example.com. A IN >outfile 2>&1
318 if test "$?" -ne 0; then
319 echo "exit status not OK"
320 echo "> cat logfiles"
328 num_ans=$(grep -B 3 "a.example.com. IN A" outfile | grep "rcode: NOERROR" | wc -l )
329 if test "$num_ans" -ne 90; then
330 echo "number of answers not OK"
331 echo "> cat logfiles"