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 \
15 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
17 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
19 if BUILD_LIBMEMCACHEDUTIL
20 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
24 tests/cpp_example.cc \
30 tests/error_conditions.h \
31 tests/hash_results.h \
32 tests/ketama_test_cases.h \
33 tests/ketama_test_cases_spy.h \
34 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_SOURCES= tests/cycle.cc
47 tests_cycle_DEPENDENCIES= $(TESTS_LDADDS)
48 tests_cycle_LDADD= $(tests_cycle_DEPENDENCIES)
49 check_PROGRAMS+= tests/cycle
50 noinst_PROGRAMS+= tests/cycle
53 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
54 tests_testapp_SOURCES= \
58 tests/error_conditions.cc \
59 tests/mem_functions.cc \
64 tests/replication.cc \
66 tests/virtual_buckets.cc
67 tests_testapp_SOURCES+= clients/generator.cc clients/execute.cc
69 tests_testapp_DEPENDENCIES= \
72 libhashkit/libhashkit.la \
73 libmemcached/libmemcachedinternal.la
75 tests_testapp_LDADD= \
78 libhashkit/libhashkit.la \
79 libmemcached/libmemcachedinternal.la
80 check_PROGRAMS+= tests/testapp
81 noinst_PROGRAMS+= tests/testapp
83 tests_testplus_SOURCES= tests/plus.cpp
84 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
85 tests_testplus_DEPENDENCIES= $(TESTS_LDADDS)
86 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) $(LIBSASL)
87 check_PROGRAMS+= tests/testplus
88 noinst_PROGRAMS+= tests/testplus
90 tests_atomsmasher_SOURCES= \
91 tests/atomsmasher.cc \
94 clients/generator.cc \
96 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
97 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
98 noinst_PROGRAMS+= tests/atomsmasher
100 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
101 tests_testudp_SOURCES= tests/mem_udp.cc
102 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
103 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
104 check_PROGRAMS+= tests/testudp
105 noinst_PROGRAMS+= tests/testudp
107 tests_testhashkit_SOURCES = tests/hashkit_functions.cc
108 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
109 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
110 check_PROGRAMS+= tests/testhashkit
111 noinst_PROGRAMS+= tests/testhashkit
113 tests_hash_plus_SOURCES= tests/hash_plus.cc
114 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
115 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
116 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
117 check_PROGRAMS+= tests/hash_plus
118 noinst_PROGRAMS+= tests/hash_plus
120 tests_memcapable_SOURCES= tests/memcapable.cc
121 tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
122 tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
123 tests_memcapable_LDADD= $(tests_memcapable_DEPENDENCIES)
124 check_PROGRAMS+= tests/memcapable
125 noinst_PROGRAMS+= tests/memcapable
127 tests_memslap_SOURCES= tests/memslap.cc
128 tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
129 tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
130 tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
131 check_PROGRAMS+= tests/memslap
132 noinst_PROGRAMS+= tests/memslap
134 # Test linking with C application
135 tests_c_test_SOURCES= tests/c_test.c
136 tests_c_test_LDADD= ${CLIENT_LDADD}
137 check_PROGRAMS+=tests/c_test
138 noinst_PROGRAMS+=tests/c_test
142 check-local: tests/var $(TEST_DOCS)
143 @echo "Tests completed"
145 test-x: tests/var test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
146 @echo "Tests completed"
148 test-memcat: clients/memcat clients/memcp
149 @echo "Testing memcat"
150 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
151 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
152 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
153 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
154 # @diff clients/memcp tests/scratch
155 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
156 @rm `pwd`/tests/Xumemc.pid
157 @rm `pwd`/tests/scratch
158 @rm `pwd`/tests/scratch2
160 valgrind-memcat: clients/memcat clients/memcp
161 @echo "Testing memcat"
162 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
163 @clients/memcp --servers="localhost:12555" clients/memcp
164 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
165 # @diff clients/memcp tests/scratch
166 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
170 test-memcp: clients/memcp
171 @echo "Testing memcp"
172 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
173 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
174 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
177 valgrind-memcp: clients/memcat clients/memcp
178 @echo "Testing memcp"
179 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
180 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
181 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
184 test-memrm: clients/memrm clients/memcp
185 @echo "Testing memrm"
186 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
187 @clients/memcp --servers="localhost:12555" clients/memcat
188 @clients/memrm --servers="localhost:12555" memcat
189 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
192 valgrind-memrm: clients/memcat clients/memcp
193 @echo "Testing memrm"
194 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
195 @clients/memcp --servers="localhost:12555" clients/memcat
196 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
197 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
200 test-memflush: clients/memflush
201 @echo "Testing memflush"
202 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
203 @clients/memflush --servers="localhost:12555"
204 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
207 valgrind-memflush: clients/memflush
208 @echo "Testing memflush"
209 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
210 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
211 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
214 test-memdump: clients/memdump clients/memcp
215 @echo "Testing memdump"
216 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
217 @clients/memcp --servers="localhost:12555" clients/memcat
218 @clients/memdump --servers="localhost:12555" > /dev/null
219 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
222 valgrind-memdump: clients/memcat clients/memcp
223 @echo "Testing memdump"
224 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
225 @clients/memcp --servers="localhost:12555" clients/memcat
226 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
227 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
230 test-memstat: clients/memstat
231 @echo "Testing memstat"
232 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
233 @clients/memstat --servers="localhost:12555" > /dev/null
234 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
237 valgrind-memstat: clients/memstat
238 @echo "Testing memstat"
239 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
240 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
241 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
244 test-memerror: clients/memerror
245 @echo "Testing memerror"
246 @clients/memerror 0 > /dev/null
248 valgrind-memerror: clients/memerror
249 @echo "Testing memerror"
250 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
252 test-mem: tests/var tests/testapp
255 test-udp: tests/var tests/testudp
258 test-atom: tests/var tests/atomsmasher
261 test-plus: tests/var tests/testplus
264 test-hash: tests/var tests/testhashkit
267 test-hashplus: tests/var tests/hash_plus
270 test-cycle: tests/var tests/cycle
273 test-memcapable: tests/var tests/memcapable
276 pahole-mem: tests/testapp
277 @$(PAHOLE_COMMAND) tests/testapp
279 gdb-mem: tests/testapp
280 @$(DEBUG_COMMAND) tests/testapp
282 gdb-atom: tests/atomsmasher
283 @$(DEBUG_COMMAND) tests/testudp
285 gdb-udp: tests/testudp
286 @$(DEBUG_COMMAND) tests/atomsmasher
288 gdb-plus: tests/testplus
289 $(DEBUG_COMMAND) tests/testplus
291 gdb-hash: tests/testhashkit
292 @$(DEBUG_COMMAND) tests/testhashkit
294 gdb-hashplus: tests/hash_plus
295 @$(DEBUG_COMMAND) tests/hash_plus
297 gdb-cycle: tests/cycle
298 @$(DEBUG_COMMAND) tests/cycle
300 valgrind-cycle: tests/cycle
301 $(VALGRIND_COMMAND) tests/cycle
303 valgrind-mem: tests/testapp
304 @$(VALGRIND_COMMAND) tests/testapp
306 valgrind-atom: tests/atomsmasher
307 $(VALGRIND_COMMAND) tests/atomsmasher
309 valgrind-udp: tests/testudp
310 $(VALGRIND_COMMAND) tests/testudp
312 valgrind-plus: tests/testplus
313 @$(VALGRIND_COMMAND) tests/testplus
315 valgrind-hash: tests/testhashkit
316 @$(VALGRIND_COMMAND) tests/testhashkit
318 valgrind-hashplus: tests/hash_plus
319 @$(VALGRIND_COMMAND) tests/hash_plus
322 valgrind: valgrind-cycle valgrind-mem valgrind-udp valgrind-plus valgrind-hash valgrind-hashplus
324 helgrind-cycle: tests/cycle
325 @$(HELGRIND_COMMAND) tests/cycle
327 helgrind-mem: tests/testapp
328 @$(HELGRIND_COMMAND) tests/testapp
330 helgrind-atom: tests/atomsmasher
331 @$(HELGRIND_COMMAND) tests/atomsmasher
333 helgrind-udp: tests/testudp
334 @$(HELGRIND_COMMAND) tests/testudp
336 helgrind-plus: tests/testplus
337 @$(HELGRIND_COMMAND) tests/testplus
339 helgrind-hash: tests/testhashkit
340 @$(HELGRIND_COMMAND) tests/testhashkit
342 helgrind-hashplus: tests/hash_plus
343 @$(HELGRIND_COMMAND) tests/hash_plus
346 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
349 CLEANFILES += tests/cachegrind.out
351 rm -f tests/cachegrind.out.*
352 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
353 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
356 CLEANFILES += tests/callgrind.out
358 rm -f tests/callgrind.out.*
359 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
360 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
362 test-no-outputdiff: test
364 hudson-valgrind: tests/testapp
365 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp