2 # Copyright (C) 2011 Data Differential
5 # Use and distribution licensed under the BSD license. See
6 # the COPYING file in the parent directory for full text.
8 # included from Top Level Makefile.am
9 # All paths should be given relative to the root
12 libmemcached/libmemcached.la \
13 libmemcached/libmemcachedutil.la \
16 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
18 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
21 tests/cpp_example.cc \
27 tests/error_conditions.h \
29 tests/hash_results.h \
31 tests/ketama_test_cases.h \
32 tests/ketama_test_cases_spy.h \
33 tests/libmemcached_world.h \
42 tests/virtual_buckets.h
44 # Cycle should always run first
45 tests_cycle_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
46 tests_cycle_CXXFLAGS= $(AM_CXXFLAGS)
47 tests_cycle_CXXFLAGS+= ${PTHREAD_CFLAGS}
48 tests_cycle_SOURCES= tests/cycle.cc
49 tests_cycle_DEPENDENCIES= $(TESTS_LDADDS)
50 tests_cycle_LDADD= $(tests_cycle_DEPENDENCIES)
51 tests_cycle_LDADD+= ${PTHREAD_LIBS}
52 check_PROGRAMS+= tests/cycle
53 noinst_PROGRAMS+= tests/cycle
56 tests_internals_SOURCES= tests/internals.cc
57 tests_internals_SOURCES+= tests/string.cc
58 tests_internals_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
59 tests_internals_DEPENDENCIES= libmemcachedinternal/libmemcachedinternal.la libtest/libtest.la libmemcachedinternal/libmemcachedutilinternal.la
60 tests_internals_LDADD= libmemcachedinternal/libmemcachedinternal.la
61 tests_internals_LDADD+= ${PTHREAD_LIBS}
62 tests_internals_LDADD+= libmemcachedinternal/libmemcachedutilinternal.la
63 tests_internals_LDADD+= libtest/libtest.la
64 check_PROGRAMS+= tests/internals
65 noinst_PROGRAMS+= tests/internals
68 tests_testapp_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
69 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
70 tests_testapp_SOURCES= \
74 tests/error_conditions.cc \
77 tests/mem_functions.cc \
82 tests/replication.cc \
84 tests/virtual_buckets.cc
85 tests_testapp_SOURCES+= clients/generator.cc clients/execute.cc
86 tests_testapp_DEPENDENCIES= \
87 libmemcached/libmemcached.la \
89 libhashkit/libhashkit.la \
90 libmemcached/libmemcachedutil.la
91 tests_testapp_LDADD= \
93 libmemcached/libmemcached.la \
94 libmemcached/libmemcachedutil.la \
96 libhashkit/libhashkit.la
97 check_PROGRAMS+= tests/testapp
98 noinst_PROGRAMS+= tests/testapp
100 tests_sasl_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
101 tests_sasl_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
102 tests_sasl_SOURCES= \
105 tests/deprecated.cc \
106 tests/error_conditions.cc \
113 tests/replication.cc \
114 tests/virtual_buckets.cc
115 tests_sasl_SOURCES+= clients/generator.cc clients/execute.cc
116 tests_sasl_DEPENDENCIES= \
117 libmemcached/libmemcached.la \
121 libmemcached/libmemcached.la \
122 libmemcached/libmemcachedutil.la \
124 libhashkit/libhashkit.la
125 check_PROGRAMS+= tests/sasl
126 noinst_PROGRAMS+= tests/sasl
128 tests_testplus_SOURCES= tests/plus.cpp
129 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
130 tests_testplus_DEPENDENCIES= $(TESTS_LDADDS)
131 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES)
132 check_PROGRAMS+= tests/testplus
133 noinst_PROGRAMS+= tests/testplus
135 tests_failure_SOURCES= tests/failure.cc
136 tests_failure_CXXFLAGS = $(AM_CXXFLAGS)
137 tests_failure_DEPENDENCIES= $(TESTS_LDADDS)
138 tests_failure_LDADD= $(tests_failure_DEPENDENCIES)
139 check_PROGRAMS+= tests/failure
140 noinst_PROGRAMS+= tests/failure
142 tests_atomsmasher_SOURCES= \
143 tests/atomsmasher.cc \
146 clients/generator.cc \
148 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
149 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES)
150 noinst_PROGRAMS+= tests/atomsmasher
152 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
153 tests_testudp_SOURCES= tests/mem_udp.cc
154 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
155 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES)
156 check_PROGRAMS+= tests/testudp
157 noinst_PROGRAMS+= tests/testudp
159 tests_testhashkit_SOURCES = tests/hashkit_functions.cc
160 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
161 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
162 check_PROGRAMS+= tests/testhashkit
163 noinst_PROGRAMS+= tests/testhashkit
165 tests_hash_plus_SOURCES= tests/hash_plus.cc
166 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
167 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
168 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
169 check_PROGRAMS+= tests/hash_plus
170 noinst_PROGRAMS+= tests/hash_plus
172 tests_memcapable_SOURCES= tests/memcapable.cc
173 tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
174 tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
175 tests_memcapable_LDADD= $(tests_memcapable_DEPENDENCIES)
176 check_PROGRAMS+= tests/memcapable
177 noinst_PROGRAMS+= tests/memcapable
179 tests_memstat_SOURCES= tests/memstat.cc
180 tests_memstat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
181 tests_memstat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
182 tests_memstat_LDADD= $(tests_memstat_DEPENDENCIES)
183 check_PROGRAMS+= tests/memstat
184 noinst_PROGRAMS+= tests/memstat
186 tests_memcp_SOURCES= tests/memcp.cc
187 tests_memcp_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
188 tests_memcp_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
189 tests_memcp_LDADD= $(tests_memcp_DEPENDENCIES)
190 check_PROGRAMS+= tests/memcp
191 noinst_PROGRAMS+= tests/memcp
193 tests_memflush_SOURCES= tests/memflush.cc
194 tests_memflush_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
195 tests_memflush_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
196 tests_memflush_LDADD= $(tests_memflush_DEPENDENCIES)
197 check_PROGRAMS+= tests/memflush
198 noinst_PROGRAMS+= tests/memflush
200 tests_memrm_SOURCES= tests/memrm.cc
201 tests_memrm_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
202 tests_memrm_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
203 tests_memrm_LDADD= $(tests_memrm_DEPENDENCIES)
204 check_PROGRAMS+= tests/memrm
205 noinst_PROGRAMS+= tests/memrm
207 tests_memexist_SOURCES= tests/memexist.cc
208 tests_memexist_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
209 tests_memexist_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
210 tests_memexist_LDADD= $(tests_memexist_DEPENDENCIES)
211 check_PROGRAMS+= tests/memexist
212 noinst_PROGRAMS+= tests/memexist
214 tests_memcat_SOURCES= tests/memcat.cc
215 tests_memcat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
216 tests_memcat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
217 tests_memcat_LDADD= $(tests_memcat_DEPENDENCIES)
218 check_PROGRAMS+= tests/memcat
219 noinst_PROGRAMS+= tests/memcat
221 tests_memerror_SOURCES= tests/memerror.cc
222 tests_memerror_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
223 tests_memerror_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
224 tests_memerror_LDADD= $(tests_memerror_DEPENDENCIES)
225 check_PROGRAMS+= tests/memerror
226 noinst_PROGRAMS+= tests/memerror
228 tests_memslap_SOURCES= tests/memslap.cc
229 tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
230 tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
231 tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
232 check_PROGRAMS+= tests/memslap
233 noinst_PROGRAMS+= tests/memslap
235 tests_memdump_SOURCES= tests/memdump.cc
236 tests_memdump_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
237 tests_memdump_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
238 tests_memdump_LDADD= $(tests_memdump_DEPENDENCIES)
239 check_PROGRAMS+= tests/memdump
240 noinst_PROGRAMS+= tests/memdump
242 # Test linking with C application
243 tests_c_test_SOURCES= tests/c_test.c
244 tests_c_test_LDADD= libmemcached/libmemcached.la
245 tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la
246 check_PROGRAMS+=tests/c_test
247 noinst_PROGRAMS+=tests/c_test
249 # Test linking with C application/SASL include
250 tests_c_sasl_test_SOURCES= tests/c_sasl_test.c
251 tests_c_sasl_test_LDADD= libmemcached/libmemcached.la
252 tests_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la
253 check_PROGRAMS+=tests/c_sasl_test
254 noinst_PROGRAMS+=tests/c_sasl_test
258 check-local: $(TEST_DOCS)
259 @echo "Tests completed"
261 test-x: test-plus test-memcp test-memdump test-memflush test-memstat
262 @echo "Tests completed"
264 test-memcp: clients/memcp
265 @echo "Testing memcp"
266 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
267 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
268 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
271 valgrind-memcp: clients/memcat clients/memcp
272 @echo "Testing memcp"
273 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
274 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
275 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
278 test-memflush: clients/memflush
279 @echo "Testing memflush"
280 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
281 @clients/memflush --servers="localhost:12555"
282 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
285 valgrind-memflush: clients/memflush
286 @echo "Testing memflush"
287 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
288 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
289 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
292 test-memdump: clients/memdump clients/memcp
293 @echo "Testing memdump"
294 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
295 @clients/memcp --servers="localhost:12555" clients/memcat
296 @clients/memdump --servers="localhost:12555" > /dev/null
297 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
300 valgrind-memdump: clients/memcat clients/memcp
301 @echo "Testing memdump"
302 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
303 @clients/memcp --servers="localhost:12555" clients/memcat
304 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
305 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
308 test-memstat: clients/memstat
309 @echo "Testing memstat"
310 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
311 @clients/memstat --servers="localhost:12555" > /dev/null
312 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
315 valgrind-memstat: clients/memstat
316 @echo "Testing memstat"
317 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
318 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
319 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
322 test-mem: tests/var tests/testapp
325 test-sasl: tests/sasl
328 test-atom: tests/var tests/atomsmasher
331 test-plus: tests/var tests/testplus
334 test-hash: tests/var tests/testhashkit
337 test-hashplus: tests/var tests/hash_plus
340 test-cycle: tests/var tests/cycle
343 test-memcapable: tests/var tests/memcapable
346 pahole-mem: tests/testapp
347 @$(PAHOLE_COMMAND) tests/testapp
349 gdb-mem: tests/testapp
350 @$(DEBUG_COMMAND) tests/testapp
353 @$(DEBUG_COMMAND) tests/sasl
355 gdb-atom: tests/atomsmasher
356 @$(DEBUG_COMMAND) tests/testudp
358 gdb-udp: tests/testudp
359 @$(DEBUG_COMMAND) tests/atomsmasher
361 gdb-plus: tests/testplus
362 $(DEBUG_COMMAND) tests/testplus
364 gdb-hash: tests/testhashkit
365 @$(DEBUG_COMMAND) tests/testhashkit
367 gdb-hashplus: tests/hash_plus
368 @$(DEBUG_COMMAND) tests/hash_plus
370 gdb-cycle: tests/cycle
371 @$(DEBUG_COMMAND) tests/cycle
373 gdb-failure: tests/failure
374 @$(DEBUG_COMMAND) tests/failure
376 valgrind-cycle: tests/cycle
377 $(VALGRIND_COMMAND) tests/cycle
379 valgrind-mem: tests/testapp
380 @$(VALGRIND_COMMAND) tests/testapp
382 valgrind-failure: tests/failure
383 @$(VALGRIND_COMMAND) tests/failure
385 valgrind-atom: tests/atomsmasher
386 $(VALGRIND_COMMAND) tests/atomsmasher
388 valgrind-udp: tests/testudp
389 $(VALGRIND_COMMAND) tests/testudp
391 valgrind-plus: tests/testplus
392 @$(VALGRIND_COMMAND) tests/testplus
394 valgrind-sasl: tests/sasl
395 @$(VALGRIND_COMMAND) tests/sasl
397 valgrind-hash: tests/testhashkit
398 @$(VALGRIND_COMMAND) tests/testhashkit
400 valgrind-hashplus: tests/hash_plus
401 @$(VALGRIND_COMMAND) tests/hash_plus
403 helgrind-cycle: tests/cycle
404 @$(HELGRIND_COMMAND) tests/cycle
406 helgrind-mem: tests/testapp
407 @$(HELGRIND_COMMAND) tests/testapp
409 helgrind-atom: tests/atomsmasher
410 @$(HELGRIND_COMMAND) tests/atomsmasher
412 helgrind-udp: tests/testudp
413 @$(HELGRIND_COMMAND) tests/testudp
415 helgrind-plus: tests/testplus
416 @$(HELGRIND_COMMAND) tests/testplus
418 helgrind-hash: tests/testhashkit
419 @$(HELGRIND_COMMAND) tests/testhashkit
421 helgrind-hashplus: tests/hash_plus
422 @$(HELGRIND_COMMAND) tests/hash_plus
425 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
428 CLEANFILES += tests/cachegrind.out
430 rm -f tests/cachegrind.out.*
431 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
432 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
435 CLEANFILES += tests/callgrind.out
437 rm -f tests/callgrind.out.*
438 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
439 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
441 hudson-valgrind: tests/testapp
442 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp