forked from cory/tildefriends
libuv 1.47.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4615 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
20
deps/libuv/test/test-udp-send-hang-loop.c
vendored
20
deps/libuv/test/test-udp-send-hang-loop.c
vendored
@@ -27,7 +27,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#define CHECK_OBJECT(handle, type, parent) \
|
||||
ASSERT((type*)(handle) == &(parent))
|
||||
ASSERT_PTR_EQ((type*)(handle), &(parent))
|
||||
|
||||
static uv_udp_t client;
|
||||
static uv_idle_t idle_handle;
|
||||
@@ -46,7 +46,7 @@ static void idle_cb(uv_idle_t* handle) {
|
||||
|
||||
ASSERT_NULL(send_req.handle);
|
||||
CHECK_OBJECT(handle, uv_idle_t, idle_handle);
|
||||
ASSERT(0 == uv_idle_stop(handle));
|
||||
ASSERT_OK(uv_idle_stop(handle));
|
||||
|
||||
/* It probably would have stalled by now if it's going to stall at all. */
|
||||
if (++loop_hang_called > 1000) {
|
||||
@@ -61,7 +61,7 @@ static void idle_cb(uv_idle_t* handle) {
|
||||
1,
|
||||
(const struct sockaddr*) &addr,
|
||||
send_cb);
|
||||
ASSERT(r == 0);
|
||||
ASSERT_OK(r);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,27 +72,27 @@ static void send_cb(uv_udp_send_t* req, int status) {
|
||||
CHECK_OBJECT(req, uv_udp_send_t, send_req);
|
||||
req->handle = NULL;
|
||||
|
||||
ASSERT(0 == uv_idle_start(&idle_handle, idle_cb));
|
||||
ASSERT_OK(uv_idle_start(&idle_handle, idle_cb));
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(udp_send_hang_loop) {
|
||||
ASSERT(0 == uv_idle_init(uv_default_loop(), &idle_handle));
|
||||
ASSERT_OK(uv_idle_init(uv_default_loop(), &idle_handle));
|
||||
|
||||
/* 192.0.2.0/8 is "TEST-NET" and reserved for documentation.
|
||||
/* 192.0.2.0/24 is "TEST-NET" and reserved for documentation.
|
||||
* Good for us, though. Since we want to have something unreachable.
|
||||
*/
|
||||
ASSERT(0 == uv_ip4_addr("192.0.2.3", TEST_PORT, &addr));
|
||||
ASSERT_OK(uv_ip4_addr("192.0.2.3", TEST_PORT, &addr));
|
||||
|
||||
ASSERT(0 == uv_udp_init(uv_default_loop(), &client));
|
||||
ASSERT_OK(uv_udp_init(uv_default_loop(), &client));
|
||||
|
||||
buf = uv_buf_init(send_data, sizeof(send_data));
|
||||
|
||||
ASSERT(0 == uv_idle_start(&idle_handle, idle_cb));
|
||||
ASSERT_OK(uv_idle_start(&idle_handle, idle_cb));
|
||||
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
|
||||
ASSERT(loop_hang_called > 1000);
|
||||
ASSERT_GT(loop_hang_called, 1000);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user