2 # included from Top Level Makefile.am
3 # All paths should be given relative to the root
5 TESTS_LDADDS = libmemcached/libmemcached.la
7 VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes
9 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
11 if BUILD_LIBMEMCACHEDUTIL
12 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
24 tests/t/memslap.test \
28 tests/hash_results.h \
29 tests/ketama_test_cases.h \
30 tests/ketama_test_cases_spy.h \
31 tests/libmemcached_world.h \
42 noinst_LTLIBRARIES+= tests/libserver.la
43 tests_libserver_la_SOURCES= tests/server.c
45 noinst_LTLIBRARIES+= tests/libtest.la
46 tests_libtest_la_SOURCES= tests/test.c
48 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
49 tests_testapp_SOURCES= tests/mem_functions.c
50 tests_testapp_LDADD= \
51 clients/libgenexec.la \
54 libmemcached/libmemcachedinternal.la \
56 tests_testapp_DEPENDENCIES= $(tests_testapp_LDADD)
58 tests_testplus_SOURCES= tests/plus.cpp
59 tests_testplus_LDADD= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
60 tests_testplus_DEPENDENCIES= $(tests_testplus_LDADD)
62 tests_atomsmasher_SOURCES= tests/atomsmasher.c
63 tests_atomsmasher_LDADD= \
64 clients/libgenexec.la \
68 tests_atomsmasher_DEPENDENCIES= $(tests_atomsmasher_LDADD)
70 tests_startservers_SOURCES= tests/start.c
71 tests_startservers_LDADD= tests/libserver.la $(TESTS_LDADDS)
72 tests_startservers_DEPENDENCIES= $(tests_startservers_LDADD)
74 tests_testhashkit_SOURCES = tests/hashkit_functions.c
75 tests_testhashkit_LDADD = tests/libtest.la libhashkit/libhashkit.la
76 tests_testhashkit_DEPENDENCIES = $(tests_testhashkit_LDADD)
79 sh tests/t/memcat.test > tests/r/memcat.res
80 sh tests/t/memcp.test > tests/r/memcp.res
81 sh tests/t/memrm.test > tests/r/memrm.res
82 sh tests/t/memslap.test > tests/r/memslap.res
83 sh tests/t/memstat.test > tests/r/memstat.res
85 test: test-docs test-mem test-plus test-hash memcapable
86 echo "Tests completed"
88 memcapable: clients/memcapable
89 @MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
90 @clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
91 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
96 @MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
97 export MEMCACHED_SERVERS="localhost:12555"
98 sh tests/t/memcat.test > tests/r/memcat.cmp
99 diff tests/r/memcat.res tests/r/memcat.cmp
100 sh tests/t/memcp.test > tests/r/memcp.cmp
101 diff tests/r/memcp.res tests/r/memcp.cmp
102 sh tests/t/memrm.test > tests/r/memrm.cmp
103 diff tests/r/memrm.res tests/r/memrm.cmp
104 sh tests/t/memslap.test > tests/r/memslap.cmp
105 diff tests/r/memslap.res tests/r/memslap.cmp
106 sh tests/t/memstat.test > tests/r/memstat.cmp
107 diff tests/r/memstat.res tests/r/memstat.cmp
108 cat tests/Xumemc.pid | xargs kill
111 MEMSLAP_COMMAND= clients/memslap $(COLLECTION) $(SUITE)
113 MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
115 PLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
117 ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
119 HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
121 test-mem: tests/testapp
124 test-atom: tests/atomsmasher
127 test-plus: tests/testplus
130 test-hash: tests/testhashkit
133 gdb-mem: tests/testapp
134 $(DEBUG_COMMAND) $(MEM_COMMAND)
136 gdb-atom: tests/atomsmasher
137 $(DEBUG_COMMAND) $(ATOM_COMMAND)
139 gdb-plus: tests/testplus
140 $(DEBUG_COMMAND) $(PLUS_COMMAND)
142 gdb-hash: tests/testhashkit
143 $(DEBUG_COMMAND) $(HASH_COMMAND)
145 gdb-memslap: clients/memslap
146 $(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
148 valgrind-mem: tests/testapp
149 $(VALGRIND_COMMAND) $(MEM_COMMAND)
151 valgrind-atom: tests/atomsmasher
152 $(VALGRIND_COMMAND) $(ATOM_COMMAND)
154 valgrind-plus: tests/testplus
155 $(VALGRIND_COMMAND) $(PLUS_COMMAND)
157 valgrind-hash: tests/testhashkit
158 $(VALGRIND_COMMAND) $(HASH_COMMAND)
160 valgrind-memslap: clients/memslap
161 $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)
164 valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash
167 CLEANFILES += tests/cachegrind.out
169 rm -f tests/cachegrind.out.*
170 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
171 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
174 CLEANFILES += tests/callgrind.out
176 rm -f tests/callgrind.out.*
177 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
178 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
181 CLEANFILES+= helgrind.out.*
184 $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
186 PHONY += helgrind-slap
188 $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
190 test-no-outputdiff: test
192 hudson-valgrind: tests/testapp
193 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out $(MEM_COMMAND)