summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-02-24 04:03:49 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-02-24 04:03:49 +0100
commitde9ee2a483012c0dc3fb48930c1e96baaa466b65 (patch)
tree92c7f84bd3b5194cbc6ea87f3e66d833d9ff7e39 /deps
parent74c08403d89366d184089bee9a2ccd4e46cd05c4 (diff)
downloadandroid-node-v8-de9ee2a483012c0dc3fb48930c1e96baaa466b65.tar.gz
android-node-v8-de9ee2a483012c0dc3fb48930c1e96baaa466b65.tar.bz2
android-node-v8-de9ee2a483012c0dc3fb48930c1e96baaa466b65.zip
deps: upgrade libuv to e89aced
Diffstat (limited to 'deps')
-rw-r--r--deps/uv/common.gypi8
-rw-r--r--deps/uv/config-unix.mk13
-rw-r--r--deps/uv/src/unix/core.c22
-rw-r--r--deps/uv/src/unix/darwin-proctitle.m78
-rw-r--r--deps/uv/src/unix/darwin.c27
-rw-r--r--deps/uv/src/unix/kqueue.c6
-rw-r--r--deps/uv/src/unix/linux-core.c98
-rw-r--r--deps/uv/src/unix/pipe.c11
-rw-r--r--deps/uv/src/unix/process.c2
-rw-r--r--deps/uv/src/unix/proctitle.c126
-rw-r--r--deps/uv/src/unix/stream.c29
-rw-r--r--deps/uv/test/run-benchmarks.c2
-rw-r--r--deps/uv/test/run-tests.c2
-rw-r--r--deps/uv/test/runner-unix.c20
-rw-r--r--deps/uv/test/runner.c32
-rw-r--r--deps/uv/test/runner.h8
-rw-r--r--deps/uv/test/test-list.h2
-rw-r--r--deps/uv/test/test-spawn.c13
-rw-r--r--deps/uv/uv.gyp11
19 files changed, 338 insertions, 172 deletions
diff --git a/deps/uv/common.gypi b/deps/uv/common.gypi
index 0a60249582..c3d9527cc8 100644
--- a/deps/uv/common.gypi
+++ b/deps/uv/common.gypi
@@ -172,6 +172,14 @@
'-Wno-unused-parameter',
],
},
+ 'conditions': [
+ ['target_arch=="ia32"', {
+ 'xcode_settings': {'ARCHS': ['i386']},
+ }],
+ ['target_arch=="x64"', {
+ 'xcode_settings': {'ARCHS': ['x86_64']},
+ }],
+ ],
'target_conditions': [
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
diff --git a/deps/uv/config-unix.mk b/deps/uv/config-unix.mk
index 1a4bf9b50e..8d01898227 100644
--- a/deps/uv/config-unix.mk
+++ b/deps/uv/config-unix.mk
@@ -70,11 +70,16 @@ endif
ifeq (darwin,$(OS))
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
-LDFLAGS+=-framework CoreServices -dynamiclib -install_name "@rpath/libuv.dylib"
+LDFLAGS += -framework Foundation \
+ -framework CoreServices \
+ -framework ApplicationServices \
+ -dynamiclib -install_name "@rpath/libuv.dylib"
SOEXT = dylib
OBJS += src/unix/darwin.o
OBJS += src/unix/kqueue.o
OBJS += src/unix/fsevents.o
+OBJS += src/unix/proctitle.o
+OBJS += src/unix/darwin-proctitle.o
endif
ifeq (linux,$(OS))
@@ -83,7 +88,8 @@ LDFLAGS+=-ldl -lrt
RUNNER_CFLAGS += -D_GNU_SOURCE
OBJS += src/unix/linux-core.o \
src/unix/linux-inotify.o \
- src/unix/linux-syscalls.o
+ src/unix/linux-syscalls.o \
+ src/unix/proctitle.o
endif
ifeq (freebsd,$(OS))
@@ -156,3 +162,6 @@ clean-platform:
distclean-platform:
-rm -f libuv.a libuv.$(SOEXT) test/run-{tests,benchmarks}.dSYM
+
+%.pic.o %.o: %.m
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
index d59927729b..e5c9a4d98a 100644
--- a/deps/uv/src/unix/core.c
+++ b/deps/uv/src/unix/core.c
@@ -603,14 +603,6 @@ void uv__io_init(uv__io_t* w, uv__io_cb cb, int fd) {
}
-/* Note that uv__io_start() and uv__io_stop() can't simply remove the watcher
- * from the queue when the new event mask equals the old one. The event ports
- * backend operates exclusively in single-shot mode and needs to rearm all fds
- * before each call to port_getn(). It's up to the individual backends to
- * filter out superfluous event mask modifications.
- */
-
-
void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
assert(0 == (events & ~(UV__POLLIN | UV__POLLOUT)));
assert(0 != events);
@@ -620,6 +612,20 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
w->pevents |= events;
maybe_resize(loop, w->fd + 1);
+#if !defined(__sun)
+ /* The event ports backend needs to rearm all file descriptors on each and
+ * every tick of the event loop but the other backends allow us to
+ * short-circuit here if the event mask is unchanged.
+ */
+ if (w->events == w->pevents) {
+ if (w->events == 0 && !ngx_queue_empty(&w->watcher_queue)) {
+ ngx_queue_remove(&w->watcher_queue);
+ ngx_queue_init(&w->watcher_queue);
+ }
+ return;
+ }
+#endif
+
if (ngx_queue_empty(&w->watcher_queue))
ngx_queue_insert_tail(&loop->watcher_queue, &w->watcher_queue);
diff --git a/deps/uv/src/unix/darwin-proctitle.m b/deps/uv/src/unix/darwin-proctitle.m
new file mode 100644
index 0000000000..d0ee95b498
--- /dev/null
+++ b/deps/uv/src/unix/darwin-proctitle.m
@@ -0,0 +1,78 @@
+/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <Cocoa/Cocoa.h>
+
+
+int uv__set_process_title(const char* title) {
+ typedef CFTypeRef (*LSGetCurrentApplicationASNType)(void);
+ typedef OSStatus (*LSSetApplicationInformationItemType)(int,
+ CFTypeRef,
+ CFStringRef,
+ CFStringRef,
+ CFDictionaryRef*);
+ CFBundleRef launch_services_bundle;
+ LSGetCurrentApplicationASNType ls_get_current_application_asn;
+ LSSetApplicationInformationItemType ls_set_application_information_item;
+ CFStringRef* display_name_key;
+ ProcessSerialNumber psn;
+ CFTypeRef asn;
+ CFStringRef display_name;
+ OSStatus err;
+
+ launch_services_bundle =
+ CFBundleGetBundleWithIdentifier(CFSTR("com.apple.LaunchServices"));
+
+ if (launch_services_bundle == NULL)
+ return -1;
+
+ ls_get_current_application_asn =
+ CFBundleGetFunctionPointerForName(launch_services_bundle,
+ CFSTR("_LSGetCurrentApplicationASN"));
+
+ if (ls_get_current_application_asn == NULL)
+ return -1;
+
+ ls_set_application_information_item =
+ CFBundleGetFunctionPointerForName(launch_services_bundle,
+ CFSTR("_LSSetApplicationInformationItem"));
+
+ if (ls_set_application_information_item == NULL)
+ return -1;
+
+ display_name_key = CFBundleGetDataPointerForName(launch_services_bundle,
+ CFSTR("_kLSDisplayNameKey"));
+
+ if (display_name_key == NULL || *display_name_key == NULL)
+ return -1;
+
+ /* Force the process manager to initialize. */
+ GetCurrentProcess(&psn);
+
+ display_name = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8);
+ asn = ls_get_current_application_asn();
+ err = ls_set_application_information_item(-2, /* Magic value. */
+ asn,
+ *display_name_key,
+ display_name,
+ NULL);
+
+ return (err == noErr) ? 0 : -1;
+}
diff --git a/deps/uv/src/unix/darwin.c b/deps/uv/src/unix/darwin.c
index b5cba8636c..82a640a840 100644
--- a/deps/uv/src/unix/darwin.c
+++ b/deps/uv/src/unix/darwin.c
@@ -37,8 +37,6 @@
#include <sys/sysctl.h>
#include <unistd.h> /* sysconf */
-static char *process_title;
-
/* Forward declarations */
void uv__cf_loop_runner(void* arg);
void uv__cf_loop_cb(void* arg);
@@ -254,31 +252,6 @@ void uv_loadavg(double avg[3]) {
}
-char** uv_setup_args(int argc, char** argv) {
- process_title = argc ? strdup(argv[0]) : NULL;
- return argv;
-}
-
-
-uv_err_t uv_set_process_title(const char* title) {
- /* TODO implement me */
- return uv__new_artificial_error(UV_ENOSYS);
-}
-
-
-uv_err_t uv_get_process_title(char* buffer, size_t size) {
- if (process_title) {
- strncpy(buffer, process_title, size);
- } else {
- if (size > 0) {
- buffer[0] = '\0';
- }
- }
-
- return uv_ok_;
-}
-
-
uv_err_t uv_resident_set_memory(size_t* rss) {
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c
index fa09070961..378903a627 100644
--- a/deps/uv/src/unix/kqueue.c
+++ b/deps/uv/src/unix/kqueue.c
@@ -84,12 +84,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
assert(w->fd >= 0);
assert(w->fd < (int) loop->nwatchers);
- /* Filter out no-op changes. This is for compatibility with the event ports
- * backend, see uv__io_start().
- */
- if (w->events == w->pevents)
- continue;
-
if ((w->events & UV__POLLIN) == 0 && (w->pevents & UV__POLLIN) != 0) {
filter = EVFILT_READ;
fflags = 0;
diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c
index 7c01d78015..0b0f58d128 100644
--- a/deps/uv/src/unix/linux-core.c
+++ b/deps/uv/src/unix/linux-core.c
@@ -57,25 +57,12 @@
# define CLOCK_BOOTTIME 7
#endif
-static void* args_mem;
-
-static struct {
- char *str;
- size_t len;
-} process_title;
-
static void read_models(unsigned int numcpus, uv_cpu_info_t* ci);
static void read_speeds(unsigned int numcpus, uv_cpu_info_t* ci);
static void read_times(unsigned int numcpus, uv_cpu_info_t* ci);
static unsigned long read_cpufreq(unsigned int cpunum);
-__attribute__((destructor))
-static void free_args_mem(void) {
- free(args_mem); /* keep valgrind happy */
-}
-
-
int uv__platform_loop_init(uv_loop_t* loop, int default_loop) {
int fd;
@@ -140,12 +127,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
assert(w->fd >= 0);
assert(w->fd < (int) loop->nwatchers);
- /* Filter out no-op changes. This is for compatibility with the event ports
- * backend, see the comment in uv__io_start().
- */
- if (w->events == w->pevents)
- continue;
-
e.events = w->pevents;
e.data = w->fd;
@@ -302,78 +283,6 @@ uint64_t uv_get_total_memory(void) {
}
-char** uv_setup_args(int argc, char** argv) {
- char **new_argv;
- char **new_env;
- size_t size;
- int envc;
- char *s;
- int i;
-
- for (envc = 0; environ[envc]; envc++);
-
- s = envc ? environ[envc - 1] : argv[argc - 1];
-
- process_title.str = argv[0];
- process_title.len = s + strlen(s) + 1 - argv[0];
-
- size = process_title.len;
- size += (argc + 1) * sizeof(char **);
- size += (envc + 1) * sizeof(char **);
-
- if (NULL == (s = malloc(size))) {
- process_title.str = NULL;
- process_title.len = 0;
- return argv;
- }
- args_mem = s;
-
- new_argv = (char **) s;
- new_env = new_argv + argc + 1;
- s = (char *) (new_env + envc + 1);
- memcpy(s, process_title.str, process_title.len);
-
- for (i = 0; i < argc; i++)
- new_argv[i] = s + (argv[i] - argv[0]);
- new_argv[argc] = NULL;
-
- s += environ[0] - argv[0];
-
- for (i = 0; i < envc; i++)
- new_env[i] = s + (environ[i] - environ[0]);
- new_env[envc] = NULL;
-
- environ = new_env;
- return new_argv;
-}
-
-
-uv_err_t uv_set_process_title(const char* title) {
- /* No need to terminate, last char is always '\0'. */
- if (process_title.len)
- strncpy(process_title.str, title, process_title.len - 1);
-
-#if defined(PR_SET_NAME)
- prctl(PR_SET_NAME, title);
-#endif
-
- return uv_ok_;
-}
-
-
-uv_err_t uv_get_process_title(char* buffer, size_t size) {
- if (process_title.str) {
- strncpy(buffer, process_title.str, size);
- } else {
- if (size > 0) {
- buffer[0] = '\0';
- }
- }
-
- return uv_ok_;
-}
-
-
uv_err_t uv_resident_set_memory(size_t* rss) {
FILE* f;
int itmp;
@@ -793,3 +702,10 @@ void uv_free_interface_addresses(uv_interface_address_t* addresses,
free(addresses);
}
+
+
+void uv__set_process_title(const char* title) {
+#if defined(PR_SET_NAME)
+ prctl(PR_SET_NAME, title); /* Only copies first 16 characters. */
+#endif
+}
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c
index b28c8ef919..1185b91a1b 100644
--- a/deps/uv/src/unix/pipe.c
+++ b/deps/uv/src/unix/pipe.c
@@ -183,9 +183,6 @@ void uv_pipe_connect(uv_connect_t* req,
uv_strlcpy(saddr.sun_path, name, sizeof(saddr.sun_path));
saddr.sun_family = AF_UNIX;
- /* We don't check for EINPROGRESS. Think about it: the socket
- * is either there or not.
- */
do {
r = connect(uv__stream_fd(handle),
(struct sockaddr*)&saddr, sizeof saddr);
@@ -193,7 +190,8 @@ void uv_pipe_connect(uv_connect_t* req,
while (r == -1 && errno == EINTR);
if (r == -1)
- goto out;
+ if (errno != EINPROGRESS)
+ goto out;
if (new_sock)
if (uv__stream_open((uv_stream_t*)handle,
@@ -213,8 +211,9 @@ out:
req->cb = cb;
ngx_queue_init(&req->queue);
- /* Run callback on next tick. */
- uv__io_feed(handle->loop, &handle->io_watcher);
+ /* Force callback to run on next tick in case of error. */
+ if (err != 0)
+ uv__io_feed(handle->loop, &handle->io_watcher);
/* Mimic the Windows pipe implementation, always
* return 0 and let the callback handle errors.
diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c
index 4c5714fa04..267ecb64c3 100644
--- a/deps/uv/src/unix/process.c
+++ b/deps/uv/src/unix/process.c
@@ -89,6 +89,8 @@ static void uv__chld(uv_signal_t* handle, int signum) {
if (process == NULL)
continue; /* XXX bug? abort? */
+ uv__handle_stop(process);
+
if (process->exit_cb == NULL)
continue;
diff --git a/deps/uv/src/unix/proctitle.c b/deps/uv/src/unix/proctitle.c
new file mode 100644
index 0000000000..c4043af311
--- /dev/null
+++ b/deps/uv/src/unix/proctitle.c
@@ -0,0 +1,126 @@
+/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "uv.h"
+#include "internal.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+extern void uv__set_process_title(const char* title);
+
+static void* args_mem;
+
+static struct {
+ char* str;
+ int len;
+} process_title;
+
+
+char** uv_setup_args(int argc, char** argv) {
+ char** new_argv;
+ char** new_env;
+ size_t size;
+ int envc;
+ char* s;
+ int i;
+
+#if defined(__APPLE__)
+ char*** _NSGetArgv(void);
+ char*** _NSGetEnviron(void);
+ char** environ = *_NSGetEnviron();
+#else
+ extern char** environ;
+#endif
+
+ for (envc = 0; environ[envc]; envc++);
+
+ if (envc == 0)
+ s = argv[argc - 1];
+ else
+ s = environ[envc - 1];
+
+ process_title.str = argv[0];
+ process_title.len = s + strlen(s) + 1 - argv[0];
+
+ size = process_title.len;
+ size += (argc + 1) * sizeof(char**);
+ size += (envc + 1) * sizeof(char**);
+ s = args_mem = malloc(size);
+
+ if (s == NULL) {
+ process_title.str = NULL;
+ process_title.len = 0;
+ return argv;
+ }
+
+ new_argv = (char**) s;
+ new_env = new_argv + argc + 1;
+ s = (char*) (new_env + envc + 1);
+ memcpy(s, process_title.str, process_title.len);
+
+ for (i = 0; i < argc; i++)
+ new_argv[i] = s + (argv[i] - argv[0]);
+ new_argv[argc] = NULL;
+
+ s += environ[0] - argv[0];
+
+ for (i = 0; i < envc; i++)
+ new_env[i] = s + (environ[i] - environ[0]);
+ new_env[envc] = NULL;
+
+#if defined(__APPLE__)
+ *_NSGetArgv() = new_argv;
+ *_NSGetEnviron() = new_env;
+#else
+ environ = new_env;
+#endif
+
+ return new_argv;
+}
+
+
+uv_err_t uv_set_process_title(const char* title) {
+ if (process_title.len == 0)
+ return uv_ok_;
+
+ /* No need to terminate, last char is always '\0'. */
+ strncpy(process_title.str, title, process_title.len - 1);
+ uv__set_process_title(title);
+
+ return uv_ok_;
+}
+
+
+uv_err_t uv_get_process_title(char* buffer, size_t size) {
+ if (process_title.len > 0)
+ strncpy(buffer, process_title.str, size);
+ else if (size > 0)
+ buffer[0] = '\0';
+
+ return uv_ok_;
+}
+
+
+__attribute__((destructor))
+static void free_args_mem(void) {
+ free(args_mem); /* Keep valgrind happy. */
+ args_mem = NULL;
+}
diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c
index 00e451c561..ff420db231 100644
--- a/deps/uv/src/unix/stream.c
+++ b/deps/uv/src/unix/stream.c
@@ -1188,21 +1188,20 @@ int uv_write2(uv_write_t* req,
int empty_queue;
assert(bufcnt > 0);
+ assert((stream->type == UV_TCP ||
+ stream->type == UV_NAMED_PIPE ||
+ stream->type == UV_TTY) &&
+ "uv_write (unix) does not yet support other types of streams");
- assert((stream->type == UV_TCP || stream->type == UV_NAMED_PIPE ||
- stream->type == UV_TTY) &&
- "uv_write (unix) does not yet support other types of streams");
-
- if (uv__stream_fd(stream) < 0) {
- uv__set_sys_error(stream->loop, EBADF);
- return -1;
- }
+ if (uv__stream_fd(stream) < 0)
+ return uv__set_artificial_error(stream->loop, UV_EBADF);
if (send_handle) {
- if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc) {
- uv__set_sys_error(stream->loop, EOPNOTSUPP);
- return -1;
- }
+ if (stream->type != UV_NAMED_PIPE || !((uv_pipe_t*)stream)->ipc)
+ return uv__set_artificial_error(stream->loop, UV_EINVAL);
+
+ if (uv__stream_fd(send_handle) < 0)
+ return uv__set_artificial_error(stream->loop, UV_EBADF);
}
empty_queue = (stream->write_queue_size == 0);
@@ -1268,10 +1267,8 @@ static int uv__read_start_common(uv_stream_t* stream,
assert(stream->type == UV_TCP || stream->type == UV_NAMED_PIPE ||
stream->type == UV_TTY);
- if (stream->flags & UV_CLOSING) {
- uv__set_sys_error(stream->loop, EINVAL);
- return -1;
- }
+ if (stream->flags & UV_CLOSING)
+ return uv__set_sys_error(stream->loop, EINVAL);
/* The UV_STREAM_READING flag is irrelevant of the state of the tcp - it just
* expresses the desired state of the user.
diff --git a/deps/uv/test/run-benchmarks.c b/deps/uv/test/run-benchmarks.c
index af11beb9b4..06732b71d3 100644
--- a/deps/uv/test/run-benchmarks.c
+++ b/deps/uv/test/run-benchmarks.c
@@ -60,5 +60,5 @@ static int maybe_run_test(int argc, char **argv) {
return 42;
}
- return run_test(argv[1], BENCHMARK_TIMEOUT, 1);
+ return run_test(argv[1], BENCHMARK_TIMEOUT, 1, 1);
}
diff --git a/deps/uv/test/run-tests.c b/deps/uv/test/run-tests.c
index a81c7e5ff6..d84be6a1a5 100644
--- a/deps/uv/test/run-tests.c
+++ b/deps/uv/test/run-tests.c
@@ -155,5 +155,5 @@ static int maybe_run_test(int argc, char **argv) {
return 1;
}
- return run_test(argv[1], TEST_TIMEOUT, 0);
+ return run_test(argv[1], TEST_TIMEOUT, 0, 1);
}
diff --git a/deps/uv/test/runner-unix.c b/deps/uv/test/runner-unix.c
index 267cc7cbf4..ebda5f8f1b 100644
--- a/deps/uv/test/runner-unix.c
+++ b/deps/uv/test/runner-unix.c
@@ -42,6 +42,7 @@
/* Do platform-specific initialization. */
void platform_init(int argc, char **argv) {
const char* var = getenv("UV_RUN_AS_ROOT");
+ const char* tap = getenv("UV_TAP_OUTPUT");
/* Running the tests as root is not smart - don't do it. */
if (getuid() == 0 && (var == NULL || atoi(var) <= 0)) {
@@ -49,6 +50,8 @@ void platform_init(int argc, char **argv) {
exit(1);
}
+ tap_output = (tap != NULL && atoi(tap) > 0);
+
/* Disable stdio output buffering. */
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
@@ -261,19 +264,26 @@ int process_copy_output(process_info_t *p, int fd) {
return -1;
}
- ssize_t nread, nwritten;
+ ssize_t nwritten;
char buf[1024];
- while ((nread = read(fileno(p->stdout_file), buf, 1024)) > 0) {
- nwritten = write(fd, buf, nread);
- /* TODO: what if write doesn't write the whole buffer... */
+ /* TODO: what if the line is longer than buf */
+ while (fgets(buf, sizeof(buf), p->stdout_file) != NULL) {
+ /* TODO: what if write doesn't write the whole buffer... */
+ nwritten = 0;
+
+ if (tap_output)
+ nwritten += write(fd, "#", 1);
+
+ nwritten += write(fd, buf, strlen(buf));
+
if (nwritten < 0) {
perror("write");
return -1;
}
}
- if (nread < 0) {
+ if (ferror(p->stdout_file)) {
perror("read");
return -1;
}
diff --git a/deps/uv/test/runner.c b/deps/uv/test/runner.c
index 01d6c773d2..1b9a980926 100644
--- a/deps/uv/test/runner.c
+++ b/deps/uv/test/runner.c
@@ -28,6 +28,8 @@
char executable_path[PATHMAX] = { '\0' };
+int tap_output = 0;
+
static void log_progress(int total, int passed, int failed, const char* name) {
if (total == 0)
@@ -76,7 +78,7 @@ const char* fmt(double d) {
int run_tests(int timeout, int benchmark_output) {
- int total, passed, failed;
+ int total, passed, failed, current;
task_entry_t* task;
/* Count the number of tests. */
@@ -87,29 +89,35 @@ int run_tests(int timeout, int benchmark_output) {
}
}
+ if (tap_output) {
+ LOGF("1..%d\n", total);
+ }
+
/* Run all tests. */
passed = 0;
failed = 0;
+ current = 1;
for (task = TASKS; task->main; task++) {
if (task->is_helper) {
continue;
}
rewind_cursor();
- if (!benchmark_output) {
+ if (!benchmark_output && !tap_output) {
log_progress(total, passed, failed, task->task_name);
}
- if (run_test(task->task_name, timeout, benchmark_output) == 0) {
+ if (run_test(task->task_name, timeout, benchmark_output, current) == 0) {
passed++;
} else {
failed++;
}
+ current++;
}
rewind_cursor();
- if (!benchmark_output) {
+ if (!benchmark_output && !tap_output) {
log_progress(total, passed, failed, "Done.\n");
}
@@ -117,7 +125,10 @@ int run_tests(int timeout, int benchmark_output) {
}
-int run_test(const char* test, int timeout, int benchmark_output) {
+int run_test(const char* test,
+ int timeout,
+ int benchmark_output,
+ int test_count) {
char errmsg[1024] = "no error";
process_info_t processes[1024];
process_info_t *main_proc;
@@ -243,7 +254,9 @@ out:
/* Show error and output from processes if the test failed. */
if (status != 0 || task->show_output) {
- if (status != 0) {
+ if (tap_output) {
+ LOGF("not ok %d - %s\n#", test_count, test);
+ } else if (status != 0) {
LOGF("\n`%s` failed: %s\n", test, errmsg);
} else {
LOGF("\n");
@@ -267,7 +280,10 @@ out:
break;
}
}
- LOG("=============================================================\n");
+
+ if (!tap_output) {
+ LOG("=============================================================\n");
+ }
/* In benchmark mode show concise output from the main process. */
} else if (benchmark_output) {
@@ -286,6 +302,8 @@ out:
}
break;
}
+ } else if (tap_output) {
+ LOGF("ok %d - %s\n", test_count, test);
}
/* Clean up all process handles. */
diff --git a/deps/uv/test/runner.h b/deps/uv/test/runner.h
index 3919007bb5..8be9e39fcc 100644
--- a/deps/uv/test/runner.h
+++ b/deps/uv/test/runner.h
@@ -102,7 +102,10 @@ int run_tests(int timeout, int benchmark_output);
/*
* Run a single test. Starts up any helpers.
*/
-int run_test(const char* test, int timeout, int benchmark_output);
+int run_test(const char* test,
+ int timeout,
+ int benchmark_output,
+ int test_count);
/*
* Run a test part, i.e. the test or one of its helpers.
@@ -156,4 +159,7 @@ void process_cleanup(process_info_t *p);
/* Move the console cursor one line up and back to the first column. */
void rewind_cursor(void);
+/* trigger output as tap */
+extern int tap_output;
+
#endif /* RUNNER_H_ */
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index efc97380fa..6c7da04ce0 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -152,6 +152,7 @@ TEST_DECLARE (spawn_preserve_env)
TEST_DECLARE (spawn_setuid_fails)
TEST_DECLARE (spawn_setgid_fails)
TEST_DECLARE (spawn_stdout_to_file)
+TEST_DECLARE (spawn_auto_unref)
TEST_DECLARE (fs_poll)
TEST_DECLARE (kill)
TEST_DECLARE (fs_file_noent)
@@ -413,6 +414,7 @@ TASK_LIST_START
TEST_ENTRY (spawn_setuid_fails)
TEST_ENTRY (spawn_setgid_fails)
TEST_ENTRY (spawn_stdout_to_file)
+ TEST_ENTRY (spawn_auto_unref)
TEST_ENTRY (fs_poll)
TEST_ENTRY (kill)
diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c
index a93e876390..56eca9c58c 100644
--- a/deps/uv/test/test-spawn.c
+++ b/deps/uv/test/test-spawn.c
@@ -923,3 +923,16 @@ TEST_IMPL(spawn_setgid_fails) {
return 0;
}
#endif
+
+
+TEST_IMPL(spawn_auto_unref) {
+ init_process_options("spawn_helper1", NULL);
+ ASSERT(0 == uv_spawn(uv_default_loop(), &process, options));
+ ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
+ ASSERT(0 == uv_is_closing((uv_handle_t*) &process));
+ uv_close((uv_handle_t*) &process, NULL);
+ ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
+ ASSERT(0 != uv_is_closing((uv_handle_t*) &process));
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp
index 301b938576..075724dc52 100644
--- a/deps/uv/uv.gyp
+++ b/deps/uv/uv.gyp
@@ -157,11 +157,20 @@
}],
],
}],
+ [ 'OS=="linux" or OS=="mac"', {
+ 'sources': [ 'src/unix/proctitle.c' ],
+ }],
[ 'OS=="mac"', {
- 'sources': [ 'src/unix/darwin.c', 'src/unix/fsevents.c' ],
+ 'sources': [
+ 'src/unix/darwin.c',
+ 'src/unix/fsevents.c',
+ 'src/unix/darwin-proctitle.m',
+ ],
'link_settings': {
'libraries': [
+ '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreServices.framework',
+ '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework',
],
},
'defines': [