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_atomsmasher_SOURCES= \
134 tests/atomsmasher.cc \
137 clients/generator.cc \
139 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
140 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES)
141 noinst_PROGRAMS+= tests/atomsmasher
143 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
144 tests_testudp_SOURCES= tests/mem_udp.cc
145 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
146 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES)
147 check_PROGRAMS+= tests/testudp
148 noinst_PROGRAMS+= tests/testudp
150 tests_testhashkit_SOURCES = tests/hashkit_functions.cc
151 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
152 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
153 check_PROGRAMS+= tests/testhashkit
154 noinst_PROGRAMS+= tests/testhashkit
156 tests_hash_plus_SOURCES= tests/hash_plus.cc
157 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
158 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
159 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
160 check_PROGRAMS+= tests/hash_plus
161 noinst_PROGRAMS+= tests/hash_plus
163 tests_memcapable_SOURCES= tests/memcapable.cc
164 tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
165 tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
166 tests_memcapable_LDADD= $(tests_memcapable_DEPENDENCIES)
167 check_PROGRAMS+= tests/memcapable
168 noinst_PROGRAMS+= tests/memcapable
170 tests_memslap_SOURCES= tests/memslap.cc
171 tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
172 tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
173 tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
174 check_PROGRAMS+= tests/memslap
175 noinst_PROGRAMS+= tests/memslap
177 # Test linking with C application
178 tests_c_test_SOURCES= tests/c_test.c
179 tests_c_test_LDADD= libmemcached/libmemcached.la
180 tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la
181 check_PROGRAMS+=tests/c_test
182 noinst_PROGRAMS+=tests/c_test
184 # Test linking with C application/SASL include
185 tests_c_sasl_test_SOURCES= tests/c_sasl_test.c
186 tests_c_sasl_test_LDADD= libmemcached/libmemcached.la
187 tests_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la
188 check_PROGRAMS+=tests/c_sasl_test
189 noinst_PROGRAMS+=tests/c_sasl_test
193 check-local: $(TEST_DOCS)
194 @echo "Tests completed"
196 test-x: test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
197 @echo "Tests completed"
199 test-memcat: clients/memcat clients/memcp
200 @echo "Testing memcat"
201 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
202 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
203 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
204 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
205 # @diff clients/memcp tests/scratch
206 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
207 @rm `pwd`/tests/Xumemc.pid
208 @rm `pwd`/tests/scratch
209 @rm `pwd`/tests/scratch2
211 valgrind-memcat: clients/memcat clients/memcp
212 @echo "Testing memcat"
213 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
214 @clients/memcp --servers="localhost:12555" clients/memcp
215 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
216 # @diff clients/memcp tests/scratch
217 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
221 test-memcp: clients/memcp
222 @echo "Testing memcp"
223 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
224 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
225 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
228 valgrind-memcp: clients/memcat clients/memcp
229 @echo "Testing memcp"
230 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
231 @$(VALGRIND_COMMAND) 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 test-memrm: clients/memrm clients/memcp
236 @echo "Testing memrm"
237 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
238 @clients/memcp --servers="localhost:12555" clients/memcat
239 @clients/memrm --servers="localhost:12555" memcat
240 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
243 valgrind-memrm: clients/memcat clients/memcp
244 @echo "Testing memrm"
245 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
246 @clients/memcp --servers="localhost:12555" clients/memcat
247 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
248 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
251 test-memflush: clients/memflush
252 @echo "Testing memflush"
253 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
254 @clients/memflush --servers="localhost:12555"
255 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
258 valgrind-memflush: clients/memflush
259 @echo "Testing memflush"
260 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
261 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
262 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
265 test-memdump: clients/memdump clients/memcp
266 @echo "Testing memdump"
267 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
268 @clients/memcp --servers="localhost:12555" clients/memcat
269 @clients/memdump --servers="localhost:12555" > /dev/null
270 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
273 valgrind-memdump: clients/memcat clients/memcp
274 @echo "Testing memdump"
275 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
276 @clients/memcp --servers="localhost:12555" clients/memcat
277 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
278 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
281 test-memstat: clients/memstat
282 @echo "Testing memstat"
283 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
284 @clients/memstat --servers="localhost:12555" > /dev/null
285 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
288 valgrind-memstat: clients/memstat
289 @echo "Testing memstat"
290 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
291 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
292 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
295 test-memerror: clients/memerror
296 @echo "Testing memerror"
297 @clients/memerror 0 > /dev/null
299 valgrind-memerror: clients/memerror
300 @echo "Testing memerror"
301 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
303 test-mem: tests/var tests/testapp
306 test-sasl: tests/sasl
310 test-udp: tests/var tests/testudp
313 test-atom: tests/var tests/atomsmasher
316 test-plus: tests/var tests/testplus
319 test-hash: tests/var tests/testhashkit
322 test-hashplus: tests/var tests/hash_plus
325 test-cycle: tests/var tests/cycle
328 test-memcapable: tests/var tests/memcapable
331 pahole-mem: tests/testapp
332 @$(PAHOLE_COMMAND) tests/testapp
334 gdb-mem: tests/testapp
335 @$(DEBUG_COMMAND) tests/testapp
338 @$(DEBUG_COMMAND) tests/sasl
340 gdb-atom: tests/atomsmasher
341 @$(DEBUG_COMMAND) tests/testudp
343 gdb-udp: tests/testudp
344 @$(DEBUG_COMMAND) tests/atomsmasher
346 gdb-plus: tests/testplus
347 $(DEBUG_COMMAND) tests/testplus
349 gdb-hash: tests/testhashkit
350 @$(DEBUG_COMMAND) tests/testhashkit
352 gdb-hashplus: tests/hash_plus
353 @$(DEBUG_COMMAND) tests/hash_plus
355 gdb-cycle: tests/cycle
356 @$(DEBUG_COMMAND) tests/cycle
358 valgrind-cycle: tests/cycle
359 $(VALGRIND_COMMAND) tests/cycle
361 valgrind-mem: tests/testapp
362 @$(VALGRIND_COMMAND) tests/testapp
364 valgrind-atom: tests/atomsmasher
365 $(VALGRIND_COMMAND) tests/atomsmasher
367 valgrind-udp: tests/testudp
368 $(VALGRIND_COMMAND) tests/testudp
370 valgrind-plus: tests/testplus
371 @$(VALGRIND_COMMAND) tests/testplus
373 valgrind-sasl: tests/sasl
374 @$(VALGRIND_COMMAND) tests/sasl
376 valgrind-hash: tests/testhashkit
377 @$(VALGRIND_COMMAND) tests/testhashkit
379 valgrind-hashplus: tests/hash_plus
380 @$(VALGRIND_COMMAND) tests/hash_plus
382 helgrind-cycle: tests/cycle
383 @$(HELGRIND_COMMAND) tests/cycle
385 helgrind-mem: tests/testapp
386 @$(HELGRIND_COMMAND) tests/testapp
388 helgrind-atom: tests/atomsmasher
389 @$(HELGRIND_COMMAND) tests/atomsmasher
391 helgrind-udp: tests/testudp
392 @$(HELGRIND_COMMAND) tests/testudp
394 helgrind-plus: tests/testplus
395 @$(HELGRIND_COMMAND) tests/testplus
397 helgrind-hash: tests/testhashkit
398 @$(HELGRIND_COMMAND) tests/testhashkit
400 helgrind-hashplus: tests/hash_plus
401 @$(HELGRIND_COMMAND) tests/hash_plus
404 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
407 CLEANFILES += tests/cachegrind.out
409 rm -f tests/cachegrind.out.*
410 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
411 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
414 CLEANFILES += tests/callgrind.out
416 rm -f tests/callgrind.out.*
417 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
418 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
420 hudson-valgrind: tests/testapp
421 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp