aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2001-01-28 02:18:24 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2001-01-28 02:18:24 +0000
commita221087bc007122c2fe127f68dcba150f69d4365 (patch)
treeb5d7bde5d6fc3269715ae4bcbd7898670051b129
parent159823e200e763529b0885715c0624559aacf82a (diff)
downloadluasocket-a221087bc007122c2fe127f68dcba150f69d4365.tar.gz
luasocket-a221087bc007122c2fe127f68dcba150f69d4365.tar.bz2
luasocket-a221087bc007122c2fe127f68dcba150f69d4365.zip
Relaxed timeout tests.
-rw-r--r--test/testclnt.lua29
1 files changed, 15 insertions, 14 deletions
diff --git a/test/testclnt.lua b/test/testclnt.lua
index 8a36512..97e06f2 100644
--- a/test/testclnt.lua
+++ b/test/testclnt.lua
@@ -205,7 +205,7 @@ function blockedtimed_out(t, s, err, o)
205 pass("got natural cause timeout") 205 pass("got natural cause timeout")
206 return 1 206 return 1
207 end 207 end
208 elseif 0.9*s > t then 208 elseif s > t then
209 if o == "send" then 209 if o == "send" then
210 pass("must have been buffered (may be wrong)") 210 pass("must have been buffered (may be wrong)")
211 else 211 else
@@ -252,14 +252,14 @@ end
252----------------------------------------------------------------------------- 252-----------------------------------------------------------------------------
253function returntimed_out(delta, t, err) 253function returntimed_out(delta, t, err)
254 if err == "timeout" then 254 if err == "timeout" then
255 if 1.1*delta >= t then 255 if delta >= t then
256 pass("got rightfull timeout") 256 pass("got rightfull timeout")
257 return 1 257 return 1
258 else 258 else
259 fail("shouldn't have gotten timeout") 259 fail("shouldn't have gotten timeout")
260 end 260 end
261 elseif 0.9*delta > t then 261 elseif delta > t then
262 fail("should have gotten timeout") 262 pass(format("but took %fs longer than should have", delta - t))
263 end 263 end
264end 264end
265 265
@@ -399,20 +399,21 @@ test_block(80000)
399test_block(800000) 399test_block(800000)
400 400
401new_test("blocked timeout test") 401new_test("blocked timeout test")
402test_blockedtimeout(80, .5, 1) 402test_blockedtimeout(80, 1, 2)
403test_blockedtimeout(80, 1, 1) 403test_blockedtimeout(80, 2, 2)
404test_blockedtimeout(80, 1.5, 1) 404test_blockedtimeout(80, 3, 2)
405test_blockedtimeout(800, 1, 0) 405test_blockedtimeout(800, 1, 0)
406test_blockedtimeout(8000, 1, 1.5) 406test_blockedtimeout(8000, 2, 3)
407test_blockedtimeout(80000, 1, 0) 407test_blockedtimeout(80000, 2, 1)
408test_blockedtimeout(800000, 0.01, 0) 408test_blockedtimeout(800000, 0.01, 0)
409 409
410new_test("return timeout test") 410new_test("return timeout test")
411test_returntimeout(80, 1, 0.5) 411test_returntimeout(80, 2, 1)
412test_returntimeout(80, 0.5, 1) 412test_returntimeout(80, 1, 2)
413test_returntimeout(8000, .5, 1) 413test_returntimeout(8000, 1, 2)
414test_returntimeout(80000, 1, 0.5) 414test_returntimeout(80000, 2, 1)
415test_returntimeout(800000, 1, 0.5) 415test_returntimeout(800000, 0.1, 0)
416test_returntimeout(800000, 2, 1)
416 417
417----------------------------------------------------------------------------- 418-----------------------------------------------------------------------------
418-- Close connection and exit server. We are done. 419-- Close connection and exit server. We are done.