summaryrefslogtreecommitdiff
path: root/deps/uv/test
diff options
context:
space:
mode:
authorSaúl Ibarra Corretgé <saghul@gmail.com>2015-09-11 17:55:29 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2015-09-11 18:38:43 +0200
commit68dc69a382692f424c53b75724e684a406b195a1 (patch)
treeae2725deaaea798d3b61e2258ad329016f0b3ddd /deps/uv/test
parent958a94e19dd6dda962cd690a5f4aa0ad02ac21bc (diff)
downloadandroid-node-v8-68dc69a382692f424c53b75724e684a406b195a1.tar.gz
android-node-v8-68dc69a382692f424c53b75724e684a406b195a1.tar.bz2
android-node-v8-68dc69a382692f424c53b75724e684a406b195a1.zip
deps: update libuv to version 1.7.4
PR-URL: https://github.com/nodejs/node/pull/2817 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/uv/test')
-rw-r--r--deps/uv/test/test-fs.c47
-rw-r--r--deps/uv/test/test-ipc.c25
2 files changed, 40 insertions, 32 deletions
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 17b90e91c1..90572ca614 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -427,6 +427,28 @@ static void rmdir_cb(uv_fs_t* req) {
}
+static void assert_is_file_type(uv_dirent_t dent) {
+#ifdef HAVE_DIRENT_TYPES
+ /*
+ * For Apple and Windows, we know getdents is expected to work but for other
+ * environments, the filesystem dictates whether or not getdents supports
+ * returning the file type.
+ *
+ * See:
+ * http://man7.org/linux/man-pages/man2/getdents.2.html
+ * https://github.com/libuv/libuv/issues/501
+ */
+ #if defined(__APPLE__) || defined(_WIN32)
+ ASSERT(dent.type == UV_DIRENT_FILE);
+ #else
+ ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN);
+ #endif
+#else
+ ASSERT(dent.type == UV_DIRENT_UNKNOWN);
+#endif
+}
+
+
static void scandir_cb(uv_fs_t* req) {
uv_dirent_t dent;
ASSERT(req == &scandir_req);
@@ -436,11 +458,7 @@ static void scandir_cb(uv_fs_t* req) {
while (UV_EOF != uv_fs_scandir_next(req, &dent)) {
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
-#ifdef HAVE_DIRENT_TYPES
- ASSERT(dent.type == UV_DIRENT_FILE);
-#else
- ASSERT(dent.type == UV_DIRENT_UNKNOWN);
-#endif
+ assert_is_file_type(dent);
}
scandir_cb_count++;
ASSERT(req->path);
@@ -878,11 +896,7 @@ TEST_IMPL(fs_async_dir) {
ASSERT(scandir_req.ptr);
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
-#ifdef HAVE_DIRENT_TYPES
- ASSERT(dent.type == UV_DIRENT_FILE);
-#else
- ASSERT(dent.type == UV_DIRENT_UNKNOWN);
-#endif
+ assert_is_file_type(dent);
}
uv_fs_req_cleanup(&scandir_req);
ASSERT(!scandir_req.ptr);
@@ -1724,6 +1738,7 @@ TEST_IMPL(fs_symlink_dir) {
r = uv_fs_symlink(NULL, &req, test_dir, "test_dir_symlink",
UV_FS_SYMLINK_JUNCTION, NULL);
+ fprintf(stderr, "r == %i\n", r);
ASSERT(r == 0);
ASSERT(req.result == 0);
uv_fs_req_cleanup(&req);
@@ -1774,11 +1789,7 @@ TEST_IMPL(fs_symlink_dir) {
ASSERT(scandir_req.ptr);
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
-#ifdef HAVE_DIRENT_TYPES
- ASSERT(dent.type == UV_DIRENT_FILE);
-#else
- ASSERT(dent.type == UV_DIRENT_UNKNOWN);
-#endif
+ assert_is_file_type(dent);
}
uv_fs_req_cleanup(&scandir_req);
ASSERT(!scandir_req.ptr);
@@ -1798,11 +1809,7 @@ TEST_IMPL(fs_symlink_dir) {
ASSERT(scandir_req.ptr);
while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) {
ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0);
-#ifdef HAVE_DIRENT_TYPES
- ASSERT(dent.type == UV_DIRENT_FILE);
-#else
- ASSERT(dent.type == UV_DIRENT_UNKNOWN);
-#endif
+ assert_is_file_type(dent);
}
uv_fs_req_cleanup(&scandir_req);
ASSERT(!scandir_req.ptr);
diff --git a/deps/uv/test/test-ipc.c b/deps/uv/test/test-ipc.c
index ed8c4dd7f0..f018c2d4d4 100644
--- a/deps/uv/test/test-ipc.c
+++ b/deps/uv/test/test-ipc.c
@@ -52,6 +52,7 @@ typedef struct {
} tcp_conn;
#define CONN_COUNT 100
+#define BACKLOG 128
static void close_server_conn_cb(uv_handle_t* handle) {
@@ -179,7 +180,7 @@ static void on_read(uv_stream_t* handle,
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server);
ASSERT(r == 0);
- r = uv_listen((uv_stream_t*)&tcp_server, 12, on_connection);
+ r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, on_connection);
ASSERT(r == 0);
tcp_server_listening = 1;
@@ -242,22 +243,22 @@ static void on_read_listen_after_bound_twice(uv_stream_t* handle,
ASSERT(pending == UV_TCP);
r = uv_tcp_init(uv_default_loop(), &tcp_server);
ASSERT(r == 0);
-
+
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server);
ASSERT(r == 0);
-
- r = uv_listen((uv_stream_t*)&tcp_server, 12, on_connection);
- ASSERT(r == 0);
+
+ r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, on_connection);
+ ASSERT(r == 0);
} else if (read_cb_called == 2) {
/* Accept the second TCP server, and start listening on it. */
ASSERT(pending == UV_TCP);
r = uv_tcp_init(uv_default_loop(), &tcp_server2);
ASSERT(r == 0);
-
+
r = uv_accept((uv_stream_t*)pipe, (uv_stream_t*)&tcp_server2);
ASSERT(r == 0);
-
- r = uv_listen((uv_stream_t*)&tcp_server2, 12, on_connection);
+
+ r = uv_listen((uv_stream_t*)&tcp_server2, BACKLOG, on_connection);
ASSERT(r == UV_EADDRINUSE);
uv_close((uv_handle_t*)&tcp_server, NULL);
@@ -652,7 +653,7 @@ int ipc_helper(int listen_after_write) {
ASSERT(r == 0);
if (!listen_after_write) {
- r = uv_listen((uv_stream_t*)&tcp_server, 12, ipc_on_connection);
+ r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection);
ASSERT(r == 0);
}
@@ -662,7 +663,7 @@ int ipc_helper(int listen_after_write) {
ASSERT(r == 0);
if (listen_after_write) {
- r = uv_listen((uv_stream_t*)&tcp_server, 12, ipc_on_connection);
+ r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection);
ASSERT(r == 0);
}
@@ -703,7 +704,7 @@ int ipc_helper_tcp_connection(void) {
r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0);
ASSERT(r == 0);
- r = uv_listen((uv_stream_t*)&tcp_server, 12, ipc_on_connection_tcp_conn);
+ r = uv_listen((uv_stream_t*)&tcp_server, BACKLOG, ipc_on_connection_tcp_conn);
ASSERT(r == 0);
/* Make a connection to the server */
@@ -772,7 +773,7 @@ int ipc_helper_bind_twice(void) {
r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
ASSERT(r == 0);
-
+
MAKE_VALGRIND_HAPPY();
return 0;
}