TESTS_LDADDS= \
libmemcached/libmemcached.la \
+ libmemcached/libmemcachedutil.la \
libtest/libtest.la
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
tests/string.h \
tests/virtual_buckets.h
-
-noinst_PROGRAMS+= \
- tests/atomsmasher \
- tests/cycle \
- tests/hash_plus \
- 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/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
+noinst_PROGRAMS+= tests/testplus
tests_atomsmasher_SOURCES= \
tests/atomsmasher.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.cc
tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
check_PROGRAMS+= tests/testudp
+noinst_PROGRAMS+= tests/testudp
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_LDADDS)
+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) memcapable
+check-local: tests/var $(TEST_DOCS)
@echo "Tests completed"
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
-
-
-
-
-MEMSLAP_COMMAND= clients/memslap
-
-MEM_COMMAND= tests/testapp
-
-TESTPLUS_COMMAND= tests/testplus
-
-HASHPLUS_COMMAND= tests/hashplus
-
-CYCLE_COMMAND= tests/cycle
-
-ATOM_COMMAND= tests/atomsmasher
-
-UDP_COMMAND= tests/testudp
-
-HASH_COMMAND= tests/testhashkit
-
test-mem: tests/var tests/testapp
@tests/testapp
test-udp: tests/var tests/testudp
- $(UDP_COMMAND)
+ @tests/testudp
test-atom: tests/var tests/atomsmasher
- $(ATOM_COMMAND)
+ @tests/atomsmasher
test-plus: tests/var tests/testplus
- $(TESTPLUS_COMMAND)
+ @tests/testplus
test-hash: tests/var tests/testhashkit
- $(HASH_COMMAND)
+ @tests/testhashkit
-test-hashplus: tests/var tests/hashplus
- $(HASHPLUS_COMMAND)
+test-hashplus: tests/var tests/hash_plus
+ @tests/hash_plus
test-cycle: tests/var tests/cycle
- $(CYCLE_COMMAND)
+ @tests/cycle
+
+test-memcapable: tests/var tests/memcapable
+ @tests/memcapable
pahole-mem: tests/testapp
@$(PAHOLE_COMMAND) tests/testapp
@$(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-cycle: tests/cycle
- $(DEBUG_COMMAND) $(CYCLE_COMMAND)
-
-gdb-memslap: clients/memslap
- $(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
+ @$(DEBUG_COMMAND) tests/cycle
valgrind-cycle: tests/cycle
- $(VALGRIND_COMMAND) $(CYCLE_COMMAND)
+ $(VALGRIND_COMMAND) tests/cycle
valgrind-mem: tests/testapp
@$(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/hashplus
- $(VALGRIND_COMMAND) $(HASHPLUS_COMMAND)
+valgrind-hashplus: tests/hash_plus
+ @$(VALGRIND_COMMAND) tests/hash_plus
-PHONY += valgrind
+.PHONY += valgrind
valgrind: valgrind-cycle valgrind-mem valgrind-udp valgrind-plus valgrind-hash valgrind-hashplus
helgrind-cycle: tests/cycle
- $(HELGRIND_COMMAND) $(CYCLE_COMMAND)
+ @$(HELGRIND_COMMAND) tests/cycle
helgrind-mem: tests/testapp
@$(HELGRIND_COMMAND) tests/testapp
helgrind-atom: tests/atomsmasher
- $(HELGRIND_COMMAND) $(ATOM_COMMAND)
+ @$(HELGRIND_COMMAND) tests/atomsmasher
helgrind-udp: tests/testudp
- $(HELGRIND_COMMAND) $(UDP_COMMAND)
+ @$(HELGRIND_COMMAND) tests/testudp
helgrind-plus: tests/testplus
- $(HELGRIND_COMMAND) $(TESTPLUS_COMMAND)
+ @$(HELGRIND_COMMAND) tests/testplus
helgrind-hash: tests/testhashkit
- $(HELGRIND_COMMAND) $(HASH_COMMAND)
+ @$(HELGRIND_COMMAND) tests/testhashkit
-helgrind-hashplus: tests/hashplus
- $(HELGRIND_COMMAND) $(HASHPLUS_COMMAND)
+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
+.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.*
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