From 4d0054145d19ac654976ddf9476756c67481ff2a Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Tue, 9 May 2017 08:29:02 +0200 Subject: [PATCH] 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 Reviewed-By: Andrius Bentkus --- test/test-tcp-write-queue-order.c | 6 +++--- 1 file 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);