diff options
| author | ruki <[email protected]> | 2019-12-15 15:30:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-12-15 15:33:26 +0800 |
| commit | f0cee734ed73e82364c07158b680d1399464a13e (patch) | |
| tree | e27ac61d70147ef203d7a28e739dab051d751890 /tests/modules | |
| parent | f72910c44225935a42b73b2b986c26f958efe5f7 (diff) | |
fix scheduler tests
Diffstat (limited to 'tests/modules')
| -rw-r--r-- | tests/modules/scheduler/test.lua | 4 | ||||
| -rw-r--r-- | tests/modules/socket/sched_tcp/echo_client.lua | 3 | ||||
| -rw-r--r-- | tests/modules/socket/sched_tcp/file_client.lua | 3 |
3 files changed, 1 insertions, 9 deletions
diff --git a/tests/modules/scheduler/test.lua b/tests/modules/scheduler/test.lua index cf87d2588..f794c8a3e 100644 --- a/tests/modules/scheduler/test.lua +++ b/tests/modules/scheduler/test.lua @@ -10,6 +10,7 @@ function test_runjobs(t) for i = 1, 100 do scheduler.co_start(task, "xmake!") end + scheduler.runloop() t:are_equal(count, 100) end @@ -22,9 +23,6 @@ function test_sleep(t) dt = os.mclock() - dt t:require(dt > 100 and dt < 1000) count = count + 1 - if count == 3 then - scheduler.stop() - end end for i = 1, 3 do scheduler.co_start(task) diff --git a/tests/modules/socket/sched_tcp/echo_client.lua b/tests/modules/socket/sched_tcp/echo_client.lua index af40a085d..f9c993729 100644 --- a/tests/modules/socket/sched_tcp/echo_client.lua +++ b/tests/modules/socket/sched_tcp/echo_client.lua @@ -17,9 +17,6 @@ function _session(addr, port) end print("%s: send ok, count: %d!", sock, count) sock:close() - if scheduler.co_count() == 1 then - scheduler.stop() - end end function main(count) diff --git a/tests/modules/socket/sched_tcp/file_client.lua b/tests/modules/socket/sched_tcp/file_client.lua index 5dda4be6d..522d05353 100644 --- a/tests/modules/socket/sched_tcp/file_client.lua +++ b/tests/modules/socket/sched_tcp/file_client.lua @@ -31,9 +31,6 @@ function _session(addr, port) end print("%s: recv ok, size: %d, #data: %d!", sock, recv, data and data:size() or 0) sock:close() - if scheduler.co_count() == 1 then - scheduler.stop() - end end function main(count) |
