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= libmemcached/libmemcached.la
150 tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la
151 check_PROGRAMS+=tests/c_test
152 noinst_PROGRAMS+=tests/c_test
156 check-local: tests/var $(TEST_DOCS)
157 @echo "Tests completed"
159 test-x: tests/var test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
160 @echo "Tests completed"
162 test-memcat: clients/memcat clients/memcp
163 @echo "Testing memcat"
164 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
165 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
166 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
167 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
168 # @diff clients/memcp tests/scratch
169 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
170 @rm `pwd`/tests/Xumemc.pid
171 @rm `pwd`/tests/scratch
172 @rm `pwd`/tests/scratch2
174 valgrind-memcat: clients/memcat clients/memcp
175 @echo "Testing memcat"
176 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
177 @clients/memcp --servers="localhost:12555" clients/memcp
178 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
179 # @diff clients/memcp tests/scratch
180 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
184 test-memcp: clients/memcp
185 @echo "Testing memcp"
186 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
187 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
188 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
191 valgrind-memcp: clients/memcat clients/memcp
192 @echo "Testing memcp"
193 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
194 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
195 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
198 test-memrm: clients/memrm clients/memcp
199 @echo "Testing memrm"
200 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
201 @clients/memcp --servers="localhost:12555" clients/memcat
202 @clients/memrm --servers="localhost:12555" memcat
203 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
206 valgrind-memrm: clients/memcat clients/memcp
207 @echo "Testing memrm"
208 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
209 @clients/memcp --servers="localhost:12555" clients/memcat
210 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
211 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
214 test-memflush: clients/memflush
215 @echo "Testing memflush"
216 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
217 @clients/memflush --servers="localhost:12555"
218 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
221 valgrind-memflush: clients/memflush
222 @echo "Testing memflush"
223 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
224 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
225 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
228 test-memdump: clients/memdump clients/memcp
229 @echo "Testing memdump"
230 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
231 @clients/memcp --servers="localhost:12555" clients/memcat
232 @clients/memdump --servers="localhost:12555" > /dev/null
233 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
236 valgrind-memdump: clients/memcat clients/memcp
237 @echo "Testing memdump"
238 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
239 @clients/memcp --servers="localhost:12555" clients/memcat
240 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
241 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
244 test-memstat: clients/memstat
245 @echo "Testing memstat"
246 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
247 @clients/memstat --servers="localhost:12555" > /dev/null
248 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
251 valgrind-memstat: clients/memstat
252 @echo "Testing memstat"
253 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
254 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
255 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
258 test-memerror: clients/memerror
259 @echo "Testing memerror"
260 @clients/memerror 0 > /dev/null
262 valgrind-memerror: clients/memerror
263 @echo "Testing memerror"
264 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
266 test-mem: tests/var tests/testapp
269 test-udp: tests/var tests/testudp
272 test-atom: tests/var tests/atomsmasher
275 test-plus: tests/var tests/testplus
278 test-hash: tests/var tests/testhashkit
281 test-hashplus: tests/var tests/hash_plus
284 test-cycle: tests/var tests/cycle
287 test-memcapable: tests/var tests/memcapable
290 pahole-mem: tests/testapp
291 @$(PAHOLE_COMMAND) tests/testapp
293 gdb-mem: tests/testapp
294 @$(DEBUG_COMMAND) tests/testapp
296 gdb-atom: tests/atomsmasher
297 @$(DEBUG_COMMAND) tests/testudp
299 gdb-udp: tests/testudp
300 @$(DEBUG_COMMAND) tests/atomsmasher
302 gdb-plus: tests/testplus
303 $(DEBUG_COMMAND) tests/testplus
305 gdb-hash: tests/testhashkit
306 @$(DEBUG_COMMAND) tests/testhashkit
308 gdb-hashplus: tests/hash_plus
309 @$(DEBUG_COMMAND) tests/hash_plus
311 gdb-cycle: tests/cycle
312 @$(DEBUG_COMMAND) tests/cycle
314 valgrind-cycle: tests/cycle
315 $(VALGRIND_COMMAND) tests/cycle
317 valgrind-mem: tests/testapp
318 @$(VALGRIND_COMMAND) tests/testapp
320 valgrind-atom: tests/atomsmasher
321 $(VALGRIND_COMMAND) tests/atomsmasher
323 valgrind-udp: tests/testudp
324 $(VALGRIND_COMMAND) tests/testudp
326 valgrind-plus: tests/testplus
327 @$(VALGRIND_COMMAND) tests/testplus
329 valgrind-hash: tests/testhashkit
330 @$(VALGRIND_COMMAND) tests/testhashkit
332 valgrind-hashplus: tests/hash_plus
333 @$(VALGRIND_COMMAND) tests/hash_plus
336 valgrind: valgrind-cycle valgrind-mem valgrind-udp valgrind-plus valgrind-hash valgrind-hashplus
338 helgrind-cycle: tests/cycle
339 @$(HELGRIND_COMMAND) tests/cycle
341 helgrind-mem: tests/testapp
342 @$(HELGRIND_COMMAND) tests/testapp
344 helgrind-atom: tests/atomsmasher
345 @$(HELGRIND_COMMAND) tests/atomsmasher
347 helgrind-udp: tests/testudp
348 @$(HELGRIND_COMMAND) tests/testudp
350 helgrind-plus: tests/testplus
351 @$(HELGRIND_COMMAND) tests/testplus
353 helgrind-hash: tests/testhashkit
354 @$(HELGRIND_COMMAND) tests/testhashkit
356 helgrind-hashplus: tests/hash_plus
357 @$(HELGRIND_COMMAND) tests/hash_plus
360 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
363 CLEANFILES += tests/cachegrind.out
365 rm -f tests/cachegrind.out.*
366 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
367 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
370 CLEANFILES += tests/callgrind.out
372 rm -f tests/callgrind.out.*
373 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
374 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
376 hudson-valgrind: tests/testapp
377 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp