blob: 8de8977762097b1d180f7b8da6d9eb6614ea8dfe (
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# #-- 08-host-lib.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="../.."
. ../common.sh
if grep FORK $PRE/config.h | grep "define" >/dev/null 2>&1; then
# nothing
:
else
echo "forking is not available; test skipped."
exit 0
fi
# test if fwder is up
echo "> dig @127.0.0.1 -p $FWD_PORT www.example.com | tee outfile"
dig @127.0.0.1 -p $FWD_PORT www.example.com | tee outfile
if grep "10.20.30.40" outfile; then
echo "fwder is up"
else
cat fwd.log
echo "fwder not up"
exit 1
fi
rm outfile
# create asynclook
get_make
echo "> (cd $PRE ; $MAKE asynclook)"
(cd $PRE ; $MAKE asynclook)
if test ! -x $PRE/asynclook; then
echo "cannot build asynclook test program"
exit 1
fi
(cd $PRE ; $MAKE lock-verify)
# check the locks.
function locktest() {
if test -x $PRE/lock-verify -a -f ublocktrace.0; then
$PRE/lock-verify ublocktrace.*
if test $? -ne 0; then
echo "lock-verify error"
exit 1
fi
fi
}
# test hosts reading (directed at local auth info)
echo '> $PRE/asynclook -H 08-host-lib.hosts virtual.virtual.virtual.local 2>&1 | tee outfile'
$PRE/asynclook -H 08-host-lib.hosts virtual.virtual.virtual.local 2>&1 | tee outfile
if grep "virtual.virtual.virtual.local: 10.20.30.40" outfile; then
echo "OK"
else
echo "Not OK"
exit 1
fi
locktest
rm outfile
# test async lookups (directed at testns)
echo '> $PRE/asynclook -f "127.0.0.1@"$FWD_PORT www.example.com 2>&1 | tee outfile'
$PRE/asynclook -f "127.0.0.1@"$FWD_PORT www.example.com 2>&1 | tee outfile
if grep "www.example.com: 10.20.30.40" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
locktest
rm outfile
echo '> $PRE/asynclook -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile'
$PRE/asynclook -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile
if grep "www.example.com: 10.20.30.40" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
if grep "www2.example.com: 10.20.30.42" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
locktest
rm outfile
echo '> $PRE/asynclook -t -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile'
$PRE/asynclook -t -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile
if grep "www.example.com: 10.20.30.40" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
if grep "www2.example.com: 10.20.30.42" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
locktest
rm outfile
# test cancellation
echo '> $PRE/asynclook -c -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile'
$PRE/asynclook -c -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile
if grep "www.example.com: cancelled" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
if grep "www2.example.com: cancelled" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
locktest
rm outfile
echo '> $PRE/asynclook -t -c -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile'
$PRE/asynclook -t -c -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile
if grep "www.example.com: cancelled" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
if grep "www2.example.com: cancelled" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
locktest
rm outfile
# test blocking mode
echo '> $PRE/asynclook -b -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile'
$PRE/asynclook -b -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile
if grep "www.example.com: 10.20.30.40" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
if grep "www2.example.com: 10.20.30.42" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
locktest
rm outfile
echo '> $PRE/asynclook -t -b -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile'
$PRE/asynclook -t -b -f "127.0.0.1@"$FWD_PORT www.example.com www2.example.com 2>&1 | tee outfile
if grep "www.example.com: 10.20.30.40" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
if grep "www2.example.com: 10.20.30.42" outfile; then
echo "OK"
else
cat fwd.log
echo "Not OK"
exit 1
fi
locktest
rm outfile
echo "> cat logfiles"
cat fwd.log
exit 0
|