forked from cory/tildefriends
libuv 1.48.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4828 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
26
deps/libuv/test/test-pipe-bind-error.c
vendored
26
deps/libuv/test/test-pipe-bind-error.c
vendored
@ -33,6 +33,7 @@
|
||||
|
||||
|
||||
static int close_cb_called = 0;
|
||||
static int connect_cb_called = 0;
|
||||
|
||||
|
||||
static void close_cb(uv_handle_t* handle) {
|
||||
@ -154,13 +155,23 @@ TEST_IMPL(pipe_bind_or_listen_error_after_close) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void connect_overlong_cb(uv_connect_t* connect_req, int status) {
|
||||
ASSERT_EQ(status, UV_EINVAL);
|
||||
connect_cb_called++;
|
||||
uv_close((uv_handle_t*) connect_req->handle, close_cb);
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(pipe_overlong_path) {
|
||||
char path[512];
|
||||
uv_pipe_t pipe;
|
||||
uv_connect_t req;
|
||||
|
||||
memset(path, '@', sizeof(path));
|
||||
ASSERT_OK(uv_pipe_init(uv_default_loop(), &pipe, 0));
|
||||
|
||||
#ifndef _WIN32
|
||||
char path[512];
|
||||
memset(path, '@', sizeof(path));
|
||||
ASSERT_EQ(UV_EINVAL,
|
||||
uv_pipe_bind2(&pipe, path, sizeof(path), UV_PIPE_NO_TRUNCATE));
|
||||
ASSERT_EQ(UV_EINVAL,
|
||||
@ -170,8 +181,17 @@ TEST_IMPL(pipe_overlong_path) {
|
||||
sizeof(path),
|
||||
UV_PIPE_NO_TRUNCATE,
|
||||
(uv_connect_cb) abort));
|
||||
uv_close((uv_handle_t*) &pipe, NULL);
|
||||
ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
#endif
|
||||
|
||||
ASSERT_EQ(UV_EINVAL, uv_pipe_bind(&pipe, ""));
|
||||
uv_pipe_connect(&req,
|
||||
&pipe,
|
||||
"",
|
||||
(uv_connect_cb) connect_overlong_cb);
|
||||
ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
ASSERT_EQ(1, connect_cb_called);
|
||||
ASSERT_EQ(1, close_cb_called);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user