aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2001-01-25 21:59:59 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2001-01-25 21:59:59 +0000
commit2bb209ab9eb746fdfb9b8f5c83eee12b40fc211e (patch)
treee905c6ad0c4112371ae30d2c608368c8dfe65e6e
parent7096b8df82eebfe857e0043bc8a853353bd78480 (diff)
downloadluasocket-2bb209ab9eb746fdfb9b8f5c83eee12b40fc211e.tar.gz
luasocket-2bb209ab9eb746fdfb9b8f5c83eee12b40fc211e.tar.bz2
luasocket-2bb209ab9eb746fdfb9b8f5c83eee12b40fc211e.zip
Updated for LuaSocket 1.2.
More tests added.
-rw-r--r--test/testclnt.lua787
1 files changed, 428 insertions, 359 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua
index c1c22bd..8a36512 100644
--- a/test/testclnt.lua
+++ b/test/testclnt.lua
@@ -1,359 +1,428 @@
1----------------------------------------------------------------------------- 1-----------------------------------------------------------------------------
2-- LuaSocket automated test module 2-- LuaSocket automated test module
3-- client.lua 3-- client.lua
4-- This is the client module. It connects with the server module and executes 4-- This is the client module. It connects with the server module and executes
5-- all tests. 5-- all tests.
6----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
7 7
8----------------------------------------------------------------------------- 8-----------------------------------------------------------------------------
9-- Prints a header to separate the test phases 9-- Prints a header to separate the test phases
10-- Input 10-- Input
11-- test: test phase name 11-- test: test phase name
12----------------------------------------------------------------------------- 12-----------------------------------------------------------------------------
13function new_test(test) 13function new_test(test)
14 write("----------------------------------------------\n", 14 write("----------------------------------------------\n",
15 test, "\n", 15 test, "\n",
16 "----------------------------------------------\n") 16 "----------------------------------------------\n")
17end 17end
18 18
19----------------------------------------------------------------------------- 19-----------------------------------------------------------------------------
20-- Read command definitions and stablish control connection 20-- Get host and port from command line
21----------------------------------------------------------------------------- 21-----------------------------------------------------------------------------
22new_test("initializing...") 22HOST = "127.0.0.1"
23dofile("command.lua") 23PORT = 2020
24test_debug_mode() 24if arg then
25while control == nil do 25 HOST = arg[1] or HOST
26 print("client: trying control connection...") 26 PORT = arg[2] or PORT
27 control, err = connect(HOST, PORT) 27end
28 if control then 28
29 print("client: control connection stablished!") 29-----------------------------------------------------------------------------
30 else 30-- Read command definitions
31 sleep(2) 31-----------------------------------------------------------------------------
32 end 32assert(dofile("testcmd.lua"))
33end 33test_debug_mode()
34 34
35----------------------------------------------------------------------------- 35-----------------------------------------------------------------------------
36-- Make sure server is ready for data transmission 36-- Start control connection
37----------------------------------------------------------------------------- 37-----------------------------------------------------------------------------
38function sync() 38new_test("initializing...")
39 send_command(SYNC) 39while control == nil do
40 get_command() 40 print("client: trying control connection...")
41end 41 control, err = connect(HOST, PORT)
42 42 if control then
43----------------------------------------------------------------------------- 43 print("client: control connection stablished!")
44-- Close and reopen data connection, to get rid of any unread blocks 44 else
45----------------------------------------------------------------------------- 45 sleep(2)
46function reconnect() 46 end
47 if data then 47end
48 data:close() 48
49 send_command(CLOSE) 49-----------------------------------------------------------------------------
50 data = nil 50-- Make sure server is ready for data transmission
51 end 51-----------------------------------------------------------------------------
52 while data == nil do 52function sync()
53 send_command(CONNECT) 53 send_command(SYNC)
54 data = connect(HOST, PORT) 54 get_command()
55 if not data then 55end
56 print("client: waiting for data connection.") 56
57 sleep(1) 57-----------------------------------------------------------------------------
58 end 58-- Close and reopen data connection, to get rid of any unread blocks
59 end 59-----------------------------------------------------------------------------
60 sync() 60function reconnect()
61end 61 if data then
62 62 close(data)
63----------------------------------------------------------------------------- 63 send_command(CLOSE)
64-- Tests the command connection 64 data = nil
65----------------------------------------------------------------------------- 65 end
66function test_command(cmd, par) 66 while data == nil do
67 local cmd_back, par_back 67 send_command(CONNECT)
68 reconnect() 68 data = connect(HOST, PORT)
69 send_command(COMMAND) 69 if not data then
70 write("testing command ") 70 print("client: waiting for data connection.")
71 print_command(cmd, par) 71 sleep(1)
72 send_command(cmd, par) 72 end
73 cmd_back, par_back = get_command() 73 end
74 if cmd_back ~= cmd or par_back ~= par then 74 sync()
75 fail(cmd) 75end
76 else 76
77 pass() 77-----------------------------------------------------------------------------
78 end 78-- Tests the command connection
79end 79-----------------------------------------------------------------------------
80 80function test_command(cmd, par)
81----------------------------------------------------------------------------- 81 local cmd_back, par_back
82-- Tests ASCII line transmission 82 reconnect()
83-- Input 83 send_command(COMMAND)
84-- len: length of line to be tested 84 write("testing command ")
85----------------------------------------------------------------------------- 85 print_command(cmd, par)
86function test_asciiline(len) 86 send_command(cmd, par)
87 local str, str10, back, err 87 cmd_back, par_back = get_command()
88 reconnect() 88 if cmd_back ~= cmd or par_back ~= par then
89 send_command(ECHO_LINE) 89 fail(cmd)
90 str = strrep("x", mod(len, 10)) 90 else
91 str10 = strrep("aZb.c#dAe?", floor(len/10)) 91 pass()
92 str = str .. str10 92 end
93 write("testing ", len, " byte(s) line\n") 93end
94 err = data:send(str, "\n") 94
95 if err then fail(err) end 95-----------------------------------------------------------------------------
96 back, err = data:receive() 96-- Tests ASCII line transmission
97 if err then fail(err) end 97-- Input
98 if back == str then pass("lines match") 98-- len: length of line to be tested
99 else fail("lines don't match") end 99-----------------------------------------------------------------------------
100end 100function test_asciiline(len)
101 101 local str, str10, back, err
102----------------------------------------------------------------------------- 102 reconnect()
103-- Tests closed connection detection 103 send_command(ECHO_LINE)
104----------------------------------------------------------------------------- 104 str = strrep("x", mod(len, 10))
105function test_closed() 105 str10 = strrep("aZb.c#dAe?", floor(len/10))
106 local str = "This is our little test line" 106 str = str .. str10
107 local len = strlen(str) 107 write("testing ", len, " byte(s) line\n")
108 local back, err, total 108 err = send(data, str, "\n")
109 reconnect() 109 if err then fail(err) end
110 print("testing close while reading line") 110 back, err = receive(data)
111 send_command(ECHO_BLOCK, len) 111 if err then fail(err) end
112 data:send(str) 112 if back == str then pass("lines match")
113 send_command(CLOSE) 113 else fail("lines don't match") end
114 -- try to get a line 114end
115 back, err = data:receive() 115
116 if not err then fail("shold have gotten 'closed'.") 116-----------------------------------------------------------------------------
117 elseif err ~= "closed" then fail("got '"..err.."' instead of 'closed'.") 117-- Tests closed connection detection
118 elseif str ~= back then fail("didn't receive what i should 'closed'.") 118-----------------------------------------------------------------------------
119 else pass("rightfull 'closed' received") end 119function test_closed()
120 reconnect() 120 local str = "This is our little test line"
121 print("testing close while reading block") 121 local len = strlen(str)
122 send_command(ECHO_BLOCK, len) 122 local back, err, total
123 data:send(str) 123 reconnect()
124 send_command(CLOSE) 124 print("testing close while reading line")
125 -- try to get a line 125 send_command(ECHO_BLOCK, len)
126 back, err = data:receive(2*len) 126 send(data, str)
127 if not err then fail("shold have gotten 'closed'.") 127 send_command(CLOSE)
128 elseif err ~= "closed" then fail("got '"..err.."' instead of 'closed'.") 128 -- try to get a line
129 elseif str ~= back then fail("didn't receive what I should.") 129 back, err = receive(data)
130 else pass("rightfull 'closed' received") end 130 if not err then fail("shold have gotten 'closed'.")
131end 131 elseif err ~= "closed" then fail("got '"..err.."' instead of 'closed'.")
132 132 elseif str ~= back then fail("didn't receive what i should 'closed'.")
133----------------------------------------------------------------------------- 133 else pass("rightfull 'closed' received") end
134-- Tests binary line transmission 134 reconnect()
135-- Input 135 print("testing close while reading block")
136-- len: length of line to be tested 136 send_command(ECHO_BLOCK, len)
137----------------------------------------------------------------------------- 137 send(data, str)
138function test_rawline(len) 138 send_command(CLOSE)
139 local str, str10, back, err 139 -- try to get a line
140 reconnect() 140 back, err = receive(data, 2*len)
141 send_command(ECHO_LINE) 141 if not err then fail("shold have gotten 'closed'.")
142 str = strrep(strchar(47), mod(len, 10)) 142 elseif err ~= "closed" then fail("got '"..err.."' instead of 'closed'.")
143 str10 = strrep(strchar(120,21,77,4,5,0,7,36,44,100), floor(len/10)) 143 elseif str ~= back then fail("didn't receive what I should.")
144 str = str .. str10 144 else pass("rightfull 'closed' received") end
145 write("testing ", len, " byte(s) line\n") 145end
146 err = data:send(str, "\n") 146
147 if err then fail(err) end 147-----------------------------------------------------------------------------
148 back, err = data:receive() 148-- Tests binary line transmission
149 if err then fail(err) end 149-- Input
150 if back == str then pass("lines match") 150-- len: length of line to be tested
151 else fail("lines don't match") end 151-----------------------------------------------------------------------------
152end 152function test_rawline(len)
153 153 local str, str10, back, err
154----------------------------------------------------------------------------- 154 reconnect()
155-- Tests block transmission 155 send_command(ECHO_LINE)
156-- Input 156 str = strrep(strchar(47), mod(len, 10))
157-- len: length of block to be tested 157 str10 = strrep(strchar(120,21,77,4,5,0,7,36,44,100), floor(len/10))
158----------------------------------------------------------------------------- 158 str = str .. str10
159function test_block(len) 159 write("testing ", len, " byte(s) line\n")
160 local half = floor(len/2) 160 err = send(data, str, "\n")
161 local s1, s2, back, err 161 if err then fail(err) end
162 reconnect() 162 back, err = receive(data)
163 send_command(ECHO_BLOCK, len) 163 if err then fail(err) end
164 write("testing ", len, " byte(s) block\n") 164 if back == str then pass("lines match")
165 s1 = strrep("x", half) 165 else fail("lines don't match") end
166 err = data:send(s1) 166end
167 if err then fail(err) end 167
168 sleep(1) 168-----------------------------------------------------------------------------
169 s2 = strrep("y", len-half) 169-- Tests block transmission
170 err = data:send(s2) 170-- Input
171 if err then fail(err) end 171-- len: length of block to be tested
172 back, err = data:receive(len) 172-----------------------------------------------------------------------------
173 if err then fail(err) end 173function test_block(len)
174 if back == s1..s2 then pass("blocks match") 174 local half = floor(len/2)
175 else fail("blocks don't match") end 175 local s1, s2, back, err
176end 176 reconnect()
177 177 send_command(ECHO_BLOCK, len)
178----------------------------------------------------------------------------- 178 write("testing ", len, " byte(s) block\n")
179-- Tests if return-timeout was respected 179 s1 = strrep("x", half)
180-- delta: time elapsed during transfer 180 err = send(data, s1)
181-- t: timeout value 181 if err then fail(err) end
182-- err: error code returned by I/O operation 182 s2 = strrep("y", len-half)
183----------------------------------------------------------------------------- 183 err = send(data, s2)
184function returntimed_out(delta, t, err) 184 if err then fail(err) end
185 if err == "timeout" then 185 back, err = receive(data, len)
186 if delta + 0.1 >= t then 186 if err then fail(err) end
187 pass("got right timeout") 187 if back == s1..s2 then pass("blocks match")
188 return 1 188 else fail("blocks don't match") end
189 else 189end
190 fail("shouldn't have gotten timeout") 190
191 end 191-----------------------------------------------------------------------------
192 elseif delta > t then 192-- Tests if return-timeout was respected
193 fail("should have gotten timeout") 193-- delta: time elapsed during transfer
194 end 194-- t: timeout value
195end 195-- s: time server slept
196 196-- err: error code returned by I/O operation
197----------------------------------------------------------------------------- 197-- o: operation being executed
198-- Tests if return-timeout was respected 198-----------------------------------------------------------------------------
199-- delta: time elapsed during transfer 199function blockedtimed_out(t, s, err, o)
200-- t: timeout value 200 if err == "timeout" then
201-- err: error code returned by I/O operation 201 if s >= t then
202-- o: operation being executed 202 pass("got rightfull forced timeout")
203----------------------------------------------------------------------------- 203 return 1
204function blockedtimed_out(t, s, err, o) 204 else
205 if err == "timeout" then 205 pass("got natural cause timeout")
206 if s >= t then 206 return 1
207 pass("got right forced timeout") 207 end
208 return 1 208 elseif 0.9*s > t then
209 else 209 if o == "send" then
210 pass("got natural cause timeout (may be wrong)") 210 pass("must have been buffered (may be wrong)")
211 return 1 211 else
212 end 212 fail("should have gotten timeout")
213 elseif s > t then 213 end
214 if o == "send" then 214 end
215 pass("must have been buffered (may be wrong)") 215end
216 else 216
217 fail("should have gotten timeout") 217-----------------------------------------------------------------------------
218 end 218-- Tests blocked-timeout conformance
219 end 219-- Input
220end 220-- len: length of block to be tested
221 221-- t: timeout value
222----------------------------------------------------------------------------- 222-- s: server sleep between transfers
223-- Tests blocked-timeout conformance 223-----------------------------------------------------------------------------
224-- Input 224function test_blockedtimeout(len, t, s)
225-- len: length of block to be tested 225 local str, err, back, total
226-- t: timeout value 226 reconnect()
227-- s: server sleep between transfers 227 send_command(RECEIVE_BLOCK, len)
228----------------------------------------------------------------------------- 228 send_command(SLEEP, s)
229function test_blockedtimeout(len, t, s) 229 send_command(RECEIVE_BLOCK, len)
230 local str, err, back, total 230 write("testing ", len, " bytes, ", t,
231 reconnect() 231 "s block timeout, ", s, "s sleep\n")
232 send_command(RECEIVE_BLOCK, len) 232 timeout(data, t)
233 send_command(SLEEP, s) 233 str = strrep("a", 2*len)
234 send_command(RECEIVE_BLOCK, len) 234 err, total = send(data, str)
235 write("testing ", len, " bytes, ", t, 235 if blockedtimed_out(t, s, err, "send") then return end
236 "s block timeout, ", s, "s sleep\n") 236 if err then fail(err) end
237 data:timeout(t) 237 send_command(SEND_BLOCK)
238 str = strrep("a", 2*len) 238 send_command(SLEEP, s)
239 err, total = data:send(str) 239 send_command(SEND_BLOCK)
240 if blockedtimed_out(t, s, err, "send") then return end 240 back, err = receive(data, 2*len)
241 if err then fail(err) end 241 if blockedtimed_out(t, s, err, "receive") then return end
242 send_command(SEND_BLOCK) 242 if err then fail(err) end
243 send_command(SLEEP, s) 243 if back == str then pass("blocks match")
244 send_command(SEND_BLOCK) 244 else fail("blocks don't match") end
245 back, err = data:receive(2*len) 245end
246 if blockedtimed_out(t, s, err, "receive") then return end 246
247 if err then fail(err) end 247-----------------------------------------------------------------------------
248 if back == str then pass("blocks match") 248-- Tests if return-timeout was respected
249 else fail("blocks don't match") end 249-- delta: time elapsed during transfer
250end 250-- t: timeout value
251 251-- err: error code returned by I/O operation
252----------------------------------------------------------------------------- 252-----------------------------------------------------------------------------
253-- Tests return-timeout conformance 253function returntimed_out(delta, t, err)
254-- Input 254 if err == "timeout" then
255-- len: length of block to be tested 255 if 1.1*delta >= t then
256-- t: timeout value 256 pass("got rightfull timeout")
257-- s: server sleep between transfers 257 return 1
258----------------------------------------------------------------------------- 258 else
259function test_returntimeout(len, t, s) 259 fail("shouldn't have gotten timeout")
260 local str, err, back, delta, total 260 end
261 reconnect() 261 elseif 0.9*delta > t then
262 send_command(RECEIVE_BLOCK, len) 262 fail("should have gotten timeout")
263 send_command(SLEEP, s) 263 end
264 send_command(RECEIVE_BLOCK, len) 264end
265 write("testing ", len, " bytes, ", t, 265
266 "s return timeout, ", s, "s sleep\n") 266-----------------------------------------------------------------------------
267 data:timeout(t, "return") 267-- Tests return-timeout conformance
268 str = strrep("a", 2*len) 268-- Input
269 err, total, delta = data:send(str) 269-- len: length of block to be tested
270 print("delta: " .. delta) 270-- t: timeout value
271 if returntimed_out(delta, t, err) then return end 271-- s: server sleep between transfers
272 if err then fail(err) end 272-----------------------------------------------------------------------------
273 send_command(SEND_BLOCK) 273function test_returntimeout(len, t, s)
274 send_command(SLEEP, s) 274 local str, err, back, delta, total
275 send_command(SEND_BLOCK) 275 reconnect()
276 back, err, delta = data:receive(2*len) 276 send_command(RECEIVE_BLOCK, len)
277 print("delta: " .. delta) 277 send_command(SLEEP, s)
278 if returntimed_out(delta, t, err) then return end 278 send_command(RECEIVE_BLOCK, len)
279 if err then fail(err) end 279 write("testing ", len, " bytes, ", t,
280 if back == str then pass("blocks match") 280 "s return timeout, ", s, "s sleep\n")
281 else fail("blocks don't match") end 281 timeout(data, t, "return")
282end 282 str = strrep("a", 2*len)
283 283 err, total, delta = send(data, str)
284----------------------------------------------------------------------------- 284 print("sent in " .. delta .. "s")
285-- Execute all tests 285 if returntimed_out(delta, t, err) then return end
286----------------------------------------------------------------------------- 286 if err then fail("unexpected error: " .. err) end
287new_test("control connection test") 287 send_command(SEND_BLOCK)
288test_command(EXIT) 288 send_command(SLEEP, s)
289test_command(CONNECT) 289 send_command(SEND_BLOCK)
290test_command(CLOSE) 290 back, err, delta = receive(data, 2*len)
291test_command(ECHO_BLOCK, 12234) 291 print("received in " .. delta .. "s")
292test_command(SLEEP, 1111) 292 if returntimed_out(delta, t, err) then return end
293test_command(ECHO_LINE) 293 if err then fail("unexpected error: " .. err) end
294 294 if back == str then pass("blocks match")
295new_test("connection close test") 295 else fail("blocks don't match") end
296test_closed() 296end
297 297
298new_test("binary string test") 298-----------------------------------------------------------------------------
299test_rawline(1) 299-- Tests return-timeout conformance
300test_rawline(17) 300-----------------------------------------------------------------------------
301test_rawline(200) 301function test_patterns()
302test_rawline(3000) 302 local dos_line1 = "this the first dos line"
303test_rawline(8000) 303 local dos_line2 = "this is another dos line"
304test_rawline(40000) 304 local unix_line1 = "this the first unix line"
305 305 local unix_line2 = "this is another unix line"
306new_test("blocking transfer test") 306 local block = dos_line1 .. "\r\n" .. dos_line2 .. "\r\n"
307test_block(1) 307 reconnect()
308test_block(17) 308 block = block .. unix_line1 .. "\n" .. unix_line2 .. "\n"
309test_block(200) 309 block = block .. block
310test_block(3000) 310 send_command(ECHO_BLOCK, strlen(block))
311test_block(80000) 311 err = send(data, block)
312test_block(800000) 312 if err then fail(err) end
313 313 local back = receive(data, "*l")
314new_test("non-blocking transfer test") 314 if back ~= dos_line1 then fail("'*l' failed") end
315-- the value is not important, we only want 315 back = receive(data, "*l")
316-- to test non-blockin I/O anyways 316 if back ~= dos_line2 then fail("'*l' failed") end
317data:timeout(200) 317 back = receive(data, "*lu")
318test_block(1) 318 if back ~= unix_line1 then fail("'*lu' failed") end
319test_block(17) 319 back = receive(data, "*lu")
320test_block(200) 320 if back ~= unix_line2 then fail("'*lu' failed") end
321test_block(3000) 321 back = receive(data)
322test_block(80000) 322 if back ~= dos_line1 then fail("default failed") end
323test_block(800000) 323 back = receive(data)
324test_block(8000000) 324 if back ~= dos_line2 then fail("default failed") end
325 325 back = receive(data, "*lu")
326new_test("character string test") 326 if back ~= unix_line1 then fail("'*lu' failed") end
327test_asciiline(1) 327 back = receive(data, "*lu")
328test_asciiline(17) 328 if back ~= unix_line2 then fail("'*lu' failed") end
329test_asciiline(200) 329 pass("line patterns are ok")
330test_asciiline(3000) 330 send_command(ECHO_BLOCK, strlen(block))
331test_asciiline(8000) 331 err = send(data, block)
332test_asciiline(40000) 332 if err then fail(err) end
333 333 back = receive(data, strlen(block))
334new_test("return timeout test") 334 if back ~= block then fail("number failed") end
335test_returntimeout(80, .5, 1) 335 pass("number is ok")
336test_returntimeout(80, 1, 0.5) 336 send_command(ECHO_BLOCK, strlen(block))
337test_returntimeout(8000, .5, 0) 337 send_command(SLEEP, 1)
338test_returntimeout(80000, .5, 0) 338 send_command(CLOSE)
339test_returntimeout(800000, .5, 0) 339 err = send(data, block)
340 340 if err then fail(err) end
341new_test("blocked timeout test") 341 back = receive(data, "*a")
342test_blockedtimeout(80, .5, 1) 342 if back ~= block then fail("'*a' failed") end
343test_blockedtimeout(80, 1, 1) 343 pass("'*a' is ok")
344test_blockedtimeout(80, 1.5, 1) 344end
345test_blockedtimeout(800, 1, 0) 345
346test_blockedtimeout(8000, 1, 0) 346-----------------------------------------------------------------------------
347test_blockedtimeout(80000, 1, 0) 347-- Execute all tests
348test_blockedtimeout(800000, 1, 0) 348-----------------------------------------------------------------------------
349 349start = time()
350----------------------------------------------------------------------------- 350
351-- Close connection and exit server. We are done. 351new_test("control connection test")
352----------------------------------------------------------------------------- 352test_command(EXIT)
353new_test("the library has passed all tests") 353test_command(CONNECT)
354print("client: closing connection with server") 354test_command(CLOSE)
355send_command(CLOSE) 355test_command(ECHO_BLOCK, 12234)
356send_command(EXIT) 356test_command(SLEEP, 1111)
357control:close() 357test_command(ECHO_LINE)
358print("client: exiting...") 358
359exit() 359new_test("connection close test")
360test_closed()
361
362new_test("read pattern test")
363test_patterns()
364
365new_test("character string test")
366test_asciiline(1)
367test_asciiline(17)
368test_asciiline(200)
369test_asciiline(3000)
370test_asciiline(80000)
371test_asciiline(800000)
372
373new_test("binary string test")
374test_rawline(1)
375test_rawline(17)
376test_rawline(200)
377test_rawline(3000)
378test_rawline(8000)
379test_rawline(80000)
380test_rawline(800000)
381
382new_test("blocking transfer test")
383test_block(1)
384test_block(17)
385test_block(200)
386test_block(3000)
387test_block(80000)
388test_block(800000)
389
390new_test("non-blocking transfer test")
391-- the value is not important, we only want
392-- to test non-blockin I/O anyways
393timeout(data, 200)
394test_block(1)
395test_block(17)
396test_block(200)
397test_block(3000)
398test_block(80000)
399test_block(800000)
400
401new_test("blocked timeout test")
402test_blockedtimeout(80, .5, 1)
403test_blockedtimeout(80, 1, 1)
404test_blockedtimeout(80, 1.5, 1)
405test_blockedtimeout(800, 1, 0)
406test_blockedtimeout(8000, 1, 1.5)
407test_blockedtimeout(80000, 1, 0)
408test_blockedtimeout(800000, 0.01, 0)
409
410new_test("return timeout test")
411test_returntimeout(80, 1, 0.5)
412test_returntimeout(80, 0.5, 1)
413test_returntimeout(8000, .5, 1)
414test_returntimeout(80000, 1, 0.5)
415test_returntimeout(800000, 1, 0.5)
416
417-----------------------------------------------------------------------------
418-- Close connection and exit server. We are done.
419-----------------------------------------------------------------------------
420print("client: closing connection with server")
421send_command(CLOSE)
422send_command(EXIT)
423close(control)
424
425new_test("the library has passed all tests")
426print(format("time elapsed: %6.2fs", time() - start))
427print("client: exiting...")
428exit()