diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2017-05-09 08:29:02 +0200 |
---|---|---|
committer | Santiago Gimeno <santiago.gimeno@gmail.com> | 2017-05-17 18:56:59 +0200 |
commit | 4d0054145d19ac654976ddf9476756c67481ff2a (patch) | |
tree | 683c83d3f12973bb285f4aebed5e7fb5d31406b1 /test/test-tcp-write-queue-order.c | |
parent | 22fc92856d8a354b7f26ca7fe2d3597a2bd57865 (diff) | |
download | libuv-4d0054145d19ac654976ddf9476756c67481ff2a.tar.gz libuv-4d0054145d19ac654976ddf9476756c67481ff2a.zip |
test: fix flaky tcp-write-queue-order
Delay the timer start to be sure all handles are created when `timer_cb`
is executed. In some cases this was not the case causing the following
error:
```
not ok 51 - tcp_write_queue_order
exit code 134
Output from process `tcp_write_queue_order`:
lt-run-tests: src/unix/core.c:166: uv_close: Assertion `0' failed.
```
PR-URL: https://github.com/libuv/libuv/pull/1338
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Andrius Bentkus <andrius.bentkus@gmail.com>
Diffstat (limited to 'test/test-tcp-write-queue-order.c')
-rw-r--r-- | test/test-tcp-write-queue-order.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test-tcp-write-queue-order.c b/test/test-tcp-write-queue-order.c index d50289c3..5119be6d 100644 --- a/test/test-tcp-write-queue-order.c +++ b/test/test-tcp-write-queue-order.c @@ -89,6 +89,9 @@ static void connection_cb(uv_stream_t* tcp, int status) { ASSERT(0 == uv_tcp_init(tcp->loop, &incoming)); ASSERT(0 == uv_accept(tcp, (uv_stream_t*) &incoming)); + ASSERT(0 == uv_timer_init(uv_default_loop(), &timer)); + ASSERT(0 == uv_timer_start(&timer, timer_cb, 1, 0)); + connection_cb_called++; } @@ -120,9 +123,6 @@ TEST_IMPL(tcp_write_queue_order) { connect_cb)); ASSERT(0 == uv_send_buffer_size((uv_handle_t*) &client, &buffer_size)); - ASSERT(0 == uv_timer_init(uv_default_loop(), &timer)); - ASSERT(0 == uv_timer_start(&timer, timer_cb, 100, 0)); - ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); ASSERT(connect_cb_called == 1); |