From 64e070cda2cc99513fdbaae770a473d5338c9378 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Sat, 7 Jan 2012 14:16:36 -0800 Subject: [PATCH] Update tests per bug 912408, so that if memcached is not available they will SKIP and not fail. --- tests/cli.am | 146 +++++++++++++++++++++++++++++++++++++ tests/include.am | 135 +--------------------------------- tests/libmemcached_world.h | 2 +- tests/memcapable.cc | 2 +- tests/memcat.cc | 2 +- tests/memcp.cc | 2 +- tests/memdump.cc | 2 +- tests/memexist.cc | 2 +- tests/memflush.cc | 2 +- tests/memrm.cc | 2 +- tests/memslap.cc | 2 +- tests/memstat.cc | 2 +- tests/memtouch.cc | 2 +- 13 files changed, 158 insertions(+), 145 deletions(-) create mode 100644 tests/cli.am diff --git a/tests/cli.am b/tests/cli.am new file mode 100644 index 00000000..9e47fdd7 --- /dev/null +++ b/tests/cli.am @@ -0,0 +1,146 @@ +# vim:ft=automake +# Copyright (C) 2012 Data Differential +# All rights reserved. +# +# Use and distribution licensed under the BSD license. See +# the COPYING file in the parent directory for full text. +# +# included from Top Level Makefile.am +# All paths should be given relative to the root + + +tests_memcapable_SOURCES= tests/memcapable.cc +tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcapable +tests_memcapable_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memcapable +noinst_PROGRAMS+= tests/memcapable + +tests_memstat_SOURCES= tests/memstat.cc +tests_memstat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memstat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memstat +tests_memstat_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memstat +noinst_PROGRAMS+= tests/memstat + +tests_memcp_SOURCES= tests/memcp.cc +tests_memcp_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memcp_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcp +tests_memcp_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memcp +noinst_PROGRAMS+= tests/memcp + +tests_memflush_SOURCES= tests/memflush.cc +tests_memflush_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memflush_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memflush +tests_memflush_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memflush +noinst_PROGRAMS+= tests/memflush + +tests_memrm_SOURCES= tests/memrm.cc +tests_memrm_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memrm_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memrm +tests_memrm_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memrm +noinst_PROGRAMS+= tests/memrm + +tests_memexist_SOURCES= tests/memexist.cc +tests_memexist_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memexist_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memexist +tests_memexist_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memexist +noinst_PROGRAMS+= tests/memexist + +tests_memtouch_SOURCES= tests/memtouch.cc +tests_memtouch_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memtouch_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memtouch +tests_memtouch_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memtouch +noinst_PROGRAMS+= tests/memtouch + +tests_memcat_SOURCES= tests/memcat.cc +tests_memcat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memcat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcat +tests_memcat_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memcat +noinst_PROGRAMS+= tests/memcat + +tests_memerror_SOURCES= tests/memerror.cc +tests_memerror_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memerror_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memerror +tests_memerror_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memerror +noinst_PROGRAMS+= tests/memerror + +tests_memslap_SOURCES= tests/memslap.cc +tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memslap +tests_memslap_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memslap +noinst_PROGRAMS+= tests/memslap + +tests_memdump_SOURCES= tests/memdump.cc +tests_memdump_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) +tests_memdump_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memdump +tests_memdump_LDADD= libtest/libtest.la $(TESTS_LDADDS) +check_PROGRAMS+= tests/memdump +noinst_PROGRAMS+= tests/memdump + +test-memcp: clients/memcp + @echo "Testing memcp" + @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 + @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat + @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" + @rm tests/Xumemc.pid + +valgrind-memcp: clients/memcat clients/memcp + @echo "Testing memcp" + @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 + @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat + @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" + @rm tests/Xumemc.pid + +test-memflush: clients/memflush + @echo "Testing memflush" + @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 + @clients/memflush --servers="localhost:12555" + @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" + @rm tests/Xumemc.pid + +valgrind-memflush: clients/memflush + @echo "Testing memflush" + @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 + @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555" + @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" + @rm tests/Xumemc.pid + +test-memdump: clients/memdump clients/memcp + @echo "Testing memdump" + @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 + @clients/memcp --servers="localhost:12555" clients/memcat + @clients/memdump --servers="localhost:12555" > /dev/null + @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" + @rm tests/Xumemc.pid + +valgrind-memdump: clients/memcat clients/memcp + @echo "Testing memdump" + @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 + @clients/memcp --servers="localhost:12555" clients/memcat + @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null + @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" + @rm tests/Xumemc.pid + +test-memstat: clients/memstat + @echo "Testing memstat" + @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 + @clients/memstat --servers="localhost:12555" > /dev/null + @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" + @rm tests/Xumemc.pid + +valgrind-memstat: clients/memstat + @echo "Testing memstat" + @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 + @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null + @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" + @rm tests/Xumemc.pid + diff --git a/tests/include.am b/tests/include.am index 23f0f899..bfdb36b8 100644 --- a/tests/include.am +++ b/tests/include.am @@ -59,82 +59,7 @@ tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES) check_PROGRAMS+= tests/hash_plus noinst_PROGRAMS+= tests/hash_plus -tests_memcapable_SOURCES= tests/memcapable.cc -tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcapable -tests_memcapable_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memcapable -noinst_PROGRAMS+= tests/memcapable - -tests_memstat_SOURCES= tests/memstat.cc -tests_memstat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memstat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memstat -tests_memstat_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memstat -noinst_PROGRAMS+= tests/memstat - -tests_memcp_SOURCES= tests/memcp.cc -tests_memcp_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memcp_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcp -tests_memcp_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memcp -noinst_PROGRAMS+= tests/memcp - -tests_memflush_SOURCES= tests/memflush.cc -tests_memflush_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memflush_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memflush -tests_memflush_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memflush -noinst_PROGRAMS+= tests/memflush - -tests_memrm_SOURCES= tests/memrm.cc -tests_memrm_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memrm_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memrm -tests_memrm_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memrm -noinst_PROGRAMS+= tests/memrm - -tests_memexist_SOURCES= tests/memexist.cc -tests_memexist_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memexist_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memexist -tests_memexist_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memexist -noinst_PROGRAMS+= tests/memexist - -tests_memtouch_SOURCES= tests/memtouch.cc -tests_memtouch_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memtouch_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memtouch -tests_memtouch_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memtouch -noinst_PROGRAMS+= tests/memtouch - -tests_memcat_SOURCES= tests/memcat.cc -tests_memcat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memcat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcat -tests_memcat_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memcat -noinst_PROGRAMS+= tests/memcat - -tests_memerror_SOURCES= tests/memerror.cc -tests_memerror_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memerror_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memerror -tests_memerror_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memerror -noinst_PROGRAMS+= tests/memerror - -tests_memslap_SOURCES= tests/memslap.cc -tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memslap -tests_memslap_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memslap -noinst_PROGRAMS+= tests/memslap - -tests_memdump_SOURCES= tests/memdump.cc -tests_memdump_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX) -tests_memdump_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memdump -tests_memdump_LDADD= libtest/libtest.la $(TESTS_LDADDS) -check_PROGRAMS+= tests/memdump -noinst_PROGRAMS+= tests/memdump +include tests/cli.am test: check @@ -144,64 +69,6 @@ check-local: $(TEST_DOCS) test-x: test-plus test-memcp test-memdump test-memflush test-memstat @echo "Tests completed" -test-memcp: clients/memcp - @echo "Testing memcp" - @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 - @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat - @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" - @rm tests/Xumemc.pid - -valgrind-memcp: clients/memcat clients/memcp - @echo "Testing memcp" - @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 - @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat - @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" - @rm tests/Xumemc.pid - -test-memflush: clients/memflush - @echo "Testing memflush" - @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 - @clients/memflush --servers="localhost:12555" - @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" - @rm tests/Xumemc.pid - -valgrind-memflush: clients/memflush - @echo "Testing memflush" - @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 - @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555" - @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" - @rm tests/Xumemc.pid - -test-memdump: clients/memdump clients/memcp - @echo "Testing memdump" - @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 - @clients/memcp --servers="localhost:12555" clients/memcat - @clients/memdump --servers="localhost:12555" > /dev/null - @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" - @rm tests/Xumemc.pid - -valgrind-memdump: clients/memcat clients/memcp - @echo "Testing memdump" - @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 - @clients/memcp --servers="localhost:12555" clients/memcat - @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null - @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" - @rm tests/Xumemc.pid - -test-memstat: clients/memstat - @echo "Testing memstat" - @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 - @clients/memstat --servers="localhost:12555" > /dev/null - @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" - @rm tests/Xumemc.pid - -valgrind-memstat: clients/memstat - @echo "Testing memstat" - @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555 - @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null - @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server" - @rm tests/Xumemc.pid - test-mem: tests/var tests/libmemcached-1.0/testapp @tests/libmemcached-1.0/testapp diff --git a/tests/libmemcached_world.h b/tests/libmemcached_world.h index ad55d17c..824aabe7 100644 --- a/tests/libmemcached_world.h +++ b/tests/libmemcached_world.h @@ -31,7 +31,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memcapable.cc b/tests/memcapable.cc index 60fd00ad..c8adad18 100644 --- a/tests/memcapable.cc +++ b/tests/memcapable.cc @@ -105,7 +105,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memcat.cc b/tests/memcat.cc index e8ed3efc..ea64352e 100644 --- a/tests/memcat.cc +++ b/tests/memcat.cc @@ -136,7 +136,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memcp.cc b/tests/memcp.cc index c22c4db7..a929b6db 100644 --- a/tests/memcp.cc +++ b/tests/memcp.cc @@ -94,7 +94,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memdump.cc b/tests/memdump.cc index 6e5a2aed..0aeb0a99 100644 --- a/tests/memdump.cc +++ b/tests/memdump.cc @@ -121,7 +121,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memexist.cc b/tests/memexist.cc index 00fc3abf..9de01fa3 100644 --- a/tests/memexist.cc +++ b/tests/memexist.cc @@ -136,7 +136,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memflush.cc b/tests/memflush.cc index 8f91356c..6cafcbba 100644 --- a/tests/memflush.cc +++ b/tests/memflush.cc @@ -94,7 +94,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memrm.cc b/tests/memrm.cc index bf2dc86a..f3a1f84b 100644 --- a/tests/memrm.cc +++ b/tests/memrm.cc @@ -134,7 +134,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memslap.cc b/tests/memslap.cc index 229a920c..21d66c59 100644 --- a/tests/memslap.cc +++ b/tests/memslap.cc @@ -160,7 +160,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memstat.cc b/tests/memstat.cc index 44bc77aa..ec7dd4f8 100644 --- a/tests/memstat.cc +++ b/tests/memstat.cc @@ -107,7 +107,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } diff --git a/tests/memtouch.cc b/tests/memtouch.cc index 21378d73..2710cb6c 100644 --- a/tests/memtouch.cc +++ b/tests/memtouch.cc @@ -130,7 +130,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error) { if (HAVE_MEMCACHED_BINARY == 0) { - error= TEST_FATAL; + error= TEST_SKIPPED; return NULL; } -- 2.30.2