TESTS_LDADDS= \
libmemcached/libmemcached.la \
- libtest/libserver.la \
+ libmemcached/libmemcachedutil.la \
libtest/libtest.la
-VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --track-fds=yes
-
DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
-if BUILD_LIBMEMCACHEDUTIL
-TESTS_LDADDS+= libmemcached/libmemcachedutil.la
-endif
-
EXTRA_DIST+= \
tests/cpp_example.cc \
tests/output_plus.res
noinst_HEADERS+= \
tests/basic.h \
+ tests/debug.h \
tests/error_conditions.h \
tests/hash_results.h \
tests/ketama_test_cases.h \
tests/ketama_test_cases_spy.h \
tests/libmemcached_world.h \
+ tests/namespace.h \
tests/parser.h \
tests/deprecated.h \
tests/pool.h \
tests/string.h \
tests/virtual_buckets.h
-
-noinst_PROGRAMS+= \
- tests/atomsmasher \
- tests/hash_plus \
- tests/startservers \
- tests/testapp \
- tests/testhashkit \
- tests/testplus \
- tests/testudp
-
+# Cycle should always run first
+tests_cycle_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
+tests_cycle_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
+tests_cycle_SOURCES= tests/cycle.cc
+tests_cycle_DEPENDENCIES= $(TESTS_LDADDS)
+tests_cycle_LDADD= $(tests_cycle_DEPENDENCIES)
+tests_cycle_LDADD+= ${PTHREAD_LIBS}
+check_PROGRAMS+= tests/cycle
+noinst_PROGRAMS+= tests/cycle
+
+# Test internals
+tests_internals_SOURCES= tests/internals.cc
+tests_internals_SOURCES+= tests/string.cc
+tests_internals_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
+tests_internals_DEPENDENCIES= libmemcachedinternal/libmemcachedinternal.la libtest/libtest.la libmemcachedinternal/libmemcachedutilinternal.la
+tests_internals_LDADD= libmemcachedinternal/libmemcachedinternal.la
+tests_internals_LDADD+= ${PTHREAD_LIBS}
+tests_internals_LDADD+= libmemcachedinternal/libmemcachedutilinternal.la
+tests_internals_LDADD+= libtest/libtest.la
+check_PROGRAMS+= tests/internals
+noinst_PROGRAMS+= tests/internals
+
+
+tests_testapp_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
tests_testapp_SOURCES= \
tests/basic.cc \
+ tests/debug.cc \
tests/deprecated.cc \
tests/error_conditions.cc \
- tests/mem_functions.c \
+ tests/ketama.cc \
+ tests/mem_functions.cc \
+ tests/namespace.cc \
tests/parser.cc \
tests/pool.cc \
tests/print.cc \
tests/replication.cc \
- tests/string.cc \
tests/virtual_buckets.cc
tests_testapp_SOURCES+= clients/generator.cc clients/execute.cc
-
tests_testapp_DEPENDENCIES= \
- $(BUILT_SOURCES) \
- $(TESTS_LDADDS) \
+ libmemcached/libmemcached.la \
+ libtest/libtest.la
libhashkit/libhashkit.la \
- libmemcached/libmemcachedinternal.la
-
+ libmemcached/libmemcachedutil.la
tests_testapp_LDADD= \
$(LIBSASL) \
- $(TESTS_LDADDS) \
- libhashkit/libhashkit.la \
- libmemcached/libmemcachedinternal.la
+ ${PTHREAD_LIBS} \
+ libmemcached/libmemcached.la \
+ libmemcached/libmemcachedutil.la \
+ libtest/libtest.la \
+ libhashkit/libhashkit.la
+check_PROGRAMS+= tests/testapp
+noinst_PROGRAMS+= tests/testapp
tests_testplus_SOURCES= tests/plus.cpp
tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
tests_testplus_DEPENDENCIES= $(TESTS_LDADDS)
tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) $(LIBSASL)
check_PROGRAMS+= tests/testplus
-
-tests_atomsmasher_SOURCES= tests/atomsmasher.c
-tests_atomsmasher_SOURCES+= clients/generator.cc clients/execute.cc
+noinst_PROGRAMS+= tests/testplus
+
+tests_atomsmasher_SOURCES= \
+ tests/atomsmasher.cc \
+ tests/debug.cc \
+ tests/print.cc \
+ clients/generator.cc \
+ clients/execute.cc
tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
-
tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
+noinst_PROGRAMS+= tests/atomsmasher
tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
-tests_testudp_SOURCES= tests/mem_udp.c
+tests_testudp_SOURCES= tests/mem_udp.cc
tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
-
tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
+check_PROGRAMS+= tests/testudp
+noinst_PROGRAMS+= tests/testudp
-tests_startservers_SOURCES= tests/start.c
-tests_startservers_DEPENDENCIES= $(TESTS_LDADDS)
-tests_startservers_LDADD= $(tests_startservers_DEPENDENCIES) $(LIBSASL)
-
-tests_testhashkit_SOURCES = tests/hashkit_functions.c
-tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la
+tests_testhashkit_SOURCES = tests/hashkit_functions.cc
+tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
+check_PROGRAMS+= tests/testhashkit
+noinst_PROGRAMS+= tests/testhashkit
tests_hash_plus_SOURCES= tests/hash_plus.cc
tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
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)
+tests_memcapable_LDADD= $(tests_memcapable_DEPENDENCIES)
+check_PROGRAMS+= tests/memcapable
+noinst_PROGRAMS+= tests/memcapable
+
+tests_memslap_SOURCES= tests/memslap.cc
+tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
+tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
+check_PROGRAMS+= tests/memslap
+noinst_PROGRAMS+= tests/memslap
+
+# Test linking with C application
+tests_c_test_SOURCES= tests/c_test.c
+tests_c_test_LDADD= ${CLIENT_LDADD}
+check_PROGRAMS+=tests/c_test
+noinst_PROGRAMS+=tests/c_test
test: check
-check-local: tests/var $(TEST_DOCS) test-mem test-hash memcapable
+check-local: tests/var $(TEST_DOCS)
@echo "Tests completed"
-test-x: check-local test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
+test-x: tests/var test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
@echo "Tests completed"
-memcapable: clients/memcapable
- @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
test-memcat: clients/memcat clients/memcp
@echo "Testing memcat"
@@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@echo "Testing memerror"
@$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
+test-mem: tests/var tests/testapp
+ @tests/testapp
+test-udp: tests/var tests/testudp
+ @tests/testudp
+test-atom: tests/var tests/atomsmasher
+ @tests/atomsmasher
+test-plus: tests/var tests/testplus
+ @tests/testplus
-MEMSLAP_COMMAND= clients/memslap $(COLLECTION) $(SUITE)
-
-MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
-
-TESTPLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
-
-HASHPLUS_COMMAND= tests/hashplus $(COLLECTION) $(SUITE)
+test-hash: tests/var tests/testhashkit
+ @tests/testhashkit
-ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
+test-hashplus: tests/var tests/hash_plus
+ @tests/hash_plus
-UDP_COMMAND= tests/testudp $(COLLECTION) $(SUITE)
+test-cycle: tests/var tests/cycle
+ @tests/cycle
-HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
-
-test-mem: tests/testapp
- $(MEM_COMMAND)
-
-test-udp: tests/testudp
- $(UDP_COMMAND)
-
-test-atom: tests/atomsmasher
- $(ATOM_COMMAND)
-
-test-plus: tests/testplus
- $(TESTPLUS_COMMAND)
-
-test-hash: tests/testhashkit
- $(HASH_COMMAND)
-
-test-hashplus: tests/hashplus
- $(HASHPLUS_COMMAND)
+test-memcapable: tests/var tests/memcapable
+ @tests/memcapable
pahole-mem: tests/testapp
- $(PAHOLE_COMMAND) $(MEM_COMMAND)
+ @$(PAHOLE_COMMAND) tests/testapp
gdb-mem: tests/testapp
- $(DEBUG_COMMAND) $(MEM_COMMAND)
+ @$(DEBUG_COMMAND) tests/testapp
gdb-atom: tests/atomsmasher
- $(DEBUG_COMMAND) $(UDP_COMMAND)
+ @$(DEBUG_COMMAND) tests/testudp
gdb-udp: tests/testudp
- $(DEBUG_COMMAND) $(ATOM_COMMAND)
+ @$(DEBUG_COMMAND) tests/atomsmasher
gdb-plus: tests/testplus
- $(DEBUG_COMMAND) $(TESTPLUS_COMMAND)
+ $(DEBUG_COMMAND) tests/testplus
gdb-hash: tests/testhashkit
- $(DEBUG_COMMAND) $(HASH_COMMAND)
+ @$(DEBUG_COMMAND) tests/testhashkit
-gdb-hashplus: tests/hashplus
- $(DEBUG_COMMAND) $(HASHPLUS_COMMAND)
+gdb-hashplus: tests/hash_plus
+ @$(DEBUG_COMMAND) tests/hash_plus
-gdb-memslap: clients/memslap
- $(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
+gdb-cycle: tests/cycle
+ @$(DEBUG_COMMAND) tests/cycle
+
+valgrind-cycle: tests/cycle
+ $(VALGRIND_COMMAND) tests/cycle
valgrind-mem: tests/testapp
- $(VALGRIND_COMMAND) $(MEM_COMMAND)
+ @$(VALGRIND_COMMAND) tests/testapp
valgrind-atom: tests/atomsmasher
- $(VALGRIND_COMMAND) $(ATOM_COMMAND)
+ $(VALGRIND_COMMAND) tests/atomsmasher
valgrind-udp: tests/testudp
- $(VALGRIND_COMMAND) $(UDP_COMMAND)
+ $(VALGRIND_COMMAND) tests/testudp
valgrind-plus: tests/testplus
- $(VALGRIND_COMMAND) $(TESTPLUS_COMMAND)
+ @$(VALGRIND_COMMAND) tests/testplus
valgrind-hash: tests/testhashkit
- $(VALGRIND_COMMAND) $(HASH_COMMAND)
+ @$(VALGRIND_COMMAND) tests/testhashkit
+
+valgrind-hashplus: tests/hash_plus
+ @$(VALGRIND_COMMAND) tests/hash_plus
-valgrind-hashplus: tests/hashplus
- $(VALGRIND_COMMAND) $(HASHPLUS_COMMAND)
+.PHONY += valgrind
+valgrind: valgrind-cycle valgrind-mem valgrind-udp valgrind-plus valgrind-hash valgrind-hashplus
-valgrind-memslap: clients/memslap
- $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)
+helgrind-cycle: tests/cycle
+ @$(HELGRIND_COMMAND) tests/cycle
-PHONY += valgrind
-valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash valgrind-memcat valgrind-memcp valgrind-memrm valgrind-memerror valgrind-memdump valgrind-memflush valgrind-memstat
+helgrind-mem: tests/testapp
+ @$(HELGRIND_COMMAND) tests/testapp
-PHONY += cachegrind
+helgrind-atom: tests/atomsmasher
+ @$(HELGRIND_COMMAND) tests/atomsmasher
+
+helgrind-udp: tests/testudp
+ @$(HELGRIND_COMMAND) tests/testudp
+
+helgrind-plus: tests/testplus
+ @$(HELGRIND_COMMAND) tests/testplus
+
+helgrind-hash: tests/testhashkit
+ @$(HELGRIND_COMMAND) tests/testhashkit
+
+helgrind-hashplus: tests/hash_plus
+ @$(HELGRIND_COMMAND) tests/hash_plus
+
+.PHONY += helgrind
+helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
+
+.PHONY += cachegrind
CLEANFILES += tests/cachegrind.out
cachegrind:
rm -f tests/cachegrind.out.*
$(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
-PHONY += callgrind
+.PHONY += callgrind
CLEANFILES += tests/callgrind.out
callgrind:
rm -f tests/callgrind.out.*
$(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
-PHONY += helgrind
-CLEANFILES+= helgrind.out.*
-helgrind:
- rm -f helgrind.out.*
- $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
-
-PHONY += helgrind-slap
-helgrind-slap:
- $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
-
test-no-outputdiff: test
hudson-valgrind: tests/testapp
- $(VALGRIND_COMMAND) --log-file=tests/valgrind.out $(MEM_COMMAND)
+ $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp