aboutsummaryrefslogtreecommitdiff
path: root/deps/uv/test
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-02-20 21:12:18 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-02-20 21:29:52 +0100
commit6ad792610b9e3a0c96206fc1f6968b0eb69956c1 (patch)
tree8f9728e8c5cee05ef5ebfae95966fb5310384a2e /deps/uv/test
parentd69a26b9650df7dc1f210c3c59df74ec4245dff3 (diff)
downloadandroid-node-v8-6ad792610b9e3a0c96206fc1f6968b0eb69956c1.tar.gz
android-node-v8-6ad792610b9e3a0c96206fc1f6968b0eb69956c1.tar.bz2
android-node-v8-6ad792610b9e3a0c96206fc1f6968b0eb69956c1.zip
deps: upgrade libuv to 26fa6f8
Diffstat (limited to 'deps/uv/test')
-rw-r--r--deps/uv/test/test-fs.c8
-rw-r--r--deps/uv/test/test-list.h2
-rw-r--r--deps/uv/test/test-timer-again.c2
-rw-r--r--deps/uv/test/test-timer.c51
4 files changed, 57 insertions, 6 deletions
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index ddc3c73b13..0016b3bede 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -107,13 +107,13 @@ static char test_buf[] = "test-buffer\n";
static void check_permission(const char* filename, int mode) {
int r;
uv_fs_t req;
- struct stat* s;
+ uv_statbuf_t* s;
r = uv_fs_stat(uv_default_loop(), &req, filename, NULL);
ASSERT(r == 0);
ASSERT(req.result == 0);
- s = req.ptr;
+ s = &req.statbuf;
#ifdef _WIN32
/*
* On Windows, chmod can only modify S_IWUSR (_S_IWRITE) bit,
@@ -543,7 +543,7 @@ TEST_IMPL(fs_file_loop) {
}
static void check_utime(const char* path, double atime, double mtime) {
- struct stat* s;
+ uv_statbuf_t* s;
uv_fs_t req;
int r;
@@ -551,7 +551,7 @@ static void check_utime(const char* path, double atime, double mtime) {
ASSERT(r == 0);
ASSERT(req.result == 0);
- s = req.ptr;
+ s = &req.statbuf;
#if defined(_WIN32) || defined(_AIX)
ASSERT(s->st_atime == atime);
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index 77f1f35d8f..efc97380fa 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -96,6 +96,7 @@ TEST_DECLARE (error_message)
TEST_DECLARE (timer)
TEST_DECLARE (timer_again)
TEST_DECLARE (timer_start_twice)
+TEST_DECLARE (timer_order)
TEST_DECLARE (idle_starvation)
TEST_DECLARE (loop_handles)
TEST_DECLARE (get_loadavg)
@@ -334,6 +335,7 @@ TASK_LIST_START
TEST_ENTRY (timer)
TEST_ENTRY (timer_again)
TEST_ENTRY (timer_start_twice)
+ TEST_ENTRY (timer_order)
TEST_ENTRY (idle_starvation)
diff --git a/deps/uv/test/test-timer-again.c b/deps/uv/test/test-timer-again.c
index 6de2904694..536ac448e4 100644
--- a/deps/uv/test/test-timer-again.c
+++ b/deps/uv/test/test-timer-again.c
@@ -31,7 +31,7 @@ static int repeat_2_cb_allowed = 0;
static uv_timer_t dummy, repeat_1, repeat_2;
-static int64_t start_time;
+static uint64_t start_time;
static void close_cb(uv_handle_t* handle) {
diff --git a/deps/uv/test/test-timer.c b/deps/uv/test/test-timer.c
index b1accb1e01..60b080d28e 100644
--- a/deps/uv/test/test-timer.c
+++ b/deps/uv/test/test-timer.c
@@ -27,8 +27,9 @@ static int once_cb_called = 0;
static int once_close_cb_called = 0;
static int repeat_cb_called = 0;
static int repeat_close_cb_called = 0;
+static int order_cb_called = 0;
-static int64_t start_time;
+static uint64_t start_time;
static void once_close_cb(uv_handle_t* handle) {
@@ -153,3 +154,51 @@ TEST_IMPL(timer_start_twice) {
MAKE_VALGRIND_HAPPY();
return 0;
}
+
+
+static void order_cb_a(uv_timer_t *handle, int status) {
+ ASSERT(order_cb_called++ == *(int*)handle->data);
+}
+
+
+static void order_cb_b(uv_timer_t *handle, int status) {
+ ASSERT(order_cb_called++ == *(int*)handle->data);
+}
+
+
+TEST_IMPL(timer_order) {
+ int first;
+ int second;
+ uv_timer_t handle_a;
+ uv_timer_t handle_b;
+
+ first = 0;
+ second = 1;
+ ASSERT(0 == uv_timer_init(uv_default_loop(), &handle_a));
+ ASSERT(0 == uv_timer_init(uv_default_loop(), &handle_b));
+
+ /* Test for starting handle_a then handle_b */
+ handle_a.data = &first;
+ ASSERT(0 == uv_timer_start(&handle_a, order_cb_a, 0, 0));
+ handle_b.data = &second;
+ ASSERT(0 == uv_timer_start(&handle_b, order_cb_b, 0, 0));
+ ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
+
+ ASSERT(order_cb_called == 2);
+
+ ASSERT(0 == uv_timer_stop(&handle_a));
+ ASSERT(0 == uv_timer_stop(&handle_b));
+
+ /* Test for starting handle_b then handle_a */
+ order_cb_called = 0;
+ handle_b.data = &first;
+ ASSERT(0 == uv_timer_start(&handle_b, order_cb_b, 0, 0));
+
+ handle_a.data = &second;
+ ASSERT(0 == uv_timer_start(&handle_a, order_cb_a, 0, 0));
+ ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
+
+ ASSERT(order_cb_called == 2);
+
+ return 0;
+}