Debian Codegraph @

texk/web2c/luatexdir/luasocket/test/testclnt.lua

raw symbols SCIP
1 local socket = require"socket"
2
3 host = host or "localhost"
4 port = port or "8383"
5
6 function printf(...)
7 io.stderr:write(string.format(...))
8 end
9
10 function pass(...)
11 printf(...)
12 io.stderr:write("\n")
13 end
14
15 function fail(...)
16 io.stderr:write("ERROR: ")
17 printf(...)
18 io.stderr:write("!\n")
19 os.exit()
20 end
21
22 function warn(...)
23 local s = string.format(...)
24 io.stderr:write("WARNING: ", s, "\n")
25 end
26
27 function remote(...)
28 local s = string.format(...)
29 s = string.gsub(s, "\n", ";")
30 s = string.gsub(s, "%s+", " ")
31 s = string.gsub(s, "^%s*", "")
32 control:send(s .. "\n")
33 control:receive()
34 end
35
36 function test(test)
37 io.stderr:write("----------------------------------------------\n",
38 "testing: ", test, "\n",
39 "----------------------------------------------\n")
40 end
41
42 function check_timeout(tm, sl, elapsed, err, opp, mode, alldone)
43 if tm < sl then
44 if opp == "send" then
45 if not err then warn("must be buffered")
46 elseif err == "timeout" then pass("proper timeout")
47 else fail("unexpected error '%s'", err) end
48 else
49 if err ~= "timeout" then fail("should have timed out")
50 else pass("proper timeout") end
51 end
52 else
53 if mode == "total" then
54 if elapsed > tm then
55 if err ~= "timeout" then fail("should have timed out")
56 else pass("proper timeout") end
57 elseif elapsed < tm then
58 if err then fail(err)
59 else pass("ok") end
60 else
61 if alldone then
62 if err then fail("unexpected error '%s'", err)
63 else pass("ok") end
64 else
65 if err ~= "timeout" then fail(err)
66 else pass("proper timeoutk") end
67 end
68 end
69 else
70 if err then fail(err)
71 else pass("ok") end
72 end
73 end
74 end
75
76 if not socket._DEBUG then
77 fail("Please define LUASOCKET_DEBUG and recompile LuaSocket")
78 end
79
80 io.stderr:write("----------------------------------------------\n",
81 "LuaSocket Test Procedures\n",
82 "----------------------------------------------\n")
83
84 start = socket.gettime()
85
86 function reconnect()
87 if data then data:close() end
88 remote [[
89 if data then data:close() data = nil end
90 data = server:accept()
91 data:setoption("tcp-nodelay", true)
92 ]]
93 data, err = socket.connect(host, port)
94 if not data then fail(err) end
95 data:setoption("tcp-nodelay", true)
96 end
97
98 printf("attempting control connection...")
99 control, err = socket.connect(host, port)
100 if err then fail(err)
101 else pass("connected!") end
102 control:setoption("tcp-nodelay", true)
103
104 ------------------------------------------------------------------------
105 function test_methods(sock, methods)
106 for _, v in pairs(methods) do
107 if type(sock[v]) ~= "function" then
108 fail(sock.class .. " method '" .. v .. "' not registered")
109 end
110 end
111 pass(sock.class .. " methods are ok")
112 end
113
114 ------------------------------------------------------------------------
115 function test_mixed(len)
116 reconnect()
117 io.stderr:write("length " .. len .. ": ")
118 local inter = math.ceil(len/4)
119 local p1 = "unix " .. string.rep("x", inter) .. "line\n"
120 local p2 = "dos " .. string.rep("y", inter) .. "line\r\n"
121 local p3 = "raw " .. string.rep("z", inter) .. "bytes"
122 local p4 = "end" .. string.rep("w", inter) .. "bytes"
123 local bp1, bp2, bp3, bp4
124 remote (string.format("str = data:receive(%d)",
125 string.len(p1)+string.len(p2)+string.len(p3)+string.len(p4)))
126 sent, err = data:send(p1..p2..p3..p4)
127 if err then fail(err) end
128 remote "data:send(str); data:close()"
129 bp1, err = data:receive()
130 if err then fail(err) end
131 bp2, err = data:receive()
132 if err then fail(err) end
133 bp3, err = data:receive(string.len(p3))
134 if err then fail(err) end
135 bp4, err = data:receive("*a")
136 if err then fail(err) end
137 if bp1.."\n" == p1 and bp2.."\r\n" == p2 and bp3 == p3 and bp4 == p4 then
138 pass("patterns match")
139 else fail("patterns don't match") end
140 end
141
142 ------------------------------------------------------------------------
143 if not math.mod then
144 math.mod = math.fmod
145 end
146 function test_asciiline(len)
147 reconnect()
148 io.stderr:write("length " .. len .. ": ")
149 local str, str10, back, err
150 str = string.rep("x", math.mod(len, 10))
151 str10 = string.rep("aZb.c#dAe?", math.floor(len/10))
152 str = str .. str10
153 remote "str = data:receive()"
154 sent, err = data:send(str.."\n")
155 if err then fail(err) end
156 remote "data:send(str ..'\\n')"
157 back, err = data:receive()
158 if err then fail(err) end
159 if back == str then pass("lines match")
160 else fail("lines don't match") end
161 end
162
163 ------------------------------------------------------------------------
164 function test_rawline(len)
165 reconnect()
166 io.stderr:write("length " .. len .. ": ")
167 local str, str10, back, err
168 str = string.rep(string.char(47), math.mod(len, 10))
169 str10 = string.rep(string.char(120,21,77,4,5,0,7,36,44,100),
170 math.floor(len/10))
171 str = str .. str10
172 remote "str = data:receive()"
173 sent, err = data:send(str.."\n")
174 if err then fail(err) end
175 remote "data:send(str..'\\n')"
176 back, err = data:receive()
177 if err then fail(err) end
178 if back == str then pass("lines match")
179 else fail("lines don't match") end
180 end
181
182 ------------------------------------------------------------------------
183 function test_raw(len)
184 reconnect()
185 io.stderr:write("length " .. len .. ": ")
186 local half = math.floor(len/2)
187 local s1, s2, back, err
188 s1 = string.rep("x", half)
189 s2 = string.rep("y", len-half)
190 remote (string.format("str = data:receive(%d)", len))
191 sent, err = data:send(s1)
192 if err then fail(err) end
193 sent, err = data:send(s2)
194 if err then fail(err) end
195 remote "data:send(str)"
196 back, err = data:receive(len)
197 if err then fail(err) end
198 if back == s1..s2 then pass("blocks match")
199 else fail("blocks don't match") end
200 end
201
202 ------------------------------------------------------------------------
203 function test_totaltimeoutreceive(len, tm, sl)
204 reconnect()
205 local str, err, partial
206 printf("%d bytes, %ds total timeout, %ds pause: ", len, tm, sl)
207 remote (string.format ([[
208 data:settimeout(%d)
209 str = string.rep('a', %d)
210 data:send(str)
211 print('server: sleeping for %ds')
212 socket.sleep(%d)
213 print('server: woke up')
214 data:send(str)
215 ]], 2*tm, len, sl, sl))
216 data:settimeout(tm, "total")
217 local t = socket.gettime()
218 str, err, partial, elapsed = data:receive(2*len)
219 check_timeout(tm, sl, elapsed, err, "receive", "total",
220 string.len(str or partial) == 2*len)
221 end
222
223 ------------------------------------------------------------------------
224 function test_totaltimeoutsend(len, tm, sl)
225 reconnect()
226 local str, err, total
227 printf("%d bytes, %ds total timeout, %ds pause: ", len, tm, sl)
228 remote (string.format ([[
229 data:settimeout(%d)
230 str = data:receive(%d)
231 print('server: sleeping for %ds')
232 socket.sleep(%d)
233 print('server: woke up')
234 str = data:receive(%d)
235 ]], 2*tm, len, sl, sl, len))
236 data:settimeout(tm, "total")
237 str = string.rep("a", 2*len)
238 total, err, partial, elapsed = data:send(str)
239 check_timeout(tm, sl, elapsed, err, "send", "total",
240 total == 2*len)
241 end
242
243 ------------------------------------------------------------------------
244 function test_blockingtimeoutreceive(len, tm, sl)
245 reconnect()
246 local str, err, partial
247 printf("%d bytes, %ds blocking timeout, %ds pause: ", len, tm, sl)
248 remote (string.format ([[
249 data:settimeout(%d)
250 str = string.rep('a', %d)
251 data:send(str)
252 print('server: sleeping for %ds')
253 socket.sleep(%d)
254 print('server: woke up')
255 data:send(str)
256 ]], 2*tm, len, sl, sl))
257 data:settimeout(tm)
258 str, err, partial, elapsed = data:receive(2*len)
259 check_timeout(tm, sl, elapsed, err, "receive", "blocking",
260 string.len(str or partial) == 2*len)
261 end
262
263 ------------------------------------------------------------------------
264 function test_blockingtimeoutsend(len, tm, sl)
265 reconnect()
266 local str, err, total
267 printf("%d bytes, %ds blocking timeout, %ds pause: ", len, tm, sl)
268 remote (string.format ([[
269 data:settimeout(%d)
270 str = data:receive(%d)
271 print('server: sleeping for %ds')
272 socket.sleep(%d)
273 print('server: woke up')
274 str = data:receive(%d)
275 ]], 2*tm, len, sl, sl, len))
276 data:settimeout(tm)
277 str = string.rep("a", 2*len)
278 total, err, partial, elapsed = data:send(str)
279 check_timeout(tm, sl, elapsed, err, "send", "blocking",
280 total == 2*len)
281 end
282
283 ------------------------------------------------------------------------
284 function empty_connect()
285 printf("empty connect: ")
286 reconnect()
287 if data then data:close() data = nil end
288 remote [[
289 if data then data:close() data = nil end
290 data = server:accept()
291 ]]
292 data, err = socket.connect("", port)
293 if not data then
294 pass("ok")
295 data = socket.connect(host, port)
296 else
297 pass("gethostbyname returns localhost on empty string...")
298 end
299 end
300
301 ------------------------------------------------------------------------
302 function isclosed(c)
303 return c:getfd() == -1 or c:getfd() == (2^32-1)
304 end
305
306 function active_close()
307 local tcp = socket.tcp4()
308 if isclosed(tcp) then fail("should not be closed") end
309 tcp:close()
310 if not isclosed(tcp) then fail("should be closed") end
311 tcp = socket.tcp()
312 if not isclosed(tcp) then fail("should be closed") end
313 tcp = nil
314 local udp = socket.udp4()
315 if isclosed(udp) then fail("should not be closed") end
316 udp:close()
317 if not isclosed(udp) then fail("should be closed") end
318 udp = socket.udp()
319 if not isclosed(udp) then fail("should be closed") end
320 udp = nil
321 pass("ok")
322 end
323
324 ------------------------------------------------------------------------
325 function test_closed()
326 local back, partial, err
327 local str = 'little string'
328 reconnect()
329 printf("trying read detection: ")
330 remote (string.format ([[
331 data:send('%s')
332 data:close()
333 data = nil
334 ]], str))
335 -- try to get a line
336 back, err, partial = data:receive()
337 if not err then fail("should have gotten 'closed'.")
338 elseif err ~= "closed" then fail("got '"..err.."' instead of 'closed'.")
339 elseif str ~= partial then fail("didn't receive partial result.")
340 else pass("graceful 'closed' received") end
341 reconnect()
342 printf("trying write detection: ")
343 remote [[
344 data:close()
345 data = nil
346 ]]
347 total, err, partial = data:send(string.rep("ugauga", 100000))
348 if not err then
349 pass("failed: output buffer is at least %d bytes long!", total)
350 elseif err ~= "closed" then
351 fail("got '"..err.."' instead of 'closed'.")
352 else
353 pass("graceful 'closed' received after %d bytes were sent", partial)
354 end
355 end
356
357 ------------------------------------------------------------------------
358 function test_selectbugs()
359 local r, s, e = socket.select(nil, nil, 0.1)
360 assert(type(r) == "table" and type(s) == "table" and
361 (e == "timeout" or e == "error"))
362 pass("both nil: ok")
363 local udp = socket.udp()
364 udp:close()
365 r, s, e = socket.select({ udp }, { udp }, 0.1)
366 assert(type(r) == "table" and type(s) == "table" and
367 (e == "timeout" or e == "error"))
368 pass("closed sockets: ok")
369 e = pcall(socket.select, "wrong", 1, 0.1)
370 assert(e == false, tostring(e))
371 e = pcall(socket.select, {}, 1, 0.1)
372 assert(e == false, tostring(e))
373 pass("invalid input: ok")
374 local toomany = {}
375 for i = 1, socket._SETSIZE+1 do
376 toomany[#toomany+1] = socket.udp4()
377 end
378 if #toomany > socket._SETSIZE then
379 local e = pcall(socket.select, toomany, nil, 0.1)
380 assert(e == false, tostring(e))
381 pass("too many sockets (" .. #toomany .. "): ok")
382 else
383 pass("unable to create enough sockets (max was "..#toomany..")")
384 pass("try using ulimit")
385 end
386 for _, c in ipairs(toomany) do c:close() end
387 end
388
389 ------------------------------------------------------------------------
390 function accept_timeout()
391 printf("accept with timeout (if it hangs, it failed): ")
392 local s, e = socket.bind("*", 0, 0)
393 assert(s, e)
394 local t = socket.gettime()
395 s:settimeout(1)
396 local c, e = s:accept()
397 assert(not c, "should not accept")
398 assert(e == "timeout", string.format("wrong error message (%s)", e))
399 t = socket.gettime() - t
400 assert(t < 2, string.format("took to long to give up (%gs)", t))
401 s:close()
402 pass("good")
403 end
404
405 ------------------------------------------------------------------------
406 function connect_timeout()
407 printf("connect with timeout (if it hangs, it failed!): ")
408 local t = socket.gettime()
409 local c, e = socket.tcp()
410 assert(c, e)
411 c:settimeout(0.1)
412 local t = socket.gettime()
413 local r, e = c:connect("10.0.0.1", 81)
414 assert(not r, "should not connect")
415 assert(socket.gettime() - t < 2, "took too long to give up.")
416 c:close()
417 pass("ok")
418 end
419
420 ------------------------------------------------------------------------
421 function accept_errors()
422 printf("not listening: ")
423 local d, e = socket.bind("*", 0)
424 assert(d, e);
425 local c, e = socket.tcp();
426 assert(c, e);
427 d:setfd(c:getfd())
428 d:settimeout(2)
429 local r, e = d:accept()
430 assert(not r and e)
431 pass("ok")
432 printf("not supported: ")
433 local c, e = socket.udp()
434 assert(c, e);
435 d:setfd(c:getfd())
436 local r, e = d:accept()
437 assert(not r and e)
438 pass("ok")
439 end
440
441 ------------------------------------------------------------------------
442 function connect_errors()
443 printf("connection refused: ")
444 local c, e = socket.connect("localhost", 1);
445 assert(not c and e)
446 pass("ok")
447 printf("host not found: ")
448 local c, e = socket.connect("host.is.invalid", 1);
449 assert(not c and e, e)
450 pass("ok")
451 end
452
453 ------------------------------------------------------------------------
454 function rebind_test()
455 local c ,c1 = socket.bind("127.0.0.1", 0)
456 if not c then pass ("failed to bind! " .. tostring(c) .. ' ' .. tostring(c1)) return end
457 assert(c,c1)
458 local i, p = c:getsockname()
459 local s, e = socket.tcp()
460 assert(s, e)
461 s:setoption("reuseaddr", false)
462 r, e = s:bind(i, p)
463 assert(not r, "managed to rebind!")
464 assert(e)
465 pass("ok")
466 end
467
468 ------------------------------------------------------------------------
469 function getstats_test()
470 reconnect()
471 local t = 0
472 for i = 1, 25 do
473 local c = math.random(1, 100)
474 remote (string.format ([[
475 str = data:receive(%d)
476 data:send(str)
477 ]], c))
478 data:send(string.rep("a", c))
479 data:receive(c)
480 t = t + c
481 local r, s, a = data:getstats()
482 assert(r == t, "received count failed" .. tostring(r)
483 .. "/" .. tostring(t))
484 assert(s == t, "sent count failed" .. tostring(s)
485 .. "/" .. tostring(t))
486 end
487 pass("ok")
488 end
489
490
491 ------------------------------------------------------------------------
492 function test_nonblocking(size)
493 reconnect()
494 printf("testing " .. 2*size .. " bytes: ")
495 remote(string.format([[
496 data:send(string.rep("a", %d))
497 socket.sleep(0.5)
498 data:send(string.rep("b", %d) .. "\n")
499 ]], size, size))
500 local err = "timeout"
501 local part = ""
502 local str
503 data:settimeout(0)
504 while 1 do
505 str, err, part = data:receive("*l", part)
506 if err ~= "timeout" then break end
507 end
508 assert(str == (string.rep("a", size) .. string.rep("b", size)))
509 reconnect()
510 remote(string.format([[
511 str = data:receive(%d)
512 socket.sleep(0.5)
513 str = data:receive(2*%d, str)
514 data:send(str)
515 ]], size, size))
516 data:settimeout(0)
517 local start = 0
518 while 1 do
519 ret, err, start = data:send(str, start+1)
520 if err ~= "timeout" then break end
521 end
522 data:send("\n")
523 data:settimeout(-1)
524 local back = data:receive(2*size)
525 assert(back == str, "'" .. back .. "' vs '" .. str .. "'")
526 pass("ok")
527 end
528
529 ------------------------------------------------------------------------
530 function test_readafterclose()
531 local back, partial, err
532 local str = 'little string'
533 reconnect()
534 printf("trying repeated '*a' pattern")
535 remote (string.format ([[
536 data:send('%s')
537 data:close()
538 data = nil
539 ]], str))
540 back, err, partial = data:receive("*a")
541 assert(back == str, "unexpected data read")
542 back, err, partial = data:receive("*a")
543 assert(back == nil and err == "closed", "should have returned 'closed'")
544 pass("ok")
545 reconnect()
546 printf("trying active close before '*a'")
547 remote (string.format ([[
548 data:close()
549 data = nil
550 ]]))
551 data:close()
552 back, err, partial = data:receive("*a")
553 assert(back == nil and err == "closed", "should have returned 'closed'")
554 pass("ok")
555 reconnect()
556 printf("trying active close before '*l'")
557 remote (string.format ([[
558 data:close()
559 data = nil
560 ]]))
561 data:close()
562 back, err, partial = data:receive()
563 assert(back == nil and err == "closed", "should have returned 'closed'")
564 pass("ok")
565 reconnect()
566 printf("trying active close before raw 1")
567 remote (string.format ([[
568 data:close()
569 data = nil
570 ]]))
571 data:close()
572 back, err, partial = data:receive(1)
573 assert(back == nil and err == "closed", "should have returned 'closed'")
574 pass("ok")
575 reconnect()
576 printf("trying active close before raw 0")
577 remote (string.format ([[
578 data:close()
579 data = nil
580 ]]))
581 data:close()
582 back, err, partial = data:receive(0)
583 assert(back == nil and err == "closed", "should have returned 'closed'")
584 pass("ok")
585 end
586
587 ------------------------------------------------------------------------
588 function test_writeafterclose()
589 local str = 'little string'
590 reconnect()
591 remote (string.format ([[
592 data:close()
593 data = nil
594 ]]))
595 local sent, err, errsent
596 while not err do
597 sent, err, errsent, time = data:send(str)
598 end
599 assert(err == "closed", "got " .. err .. " instead of 'closed'")
600 pass("ok")
601 end
602
603 ------------------------------------------------------------------------
604
605 function test_partialrecv()
606 local str = 'little string'
607 reconnect()
608 remote([[
609 data:send("7890")
610 ]])
611 data:settimeout(1)
612 back, err = data:receive(10, "123456")
613 assert(back == "1234567890", "failed on exact mixed length")
614 back, err = data:receive(8, "87654321")
615 assert(back == "87654321", "failed on exact length")
616 back, err = data:receive(4, "87654321")
617 assert(back == "87654321", "failed on smaller length")
618 pass("ok")
619 end
620
621 ------------------------------------------------------------------------
622 test("method registration")
623
624 local tcp_methods = {
625 "accept",
626 "bind",
627 "close",
628 "connect",
629 "dirty",
630 "getfamily",
631 "getfd",
632 "getoption",
633 "getpeername",
634 "getsockname",
635 "getstats",
636 "setstats",
637 "listen",
638 "receive",
639 "send",
640 "setfd",
641 "setoption",
642 "setpeername",
643 "setsockname",
644 "settimeout",
645 "shutdown",
646 }
647 test_methods(socket.tcp(), tcp_methods)
648 do local sock = socket.tcp6()
649 if sock then test_methods(socket.tcp6(), tcp_methods)
650 else io.stderr:write("Warning! IPv6 does not support!\n") end
651 end
652
653 local udp_methods = {
654 "close",
655 "dirty",
656 "getfamily",
657 "getfd",
658 "getoption",
659 "getpeername",
660 "getsockname",
661 "receive",
662 "receivefrom",
663 "send",
664 "sendto",
665 "setfd",
666 "setoption",
667 "setpeername",
668 "setsockname",
669 "settimeout"
670 }
671
672 ------------------------------------------------------------------------
673 test_methods(socket.udp(), udp_methods)
674 do local sock = socket.tcp6()
675 if sock then test_methods(socket.udp6(), udp_methods)
676 else io.stderr:write("Warning! IPv6 does not support!\n") end
677 end
678
679 test("closed connection detection: ")
680 test_closed()
681
682 test("partial receive")
683 test_partialrecv()
684
685 test("select function")
686 test_selectbugs()
687
688 test("read after close")
689 test_readafterclose()
690
691 test("write after close")
692 test_writeafterclose()
693
694 test("connect function")
695 connect_timeout()
696 empty_connect()
697 connect_errors()
698
699 test("rebinding: ")
700 rebind_test()
701
702 test("active close: ")
703 active_close()
704
705 test("accept function: ")
706 accept_timeout()
707 accept_errors()
708
709 test("getstats test")
710 getstats_test()
711
712 test("character line")
713 test_asciiline(1)
714 test_asciiline(17)
715 test_asciiline(200)
716 test_asciiline(4091)
717 test_asciiline(80199)
718 test_asciiline(8000000)
719 test_asciiline(80199)
720 test_asciiline(4091)
721 test_asciiline(200)
722 test_asciiline(17)
723 test_asciiline(1)
724
725 test("mixed patterns")
726 test_mixed(1)
727 test_mixed(17)
728 test_mixed(200)
729 test_mixed(4091)
730 test_mixed(801990)
731 test_mixed(4091)
732 test_mixed(200)
733 test_mixed(17)
734 test_mixed(1)
735
736 test("binary line")
737 test_rawline(1)
738 test_rawline(17)
739 test_rawline(200)
740 test_rawline(4091)
741 test_rawline(80199)
742 test_rawline(8000000)
743 test_rawline(80199)
744 test_rawline(4091)
745 test_rawline(200)
746 test_rawline(17)
747 test_rawline(1)
748
749 test("raw transfer")
750 test_raw(1)
751 test_raw(17)
752 test_raw(200)
753 test_raw(4091)
754 test_raw(80199)
755 test_raw(8000000)
756 test_raw(80199)
757 test_raw(4091)
758 test_raw(200)
759 test_raw(17)
760 test_raw(1)
761
762 test("non-blocking transfer")
763 test_nonblocking(1)
764 test_nonblocking(17)
765 test_nonblocking(200)
766 test_nonblocking(4091)
767 test_nonblocking(80199)
768 test_nonblocking(800000)
769 test_nonblocking(80199)
770 test_nonblocking(4091)
771 test_nonblocking(200)
772 test_nonblocking(17)
773 test_nonblocking(1)
774
775 test("total timeout on send")
776 test_totaltimeoutsend(800091, 1, 3)
777 test_totaltimeoutsend(800091, 2, 3)
778 test_totaltimeoutsend(800091, 5, 2)
779 test_totaltimeoutsend(800091, 3, 1)
780
781 test("total timeout on receive")
782 test_totaltimeoutreceive(800091, 1, 3)
783 test_totaltimeoutreceive(800091, 2, 3)
784 test_totaltimeoutreceive(800091, 3, 2)
785 test_totaltimeoutreceive(800091, 3, 1)
786
787 test("blocking timeout on send")
788 test_blockingtimeoutsend(800091, 1, 3)
789 test_blockingtimeoutsend(800091, 2, 3)
790 test_blockingtimeoutsend(800091, 3, 2)
791 test_blockingtimeoutsend(800091, 3, 1)
792
793 test("blocking timeout on receive")
794 test_blockingtimeoutreceive(800091, 1, 3)
795 test_blockingtimeoutreceive(800091, 2, 3)
796 test_blockingtimeoutreceive(800091, 3, 2)
797 test_blockingtimeoutreceive(800091, 3, 1)
798
799 test("shutting server down")
800 reconnect()
801 remote("os.exit()")
802
803 test(string.format("done in %.2fs", socket.gettime() - start))