diff --git a/deps/uv/Makefile b/deps/uv/Makefile index 069c67e542..1584e670d9 100644 --- a/deps/uv/Makefile +++ b/deps/uv/Makefile @@ -46,8 +46,8 @@ Makefile:: ; # Turn everything else into a no-op rule that depends on the build directory. %:: $(builddir_name) ; -.PHONY: clean -clean: +.PHONY: clean distclean +clean distclean: $(RM) -fr $(builddir_name) endif diff --git a/deps/uv/build.mk b/deps/uv/build.mk index a19db4948d..91886f0e7c 100644 --- a/deps/uv/build.mk +++ b/deps/uv/build.mk @@ -148,7 +148,7 @@ run-benchmarks$(E): test/run-benchmarks.o test/runner.o $(RUNNER_SRC) $(BENCHMAR test/echo.o: test/echo.c test/echo.h -.PHONY: clean clean-platform distclean distclean-platform test bench +.PHONY: clean clean-platform distclean test bench test: run-tests$(E) @@ -157,8 +157,8 @@ test: run-tests$(E) bench: run-benchmarks$(E) $(CURDIR)/$< -clean: clean-platform - $(RM) -f *.a *.so test/run-tests$(E) test/run-benchmarks$(E) - -distclean: distclean-platform - $(RM) -f *.a *.so test/run-tests$(E) test/run-benchmarks$(E) +clean distclean: clean-platform + $(RM) libuv.a libuv.$(SOEXT) \ + test/run-tests.o test/run-benchmarks.o \ + test/run-tests$(E) test/run-benchmarks$(E) \ + $(BENCHMARKS) $(TESTS) $(RUNNER_LIBS) diff --git a/deps/uv/config-mingw.mk b/deps/uv/config-mingw.mk index 9906a1c621..400a6c46a7 100644 --- a/deps/uv/config-mingw.mk +++ b/deps/uv/config-mingw.mk @@ -46,6 +46,3 @@ src/win/%.o: src/win/%.c include/uv.h include/uv-private/uv-win.h src/win/intern clean-platform: -rm -f src/win/*.o - -distclean-platform: - -rm -f src/win/*.o diff --git a/deps/uv/config-unix.mk b/deps/uv/config-unix.mk index 8d01898227..efe0d17eff 100644 --- a/deps/uv/config-unix.mk +++ b/deps/uv/config-unix.mk @@ -158,10 +158,7 @@ test/%.o: test/%.c include/uv.h test/.buildstamp $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ clean-platform: - -rm -f libuv.a libuv.$(SOEXT) test/run-{tests,benchmarks}.dSYM - -distclean-platform: - -rm -f libuv.a libuv.$(SOEXT) test/run-{tests,benchmarks}.dSYM + $(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o) %.pic.o %.o: %.m $(CC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@ diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c index ff420db231..080535e5f1 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -125,7 +125,7 @@ void uv__stream_init(uv_loop_t* loop, #if defined(__APPLE__) -void uv__stream_osx_select(void* arg) { +static void uv__stream_osx_select(void* arg) { uv_stream_t* stream; uv__stream_select_t* s; char buf[1024]; @@ -216,7 +216,7 @@ void uv__stream_osx_select(void* arg) { } -void uv__stream_osx_interrupt_select(uv_stream_t* stream) { +static void uv__stream_osx_interrupt_select(uv_stream_t* stream) { /* Notify select() thread about state change */ uv__stream_select_t* s; int r; @@ -235,7 +235,7 @@ void uv__stream_osx_interrupt_select(uv_stream_t* stream) { } -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_t* stream; int events; @@ -260,7 +260,7 @@ void uv__stream_osx_select_cb(uv_async_t* handle, int status) { } -void uv__stream_osx_cb_close(uv_handle_t* async) { +static void uv__stream_osx_cb_close(uv_handle_t* async) { uv__stream_select_t* s; s = container_of(async, uv__stream_select_t, async); @@ -268,7 +268,7 @@ void uv__stream_osx_cb_close(uv_handle_t* async) { } -int uv__stream_try_select(uv_stream_t* stream, int fd) { +static int uv__stream_try_select(uv_stream_t* stream, int fd) { /* * kqueue doesn't work with some files from /dev mount on osx. * select(2) in separate thread for those fds @@ -300,7 +300,7 @@ int uv__stream_try_select(uv_stream_t* stream, int fd) { if (ret == -1) return uv__set_sys_error(stream->loop, errno); - if ((events[0].flags & EV_ERROR) == 0 || events[0].data != EINVAL) + if (ret == 0 || (events[0].flags & EV_ERROR) == 0 || events[0].data != EINVAL) return 0; /* At this point we definitely know that this fd won't work with kqueue */ @@ -1200,7 +1200,13 @@ int uv_write2(uv_write_t* req, 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) + /* XXX We abuse uv_write2() to send over UDP handles to child processes. + * Don't call uv__stream_fd() on those handles, it's a macro that on OS X + * evaluates to a function that operates on a uv_stream_t with a couple of + * OS X specific fields. On other Unices it does (handle)->io_watcher.fd, + * which works but only by accident. + */ + if (uv__handle_fd((uv_handle_t*) send_handle) < 0) return uv__set_artificial_error(stream->loop, UV_EBADF); } @@ -1343,6 +1349,10 @@ int uv_is_writable(const uv_stream_t* stream) { int uv___stream_fd(uv_stream_t* handle) { uv__stream_select_t* s; + assert(handle->type == UV_TCP || + handle->type == UV_TTY || + handle->type == UV_NAMED_PIPE); + s = handle->select; if (s != NULL) return s->fd; diff --git a/deps/uv/test/runner-unix.c b/deps/uv/test/runner-unix.c index ebda5f8f1b..eefb700835 100644 --- a/deps/uv/test/runner-unix.c +++ b/deps/uv/test/runner-unix.c @@ -41,15 +41,9 @@ /* 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)) { - fprintf(stderr, "Running the tests as root is not safe.\n"); - exit(1); - } + const char* tap; + tap = getenv("UV_TAP_OUTPUT"); tap_output = (tap != NULL && atoi(tap) > 0); /* Disable stdio output buffering. */ diff --git a/deps/uv/test/runner.c b/deps/uv/test/runner.c index 6e4b4f6736..bda1080a18 100644 --- a/deps/uv/test/runner.c +++ b/deps/uv/test/runner.c @@ -255,10 +255,17 @@ out: FATAL("process_wait failed"); } + if (tap_output) { + if (status == 0) + LOGF("ok %d - %s\n", test_count, test); + else + LOGF("not ok %d - %s\n", test_count, test); + } + /* Show error and output from processes if the test failed. */ if (status != 0 || task->show_output) { if (tap_output) { - LOGF("not ok %d - %s\n#", test_count, test); + LOGF("#"); } else if (status != 0) { LOGF("\n`%s` failed: %s\n", test, errmsg); } else { @@ -305,8 +312,6 @@ out: } break; } - } else if (tap_output) { - LOGF("ok %d - %s\n", test_count, test); } /* Clean up all process handles. */ diff --git a/deps/uv/vcbuild.bat b/deps/uv/vcbuild.bat index aa8a757c89..2165bda56d 100644 --- a/deps/uv/vcbuild.bat +++ b/deps/uv/vcbuild.bat @@ -79,10 +79,11 @@ goto have_gyp :gyp_install_failed echo Failed to download gyp. Make sure you have git installed, or echo manually install gyp into %~dp0build\gyp. -goto exit +exit /b 1 :have_gyp -python gyp_uv -Dtarget_arch=%target_arch% -Dlibrary=%library% +if not defined PYTHON set PYTHON="python" +%PYTHON% gyp_uv -Dtarget_arch=%target_arch% -Dlibrary=%library% if errorlevel 1 goto create-msvs-files-failed if not exist uv.sln goto create-msvs-files-failed echo Project files generated. @@ -102,7 +103,7 @@ goto run @rem Build the sln with msbuild. :msbuild-found msbuild uv.sln /t:%target% /p:Configuration=%config% /p:Platform="%platform%" /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo -if errorlevel 1 goto exit +if errorlevel 1 exit /b 1 :run @rem Run tests if requested. @@ -114,7 +115,7 @@ goto exit :create-msvs-files-failed echo Failed to create vc project files. -goto exit +exit /b 1 :help echo vcbuild.bat [debug/release] [test/bench] [clean] [noprojgen] [nobuild] [x86/x64] [static/shared]