]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/dnscrypt_queries_chacha.tdir/dnscrypt_queries_chacha.test
Vendor import of Unbound 1.6.6.
[FreeBSD/FreeBSD.git] / testdata / dnscrypt_queries_chacha.tdir / dnscrypt_queries_chacha.test
1 # #-- dnscrypt_queries_chacha.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 # Check if we can run the test.
10 . ./precheck.sh
11
12 # do the test
13 for opt in '' '+tcp'
14 do
15     echo "> do queries ${opt}"
16     dig @127.0.0.1 ${opt} -p $PROXY_PORT www1.example.com. >outfile1 &
17     digpid1=$!
18     dig @127.0.0.1 ${opt} -p $PROXY_PORT www2.example.com. >outfile2 &
19     digpid2=$!
20     dig @127.0.0.1 ${opt} -p $PROXY_PORT www3.example.com. >outfile3 &
21     digpid3=$!
22     dig @127.0.0.1 ${opt} -p $PROXY_PORT www4.example.com. >outfile4 &
23     digpid4=$!
24     dig @127.0.0.1 ${opt} -p $PROXY_PORT www5.example.com. >outfile5 &
25     digpid5=$!
26     dig @127.0.0.1 ${opt} -p $PROXY_PORT www6.example.com. >outfile6 &
27     digpid6=$!
28     sleep 1
29     kill -9 $digpid1
30     kill -9 $digpid2
31     kill -9 $digpid3
32     kill -9 $digpid4
33     kill -9 $digpid5
34     kill -9 $digpid6
35
36     echo "> cat outfile1"
37     cat outfile1 
38     echo "> cat outfile2"
39     cat outfile2 
40     echo "> cat outfile3"
41     cat outfile3
42     echo "> cat outfile4"
43     cat outfile4
44     echo "> cat outfile5"
45     cat outfile5
46     echo "> cat outfile6"
47     cat outfile6
48     echo "> cat logfiles"
49     cat fwd.log 
50     cat unbound.log
51
52     echo "> check for ID bit collisions"
53     grep "pending reply" unbound.log > ids
54     numsend=`cat ids | wc -l`
55     cat ids | awk '{print $8};' | sort -u > ids2
56     numuniq=`cat ids2 | wc -l`
57     if test $numuniq -ne $numsend; then
58         echo "got a ID number clash. could not do test, sorry"
59         exit 0
60     fi
61
62     echo "> check answers for queries"
63     if grep "10.20.30.40" outfile1; then
64         echo "1 is OK"
65     else
66         echo "1 is not OK"
67         exit 1
68     fi
69     if grep "10.20.30.50" outfile2; then
70         echo "2 is OK"
71     else
72         echo "2 is not OK"
73         exit 1
74     fi
75     if grep "10.20.30.60" outfile3; then
76         echo "3 is OK"
77     else
78         echo "3 is not OK"
79         exit 1
80     fi
81     if grep "10.20.30.70" outfile4; then
82         echo "4 is OK"
83     else
84         echo "4 is not OK"
85         exit 1
86     fi
87     if grep "10.20.30.80" outfile5; then
88         echo "5 is OK"
89     else
90         echo "5 is not OK"
91         exit 1
92     fi
93     if grep "10.20.30.90" outfile6; then
94         echo "6 is OK"
95     else
96         echo "6 is not OK"
97         exit 1
98     fi
99 done
100
101 exit 0