diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2012-12-18 14:14:38 +0400 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2012-12-18 14:15:02 +0400 |
commit | ba754524a9f6a729a337803aadd5f1b47af968b9 (patch) | |
tree | e4170a4b72257aa7b136edc96e8b2cb4582b1932 /deps/uv/test | |
parent | 82c7c84e2550e79b816f87cd1dff3fe4cafb6bbb (diff) | |
download | android-node-v8-ba754524a9f6a729a337803aadd5f1b47af968b9.tar.gz android-node-v8-ba754524a9f6a729a337803aadd5f1b47af968b9.tar.bz2 android-node-v8-ba754524a9f6a729a337803aadd5f1b47af968b9.zip |
deps: upgrade libuv to b86ed94
Diffstat (limited to 'deps/uv/test')
-rw-r--r-- | deps/uv/test/benchmark-getaddrinfo.c | 4 | ||||
-rw-r--r-- | deps/uv/test/benchmark-ping-pongs.c | 4 | ||||
-rw-r--r-- | deps/uv/test/run-tests.c | 18 | ||||
-rw-r--r-- | deps/uv/test/runner-unix.c | 8 | ||||
-rw-r--r-- | deps/uv/test/test-fs-event.c | 31 | ||||
-rw-r--r-- | deps/uv/test/test-getaddrinfo.c | 4 | ||||
-rw-r--r-- | deps/uv/test/test-list.h | 2 | ||||
-rw-r--r-- | deps/uv/test/test-ping-pong.c | 7 |
8 files changed, 55 insertions, 23 deletions
diff --git a/deps/uv/test/benchmark-getaddrinfo.c b/deps/uv/test/benchmark-getaddrinfo.c index 07dfa87a0d..8ee0c50add 100644 --- a/deps/uv/test/benchmark-getaddrinfo.c +++ b/deps/uv/test/benchmark-getaddrinfo.c @@ -21,11 +21,7 @@ #include "uv.h" #include "task.h" - #include <stdlib.h> -#include <stdio.h> -#include <string.h> /* strlen */ - #define CONCURRENT_CALLS 10 #define TOTAL_CALLS 10000 diff --git a/deps/uv/test/benchmark-ping-pongs.c b/deps/uv/test/benchmark-ping-pongs.c index 4196b42ff9..e1de83df9d 100644 --- a/deps/uv/test/benchmark-ping-pongs.c +++ b/deps/uv/test/benchmark-ping-pongs.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <stdio.h> -#include <string.h> /* strlen */ /* Run the benchmark for this many ms */ #define TIME 5000 @@ -103,8 +102,7 @@ static void pinger_write_ping(pinger_t* pinger) { uv_write_t* req; uv_buf_t buf; - buf.base = (char*)&PING; - buf.len = strlen(PING); + buf = uv_buf_init(PING, sizeof(PING) - 1); req = malloc(sizeof *req); if (uv_write(req, (uv_stream_t*) &pinger->tcp, &buf, 1, pinger_write_cb)) { diff --git a/deps/uv/test/run-tests.c b/deps/uv/test/run-tests.c index d0e64f05d3..a81c7e5ff6 100644 --- a/deps/uv/test/run-tests.c +++ b/deps/uv/test/run-tests.c @@ -19,6 +19,7 @@ * IN THE SOFTWARE. */ +#include <errno.h> #include <stdio.h> #include <string.h> @@ -99,7 +100,7 @@ static int maybe_run_test(int argc, char **argv) { if (strcmp(argv[1], "spawn_helper3") == 0) { char buffer[256]; - fgets(buffer, sizeof(buffer) - 1, stdin); + ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin)); buffer[sizeof(buffer) - 1] = '\0'; fputs(buffer, stdout); return 1; @@ -111,13 +112,20 @@ static int maybe_run_test(int argc, char **argv) { } if (strcmp(argv[1], "spawn_helper5") == 0) { - const char* out = "fourth stdio!\n\0"; + const char out[] = "fourth stdio!\n"; #ifdef _WIN32 DWORD bytes; - WriteFile((HANDLE) _get_osfhandle(3), out, strlen(out), &bytes, NULL); + WriteFile((HANDLE) _get_osfhandle(3), out, sizeof(out) - 1, &bytes, NULL); #else - write(3, out, strlen(out)); - fsync(3); + { + ssize_t r; + + do + r = write(3, out, sizeof(out) - 1); + while (r == -1 && errno == EINTR); + + fsync(3); + } #endif return 1; } diff --git a/deps/uv/test/runner-unix.c b/deps/uv/test/runner-unix.c index 77c68dcd6c..f6ea45e140 100644 --- a/deps/uv/test/runner-unix.c +++ b/deps/uv/test/runner-unix.c @@ -24,6 +24,7 @@ #include <stdint.h> /* uintptr_t */ +#include <errno.h> #include <unistd.h> /* usleep */ #include <string.h> /* strdup */ #include <stdio.h> @@ -146,8 +147,11 @@ static void* dowait(void* data) { if (args->pipe[1] >= 0) { /* Write a character to the main thread to notify it about this. */ - char c = 0; - write(args->pipe[1], &c, 1); + ssize_t r; + + do + r = write(args->pipe[1], "", 1); + while (r == -1 && errno == EINTR); } return NULL; diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c index 67f9421998..249af9acdd 100644 --- a/deps/uv/test/test-fs-event.c +++ b/deps/uv/test/test-fs-event.c @@ -296,6 +296,37 @@ TEST_IMPL(fs_event_watch_file_current_dir) { return 0; } +TEST_IMPL(fs_event_no_callback_after_close) { + uv_loop_t* loop = uv_default_loop(); + int r; + + /* Setup */ + remove("watch_dir/file1"); + remove("watch_dir/"); + create_dir(loop, "watch_dir"); + create_file(loop, "watch_dir/file1"); + + r = uv_fs_event_init(loop, + &fs_event, + "watch_dir/file1", + fs_event_cb_file, + 0); + ASSERT(r != -1); + + uv_close((uv_handle_t*)&fs_event, close_cb); + touch_file(loop, "watch_dir/file1"); + uv_run(loop); + + ASSERT(fs_event_cb_called == 0); + ASSERT(close_cb_called == 1); + + /* Cleanup */ + remove("watch_dir/file1"); + remove("watch_dir/"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} TEST_IMPL(fs_event_no_callback_on_close) { uv_loop_t* loop = uv_default_loop(); diff --git a/deps/uv/test/test-getaddrinfo.c b/deps/uv/test/test-getaddrinfo.c index b88d4b315f..6baf676bd9 100644 --- a/deps/uv/test/test-getaddrinfo.c +++ b/deps/uv/test/test-getaddrinfo.c @@ -21,11 +21,7 @@ #include "uv.h" #include "task.h" - #include <stdlib.h> -#include <stdio.h> -#include <string.h> /* strlen */ - #define CONCURRENT_COUNT 10 diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 82a96a0323..9c59a2d47c 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -177,6 +177,7 @@ TEST_DECLARE (fs_event_watch_dir) TEST_DECLARE (fs_event_watch_file) TEST_DECLARE (fs_event_watch_file_twice) TEST_DECLARE (fs_event_watch_file_current_dir) +TEST_DECLARE (fs_event_no_callback_after_close) TEST_DECLARE (fs_event_no_callback_on_close) TEST_DECLARE (fs_event_immediate_close) TEST_DECLARE (fs_event_close_with_pending_event) @@ -450,6 +451,7 @@ TASK_LIST_START TEST_ENTRY (fs_event_watch_file) TEST_ENTRY (fs_event_watch_file_twice) TEST_ENTRY (fs_event_watch_file_current_dir) + TEST_ENTRY (fs_event_no_callback_after_close) TEST_ENTRY (fs_event_no_callback_on_close) TEST_ENTRY (fs_event_immediate_close) TEST_ENTRY (fs_event_close_with_pending_event) diff --git a/deps/uv/test/test-ping-pong.c b/deps/uv/test/test-ping-pong.c index 1b85fa8948..a7b31c73e1 100644 --- a/deps/uv/test/test-ping-pong.c +++ b/deps/uv/test/test-ping-pong.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <stdio.h> -#include <string.h> /* strlen */ static int completed_pingers = 0; @@ -77,11 +76,9 @@ static void pinger_write_ping(pinger_t* pinger) { uv_write_t *req; uv_buf_t buf; - buf.base = (char*)&PING; - buf.len = strlen(PING); - - req = malloc(sizeof(uv_write_t)); + buf = uv_buf_init(PING, sizeof(PING) - 1); + req = malloc(sizeof(*req)); if (uv_write(req, (uv_stream_t*)&pinger->stream.tcp, &buf, 1, pinger_after_write)) { FATAL("uv_write failed"); } |