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 \
40 tests/virtual_buckets.h
42 # Cycle should always run first
43 tests_cycle_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
44 tests_cycle_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
45 tests_cycle_SOURCES= tests/cycle.cc
46 tests_cycle_DEPENDENCIES= $(TESTS_LDADDS)
47 tests_cycle_LDADD= $(tests_cycle_DEPENDENCIES)
48 tests_cycle_LDADD+= ${PTHREAD_LIBS}
49 check_PROGRAMS+= tests/cycle
50 noinst_PROGRAMS+= tests/cycle
53 tests_internals_SOURCES= tests/internals.cc
54 tests_internals_SOURCES+= tests/string.cc
55 tests_internals_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
56 tests_internals_DEPENDENCIES= libmemcachedinternal/libmemcachedinternal.la libtest/libtest.la libmemcachedinternal/libmemcachedutilinternal.la
57 tests_internals_LDADD= libmemcachedinternal/libmemcachedinternal.la
58 tests_internals_LDADD+= ${PTHREAD_LIBS}
59 tests_internals_LDADD+= libmemcachedinternal/libmemcachedutilinternal.la
60 tests_internals_LDADD+= libtest/libtest.la
61 check_PROGRAMS+= tests/internals
62 noinst_PROGRAMS+= tests/internals
65 tests_testapp_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
66 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
67 tests_testapp_SOURCES= \
71 tests/error_conditions.cc \
73 tests/mem_functions.cc \
78 tests/replication.cc \
79 tests/virtual_buckets.cc
80 tests_testapp_SOURCES+= clients/generator.cc clients/execute.cc
81 tests_testapp_DEPENDENCIES= \
82 libmemcached/libmemcached.la \
84 libhashkit/libhashkit.la \
85 libmemcached/libmemcachedutil.la
86 tests_testapp_LDADD= \
89 libmemcached/libmemcached.la \
90 libmemcached/libmemcachedutil.la \
92 libhashkit/libhashkit.la
93 check_PROGRAMS+= tests/testapp
94 noinst_PROGRAMS+= tests/testapp
96 tests_testplus_SOURCES= tests/plus.cpp
97 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
98 tests_testplus_DEPENDENCIES= $(TESTS_LDADDS)
99 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) $(LIBSASL)
100 check_PROGRAMS+= tests/testplus
101 noinst_PROGRAMS+= tests/testplus
103 tests_atomsmasher_SOURCES= \
104 tests/atomsmasher.cc \
107 clients/generator.cc \
109 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
110 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
111 noinst_PROGRAMS+= tests/atomsmasher
113 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
114 tests_testudp_SOURCES= tests/mem_udp.cc
115 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
116 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
117 check_PROGRAMS+= tests/testudp
118 noinst_PROGRAMS+= tests/testudp
120 tests_testhashkit_SOURCES = tests/hashkit_functions.cc
121 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
122 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
123 check_PROGRAMS+= tests/testhashkit
124 noinst_PROGRAMS+= tests/testhashkit
126 tests_hash_plus_SOURCES= tests/hash_plus.cc
127 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
128 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
129 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
130 check_PROGRAMS+= tests/hash_plus
131 noinst_PROGRAMS+= tests/hash_plus
133 tests_memcapable_SOURCES= tests/memcapable.cc
134 tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
135 tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
136 tests_memcapable_LDADD= $(tests_memcapable_DEPENDENCIES)
137 check_PROGRAMS+= tests/memcapable
138 noinst_PROGRAMS+= tests/memcapable
140 tests_memslap_SOURCES= tests/memslap.cc
141 tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
142 tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
143 tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
144 check_PROGRAMS+= tests/memslap
145 noinst_PROGRAMS+= tests/memslap
147 # Test linking with C application
148 tests_c_test_SOURCES= tests/c_test.c
149 tests_c_test_LDADD= ${CLIENT_LDADD}
150 check_PROGRAMS+=tests/c_test
151 noinst_PROGRAMS+=tests/c_test
155 check-local: tests/var $(TEST_DOCS)
156 @echo "Tests completed"
158 test-x: tests/var test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
159 @echo "Tests completed"
161 test-memcat: clients/memcat clients/memcp
162 @echo "Testing memcat"
163 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
164 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
165 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
166 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
167 # @diff clients/memcp tests/scratch
168 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
169 @rm `pwd`/tests/Xumemc.pid
170 @rm `pwd`/tests/scratch
171 @rm `pwd`/tests/scratch2
173 valgrind-memcat: clients/memcat clients/memcp
174 @echo "Testing memcat"
175 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
176 @clients/memcp --servers="localhost:12555" clients/memcp
177 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
178 # @diff clients/memcp tests/scratch
179 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
183 test-memcp: clients/memcp
184 @echo "Testing memcp"
185 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
186 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
187 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
190 valgrind-memcp: clients/memcat clients/memcp
191 @echo "Testing memcp"
192 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
193 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
194 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
197 test-memrm: clients/memrm clients/memcp
198 @echo "Testing memrm"
199 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
200 @clients/memcp --servers="localhost:12555" clients/memcat
201 @clients/memrm --servers="localhost:12555" memcat
202 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
205 valgrind-memrm: clients/memcat clients/memcp
206 @echo "Testing memrm"
207 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
208 @clients/memcp --servers="localhost:12555" clients/memcat
209 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
210 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
213 test-memflush: clients/memflush
214 @echo "Testing memflush"
215 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
216 @clients/memflush --servers="localhost:12555"
217 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
220 valgrind-memflush: clients/memflush
221 @echo "Testing memflush"
222 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
223 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
224 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
227 test-memdump: clients/memdump clients/memcp
228 @echo "Testing memdump"
229 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
230 @clients/memcp --servers="localhost:12555" clients/memcat
231 @clients/memdump --servers="localhost:12555" > /dev/null
232 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
235 valgrind-memdump: clients/memcat clients/memcp
236 @echo "Testing memdump"
237 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
238 @clients/memcp --servers="localhost:12555" clients/memcat
239 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
240 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
243 test-memstat: clients/memstat
244 @echo "Testing memstat"
245 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
246 @clients/memstat --servers="localhost:12555" > /dev/null
247 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
250 valgrind-memstat: clients/memstat
251 @echo "Testing memstat"
252 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
253 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
254 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
257 test-memerror: clients/memerror
258 @echo "Testing memerror"
259 @clients/memerror 0 > /dev/null
261 valgrind-memerror: clients/memerror
262 @echo "Testing memerror"
263 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
265 test-mem: tests/var tests/testapp
268 test-udp: tests/var tests/testudp
271 test-atom: tests/var tests/atomsmasher
274 test-plus: tests/var tests/testplus
277 test-hash: tests/var tests/testhashkit
280 test-hashplus: tests/var tests/hash_plus
283 test-cycle: tests/var tests/cycle
286 test-memcapable: tests/var tests/memcapable
289 pahole-mem: tests/testapp
290 @$(PAHOLE_COMMAND) tests/testapp
292 gdb-mem: tests/testapp
293 @$(DEBUG_COMMAND) tests/testapp
295 gdb-atom: tests/atomsmasher
296 @$(DEBUG_COMMAND) tests/testudp
298 gdb-udp: tests/testudp
299 @$(DEBUG_COMMAND) tests/atomsmasher
301 gdb-plus: tests/testplus
302 $(DEBUG_COMMAND) tests/testplus
304 gdb-hash: tests/testhashkit
305 @$(DEBUG_COMMAND) tests/testhashkit
307 gdb-hashplus: tests/hash_plus
308 @$(DEBUG_COMMAND) tests/hash_plus
310 gdb-cycle: tests/cycle
311 @$(DEBUG_COMMAND) tests/cycle
313 valgrind-cycle: tests/cycle
314 $(VALGRIND_COMMAND) tests/cycle
316 valgrind-mem: tests/testapp
317 @$(VALGRIND_COMMAND) tests/testapp
319 valgrind-atom: tests/atomsmasher
320 $(VALGRIND_COMMAND) tests/atomsmasher
322 valgrind-udp: tests/testudp
323 $(VALGRIND_COMMAND) tests/testudp
325 valgrind-plus: tests/testplus
326 @$(VALGRIND_COMMAND) tests/testplus
328 valgrind-hash: tests/testhashkit
329 @$(VALGRIND_COMMAND) tests/testhashkit
331 valgrind-hashplus: tests/hash_plus
332 @$(VALGRIND_COMMAND) tests/hash_plus
335 valgrind: valgrind-cycle valgrind-mem valgrind-udp valgrind-plus valgrind-hash valgrind-hashplus
337 helgrind-cycle: tests/cycle
338 @$(HELGRIND_COMMAND) tests/cycle
340 helgrind-mem: tests/testapp
341 @$(HELGRIND_COMMAND) tests/testapp
343 helgrind-atom: tests/atomsmasher
344 @$(HELGRIND_COMMAND) tests/atomsmasher
346 helgrind-udp: tests/testudp
347 @$(HELGRIND_COMMAND) tests/testudp
349 helgrind-plus: tests/testplus
350 @$(HELGRIND_COMMAND) tests/testplus
352 helgrind-hash: tests/testhashkit
353 @$(HELGRIND_COMMAND) tests/testhashkit
355 helgrind-hashplus: tests/hash_plus
356 @$(HELGRIND_COMMAND) tests/hash_plus
359 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
362 CLEANFILES += tests/cachegrind.out
364 rm -f tests/cachegrind.out.*
365 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
366 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
369 CLEANFILES += tests/callgrind.out
371 rm -f tests/callgrind.out.*
372 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
373 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
375 test-no-outputdiff: test
377 hudson-valgrind: tests/testapp
378 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp