aboutsummaryrefslogtreecommitdiffstats
path: root/testdata/fwd_oneport.tdir/fwd_oneport.test
blob: f6dfcea91f71e19fd15106e3606b3c87d80c4fb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# #-- fwd_oneport.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test

PRE="../.."
# do the test

# skip the single query test
# so that all three queries get timeouts during the later test.
#
#echo "> dig www1.example.com."
#dig @localhost -p $UNBOUND_PORT www1.example.com. | tee outfile
#echo "> cat logfiles"
#cat fwd.log 
#cat unbound.log
#echo "> check answer for single query"
#if grep "10.20.30.40" outfile; then
	#echo "OK"
#else
	#echo "Not OK"
	#exit 1
#fi

echo "> do queries"
dig @localhost -p $UNBOUND_PORT www1.example.com. >outfile1 &
digpid1=$!
dig @localhost -p $UNBOUND_PORT www2.example.com. >outfile2 &
digpid2=$!
dig @localhost -p $UNBOUND_PORT www3.example.com. >outfile3 &
digpid3=$!
dig @localhost -p $UNBOUND_PORT www4.example.com. >outfile4 &
digpid4=$!
dig @localhost -p $UNBOUND_PORT www5.example.com. >outfile5 &
digpid5=$!
dig @localhost -p $UNBOUND_PORT www6.example.com. >outfile6 &
digpid6=$!
sleep 6
kill -9 $digpid1
kill -9 $digpid2
kill -9 $digpid3
kill -9 $digpid4
kill -9 $digpid5
kill -9 $digpid6

echo "> cat outfile1"
cat outfile1 
echo "> cat outfile2"
cat outfile2 
echo "> cat outfile3"
cat outfile3
echo "> cat outfile4"
cat outfile4
echo "> cat outfile5"
cat outfile5
echo "> cat outfile6"
cat outfile6
echo "> cat logfiles"
cat fwd.log 
cat unbound.log

echo "> check for ID bit collisions"
grep "pending reply" unbound.log > ids
numsend=`cat ids | wc -l`
cat ids | awk '{print $8};' | sort -u > ids2
numuniq=`cat ids2 | wc -l`
if test $numuniq -ne $numsend; then
	echo "got a ID number clash. could not do test, sorry"
	exit 0
fi

echo "> check answers for queries"
if grep "10.20.30.40" outfile1; then
	echo "1 is OK"
else
	echo "1 is not OK"
	exit 1
fi
if grep "10.20.30.50" outfile2; then
	echo "2 is OK"
else
	echo "2 is not OK"
	exit 1
fi
if grep "10.20.30.60" outfile3; then
	echo "3 is OK"
else
	echo "3 is not OK"
	exit 1
fi
if grep "10.20.30.70" outfile4; then
	echo "4 is OK"
else
	echo "4 is not OK"
	exit 1
fi
if grep "10.20.30.80" outfile5; then
	echo "5 is OK"
else
	echo "5 is not OK"
	exit 1
fi
if grep "10.20.30.90" outfile6; then
	echo "6 is OK"
else
	echo "6 is not OK"
	exit 1
fi

exit 0