From 42e0e74487ca62b58a8a1fa06580154c632b4942 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Wed, 21 Jan 2004 20:16:48 +0000 Subject: Adjusted wsocket to match usocket. Adjusted windows projects. --- test/testclnt.lua | 16 ++++++++++------ test/testsrvr.lua | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/testclnt.lua b/test/testclnt.lua index a0d9fda..6dccd0c 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua @@ -132,6 +132,7 @@ end ------------------------------------------------------------------------ function test_asciiline(len) + reconnect() local str, str10, back, err str = string.rep("x", math.mod(len, 10)) str10 = string.rep("aZb.c#dAe?", math.floor(len/10)) @@ -149,6 +150,7 @@ end ------------------------------------------------------------------------ function test_rawline(len) + reconnect() local str, str10, back, err str = string.rep(string.char(47), math.mod(len, 10)) str10 = string.rep(string.char(120,21,77,4,5,0,7,36,44,100), @@ -167,6 +169,7 @@ end ------------------------------------------------------------------------ function test_raw(len) + reconnect() local half = math.floor(len/2) local s1, s2, back, err s1 = string.rep("x", half) @@ -186,8 +189,8 @@ end ------------------------------------------------------------------------ function test_totaltimeoutreceive(len, tm, sl) - local str, err, total reconnect() + local str, err, total pass("%d bytes, %ds total timeout, %ds pause", len, tm, sl) remote (string.format ([[ data:settimeout(%d) @@ -206,8 +209,8 @@ end ------------------------------------------------------------------------ function test_totaltimeoutsend(len, tm, sl) - local str, err, total reconnect() + local str, err, total pass("%d bytes, %ds total timeout, %ds pause", len, tm, sl) remote (string.format ([[ data:settimeout(%d) @@ -226,8 +229,8 @@ end ------------------------------------------------------------------------ function test_blockingtimeoutreceive(len, tm, sl) - local str, err, total reconnect() + local str, err, total pass("%d bytes, %ds blocking timeout, %ds pause", len, tm, sl) remote (string.format ([[ data:settimeout(%d) @@ -246,8 +249,8 @@ end ------------------------------------------------------------------------ function test_blockingtimeoutsend(len, tm, sl) - local str, err, total reconnect() + local str, err, total pass("%d bytes, %ds blocking timeout, %ds pause", len, tm, sl) remote (string.format ([[ data:settimeout(%d) @@ -266,11 +269,14 @@ end ------------------------------------------------------------------------ function empty_connect() + reconnect() if data then data:close() data = nil end +print("before remote") remote [[ if data then data:close() data = nil end data = server:accept() ]] +print("after remote") data, err = socket.connect("", port) if not data then pass("ok") @@ -445,7 +451,6 @@ test("connect with timeout (if it hangs, it failed:)") connect_timeout() test("mixed patterns") -reconnect() test_mixed(1) test_mixed(17) test_mixed(200) @@ -457,7 +462,6 @@ test_mixed(17) test_mixed(1) test("character line") -reconnect() test_asciiline(1) test_asciiline(17) test_asciiline(200) diff --git a/test/testsrvr.lua b/test/testsrvr.lua index 6010789..99b54e5 100644 --- a/test/testsrvr.lua +++ b/test/testsrvr.lua @@ -6,7 +6,8 @@ if not server then print("server: " .. tostring(error)) os.exit() end ack = "\n" while 1 do print("server: waiting for client connection..."); - control = server:accept() + control, error = server:accept() + assert(control, error) -- control:setoption("nodelay", true) while 1 do command, error = control:receive() -- cgit v1.2.3-55-g6feb