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_memslap_SOURCES= tests/memslap.cc
178 tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
179 tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
180 tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
181 check_PROGRAMS+= tests/memslap
182 noinst_PROGRAMS+= tests/memslap
184 # Test linking with C application
185 tests_c_test_SOURCES= tests/c_test.c
186 tests_c_test_LDADD= libmemcached/libmemcached.la
187 tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la
188 check_PROGRAMS+=tests/c_test
189 noinst_PROGRAMS+=tests/c_test
191 # Test linking with C application/SASL include
192 tests_c_sasl_test_SOURCES= tests/c_sasl_test.c
193 tests_c_sasl_test_LDADD= libmemcached/libmemcached.la
194 tests_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la
195 check_PROGRAMS+=tests/c_sasl_test
196 noinst_PROGRAMS+=tests/c_sasl_test
200 check-local: $(TEST_DOCS)
201 @echo "Tests completed"
203 test-x: test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
204 @echo "Tests completed"
206 test-memcat: clients/memcat clients/memcp
207 @echo "Testing memcat"
208 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
209 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
210 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
211 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
212 # @diff clients/memcp tests/scratch
213 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
214 @rm `pwd`/tests/Xumemc.pid
215 @rm `pwd`/tests/scratch
216 @rm `pwd`/tests/scratch2
218 valgrind-memcat: clients/memcat clients/memcp
219 @echo "Testing memcat"
220 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
221 @clients/memcp --servers="localhost:12555" clients/memcp
222 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
223 # @diff clients/memcp tests/scratch
224 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
228 test-memcp: clients/memcp
229 @echo "Testing memcp"
230 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
231 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
232 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
235 valgrind-memcp: clients/memcat clients/memcp
236 @echo "Testing memcp"
237 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
238 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
239 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
242 test-memrm: clients/memrm clients/memcp
243 @echo "Testing memrm"
244 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
245 @clients/memcp --servers="localhost:12555" clients/memcat
246 @clients/memrm --servers="localhost:12555" memcat
247 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
250 valgrind-memrm: clients/memcat clients/memcp
251 @echo "Testing memrm"
252 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
253 @clients/memcp --servers="localhost:12555" clients/memcat
254 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
255 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
258 test-memflush: clients/memflush
259 @echo "Testing memflush"
260 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
261 @clients/memflush --servers="localhost:12555"
262 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
265 valgrind-memflush: clients/memflush
266 @echo "Testing memflush"
267 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
268 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
269 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
272 test-memdump: clients/memdump clients/memcp
273 @echo "Testing memdump"
274 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
275 @clients/memcp --servers="localhost:12555" clients/memcat
276 @clients/memdump --servers="localhost:12555" > /dev/null
277 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
280 valgrind-memdump: clients/memcat clients/memcp
281 @echo "Testing memdump"
282 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
283 @clients/memcp --servers="localhost:12555" clients/memcat
284 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
285 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
288 test-memstat: clients/memstat
289 @echo "Testing memstat"
290 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
291 @clients/memstat --servers="localhost:12555" > /dev/null
292 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
295 valgrind-memstat: clients/memstat
296 @echo "Testing memstat"
297 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
298 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
299 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
302 test-memerror: clients/memerror
303 @echo "Testing memerror"
304 @clients/memerror 0 > /dev/null
306 valgrind-memerror: clients/memerror
307 @echo "Testing memerror"
308 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
310 test-mem: tests/var tests/testapp
313 test-sasl: tests/sasl
317 test-udp: tests/var tests/testudp
320 test-atom: tests/var tests/atomsmasher
323 test-plus: tests/var tests/testplus
326 test-hash: tests/var tests/testhashkit
329 test-hashplus: tests/var tests/hash_plus
332 test-cycle: tests/var tests/cycle
335 test-memcapable: tests/var tests/memcapable
338 pahole-mem: tests/testapp
339 @$(PAHOLE_COMMAND) tests/testapp
341 gdb-mem: tests/testapp
342 @$(DEBUG_COMMAND) tests/testapp
345 @$(DEBUG_COMMAND) tests/sasl
347 gdb-atom: tests/atomsmasher
348 @$(DEBUG_COMMAND) tests/testudp
350 gdb-udp: tests/testudp
351 @$(DEBUG_COMMAND) tests/atomsmasher
353 gdb-plus: tests/testplus
354 $(DEBUG_COMMAND) tests/testplus
356 gdb-hash: tests/testhashkit
357 @$(DEBUG_COMMAND) tests/testhashkit
359 gdb-hashplus: tests/hash_plus
360 @$(DEBUG_COMMAND) tests/hash_plus
362 gdb-cycle: tests/cycle
363 @$(DEBUG_COMMAND) tests/cycle
365 gdb-failure: tests/failure
366 @$(DEBUG_COMMAND) tests/failure
368 valgrind-cycle: tests/cycle
369 $(VALGRIND_COMMAND) tests/cycle
371 valgrind-mem: tests/testapp
372 @$(VALGRIND_COMMAND) tests/testapp
374 valgrind-failure: tests/failure
375 @$(VALGRIND_COMMAND) tests/failure
377 valgrind-atom: tests/atomsmasher
378 $(VALGRIND_COMMAND) tests/atomsmasher
380 valgrind-udp: tests/testudp
381 $(VALGRIND_COMMAND) tests/testudp
383 valgrind-plus: tests/testplus
384 @$(VALGRIND_COMMAND) tests/testplus
386 valgrind-sasl: tests/sasl
387 @$(VALGRIND_COMMAND) tests/sasl
389 valgrind-hash: tests/testhashkit
390 @$(VALGRIND_COMMAND) tests/testhashkit
392 valgrind-hashplus: tests/hash_plus
393 @$(VALGRIND_COMMAND) tests/hash_plus
395 helgrind-cycle: tests/cycle
396 @$(HELGRIND_COMMAND) tests/cycle
398 helgrind-mem: tests/testapp
399 @$(HELGRIND_COMMAND) tests/testapp
401 helgrind-atom: tests/atomsmasher
402 @$(HELGRIND_COMMAND) tests/atomsmasher
404 helgrind-udp: tests/testudp
405 @$(HELGRIND_COMMAND) tests/testudp
407 helgrind-plus: tests/testplus
408 @$(HELGRIND_COMMAND) tests/testplus
410 helgrind-hash: tests/testhashkit
411 @$(HELGRIND_COMMAND) tests/testhashkit
413 helgrind-hashplus: tests/hash_plus
414 @$(HELGRIND_COMMAND) tests/hash_plus
417 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
420 CLEANFILES += tests/cachegrind.out
422 rm -f tests/cachegrind.out.*
423 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
424 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
427 CLEANFILES += tests/callgrind.out
429 rm -f tests/callgrind.out.*
430 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
431 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
433 hudson-valgrind: tests/testapp
434 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp