Skip to content

Commit

Permalink
Upgrade libuv to 404d697
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Aug 1, 2011
1 parent 99c15e5 commit e0d7c2c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 24 deletions.
25 changes: 10 additions & 15 deletions deps/uv/src/ares/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
cmake_minimum_required(VERSION 2.6)

project(ares)

string(TOLOWER ${CMAKE_SYSTEM_NAME} ares_platform)

include_directories(config_${ares_platform})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${node_platform}-${cares_arch})
add_definitions(-DHAVE_CONFIG_H=1)

include(CheckLibraryExists)
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIB)

file(GLOB ares_source *.c)
add_library(ares ${ares_source})
file(GLOB lib_sources *.c)
add_library(cares ${lib_sources})

if(HAVE_SOCKET_LIB)
set(ares_libs ${ares_libs} socket)
if(${HAVE_SOCKET_LIB})
set(cares_libs ${cares_libs} socket)
endif()

if(HAVE_NSL_LIB)
set(ares_libs ${ares_libs} nsl)
if(${HAVE_NSL_LIB})
set(cares_libs ${cares_libs} nsl)
endif()

if(ares_libs)
target_link_libraries(ares ${ares_libs})
if(cares_libs)
target_link_libraries(cares ${cares_libs})
endif()
1 change: 1 addition & 0 deletions deps/uv/src/uv-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,7 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {

/* Success. */
handle->pipe_fname = pipe_fname; /* Is a strdup'ed copy. */
handle->pipe_flock = pipe_flock;
handle->fd = sockfd;
status = 0;

Expand Down
4 changes: 2 additions & 2 deletions deps/uv/test/run-tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ static int maybe_run_test(int argc, char **argv) {
}

if (strcmp(argv[1], "spawn_helper4") == 0) {
uv_sleep(10000);
return 1;
/* Never surrender, never return! */
while (1) uv_sleep(10000);
}

return run_test(argv[1], TEST_TIMEOUT, 0);
Expand Down
28 changes: 21 additions & 7 deletions deps/uv/test/test-spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ static void exit_cb(uv_process_t* process, int exit_status, int term_signal) {
}


static void kill_cb(uv_process_t* process, int exit_status, int term_signal) {
printf("exit_cb\n");
exit_cb_called++;
#ifdef _WIN32
ASSERT(exit_status == 1);
ASSERT(term_signal == 0);
#else
ASSERT(exit_status == 0);
ASSERT(term_signal == 15);
#endif
uv_close((uv_handle_t*)process, close_cb);
}


uv_buf_t on_alloc(uv_stream_t* tcp, size_t suggested_size) {
uv_buf_t buf;
buf.base = output + output_used;
Expand Down Expand Up @@ -80,7 +94,7 @@ void write_cb(uv_write_t* req, int status) {
}


static void init_process_options(char* test) {
static void init_process_options(char* test, uv_exit_cb exit_cb) {
/* Note spawn_helper1 defined in test/run-tests.c */
int r = uv_exepath(exepath, &exepath_size);
ASSERT(r == 0);
Expand All @@ -95,7 +109,7 @@ static void init_process_options(char* test) {


static void timer_cb(uv_timer_t* handle, int status) {
uv_process_kill(&process, 0);
uv_process_kill(&process, /* SIGTERM */ 15);
uv_close((uv_handle_t*)handle, close_cb);
}

Expand All @@ -105,7 +119,7 @@ TEST_IMPL(spawn_exit_code) {

uv_init();

init_process_options("spawn_helper1");
init_process_options("spawn_helper1", exit_cb);

r = uv_spawn(&process, options);
ASSERT(r == 0);
Expand All @@ -126,7 +140,7 @@ TEST_IMPL(spawn_stdout) {

uv_init();

init_process_options("spawn_helper2");
init_process_options("spawn_helper2", exit_cb);

uv_pipe_init(&out);
options.stdout_stream = &out;
Expand Down Expand Up @@ -159,7 +173,7 @@ int r;

uv_init();

init_process_options("spawn_helper3");
init_process_options("spawn_helper3", exit_cb);

uv_pipe_init(&out);
uv_pipe_init(&in);
Expand Down Expand Up @@ -193,15 +207,15 @@ TEST_IMPL(spawn_and_kill) {

uv_init();

init_process_options("spawn_helper4");
init_process_options("spawn_helper4", kill_cb);

r = uv_spawn(&process, options);
ASSERT(r == 0);

r = uv_timer_init(&timer);
ASSERT(r == 0);

r = uv_timer_start(&timer, timer_cb, 1000, 0);
r = uv_timer_start(&timer, timer_cb, 500, 0);
ASSERT(r == 0);

r = uv_run();
Expand Down

0 comments on commit e0d7c2c

Please sign in to comment.