X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fserver.c;h=543d5bacebd21ffc838e00e0921209e1c3858f1e;hb=2cb0f301484b334b248e65ddb0537bb344125fb4;hp=c96f5972dbda3a5c2b2e32df8ea43bed999e0fd9;hpb=519261ca98528ebc5d854ed839f400aa03a3dc5c;p=awesomized%2Flibmemcached diff --git a/tests/server.c b/tests/server.c index c96f5972..543d5bac 100644 --- a/tests/server.c +++ b/tests/server.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "server.h" @@ -73,15 +74,22 @@ void server_startup(server_startup_st *construct) if (x == 0) { sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -U %u -m 128", - MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE); + MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE); } else { sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -U %u", - MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE); + MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE); } - fprintf(stderr, "STARTING SERVER: %s\n", buffer); - status= system(buffer); + if (libmemcached_util_ping("localhost", (in_port_t)(x + TEST_PORT_BASE), NULL)) + { + fprintf(stderr, "Server on port %u already exists\n", x + TEST_PORT_BASE); + } + else + { + status= system(buffer); + fprintf(stderr, "STARTING SERVER: %s status:%d\n", buffer, status); + } count= sprintf(end_ptr, "localhost:%u,", x + TEST_PORT_BASE); end_ptr+= count; }