summaryrefslogtreecommitdiff
path: root/deps/uv/test
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/test')
-rw-r--r--deps/uv/test/test-error.c3
-rw-r--r--deps/uv/test/test-fs.c45
-rw-r--r--deps/uv/test/test-list.h4
-rw-r--r--deps/uv/test/test-process-title.c2
-rw-r--r--deps/uv/test/test-signal.c35
-rw-r--r--deps/uv/test/test-tty.c3
6 files changed, 87 insertions, 5 deletions
diff --git a/deps/uv/test/test-error.c b/deps/uv/test/test-error.c
index ff53eb1d77..a2d559a4ee 100644
--- a/deps/uv/test/test-error.c
+++ b/deps/uv/test/test-error.c
@@ -21,6 +21,9 @@
#include "uv.h"
#include "task.h"
+#if defined(_WIN32)
+# include "../src/win/winapi.h"
+#endif
#include <stdio.h>
#include <stdlib.h>
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 70a2399962..030245eadc 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -510,6 +510,18 @@ static void empty_scandir_cb(uv_fs_t* req) {
scandir_cb_count++;
}
+static void non_existent_scandir_cb(uv_fs_t* req) {
+ uv_dirent_t dent;
+
+ ASSERT(req == &scandir_req);
+ ASSERT(req->fs_type == UV_FS_SCANDIR);
+ ASSERT(req->result == UV_ENOENT);
+ ASSERT(req->ptr == NULL);
+ ASSERT(UV_ENOENT == uv_fs_scandir_next(req, &dent));
+ uv_fs_req_cleanup(req);
+ scandir_cb_count++;
+}
+
static void file_scandir_cb(uv_fs_t* req) {
ASSERT(req == &scandir_req);
@@ -2175,6 +2187,39 @@ TEST_IMPL(fs_scandir_empty_dir) {
}
+TEST_IMPL(fs_scandir_non_existent_dir) {
+ const char* path;
+ uv_fs_t req;
+ uv_dirent_t dent;
+ int r;
+
+ path = "./non_existent_dir/";
+ loop = uv_default_loop();
+
+ uv_fs_rmdir(NULL, &req, path, NULL);
+ uv_fs_req_cleanup(&req);
+
+ /* Fill the req to ensure that required fields are cleaned up */
+ memset(&req, 0xdb, sizeof(req));
+
+ r = uv_fs_scandir(NULL, &req, path, 0, NULL);
+ ASSERT(r == UV_ENOENT);
+ ASSERT(req.result == UV_ENOENT);
+ ASSERT(req.ptr == NULL);
+ ASSERT(UV_ENOENT == uv_fs_scandir_next(&req, &dent));
+ uv_fs_req_cleanup(&req);
+
+ r = uv_fs_scandir(loop, &scandir_req, path, 0, non_existent_scandir_cb);
+ ASSERT(r == 0);
+
+ ASSERT(scandir_cb_count == 0);
+ uv_run(loop, UV_RUN_DEFAULT);
+ ASSERT(scandir_cb_count == 1);
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
+
TEST_IMPL(fs_scandir_file) {
const char* path;
int r;
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index be3f9069cc..3a1e82a919 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -295,6 +295,7 @@ TEST_DECLARE (fs_event_start_and_close)
TEST_DECLARE (fs_event_error_reporting)
TEST_DECLARE (fs_event_getpath)
TEST_DECLARE (fs_scandir_empty_dir)
+TEST_DECLARE (fs_scandir_non_existent_dir)
TEST_DECLARE (fs_scandir_file)
TEST_DECLARE (fs_open_dir)
TEST_DECLARE (fs_rename_to_existing_file)
@@ -345,6 +346,7 @@ TEST_DECLARE (listen_no_simultaneous_accepts)
TEST_DECLARE (fs_stat_root)
TEST_DECLARE (spawn_with_an_odd_path)
TEST_DECLARE (ipc_listen_after_bind_twice)
+TEST_DECLARE (win32_signum_number)
#else
TEST_DECLARE (emfile)
TEST_DECLARE (close_fd)
@@ -694,6 +696,7 @@ TASK_LIST_START
TEST_ENTRY (fs_stat_root)
TEST_ENTRY (spawn_with_an_odd_path)
TEST_ENTRY (ipc_listen_after_bind_twice)
+ TEST_ENTRY (win32_signum_number)
#else
TEST_ENTRY (emfile)
TEST_ENTRY (close_fd)
@@ -751,6 +754,7 @@ TASK_LIST_START
TEST_ENTRY (fs_event_error_reporting)
TEST_ENTRY (fs_event_getpath)
TEST_ENTRY (fs_scandir_empty_dir)
+ TEST_ENTRY (fs_scandir_non_existent_dir)
TEST_ENTRY (fs_scandir_file)
TEST_ENTRY (fs_open_dir)
TEST_ENTRY (fs_rename_to_existing_file)
diff --git a/deps/uv/test/test-process-title.c b/deps/uv/test/test-process-title.c
index 21ab0ed4fd..5d5ede9d60 100644
--- a/deps/uv/test/test-process-title.c
+++ b/deps/uv/test/test-process-title.c
@@ -60,7 +60,7 @@ static void uv_get_process_title_edge_cases() {
TEST_IMPL(process_title) {
-#if defined(__sun) || defined(_AIX) || defined(__MVS__)
+#if defined(__sun)
RETURN_SKIP("uv_(get|set)_process_title is not implemented.");
#else
/* Check for format string vulnerabilities. */
diff --git a/deps/uv/test/test-signal.c b/deps/uv/test/test-signal.c
index fcdd8e4d2d..c0424c60a0 100644
--- a/deps/uv/test/test-signal.c
+++ b/deps/uv/test/test-signal.c
@@ -19,13 +19,40 @@
* IN THE SOFTWARE.
*/
-
-/* This test does not pretend to be cross-platform. */
-#ifndef _WIN32
-
#include "uv.h"
#include "task.h"
+/* For Windows we test only signum handling */
+#ifdef _WIN32
+static void signum_test_cb(uv_signal_t* handle, int signum) {
+ FATAL("signum_test_cb should not be called");
+}
+
+TEST_IMPL(win32_signum_number) {
+ uv_signal_t signal;
+ uv_loop_t* loop;
+
+ loop = uv_default_loop();
+ uv_signal_init(loop, &signal);
+
+ ASSERT(uv_signal_start(&signal, signum_test_cb, 0) == UV_EINVAL);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGINT) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGBREAK) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGHUP) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGWINCH) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGILL) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGABRT_COMPAT) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGFPE) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGSEGV) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGTERM) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, SIGABRT) == 0);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, -1) == UV_EINVAL);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, NSIG) == UV_EINVAL);
+ ASSERT(uv_signal_start(&signal, signum_test_cb, 1024) == UV_EINVAL);
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
+#else
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
diff --git a/deps/uv/test/test-tty.c b/deps/uv/test/test-tty.c
index d1f7deb231..6fc2c95c98 100644
--- a/deps/uv/test/test-tty.c
+++ b/deps/uv/test/test-tty.c
@@ -287,6 +287,9 @@ TEST_IMPL(tty_large_write) {
r = uv_tty_init(uv_default_loop(), &tty_out, ttyout_fd, 0); /* Writable. */
ASSERT(r == 0);
+ memset(dummy, '.', sizeof(dummy) - 1);
+ dummy[sizeof(dummy) - 1] = '\n';
+
bufs[0] = uv_buf_init(dummy, sizeof(dummy));
r = uv_try_write((uv_stream_t*) &tty_out, bufs, 1);