Browse Source

uv: Upgrade to v0.11.17

v0.11.10-release
Timothy J Fontaine 11 years ago
parent
commit
8590f810a5
  1. 3
      deps/uv/.gitignore
  2. 1
      deps/uv/.mailmap
  3. 2
      deps/uv/AUTHORS
  4. 17
      deps/uv/ChangeLog
  5. 2
      deps/uv/Makefile.am
  6. 16
      deps/uv/README.md
  7. 1
      deps/uv/checksparse.sh
  8. 10
      deps/uv/include/uv.h
  9. 7
      deps/uv/src/unix/core.c
  10. 7
      deps/uv/src/unix/fs.c
  11. 3
      deps/uv/src/unix/kqueue.c
  12. 83
      deps/uv/src/unix/stream.c
  13. 2
      deps/uv/src/version.c
  14. 7
      deps/uv/src/win/core.c
  15. 7
      deps/uv/src/win/pipe.c
  16. 4
      deps/uv/src/win/stream.c
  17. 2
      deps/uv/test/test-ip4-addr.c
  18. 4
      deps/uv/test/test-list.h
  19. 68
      deps/uv/test/test-loop-alive.c
  20. 91
      deps/uv/test/test-pipe-server-close.c
  21. 5
      deps/uv/test/test-spawn.c
  22. 3
      deps/uv/test/test-tcp-try-write.c
  23. 2
      deps/uv/uv.gyp
  24. 8
      deps/uv/vcbuild.bat

3
deps/uv/.gitignore

@ -37,6 +37,9 @@ Makefile.in
# Generated by dtrace(1) when doing an in-tree build. # Generated by dtrace(1) when doing an in-tree build.
/include/uv-dtrace.h /include/uv-dtrace.h
# Generated by gyp for android
*.target.mk
/out/ /out/
/build/gyp /build/gyp

1
deps/uv/.mailmap

@ -1,4 +1,5 @@
Alan Gutierrez <alan@prettyrobots.com> <alan@blogometer.com> Alan Gutierrez <alan@prettyrobots.com> <alan@blogometer.com>
Andrius Bentkus <andrius.bentkus@gmail.com> <toxedvirus@gmail.com>
Bert Belder <bertbelder@gmail.com> <info@2bs.nl> Bert Belder <bertbelder@gmail.com> <info@2bs.nl>
Bert Belder <bertbelder@gmail.com> <user@ChrUbuntu.(none)> Bert Belder <bertbelder@gmail.com> <user@ChrUbuntu.(none)>
Brandon Philips <brandon.philips@rackspace.com> <brandon@ifup.org> Brandon Philips <brandon.philips@rackspace.com> <brandon@ifup.org>

2
deps/uv/AUTHORS

@ -108,3 +108,5 @@ Andrej Manduch <AManduch@gmail.com>
Joshua Neuheisel <joshua@neuheisel.us> Joshua Neuheisel <joshua@neuheisel.us>
Alexis Campailla <alexis@janeasystems.com> Alexis Campailla <alexis@janeasystems.com>
Yorkie <yorkiefixer@gmail.com> Yorkie <yorkiefixer@gmail.com>
Sam Roberts <vieuxtech@gmail.com>
River Tarnell <river@loreley.flyingparchment.org.uk>

17
deps/uv/ChangeLog

@ -1,3 +1,20 @@
2013.12.32, Version 0.11.17 (Unstable)
Changes since version 0.11.16:
* stream: allow multiple buffers for uv_try_write (Fedor Indutny)
* unix: fix a possible memory leak in uv_fs_readdir (Alex Crichton)
* unix, windows: add uv_loop_alive() function (Sam Roberts)
* windows: avoid assertion failure when pipe server is closed (Bert Belder)
* osx: Fix a possible segfault in uv__io_poll (Alex Crichton)
* stream: fix uv__stream_osx_select (Fedor Indutny)
2013.12.14, Version 0.11.16 (Unstable), ae0ed8c49d0d313c935c22077511148b6e8408a4 2013.12.14, Version 0.11.16 (Unstable), ae0ed8c49d0d313c935c22077511148b6e8408a4
Changes since version 0.11.15: Changes since version 0.11.15:

2
deps/uv/Makefile.am

@ -145,6 +145,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test/test-ipc.c \ test/test-ipc.c \
test/test-list.h \ test/test-list.h \
test/test-loop-handles.c \ test/test-loop-handles.c \
test/test-loop-alive.c \
test/test-loop-stop.c \ test/test-loop-stop.c \
test/test-loop-time.c \ test/test-loop-time.c \
test/test-multiple-listen.c \ test/test-multiple-listen.c \
@ -154,6 +155,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test/test-ping-pong.c \ test/test-ping-pong.c \
test/test-pipe-bind-error.c \ test/test-pipe-bind-error.c \
test/test-pipe-connect-error.c \ test/test-pipe-connect-error.c \
test/test-pipe-server-close.c \
test/test-platform-output.c \ test/test-platform-output.c \
test/test-poll-close.c \ test/test-poll-close.c \
test/test-poll.c \ test/test-poll.c \

16
deps/uv/README.md

@ -4,7 +4,7 @@ libuv is a multi-platform support library with a focus on asynchronous I/O. It
was primarily developed for use by [Node.js](http://nodejs.org), but it's also was primarily developed for use by [Node.js](http://nodejs.org), but it's also
used by Mozilla's [Rust language](http://www.rust-lang.org/), used by Mozilla's [Rust language](http://www.rust-lang.org/),
[Luvit](http://luvit.io/), [Julia](http://julialang.org/), [Luvit](http://luvit.io/), [Julia](http://julialang.org/),
[pyuv](https://crate.io/packages/pyuv/), and others. [pyuv](https://crate.io/packages/pyuv/), and [others](https://github.com/joyent/libuv/wiki/Projects-that-use-libuv).
## Feature highlights ## Feature highlights
@ -41,12 +41,14 @@ used by Mozilla's [Rust language](http://www.rust-lang.org/),
* [include/uv.h](https://github.com/joyent/libuv/blob/master/include/uv.h) * [include/uv.h](https://github.com/joyent/libuv/blob/master/include/uv.h)
&mdash; API documentation in the form of detailed header comments. &mdash; API documentation in the form of detailed header comments.
* [An Introduction to libuv](http://nikhilm.github.com/uvbook/) &mdash; An * [An Introduction to libuv](http://nikhilm.github.com/uvbook/)
overview of libuv with tutorials. &mdash; An overview of libuv with tutorials.
* [LXJS 2012 talk](http://www.youtube.com/watch?v=nGn60vDSxQ4) - High-level * [LXJS 2012 talk](http://www.youtube.com/watch?v=nGn60vDSxQ4)
introductory talk about libuv. &mdash; High-level introductory talk about libuv.
* [Tests and benchmarks](https://github.com/joyent/libuv/tree/master/test) - * [Tests and benchmarks](https://github.com/joyent/libuv/tree/master/test)
API specification and usage examples. &mdash; API specification and usage examples.
* [libuv-dox](https://github.com/thlorenz/libuv-dox)
&mdash; Documenting types and methods of libuv, mostly by reading uv.h.
## Build Instructions ## Build Instructions

1
deps/uv/checksparse.sh

@ -115,6 +115,7 @@ test/test-pass-always.c
test/test-ping-pong.c test/test-ping-pong.c
test/test-pipe-bind-error.c test/test-pipe-bind-error.c
test/test-pipe-connect-error.c test/test-pipe-connect-error.c
test/test-pipe-server-close.c
test/test-platform-output.c test/test-platform-output.c
test/test-poll-close.c test/test-poll-close.c
test/test-poll.c test/test-poll.c

10
deps/uv/include/uv.h

@ -272,6 +272,12 @@ UV_EXTERN uv_loop_t* uv_default_loop(void);
*/ */
UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode); UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode);
/*
* This function checks whether the reference count, the number of active
* handles or requests left in the event loop, is non-zero.
*/
UV_EXTERN int uv_loop_alive(const uv_loop_t* loop);
/* /*
* This function will stop the event loop by forcing uv_run to end * This function will stop the event loop by forcing uv_run to end
* as soon as possible, but not sooner than the next loop iteration. * as soon as possible, but not sooner than the next loop iteration.
@ -681,7 +687,9 @@ UV_EXTERN int uv_write2(uv_write_t* req,
* - zero - if queued write is needed * - zero - if queued write is needed
* - negative error code * - negative error code
*/ */
UV_EXTERN int uv_try_write(uv_stream_t* handle, const char* buf, size_t length); UV_EXTERN int uv_try_write(uv_stream_t* handle,
const uv_buf_t bufs[],
unsigned int nbufs);
/* uv_write_t is a subclass of uv_req_t */ /* uv_write_t is a subclass of uv_req_t */
struct uv_write_s { struct uv_write_s {

7
deps/uv/src/unix/core.c

@ -248,13 +248,18 @@ int uv_backend_timeout(const uv_loop_t* loop) {
} }
static int uv__loop_alive(uv_loop_t* loop) { static int uv__loop_alive(const uv_loop_t* loop) {
return uv__has_active_handles(loop) || return uv__has_active_handles(loop) ||
uv__has_active_reqs(loop) || uv__has_active_reqs(loop) ||
loop->closing_handles != NULL; loop->closing_handles != NULL;
} }
int uv_loop_alive(const uv_loop_t* loop) {
return uv__loop_alive(loop);
}
int uv_run(uv_loop_t* loop, uv_run_mode mode) { int uv_run(uv_loop_t* loop, uv_run_mode mode) {
int timeout; int timeout;
int r; int r;

7
deps/uv/src/unix/fs.c

@ -213,9 +213,12 @@ static ssize_t uv__fs_readdir(uv_fs_t* req) {
int i; int i;
int n; int n;
dents = NULL;
n = scandir(req->path, &dents, uv__fs_readdir_filter, alphasort); n = scandir(req->path, &dents, uv__fs_readdir_filter, alphasort);
if (n == -1 || n == 0) if (n == 0)
goto out; /* osx still needs to deallocate some memory */
else if (n == -1)
return n; return n;
len = 0; len = 0;
@ -243,7 +246,7 @@ static ssize_t uv__fs_readdir(uv_fs_t* req) {
out: out:
saved_errno = errno; saved_errno = errno;
{ if (dents != NULL) {
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
free(dents[i]); free(dents[i]);
free(dents); free(dents);

3
deps/uv/src/unix/kqueue.c

@ -167,11 +167,10 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
for (i = 0; i < nfds; i++) { for (i = 0; i < nfds; i++) {
ev = events + i; ev = events + i;
fd = ev->ident; fd = ev->ident;
w = loop->watchers[fd];
/* Skip invalidated events, see uv__platform_invalidate_fd */ /* Skip invalidated events, see uv__platform_invalidate_fd */
if (fd == -1) if (fd == -1)
continue; continue;
w = loop->watchers[fd];
if (w == NULL) { if (w == NULL) {
/* File descriptor that we've stopped watching, disarm it. */ /* File descriptor that we've stopped watching, disarm it. */

83
deps/uv/src/unix/stream.c

@ -138,6 +138,31 @@ void uv__stream_init(uv_loop_t* loop,
} }
static void uv__stream_osx_interrupt_select(uv_stream_t* stream) {
#if defined(__APPLE__)
/* Notify select() thread about state change */
uv__stream_select_t* s;
int r;
s = stream->select;
if (s == NULL)
return;
/* Interrupt select() loop
* NOTE: fake_fd and int_fd are socketpair(), thus writing to one will
* emit read event on other side
*/
do
r = write(s->fake_fd, "x", 1);
while (r == -1 && errno == EINTR);
assert(r == 1);
#else /* !defined(__APPLE__) */
/* No-op on any other platform */
#endif /* !defined(__APPLE__) */
}
#if defined(__APPLE__) #if defined(__APPLE__)
static void uv__stream_osx_select(void* arg) { static void uv__stream_osx_select(void* arg) {
uv_stream_t* stream; uv_stream_t* stream;
@ -168,9 +193,9 @@ static void uv__stream_osx_select(void* arg) {
FD_ZERO(&sread); FD_ZERO(&sread);
FD_ZERO(&swrite); FD_ZERO(&swrite);
if (uv_is_readable(stream)) if (uv__io_active(&stream->io_watcher, UV__POLLIN))
FD_SET(fd, &sread); FD_SET(fd, &sread);
if (uv_is_writable(stream)) if (uv__io_active(&stream->io_watcher, UV__POLLOUT))
FD_SET(fd, &swrite); FD_SET(fd, &swrite);
FD_SET(s->int_fd, &sread); FD_SET(s->int_fd, &sread);
@ -229,25 +254,6 @@ static void uv__stream_osx_select(void* arg) {
} }
static void uv__stream_osx_interrupt_select(uv_stream_t* stream) {
/* Notify select() thread about state change */
uv__stream_select_t* s;
int r;
s = stream->select;
/* Interrupt select() loop
* NOTE: fake_fd and int_fd are socketpair(), thus writing to one will
* emit read event on other side
*/
do
r = write(s->fake_fd, "x", 1);
while (r == -1 && errno == EINTR);
assert(r == 1);
}
static void uv__stream_osx_select_cb(uv_async_t* handle, int status) { static void uv__stream_osx_select_cb(uv_async_t* handle, int status) {
uv__stream_select_t* s; uv__stream_select_t* s;
uv_stream_t* stream; uv_stream_t* stream;
@ -622,6 +628,7 @@ static void uv__drain(uv_stream_t* stream) {
assert(QUEUE_EMPTY(&stream->write_queue)); assert(QUEUE_EMPTY(&stream->write_queue));
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT); uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
uv__stream_osx_interrupt_select(stream);
/* Shutdown? */ /* Shutdown? */
if ((stream->flags & UV_STREAM_SHUTTING) && if ((stream->flags & UV_STREAM_SHUTTING) &&
@ -802,6 +809,7 @@ start:
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT); uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
if (!uv__io_active(&stream->io_watcher, UV__POLLIN)) if (!uv__io_active(&stream->io_watcher, UV__POLLIN))
uv__handle_stop(stream); uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
return; return;
} else if (stream->flags & UV_STREAM_BLOCKING) { } else if (stream->flags & UV_STREAM_BLOCKING) {
/* If this is a blocking stream, try again. */ /* If this is a blocking stream, try again. */
@ -863,6 +871,9 @@ start:
/* We're not done. */ /* We're not done. */
uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT); uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT);
/* Notify select() thread about state change */
uv__stream_osx_interrupt_select(stream);
} }
@ -947,6 +958,7 @@ static void uv__stream_eof(uv_stream_t* stream, const uv_buf_t* buf) {
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN); uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
if (!uv__io_active(&stream->io_watcher, UV__POLLOUT)) if (!uv__io_active(&stream->io_watcher, UV__POLLOUT))
uv__handle_stop(stream); uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
uv__stream_read_cb(stream, UV_EOF, buf, UV_UNKNOWN_HANDLE); uv__stream_read_cb(stream, UV_EOF, buf, UV_UNKNOWN_HANDLE);
} }
@ -1013,6 +1025,7 @@ static void uv__read(uv_stream_t* stream) {
/* Wait for the next one. */ /* Wait for the next one. */
if (stream->flags & UV_STREAM_READING) { if (stream->flags & UV_STREAM_READING) {
uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN); uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN);
uv__stream_osx_interrupt_select(stream);
} }
uv__stream_read_cb(stream, 0, &buf, UV_UNKNOWN_HANDLE); uv__stream_read_cb(stream, 0, &buf, UV_UNKNOWN_HANDLE);
} else { } else {
@ -1105,6 +1118,7 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) {
stream->flags |= UV_STREAM_SHUTTING; stream->flags |= UV_STREAM_SHUTTING;
uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT); uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT);
uv__stream_osx_interrupt_select(stream);
return 0; return 0;
} }
@ -1281,6 +1295,7 @@ int uv_write2(uv_write_t* req,
*/ */
assert(!(stream->flags & UV_STREAM_BLOCKING)); assert(!(stream->flags & UV_STREAM_BLOCKING));
uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT); uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT);
uv__stream_osx_interrupt_select(stream);
} }
return 0; return 0;
@ -1305,13 +1320,14 @@ void uv_try_write_cb(uv_write_t* req, int status) {
} }
int uv_try_write(uv_stream_t* stream, const char* buf, size_t size) { int uv_try_write(uv_stream_t* stream,
const uv_buf_t bufs[],
unsigned int nbufs) {
int r; int r;
int has_pollout; int has_pollout;
size_t written; size_t written;
size_t req_size; size_t req_size;
uv_write_t req; uv_write_t req;
uv_buf_t bufstruct;
/* Connecting or already writing some data */ /* Connecting or already writing some data */
if (stream->connect_req != NULL || stream->write_queue_size != 0) if (stream->connect_req != NULL || stream->write_queue_size != 0)
@ -1319,13 +1335,12 @@ int uv_try_write(uv_stream_t* stream, const char* buf, size_t size) {
has_pollout = uv__io_active(&stream->io_watcher, UV__POLLOUT); has_pollout = uv__io_active(&stream->io_watcher, UV__POLLOUT);
bufstruct = uv_buf_init((char*) buf, size); r = uv_write(&req, stream, bufs, nbufs, uv_try_write_cb);
r = uv_write(&req, stream, &bufstruct, 1, uv_try_write_cb);
if (r != 0) if (r != 0)
return r; return r;
/* Remove not written bytes from write queue size */ /* Remove not written bytes from write queue size */
written = size; written = uv_count_bufs(bufs, nbufs);
if (req.bufs != NULL) if (req.bufs != NULL)
req_size = uv__write_req_size(&req); req_size = uv__write_req_size(&req);
else else
@ -1341,8 +1356,10 @@ int uv_try_write(uv_stream_t* stream, const char* buf, size_t size) {
req.bufs = NULL; req.bufs = NULL;
/* Do not poll for writable, if we wasn't before calling this */ /* Do not poll for writable, if we wasn't before calling this */
if (!has_pollout) if (!has_pollout) {
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT); uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
uv__stream_osx_interrupt_select(stream);
}
return (int) written; return (int) written;
} }
@ -1363,12 +1380,6 @@ static int uv__read_start_common(uv_stream_t* stream,
*/ */
stream->flags |= UV_STREAM_READING; stream->flags |= UV_STREAM_READING;
#if defined(__APPLE__)
/* Notify select() thread about state change */
if (stream->select != NULL)
uv__stream_osx_interrupt_select(stream);
#endif /* defined(__APPLE__) */
/* TODO: try to do the read inline? */ /* TODO: try to do the read inline? */
/* TODO: keep track of tcp state. If we've gotten a EOF then we should /* TODO: keep track of tcp state. If we've gotten a EOF then we should
* not start the IO watcher. * not start the IO watcher.
@ -1382,6 +1393,7 @@ static int uv__read_start_common(uv_stream_t* stream,
uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN); uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN);
uv__handle_start(stream); uv__handle_start(stream);
uv__stream_osx_interrupt_select(stream);
return 0; return 0;
} }
@ -1414,12 +1426,7 @@ int uv_read_stop(uv_stream_t* stream) {
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN); uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
if (!uv__io_active(&stream->io_watcher, UV__POLLOUT)) if (!uv__io_active(&stream->io_watcher, UV__POLLOUT))
uv__handle_stop(stream); uv__handle_stop(stream);
#if defined(__APPLE__)
/* Notify select() thread about state change */
if (stream->select != NULL)
uv__stream_osx_interrupt_select(stream); uv__stream_osx_interrupt_select(stream);
#endif /* defined(__APPLE__) */
stream->read_cb = NULL; stream->read_cb = NULL;
stream->read2_cb = NULL; stream->read2_cb = NULL;

2
deps/uv/src/version.c

@ -32,7 +32,7 @@
#define UV_VERSION_MAJOR 0 #define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 11 #define UV_VERSION_MINOR 11
#define UV_VERSION_PATCH 17 #define UV_VERSION_PATCH 17
#define UV_VERSION_IS_RELEASE 0 #define UV_VERSION_IS_RELEASE 1
#define UV_VERSION ((UV_VERSION_MAJOR << 16) | \ #define UV_VERSION ((UV_VERSION_MAJOR << 16) | \

7
deps/uv/src/win/core.c

@ -256,13 +256,18 @@ static void uv_poll_ex(uv_loop_t* loop, int block) {
} }
static int uv__loop_alive(uv_loop_t* loop) { static int uv__loop_alive(const uv_loop_t* loop) {
return loop->active_handles > 0 || return loop->active_handles > 0 ||
!QUEUE_EMPTY(&loop->active_reqs) || !QUEUE_EMPTY(&loop->active_reqs) ||
loop->endgame_handles != NULL; loop->endgame_handles != NULL;
} }
int uv_loop_alive(const uv_loop_t* loop) {
return uv__loop_alive(loop);
}
int uv_run(uv_loop_t *loop, uv_run_mode mode) { int uv_run(uv_loop_t *loop, uv_run_mode mode) {
int r; int r;
void (*poll)(uv_loop_t* loop, int block); void (*poll)(uv_loop_t* loop, int block);

7
deps/uv/src/win/pipe.c

@ -1557,6 +1557,13 @@ void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle,
assert(handle->type == UV_NAMED_PIPE); assert(handle->type == UV_NAMED_PIPE);
if (handle->flags & UV__HANDLE_CLOSING) {
/* The req->pipeHandle should be freed already in uv_pipe_cleanup(). */
assert(req->pipeHandle == INVALID_HANDLE_VALUE);
DECREASE_PENDING_REQ_COUNT(handle);
return;
}
if (REQ_SUCCESS(req)) { if (REQ_SUCCESS(req)) {
assert(req->pipeHandle != INVALID_HANDLE_VALUE); assert(req->pipeHandle != INVALID_HANDLE_VALUE);
req->next_pending = handle->pending_accepts; req->next_pending = handle->pending_accepts;

4
deps/uv/src/win/stream.c

@ -202,7 +202,9 @@ int uv_write2(uv_write_t* req,
} }
int uv_try_write(uv_stream_t* handle, const char* buf, size_t length) { int uv_try_write(uv_stream_t* stream,
const uv_buf_t bufs[],
unsigned int nbufs) {
/* NOTE: Won't work with overlapped writes */ /* NOTE: Won't work with overlapped writes */
return UV_ENOSYS; return UV_ENOSYS;
} }

2
deps/uv/test/test-ip4-addr.c

@ -37,7 +37,7 @@ TEST_IMPL(ip4_addr) {
ASSERT(UV_EINVAL == uv_ip4_addr("2555.0.0.0", TEST_PORT, &addr)); ASSERT(UV_EINVAL == uv_ip4_addr("2555.0.0.0", TEST_PORT, &addr));
ASSERT(UV_EINVAL == uv_ip4_addr("255", TEST_PORT, &addr)); ASSERT(UV_EINVAL == uv_ip4_addr("255", TEST_PORT, &addr));
// for broken address family /* for broken address family */
ASSERT(UV_EAFNOSUPPORT == uv_inet_pton(42, "127.0.0.1", ASSERT(UV_EAFNOSUPPORT == uv_inet_pton(42, "127.0.0.1",
&addr.sin_addr.s_addr)); &addr.sin_addr.s_addr));

4
deps/uv/test/test-list.h

@ -24,6 +24,7 @@ TEST_DECLARE (callback_order)
TEST_DECLARE (close_order) TEST_DECLARE (close_order)
TEST_DECLARE (run_once) TEST_DECLARE (run_once)
TEST_DECLARE (run_nowait) TEST_DECLARE (run_nowait)
TEST_DECLARE (loop_alive)
TEST_DECLARE (loop_stop) TEST_DECLARE (loop_stop)
TEST_DECLARE (loop_update_time) TEST_DECLARE (loop_update_time)
TEST_DECLARE (barrier_1) TEST_DECLARE (barrier_1)
@ -91,6 +92,7 @@ TEST_DECLARE (pipe_bind_error_inval)
TEST_DECLARE (pipe_listen_without_bind) TEST_DECLARE (pipe_listen_without_bind)
TEST_DECLARE (pipe_connect_bad_name) TEST_DECLARE (pipe_connect_bad_name)
TEST_DECLARE (pipe_connect_to_file) TEST_DECLARE (pipe_connect_to_file)
TEST_DECLARE (pipe_server_close)
TEST_DECLARE (connection_fail) TEST_DECLARE (connection_fail)
TEST_DECLARE (connection_fail_doesnt_auto_close) TEST_DECLARE (connection_fail_doesnt_auto_close)
TEST_DECLARE (shutdown_close_tcp) TEST_DECLARE (shutdown_close_tcp)
@ -253,6 +255,7 @@ TASK_LIST_START
TEST_ENTRY (close_order) TEST_ENTRY (close_order)
TEST_ENTRY (run_once) TEST_ENTRY (run_once)
TEST_ENTRY (run_nowait) TEST_ENTRY (run_nowait)
TEST_ENTRY (loop_alive)
TEST_ENTRY (loop_stop) TEST_ENTRY (loop_stop)
TEST_ENTRY (loop_update_time) TEST_ENTRY (loop_update_time)
TEST_ENTRY (barrier_1) TEST_ENTRY (barrier_1)
@ -270,6 +273,7 @@ TASK_LIST_START
TEST_ENTRY (pipe_connect_bad_name) TEST_ENTRY (pipe_connect_bad_name)
TEST_ENTRY (pipe_connect_to_file) TEST_ENTRY (pipe_connect_to_file)
TEST_ENTRY (pipe_server_close)
TEST_ENTRY (tty) TEST_ENTRY (tty)
TEST_ENTRY (stdio_over_pipes) TEST_ENTRY (stdio_over_pipes)
TEST_ENTRY (ipc_listen_before_write) TEST_ENTRY (ipc_listen_before_write)

68
deps/uv/test/test-loop-alive.c

@ -0,0 +1,68 @@
/* 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 "task.h"
static uv_timer_t timer_handle;
static void timer_cb(uv_timer_t* handle, int status) {
ASSERT(handle);
ASSERT(status == 0);
}
static uv_work_t work_req;
static void work_cb(uv_work_t* req) {
ASSERT(req);
}
static void after_work_cb(uv_work_t* req, int status) {
ASSERT(req);
ASSERT(status == 0);
}
TEST_IMPL(loop_alive) {
int r;
ASSERT(!uv_loop_alive(uv_default_loop()));
/* loops with handles are alive */
uv_timer_init(uv_default_loop(), &timer_handle);
uv_timer_start(&timer_handle, timer_cb, 100, 0);
ASSERT(uv_loop_alive(uv_default_loop()));
r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
ASSERT(r == 0);
ASSERT(!uv_loop_alive(uv_default_loop()));
/* loops with requests are alive */
r = uv_queue_work(uv_default_loop(), &work_req, work_cb, after_work_cb);
ASSERT(r == 0);
ASSERT(uv_loop_alive(uv_default_loop()));
r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
ASSERT(r == 0);
ASSERT(!uv_loop_alive(uv_default_loop()));
return 0;
}

91
deps/uv/test/test-pipe-server-close.c

@ -0,0 +1,91 @@
/* 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 "task.h"
#include <string.h>
#include <errno.h>
static uv_pipe_t pipe_client;
static uv_pipe_t pipe_server;
static uv_connect_t connect_req;
static int pipe_close_cb_called = 0;
static int pipe_client_connect_cb_called = 0;
static void pipe_close_cb(uv_handle_t* handle) {
ASSERT(handle == (uv_handle_t*) &pipe_client ||
handle == (uv_handle_t*) &pipe_server);
pipe_close_cb_called++;
}
static void pipe_client_connect_cb(uv_connect_t* req, int status) {
ASSERT(req == &connect_req);
ASSERT(status == 0);
pipe_client_connect_cb_called++;
uv_close((uv_handle_t*) &pipe_client, pipe_close_cb);
uv_close((uv_handle_t*) &pipe_server, pipe_close_cb);
}
static void pipe_server_connection_cb(uv_stream_t* handle, int status) {
/* This function *may* be called, depending on whether accept or the
* connection callback is called first.
*/
ASSERT(status == 0);
}
TEST_IMPL(pipe_server_close) {
uv_loop_t* loop;
int r;
loop = uv_default_loop();
ASSERT(loop != NULL);
r = uv_pipe_init(loop, &pipe_server, 0);
ASSERT(r == 0);
r = uv_pipe_bind(&pipe_server, TEST_PIPENAME);
ASSERT(r == 0);
r = uv_listen((uv_stream_t*) &pipe_server, 0, pipe_server_connection_cb);
ASSERT(r == 0);
r = uv_pipe_init(loop, &pipe_client, 0);
ASSERT(r == 0);
uv_pipe_connect(&connect_req, &pipe_client, TEST_PIPENAME, pipe_client_connect_cb);
r = uv_run(loop, UV_RUN_DEFAULT);
ASSERT(r == 0);
ASSERT(pipe_client_connect_cb_called == 1);
ASSERT(pipe_close_cb_called == 2);
MAKE_VALGRIND_HAPPY();
return 0;
}

5
deps/uv/test/test-spawn.c

@ -146,10 +146,13 @@ static void timer_cb(uv_timer_t* handle, int status) {
TEST_IMPL(spawn_fails) { TEST_IMPL(spawn_fails) {
int r;
init_process_options("", fail_cb); init_process_options("", fail_cb);
options.file = options.args[0] = "program-that-had-better-not-exist"; options.file = options.args[0] = "program-that-had-better-not-exist";
ASSERT(UV_ENOENT == uv_spawn(uv_default_loop(), &process, &options)); r = uv_spawn(uv_default_loop(), &process, &options);
ASSERT(r == UV_ENOENT || r == UV_EACCES);
ASSERT(0 == uv_is_active((uv_handle_t*) &process)); ASSERT(0 == uv_is_active((uv_handle_t*) &process));
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT)); ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));

3
deps/uv/test/test-tcp-try-write.c

@ -61,7 +61,8 @@ static void connect_cb(uv_connect_t* req, int status) {
connect_cb_called++; connect_cb_called++;
do { do {
r = uv_try_write((uv_stream_t*) &client, zeroes, sizeof(zeroes)); buf = uv_buf_init(zeroes, sizeof(zeroes));
r = uv_try_write((uv_stream_t*) &client, &buf, 1);
ASSERT(r >= 0); ASSERT(r >= 0);
bytes_written += r; bytes_written += r;

2
deps/uv/uv.gyp

@ -323,6 +323,7 @@
'test/test-ipc-send-recv.c', 'test/test-ipc-send-recv.c',
'test/test-list.h', 'test/test-list.h',
'test/test-loop-handles.c', 'test/test-loop-handles.c',
'test/test-loop-alive.c',
'test/test-loop-stop.c', 'test/test-loop-stop.c',
'test/test-loop-time.c', 'test/test-loop-time.c',
'test/test-walk-handles.c', 'test/test-walk-handles.c',
@ -333,6 +334,7 @@
'test/test-ping-pong.c', 'test/test-ping-pong.c',
'test/test-pipe-bind-error.c', 'test/test-pipe-bind-error.c',
'test/test-pipe-connect-error.c', 'test/test-pipe-connect-error.c',
'test/test-pipe-server-close.c',
'test/test-platform-output.c', 'test/test-platform-output.c',
'test/test-poll.c', 'test/test-poll.c',
'test/test-poll-close.c', 'test/test-poll-close.c',

8
deps/uv/vcbuild.bat

@ -41,7 +41,15 @@ shift
goto next-arg goto next-arg
:args-done :args-done
@rem Look for Visual Studio 2013
if not defined VS120COMNTOOLS goto vc-set-2012
if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2012
call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
set GYP_MSVS_VERSION=2013
goto select-target
@rem Look for Visual Studio 2012 @rem Look for Visual Studio 2012
:vc-set-2012
if not defined VS110COMNTOOLS goto vc-set-2010 if not defined VS110COMNTOOLS goto vc-set-2010
if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2010 if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2010
call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset% call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%

Loading…
Cancel
Save