From 34445d0741d06c43befe4b83e87ba4086e4cee9b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 26 May 2012 01:42:40 +0200 Subject: [PATCH] test: remove stale UNIX socket before running test Fixes spurious test and benchmark failures. --- test/runner.c | 6 ++++++ test/test-ipc-send-recv.c | 5 ----- test/test-pipe-bind-error.c | 4 ---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/test/runner.c b/test/runner.c index 78b0f211..1bda4806 100644 --- a/test/runner.c +++ b/test/runner.c @@ -19,6 +19,7 @@ * IN THE SOFTWARE. */ +#include #include #include "runner.h" @@ -92,6 +93,11 @@ int run_test(const char* test, int timeout, int benchmark_output) { main_proc = NULL; process_count = 0; +#ifndef _WIN32 + /* Clean up stale socket from previous run. */ + remove(TEST_PIPENAME); +#endif + /* If it's a helper the user asks for, start it directly. */ for (task = TASKS; task->main; task++) { if (task->is_helper && strcmp(test, task->process_name) == 0) { diff --git a/test/test-ipc-send-recv.c b/test/test-ipc-send-recv.c index faedc546..970bf1ef 100644 --- a/test/test-ipc-send-recv.c +++ b/test/test-ipc-send-recv.c @@ -120,11 +120,6 @@ TEST_IMPL(ipc_send_recv_pipe) { r = uv_pipe_init(uv_default_loop(), &ctx.send.pipe, 1); ASSERT(r == 0); -#ifndef _WIN32 - /* Clean up stale socket from previous test run. */ - remove(TEST_PIPENAME); -#endif - r = uv_pipe_bind(&ctx.send.pipe, TEST_PIPENAME); ASSERT(r == 0); diff --git a/test/test-pipe-bind-error.c b/test/test-pipe-bind-error.c index 4e73b639..b84d20f1 100644 --- a/test/test-pipe-bind-error.c +++ b/test/test-pipe-bind-error.c @@ -27,10 +27,8 @@ #ifdef _WIN32 # define BAD_PIPENAME "bad-pipe" -# define UNLINK_PIPE(name) #else # define BAD_PIPENAME "/path/to/unix/socket/that/really/should/not/be/there" -# define UNLINK_PIPE(name) remove(name) #endif @@ -47,8 +45,6 @@ TEST_IMPL(pipe_bind_error_addrinuse) { uv_pipe_t server1, server2; int r; - UNLINK_PIPE(TEST_PIPENAME); - r = uv_pipe_init(uv_default_loop(), &server1, 0); ASSERT(r == 0); r = uv_pipe_bind(&server1, TEST_PIPENAME);