]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/dnstap.tdir/dnstap.test
Vendor import of Unbound 1.11.0.
[FreeBSD/FreeBSD.git] / testdata / dnstap.tdir / dnstap.test
1 # #-- dnstap.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 . ../common.sh
8 PRE="../.."
9 if grep "define USE_DNSTAP 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
10
11 # test if the server is up.
12 echo "> dig www.example.com."
13 dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile
14 echo "> check answer"
15 if grep "10.20.30.40" outfile; then
16         echo "OK"
17 else
18         echo "> cat logfiles"
19         cat tap.log
20         cat tap.errlog
21         cat fwd.log
22         cat unbound.log
23         echo "Not OK"
24         exit 1
25 fi
26
27 echo "> check tap.log for dnstap info"
28 # see if it logged the information in tap.log
29 # wait for a moment for filesystem to catch up.
30 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
31 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
32 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
33 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
34 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
35 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 10; fi
36 if grep "www.example.com" tap.log; then echo "yes it is in tap.log";
37 else
38         echo "information not in tap.log"
39         echo "failed"
40         echo "> cat logfiles"
41         cat tap.log
42         cat tap.errlog
43         cat fwd.log
44         cat unbound.log
45         echo "Not OK"
46         exit 1
47 fi
48
49 echo "> make 10 queries to spread them over threads"
50 dig @127.0.0.1 -p $UNBOUND_PORT q1.example.net.
51 dig @127.0.0.1 -p $UNBOUND_PORT q2.example.net.
52 dig @127.0.0.1 -p $UNBOUND_PORT q3.example.net.
53 dig @127.0.0.1 -p $UNBOUND_PORT q4.example.net.
54 dig @127.0.0.1 -p $UNBOUND_PORT q5.example.net.
55 dig @127.0.0.1 -p $UNBOUND_PORT q6.example.net.
56 dig @127.0.0.1 -p $UNBOUND_PORT q7.example.net.
57 dig @127.0.0.1 -p $UNBOUND_PORT q8.example.net.
58 dig @127.0.0.1 -p $UNBOUND_PORT q9.example.net.
59 dig @127.0.0.1 -p $UNBOUND_PORT q10.example.net.
60 for x in q1 q2 q3 q4 5 q6 q7 q8 q9 q10; do
61         if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
62         if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
63         if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
64         if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
65         if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 1; fi
66         if grep "$x.example.net" tap.log >/dev/null; then :; else sleep 10; fi
67         if grep "$x.example.net" tap.log; then echo "yes it is in tap.log";
68         else
69                 echo "$x.example.net. information not in tap.log"
70                 echo "failed"
71                 echo "> cat logfiles"
72                 cat tap.log
73                 cat tap.errlog
74                 cat fwd.log
75                 cat unbound.log
76                 echo "Not OK"
77                 exit 1
78         fi
79 done
80
81 echo "> cat logfiles"
82 cat tap.log
83 cat tap.errlog
84 cat fwd.log
85 echo "> OK"
86 exit 0