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 libtest/libserver.la \
16 VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
18 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
20 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
22 if BUILD_LIBMEMCACHEDUTIL
23 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
27 tests/cpp_example.cc \
32 tests/error_conditions.h \
33 tests/hash_results.h \
34 tests/ketama_test_cases.h \
35 tests/ketama_test_cases_spy.h \
36 tests/libmemcached_world.h \
43 tests/virtual_buckets.h
55 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
56 tests_testapp_SOURCES= \
59 tests/error_conditions.cc \
60 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
81 tests_testplus_SOURCES= tests/plus.cpp
82 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
83 tests_testplus_DEPENDENCIES= $(TESTS_LDADDS)
84 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) $(LIBSASL)
85 check_PROGRAMS+= tests/testplus
87 tests_atomsmasher_SOURCES= tests/atomsmasher.c
88 tests_atomsmasher_SOURCES+= clients/generator.cc clients/execute.cc
89 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
91 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
93 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
94 tests_testudp_SOURCES= tests/mem_udp.c
95 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
97 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
99 tests_startservers_SOURCES= tests/start.c
100 tests_startservers_DEPENDENCIES= $(TESTS_LDADDS)
101 tests_startservers_LDADD= $(tests_startservers_DEPENDENCIES) $(LIBSASL)
103 tests_testhashkit_SOURCES = tests/hashkit_functions.c
104 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la
105 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
107 tests_hash_plus_SOURCES= tests/hash_plus.cc
108 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
109 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
110 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
111 check_PROGRAMS+= tests/hash_plus
115 check-local: tests/var $(TEST_DOCS) test-mem test-hash memcapable
116 @echo "Tests completed"
118 test-x: check-local test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
119 @echo "Tests completed"
121 memcapable: clients/memcapable
122 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
123 @clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
124 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
127 test-memcat: clients/memcat clients/memcp
128 @echo "Testing memcat"
129 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
130 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
131 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
132 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
133 # @diff clients/memcp tests/scratch
134 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
135 @rm `pwd`/tests/Xumemc.pid
136 @rm `pwd`/tests/scratch
137 @rm `pwd`/tests/scratch2
139 valgrind-memcat: clients/memcat clients/memcp
140 @echo "Testing memcat"
141 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
142 @clients/memcp --servers="localhost:12555" clients/memcp
143 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
144 # @diff clients/memcp tests/scratch
145 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
149 test-memcp: clients/memcp
150 @echo "Testing memcp"
151 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
152 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
153 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
156 valgrind-memcp: clients/memcat clients/memcp
157 @echo "Testing memcp"
158 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
159 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
160 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
163 test-memrm: clients/memrm clients/memcp
164 @echo "Testing memrm"
165 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
166 @clients/memcp --servers="localhost:12555" clients/memcat
167 @clients/memrm --servers="localhost:12555" memcat
168 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
171 valgrind-memrm: clients/memcat clients/memcp
172 @echo "Testing memrm"
173 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
174 @clients/memcp --servers="localhost:12555" clients/memcat
175 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
176 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
179 test-memflush: clients/memflush
180 @echo "Testing memflush"
181 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
182 @clients/memflush --servers="localhost:12555"
183 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
186 valgrind-memflush: clients/memflush
187 @echo "Testing memflush"
188 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
189 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
190 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
193 test-memdump: clients/memdump clients/memcp
194 @echo "Testing memdump"
195 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
196 @clients/memcp --servers="localhost:12555" clients/memcat
197 @clients/memdump --servers="localhost:12555" > /dev/null
198 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
201 valgrind-memdump: clients/memcat clients/memcp
202 @echo "Testing memdump"
203 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
204 @clients/memcp --servers="localhost:12555" clients/memcat
205 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
206 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
209 test-memstat: clients/memstat
210 @echo "Testing memstat"
211 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
212 @clients/memstat --servers="localhost:12555" > /dev/null
213 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
216 valgrind-memstat: clients/memstat
217 @echo "Testing memstat"
218 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
219 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
220 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
223 test-memerror: clients/memerror
224 @echo "Testing memerror"
225 @clients/memerror 0 > /dev/null
227 valgrind-memerror: clients/memerror
228 @echo "Testing memerror"
229 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
235 MEMSLAP_COMMAND= clients/memslap $(COLLECTION) $(SUITE)
237 MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
239 TESTPLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
241 HASHPLUS_COMMAND= tests/hashplus $(COLLECTION) $(SUITE)
243 ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
245 UDP_COMMAND= tests/testudp $(COLLECTION) $(SUITE)
247 HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
249 test-mem: tests/testapp
252 test-udp: tests/testudp
255 test-atom: tests/atomsmasher
258 test-plus: tests/testplus
261 test-hash: tests/testhashkit
264 test-hashplus: tests/hashplus
267 pahole-mem: tests/testapp
268 $(PAHOLE_COMMAND) $(MEM_COMMAND)
270 gdb-mem: tests/testapp
271 $(DEBUG_COMMAND) $(MEM_COMMAND)
273 gdb-atom: tests/atomsmasher
274 $(DEBUG_COMMAND) $(UDP_COMMAND)
276 gdb-udp: tests/testudp
277 $(DEBUG_COMMAND) $(ATOM_COMMAND)
279 gdb-plus: tests/testplus
280 $(DEBUG_COMMAND) $(TESTPLUS_COMMAND)
282 gdb-hash: tests/testhashkit
283 $(DEBUG_COMMAND) $(HASH_COMMAND)
285 gdb-hashplus: tests/hashplus
286 $(DEBUG_COMMAND) $(HASHPLUS_COMMAND)
288 gdb-memslap: clients/memslap
289 $(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
291 valgrind-mem: tests/testapp
292 $(VALGRIND_COMMAND) $(MEM_COMMAND)
294 valgrind-atom: tests/atomsmasher
295 $(VALGRIND_COMMAND) $(ATOM_COMMAND)
297 valgrind-udp: tests/testudp
298 $(VALGRIND_COMMAND) $(UDP_COMMAND)
300 valgrind-plus: tests/testplus
301 $(VALGRIND_COMMAND) $(TESTPLUS_COMMAND)
303 valgrind-hash: tests/testhashkit
304 $(VALGRIND_COMMAND) $(HASH_COMMAND)
306 valgrind-hashplus: tests/hashplus
307 $(VALGRIND_COMMAND) $(HASHPLUS_COMMAND)
309 valgrind-memslap: clients/memslap
310 $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)
313 valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash valgrind-memcat valgrind-memcp valgrind-memrm valgrind-memerror valgrind-memdump valgrind-memflush valgrind-memstat
316 CLEANFILES += tests/cachegrind.out
318 rm -f tests/cachegrind.out.*
319 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
320 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
323 CLEANFILES += tests/callgrind.out
325 rm -f tests/callgrind.out.*
326 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
327 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
330 CLEANFILES+= helgrind.out.*
333 $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
335 PHONY += helgrind-slap
337 $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
339 test-no-outputdiff: test
341 hudson-valgrind: tests/testapp
342 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out $(MEM_COMMAND)