From 07039f809a9e6866b6d32dd28b51937f6eb5a336 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 8 Feb 2008 19:51:39 -0800 Subject: [PATCH] Random cleanup, plus server startup script --- .hgignore | 8 ++++++++ src/memslap.c | 3 +++ tests/Makefile.am | 5 ++++- tests/server.c | 9 +++++---- tests/start.c | 16 ++++++++++++++++ 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 tests/start.c diff --git a/.hgignore b/.hgignore index cd363e7a..9aa168ed 100644 --- a/.hgignore +++ b/.hgignore @@ -22,6 +22,14 @@ autom4te.cache/*$ .(gz|cmp|tar|rpm|srpm)$ support/libmemcached.pc$ support/libmemcached.spec$ +docs/pod2htmd.tmp +docs/pod2htmi.tmp +lib/memcachedplus.loT +tests/atomsmasher +tests/startservers +tests/stopservers +tests/udptest + Makefile(.in)?$ diff --git a/src/memslap.c b/src/memslap.c index 6027fddd..1d3f8791 100644 --- a/src/memslap.c +++ b/src/memslap.c @@ -96,7 +96,10 @@ int main(int argc, char *argv[]) if ((temp= getenv("MEMCACHED_SERVERS"))) opt_servers= strdup(temp); else + { + fprintf(stderr, "No Servers provided\n"); exit(1); + } } servers= memcached_servers_parse(opt_servers); diff --git a/tests/Makefile.am b/tests/Makefile.am index 04c1c8f8..f23fde0b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,7 +16,7 @@ EXTRA_DIST = output.res output2.res\ LIBS = noinst_HEADERS = test.h server.h -noinst_PROGRAMS = testapp testplus udptest atomsmasher +noinst_PROGRAMS = testapp testplus udptest atomsmasher startservers testapp_SOURCES = test.c function.c ../src/generator.c ../src/execute.c server.c testapp_LDADD = $(LDADDS) @@ -30,6 +30,9 @@ udptest_LDADD = $(LDADDS) atomsmasher_SOURCES = test.c atomsmasher.c server.c ../src/generator.c ../src/execute.c atomsmasher_LDADD = $(LDADDS) +startservers_SOURCES = start.c server.c +startservers_LDADD = $(LDADDS) + record: ./testapp > output.res diff --git a/tests/server.c b/tests/server.c index c8e1d98f..ce8db70b 100644 --- a/tests/server.c +++ b/tests/server.c @@ -25,7 +25,6 @@ void server_startup(server_startup_st *construct) } else { - WATCHPOINT; { char server_string_buffer[8096]; char *end_ptr; @@ -35,12 +34,14 @@ void server_startup(server_startup_st *construct) { char buffer[1024]; /* Nothing special for number */ int count; + int status; if (construct->udp) - sprintf(buffer, "memcached -d -P /tmp/%umemc.pid -U %u", x, x+ TEST_PORT_BASE); + sprintf(buffer, "memcached -d -P /tmp/%umemc.pid -t 1 -U %u", x, x+ TEST_PORT_BASE); else - sprintf(buffer, "memcached -d -P /tmp/%umemc.pid -p %u", x, x+ TEST_PORT_BASE); - system(buffer); + sprintf(buffer, "memcached -d -P /tmp/%umemc.pid -t 1 -p %u", x, x+ TEST_PORT_BASE); + status= system(buffer); + WATCHPOINT_ASSERT(status == 0); count= sprintf(end_ptr, "localhost:%u,", x + TEST_PORT_BASE); end_ptr+= count; } diff --git a/tests/start.c b/tests/start.c new file mode 100644 index 00000000..aa042f97 --- /dev/null +++ b/tests/start.c @@ -0,0 +1,16 @@ +#include +#include +#include "server.h" + +int main(void) +{ + server_startup_st construct; + + memset(&construct, 0, sizeof(server_startup_st)); + + construct.count= 4; + + server_startup(&construct); + + return 0; +} -- 2.30.2