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 --track-fds=yes
9 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
11 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
13 if BUILD_LIBMEMCACHEDUTIL
14 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
18 tests/hash_results.h \
19 tests/ketama_test_cases.h \
20 tests/ketama_test_cases_spy.h \
21 tests/libmemcached_world.h \
35 noinst_LTLIBRARIES+= tests/libserver.la
36 tests_libserver_la_SOURCES= tests/server.c
38 noinst_LTLIBRARIES+= tests/libtest.la
39 tests_libtest_la_SOURCES= tests/test.c
41 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
42 tests_testapp_SOURCES= tests/mem_functions.c
43 tests_testapp_DEPENDENCIES= \
45 clients/libgenexec.la \
48 libmemcached/libmemcachedinternal.la \
50 tests_testapp_LDADD= $(tests_testapp_DEPENDENCIES) $(LIBSASL)
52 tests_testplus_SOURCES= tests/plus.cpp
53 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
54 tests_testplus_DEPENDENCIES= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
55 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) $(LIBSASL)
57 tests_atomsmasher_SOURCES= tests/atomsmasher.c
58 tests_atomsmasher_DEPENDENCIES= \
59 clients/libgenexec.la \
63 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
65 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
66 tests_testudp_SOURCES= tests/mem_udp.c
67 tests_testudp_DEPENDENCIES= \
68 clients/libgenexec.la \
72 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
74 tests_startservers_SOURCES= tests/start.c
75 tests_startservers_DEPENDENCIES= tests/libserver.la $(TESTS_LDADDS)
76 tests_startservers_LDADD= $(tests_startservers_DEPENDENCIES) $(LIBSASL)
78 tests_testhashkit_SOURCES = tests/hashkit_functions.c
79 tests_testhashkit_DEPENDENCIES = tests/libtest.la libhashkit/libhashkit.la
80 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL)
82 tests_hashplus_SOURCES = tests/hash_plus.cc
83 tests_hashplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
84 tests_hashplus_DEPENDENCIES = $(tests_testhashkit_DEPENDENCIES)
85 tests_hashplus_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL)
87 tests_memplus_SOURCES = tests/mem_plus.cc
88 tests_memplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
89 tests_memplus_DEPENDENCIES = tests/libtest.la tests/libserver.la libmemcached/libmemcached.la
90 tests_memplus_LDADD = $(tests_memplus_DEPENDENCIES) $(LIBSASL)
94 check-local: $(TEST_DOCS) test-mem test-hash memcapable
95 echo "Tests completed"
97 test-x: check-local test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
98 echo "Tests completed"
100 memcapable: clients/memcapable
101 @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
102 @clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
103 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
106 test-memcat: clients/memcat clients/memcp
107 @echo "Testing memcat"
108 @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
109 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
110 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
111 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
112 # @diff clients/memcp tests/scratch
113 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
114 @rm `pwd`/tests/Xumemc.pid
115 @rm `pwd`/tests/scratch
116 @rm `pwd`/tests/scratch2
118 valgrind-memcat: clients/memcat clients/memcp
119 @echo "Testing memcat"
120 @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
121 @clients/memcp --servers="localhost:12555" clients/memcp
122 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
123 # @diff clients/memcp tests/scratch
124 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
128 test-memcp: clients/memcp
129 @echo "Testing memcp"
130 @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
131 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
132 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
135 valgrind-memcp: clients/memcat clients/memcp
136 @echo "Testing memcp"
137 @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
138 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
139 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
142 test-memrm: clients/memrm clients/memcp
143 @echo "Testing memrm"
144 @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
145 @clients/memcp --servers="localhost:12555" clients/memcat
146 @clients/memrm --servers="localhost:12555" memcat
147 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
150 valgrind-memrm: clients/memcat clients/memcp
151 @echo "Testing memrm"
152 @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
153 @clients/memcp --servers="localhost:12555" clients/memcat
154 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
155 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
158 test-memflush: clients/memflush
159 @echo "Testing memflush"
160 @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
161 @clients/memflush --servers="localhost:12555"
162 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
165 valgrind-memflush: clients/memflush
166 @echo "Testing memflush"
167 @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
168 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
169 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
172 test-memdump: clients/memdump clients/memcp
173 @echo "Testing memdump"
174 @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
175 @clients/memcp --servers="localhost:12555" clients/memcat
176 @clients/memdump --servers="localhost:12555" > /dev/null
177 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
180 valgrind-memdump: clients/memcat clients/memcp
181 @echo "Testing memdump"
182 @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
183 @clients/memcp --servers="localhost:12555" clients/memcat
184 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
185 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
188 test-memstat: clients/memstat
189 @echo "Testing memstat"
190 @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
191 @clients/memstat --servers="localhost:12555" > /dev/null
192 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
195 valgrind-memstat: clients/memstat
196 @echo "Testing memstat"
197 @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
198 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
199 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
202 test-memerror: clients/memerror
203 @echo "Testing memerror"
204 @clients/memerror 0 > /dev/null
206 valgrind-memerror: clients/memerror
207 @echo "Testing memerror"
208 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
214 MEMSLAP_COMMAND= clients/memslap $(COLLECTION) $(SUITE)
216 MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
218 TESTPLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
220 MEMPLUS_COMMAND= tests/memplus $(COLLECTION) $(SUITE)
222 HASHPLUS_COMMAND= tests/hashplus $(COLLECTION) $(SUITE)
224 ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
226 UDP_COMMAND= tests/testudp $(COLLECTION) $(SUITE)
228 HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
230 test-mem: tests/testapp
233 test-udp: tests/testudp
236 test-atom: tests/atomsmasher
239 test-plus: tests/testplus
242 test-hash: tests/testhashkit
245 test-hashplus: tests/hashplus
248 test-memplus: tests/memplus
251 pahole-mem: tests/testapp
252 $(PAHOLE_COMMAND) $(MEM_COMMAND)
254 gdb-mem: tests/testapp
255 $(DEBUG_COMMAND) $(MEM_COMMAND)
257 gdb-atom: tests/atomsmasher
258 $(DEBUG_COMMAND) $(UDP_COMMAND)
260 gdb-udp: tests/testudp
261 $(DEBUG_COMMAND) $(ATOM_COMMAND)
263 gdb-plus: tests/testplus
264 $(DEBUG_COMMAND) $(TESTPLUS_COMMAND)
266 gdb-hash: tests/testhashkit
267 $(DEBUG_COMMAND) $(HASH_COMMAND)
269 gdb-hashplus: tests/hashplus
270 $(DEBUG_COMMAND) $(HASHPLUS_COMMAND)
272 gdb-memplus: tests/memplus
273 $(DEBUG_COMMAND) $(MEMPLUS_COMMAND)
275 gdb-memslap: clients/memslap
276 $(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
278 valgrind-mem: tests/testapp
279 $(VALGRIND_COMMAND) $(MEM_COMMAND)
281 valgrind-atom: tests/atomsmasher
282 $(VALGRIND_COMMAND) $(ATOM_COMMAND)
284 valgrind-udp: tests/testudp
285 $(VALGRIND_COMMAND) $(UDP_COMMAND)
287 valgrind-plus: tests/testplus
288 $(VALGRIND_COMMAND) $(TESTPLUS_COMMAND)
290 valgrind-hash: tests/testhashkit
291 $(VALGRIND_COMMAND) $(HASH_COMMAND)
293 valgrind-hashplus: tests/hashplus
294 $(VALGRIND_COMMAND) $(HASHPLUS_COMMAND)
296 valgrind-memplus: tests/memplus
297 $(VALGRIND_COMMAND) $(MEMPLUS_COMMAND)
299 valgrind-memslap: clients/memslap
300 $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)
303 valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash valgrind-memcat valgrind-memcp valgrind-memrm valgrind-memerror valgrind-memdump valgrind-memflush valgrind-memstat
306 CLEANFILES += tests/cachegrind.out
308 rm -f tests/cachegrind.out.*
309 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
310 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
313 CLEANFILES += tests/callgrind.out
315 rm -f tests/callgrind.out.*
316 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
317 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
320 CLEANFILES+= helgrind.out.*
323 $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
325 PHONY += helgrind-slap
327 $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
329 test-no-outputdiff: test
331 hudson-valgrind: tests/testapp
332 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out $(MEM_COMMAND)