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 \
28 tests/hash_results.h \
30 tests/ketama_test_cases.h \
31 tests/ketama_test_cases_spy.h \
32 tests/libmemcached_world.h \
41 tests/virtual_buckets.h
43 # Cycle should always run first
44 tests_cycle_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
45 tests_cycle_CXXFLAGS= $(AM_CXXFLAGS)
46 tests_cycle_CXXFLAGS+= ${PTHREAD_CFLAGS}
47 tests_cycle_SOURCES= tests/cycle.cc
48 tests_cycle_DEPENDENCIES= $(TESTS_LDADDS)
49 tests_cycle_LDADD= $(tests_cycle_DEPENDENCIES)
50 tests_cycle_LDADD+= ${PTHREAD_LIBS}
51 check_PROGRAMS+= tests/cycle
52 noinst_PROGRAMS+= tests/cycle
55 tests_internals_SOURCES= tests/internals.cc
56 tests_internals_SOURCES+= tests/string.cc
57 tests_internals_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
58 tests_internals_DEPENDENCIES= libmemcachedinternal/libmemcachedinternal.la libtest/libtest.la libmemcachedinternal/libmemcachedutilinternal.la
59 tests_internals_LDADD= libmemcachedinternal/libmemcachedinternal.la
60 tests_internals_LDADD+= ${PTHREAD_LIBS}
61 tests_internals_LDADD+= libmemcachedinternal/libmemcachedutilinternal.la
62 tests_internals_LDADD+= libtest/libtest.la
63 check_PROGRAMS+= tests/internals
64 noinst_PROGRAMS+= tests/internals
67 tests_testapp_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
68 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
69 tests_testapp_SOURCES= \
73 tests/error_conditions.cc \
75 tests/mem_functions.cc \
80 tests/replication.cc \
82 tests/virtual_buckets.cc
83 tests_testapp_SOURCES+= clients/generator.cc clients/execute.cc
84 tests_testapp_DEPENDENCIES= \
85 libmemcached/libmemcached.la \
87 libhashkit/libhashkit.la \
88 libmemcached/libmemcachedutil.la
89 tests_testapp_LDADD= \
91 libmemcached/libmemcached.la \
92 libmemcached/libmemcachedutil.la \
94 libhashkit/libhashkit.la
95 check_PROGRAMS+= tests/testapp
96 noinst_PROGRAMS+= tests/testapp
98 tests_sasl_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
99 tests_sasl_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
100 tests_sasl_SOURCES= \
103 tests/deprecated.cc \
104 tests/error_conditions.cc \
111 tests/replication.cc \
112 tests/virtual_buckets.cc
113 tests_sasl_SOURCES+= clients/generator.cc clients/execute.cc
114 tests_sasl_DEPENDENCIES= \
115 libmemcached/libmemcached.la \
119 libmemcached/libmemcached.la \
120 libmemcached/libmemcachedutil.la \
122 libhashkit/libhashkit.la
123 check_PROGRAMS+= tests/sasl
124 noinst_PROGRAMS+= tests/sasl
126 tests_testplus_SOURCES= tests/plus.cpp
127 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
128 tests_testplus_DEPENDENCIES= $(TESTS_LDADDS)
129 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES)
130 check_PROGRAMS+= tests/testplus
131 noinst_PROGRAMS+= tests/testplus
133 tests_failure_SOURCES= tests/failure.cc
134 tests_failure_CXXFLAGS = $(AM_CXXFLAGS)
135 tests_failure_DEPENDENCIES= $(TESTS_LDADDS)
136 tests_failure_LDADD= $(tests_failure_DEPENDENCIES)
137 check_PROGRAMS+= tests/failure
138 noinst_PROGRAMS+= tests/failure
140 tests_atomsmasher_SOURCES= \
141 tests/atomsmasher.cc \
144 clients/generator.cc \
146 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
147 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES)
148 noinst_PROGRAMS+= tests/atomsmasher
150 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
151 tests_testudp_SOURCES= tests/mem_udp.cc
152 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
153 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES)
154 check_PROGRAMS+= tests/testudp
155 noinst_PROGRAMS+= tests/testudp
157 tests_testhashkit_SOURCES = tests/hashkit_functions.cc
158 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
159 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
160 check_PROGRAMS+= tests/testhashkit
161 noinst_PROGRAMS+= tests/testhashkit
163 tests_hash_plus_SOURCES= tests/hash_plus.cc
164 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
165 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
166 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
167 check_PROGRAMS+= tests/hash_plus
168 noinst_PROGRAMS+= tests/hash_plus
170 tests_memcapable_SOURCES= tests/memcapable.cc
171 tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
172 tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
173 tests_memcapable_LDADD= $(tests_memcapable_DEPENDENCIES)
174 check_PROGRAMS+= tests/memcapable
175 noinst_PROGRAMS+= tests/memcapable
177 tests_memstat_SOURCES= tests/memstat.cc
178 tests_memstat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
179 tests_memstat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
180 tests_memstat_LDADD= $(tests_memstat_DEPENDENCIES)
181 check_PROGRAMS+= tests/memstat
182 noinst_PROGRAMS+= tests/memstat
184 tests_memcp_SOURCES= tests/memcp.cc
185 tests_memcp_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
186 tests_memcp_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
187 tests_memcp_LDADD= $(tests_memcp_DEPENDENCIES)
188 check_PROGRAMS+= tests/memcp
189 noinst_PROGRAMS+= tests/memcp
191 tests_memflush_SOURCES= tests/memflush.cc
192 tests_memflush_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
193 tests_memflush_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
194 tests_memflush_LDADD= $(tests_memflush_DEPENDENCIES)
195 check_PROGRAMS+= tests/memflush
196 noinst_PROGRAMS+= tests/memflush
198 tests_memrm_SOURCES= tests/memrm.cc
199 tests_memrm_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
200 tests_memrm_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
201 tests_memrm_LDADD= $(tests_memrm_DEPENDENCIES)
202 check_PROGRAMS+= tests/memrm
203 noinst_PROGRAMS+= tests/memrm
205 tests_memcat_SOURCES= tests/memcat.cc
206 tests_memcat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
207 tests_memcat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
208 tests_memcat_LDADD= $(tests_memcat_DEPENDENCIES)
209 check_PROGRAMS+= tests/memcat
210 noinst_PROGRAMS+= tests/memcat
212 tests_memerror_SOURCES= tests/memerror.cc
213 tests_memerror_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
214 tests_memerror_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
215 tests_memerror_LDADD= $(tests_memerror_DEPENDENCIES)
216 check_PROGRAMS+= tests/memerror
217 noinst_PROGRAMS+= tests/memerror
219 tests_memslap_SOURCES= tests/memslap.cc
220 tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
221 tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
222 tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
223 check_PROGRAMS+= tests/memslap
224 noinst_PROGRAMS+= tests/memslap
226 tests_memdump_SOURCES= tests/memdump.cc
227 tests_memdump_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
228 tests_memdump_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
229 tests_memdump_LDADD= $(tests_memdump_DEPENDENCIES)
230 check_PROGRAMS+= tests/memdump
231 noinst_PROGRAMS+= tests/memdump
233 # Test linking with C application
234 tests_c_test_SOURCES= tests/c_test.c
235 tests_c_test_LDADD= libmemcached/libmemcached.la
236 tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la
237 check_PROGRAMS+=tests/c_test
238 noinst_PROGRAMS+=tests/c_test
240 # Test linking with C application/SASL include
241 tests_c_sasl_test_SOURCES= tests/c_sasl_test.c
242 tests_c_sasl_test_LDADD= libmemcached/libmemcached.la
243 tests_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la
244 check_PROGRAMS+=tests/c_sasl_test
245 noinst_PROGRAMS+=tests/c_sasl_test
249 check-local: $(TEST_DOCS)
250 @echo "Tests completed"
252 test-x: test-plus test-memcp test-memdump test-memflush test-memstat
253 @echo "Tests completed"
255 test-memcp: clients/memcp
256 @echo "Testing memcp"
257 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
258 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
259 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
262 valgrind-memcp: clients/memcat clients/memcp
263 @echo "Testing memcp"
264 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
265 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
266 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
269 test-memflush: clients/memflush
270 @echo "Testing memflush"
271 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
272 @clients/memflush --servers="localhost:12555"
273 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
276 valgrind-memflush: clients/memflush
277 @echo "Testing memflush"
278 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
279 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
280 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
283 test-memdump: clients/memdump clients/memcp
284 @echo "Testing memdump"
285 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
286 @clients/memcp --servers="localhost:12555" clients/memcat
287 @clients/memdump --servers="localhost:12555" > /dev/null
288 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
291 valgrind-memdump: clients/memcat clients/memcp
292 @echo "Testing memdump"
293 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
294 @clients/memcp --servers="localhost:12555" clients/memcat
295 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
296 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
299 test-memstat: clients/memstat
300 @echo "Testing memstat"
301 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
302 @clients/memstat --servers="localhost:12555" > /dev/null
303 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
306 valgrind-memstat: clients/memstat
307 @echo "Testing memstat"
308 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
309 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
310 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
313 test-mem: tests/var tests/testapp
316 test-sasl: tests/sasl
319 test-atom: tests/var tests/atomsmasher
322 test-plus: tests/var tests/testplus
325 test-hash: tests/var tests/testhashkit
328 test-hashplus: tests/var tests/hash_plus
331 test-cycle: tests/var tests/cycle
334 test-memcapable: tests/var tests/memcapable
337 pahole-mem: tests/testapp
338 @$(PAHOLE_COMMAND) tests/testapp
340 gdb-mem: tests/testapp
341 @$(DEBUG_COMMAND) tests/testapp
344 @$(DEBUG_COMMAND) tests/sasl
346 gdb-atom: tests/atomsmasher
347 @$(DEBUG_COMMAND) tests/testudp
349 gdb-udp: tests/testudp
350 @$(DEBUG_COMMAND) tests/atomsmasher
352 gdb-plus: tests/testplus
353 $(DEBUG_COMMAND) tests/testplus
355 gdb-hash: tests/testhashkit
356 @$(DEBUG_COMMAND) tests/testhashkit
358 gdb-hashplus: tests/hash_plus
359 @$(DEBUG_COMMAND) tests/hash_plus
361 gdb-cycle: tests/cycle
362 @$(DEBUG_COMMAND) tests/cycle
364 gdb-failure: tests/failure
365 @$(DEBUG_COMMAND) tests/failure
367 valgrind-cycle: tests/cycle
368 $(VALGRIND_COMMAND) tests/cycle
370 valgrind-mem: tests/testapp
371 @$(VALGRIND_COMMAND) tests/testapp
373 valgrind-failure: tests/failure
374 @$(VALGRIND_COMMAND) tests/failure
376 valgrind-atom: tests/atomsmasher
377 $(VALGRIND_COMMAND) tests/atomsmasher
379 valgrind-udp: tests/testudp
380 $(VALGRIND_COMMAND) tests/testudp
382 valgrind-plus: tests/testplus
383 @$(VALGRIND_COMMAND) tests/testplus
385 valgrind-sasl: tests/sasl
386 @$(VALGRIND_COMMAND) tests/sasl
388 valgrind-hash: tests/testhashkit
389 @$(VALGRIND_COMMAND) tests/testhashkit
391 valgrind-hashplus: tests/hash_plus
392 @$(VALGRIND_COMMAND) tests/hash_plus
394 helgrind-cycle: tests/cycle
395 @$(HELGRIND_COMMAND) tests/cycle
397 helgrind-mem: tests/testapp
398 @$(HELGRIND_COMMAND) tests/testapp
400 helgrind-atom: tests/atomsmasher
401 @$(HELGRIND_COMMAND) tests/atomsmasher
403 helgrind-udp: tests/testudp
404 @$(HELGRIND_COMMAND) tests/testudp
406 helgrind-plus: tests/testplus
407 @$(HELGRIND_COMMAND) tests/testplus
409 helgrind-hash: tests/testhashkit
410 @$(HELGRIND_COMMAND) tests/testhashkit
412 helgrind-hashplus: tests/hash_plus
413 @$(HELGRIND_COMMAND) tests/hash_plus
416 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
419 CLEANFILES += tests/cachegrind.out
421 rm -f tests/cachegrind.out.*
422 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
423 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
426 CLEANFILES += tests/callgrind.out
428 rm -f tests/callgrind.out.*
429 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
430 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
432 hudson-valgrind: tests/testapp
433 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp