diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2001-01-28 02:18:24 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2001-01-28 02:18:24 +0000 |
| commit | a221087bc007122c2fe127f68dcba150f69d4365 (patch) | |
| tree | b5d7bde5d6fc3269715ae4bcbd7898670051b129 /test | |
| parent | 159823e200e763529b0885715c0624559aacf82a (diff) | |
| download | luasocket-a221087bc007122c2fe127f68dcba150f69d4365.tar.gz luasocket-a221087bc007122c2fe127f68dcba150f69d4365.tar.bz2 luasocket-a221087bc007122c2fe127f68dcba150f69d4365.zip | |
Relaxed timeout tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/testclnt.lua | 29 |
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 | ----------------------------------------------------------------------------- |
| 253 | function returntimed_out(delta, t, err) | 253 | function 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 |
| 264 | end | 264 | end |
| 265 | 265 | ||
| @@ -399,20 +399,21 @@ test_block(80000) | |||
| 399 | test_block(800000) | 399 | test_block(800000) |
| 400 | 400 | ||
| 401 | new_test("blocked timeout test") | 401 | new_test("blocked timeout test") |
| 402 | test_blockedtimeout(80, .5, 1) | 402 | test_blockedtimeout(80, 1, 2) |
| 403 | test_blockedtimeout(80, 1, 1) | 403 | test_blockedtimeout(80, 2, 2) |
| 404 | test_blockedtimeout(80, 1.5, 1) | 404 | test_blockedtimeout(80, 3, 2) |
| 405 | test_blockedtimeout(800, 1, 0) | 405 | test_blockedtimeout(800, 1, 0) |
| 406 | test_blockedtimeout(8000, 1, 1.5) | 406 | test_blockedtimeout(8000, 2, 3) |
| 407 | test_blockedtimeout(80000, 1, 0) | 407 | test_blockedtimeout(80000, 2, 1) |
| 408 | test_blockedtimeout(800000, 0.01, 0) | 408 | test_blockedtimeout(800000, 0.01, 0) |
| 409 | 409 | ||
| 410 | new_test("return timeout test") | 410 | new_test("return timeout test") |
| 411 | test_returntimeout(80, 1, 0.5) | 411 | test_returntimeout(80, 2, 1) |
| 412 | test_returntimeout(80, 0.5, 1) | 412 | test_returntimeout(80, 1, 2) |
| 413 | test_returntimeout(8000, .5, 1) | 413 | test_returntimeout(8000, 1, 2) |
| 414 | test_returntimeout(80000, 1, 0.5) | 414 | test_returntimeout(80000, 2, 1) |
| 415 | test_returntimeout(800000, 1, 0.5) | 415 | test_returntimeout(800000, 0.1, 0) |
| 416 | test_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. |
