Fix test system to error correctly on interrupt/shutdown servers.
[m6w6/libmemcached] / tests / include.am
1 # vim:ft=automake
2 # Copyright (C) 2011 Data Differential
3 # All rights reserved.
4 #
5 # Use and distribution licensed under the BSD license. See
6 # the COPYING file in the parent directory for full text.
7 #
8 # included from Top Level Makefile.am
9 # All paths should be given relative to the root
10
11 TESTS_LDADDS= \
12 libmemcached/libmemcached.la \
13 libtest/libserver.la \
14 libtest/libtest.la
15
16 VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
17
18 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
19
20 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
21
22 if BUILD_LIBMEMCACHEDUTIL
23 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
24 endif
25
26 EXTRA_DIST+= \
27 tests/cpp_example.cc \
28 tests/output_plus.res
29
30 noinst_HEADERS+= \
31 tests/basic.h \
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 \
37 tests/namespace.h \
38 tests/parser.h \
39 tests/deprecated.h \
40 tests/pool.h \
41 tests/print.h \
42 tests/replication.h \
43 tests/string.h \
44 tests/virtual_buckets.h
45
46
47 noinst_PROGRAMS+= \
48 tests/atomsmasher \
49 tests/cycle \
50 tests/hash_plus \
51 tests/testapp \
52 tests/testhashkit \
53 tests/testplus \
54 tests/testudp
55
56 # Cycle should always run first
57 tests_cycle_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
58 tests_cycle_SOURCES= tests/cycle.cc
59 tests_cycle_DEPENDENCIES= $(TESTS_LDADDS)
60 tests_cycle_LDADD= $(tests_cycle_DEPENDENCIES)
61 check_PROGRAMS+= tests/cycle
62
63
64 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
65 tests_testapp_SOURCES= \
66 tests/basic.cc \
67 tests/deprecated.cc \
68 tests/error_conditions.cc \
69 tests/mem_functions.cc \
70 tests/namespace.cc \
71 tests/parser.cc \
72 tests/pool.cc \
73 tests/print.cc \
74 tests/replication.cc \
75 tests/string.cc \
76 tests/virtual_buckets.cc
77 tests_testapp_SOURCES+= clients/generator.cc clients/execute.cc
78
79 tests_testapp_DEPENDENCIES= \
80 $(BUILT_SOURCES) \
81 $(TESTS_LDADDS) \
82 libhashkit/libhashkit.la \
83 libmemcached/libmemcachedinternal.la
84
85 tests_testapp_LDADD= \
86 $(LIBSASL) \
87 $(TESTS_LDADDS) \
88 libhashkit/libhashkit.la \
89 libmemcached/libmemcachedinternal.la
90 check_PROGRAMS+= tests/testapp
91
92 tests_testplus_SOURCES= tests/plus.cpp
93 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
94 tests_testplus_DEPENDENCIES= $(TESTS_LDADDS)
95 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) $(LIBSASL)
96 check_PROGRAMS+= tests/testplus
97
98 tests_atomsmasher_SOURCES= \
99 tests/atomsmasher.cc \
100 clients/generator.cc \
101 clients/execute.cc
102 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
103 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
104
105 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
106 tests_testudp_SOURCES= tests/mem_udp.cc
107 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
108 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
109 check_PROGRAMS+= tests/testudp
110
111 tests_testhashkit_SOURCES = tests/hashkit_functions.cc
112 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la
113 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
114 check_PROGRAMS+= tests/testhashkit
115
116 tests_hash_plus_SOURCES= tests/hash_plus.cc
117 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
118 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
119 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
120 check_PROGRAMS+= tests/hash_plus
121
122 test: check
123
124 check-local: tests/var $(TEST_DOCS) memcapable
125 @echo "Tests completed"
126
127 test-x: tests/var test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
128 @echo "Tests completed"
129
130 memcapable: clients/memcapable
131 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
132 @clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
133 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
134 @rm tests/Xumemc.pid
135
136 test-memcat: clients/memcat clients/memcp
137 @echo "Testing memcat"
138 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
139 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
140 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
141 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
142 # @diff clients/memcp tests/scratch
143 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
144 @rm `pwd`/tests/Xumemc.pid
145 @rm `pwd`/tests/scratch
146 @rm `pwd`/tests/scratch2
147
148 valgrind-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" clients/memcp
152 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
153 # @diff clients/memcp tests/scratch
154 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
155 @rm tests/Xumemc.pid
156 @rm tests/scratch
157
158 test-memcp: clients/memcp
159 @echo "Testing memcp"
160 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
161 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
162 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
163 @rm tests/Xumemc.pid
164
165 valgrind-memcp: clients/memcat clients/memcp
166 @echo "Testing memcp"
167 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
168 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
169 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
170 @rm tests/Xumemc.pid
171
172 test-memrm: clients/memrm clients/memcp
173 @echo "Testing memrm"
174 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
175 @clients/memcp --servers="localhost:12555" clients/memcat
176 @clients/memrm --servers="localhost:12555" memcat
177 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
178 @rm tests/Xumemc.pid
179
180 valgrind-memrm: clients/memcat clients/memcp
181 @echo "Testing memrm"
182 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
183 @clients/memcp --servers="localhost:12555" clients/memcat
184 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
185 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
186 @rm tests/Xumemc.pid
187
188 test-memflush: clients/memflush
189 @echo "Testing memflush"
190 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
191 @clients/memflush --servers="localhost:12555"
192 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
193 @rm tests/Xumemc.pid
194
195 valgrind-memflush: clients/memflush
196 @echo "Testing memflush"
197 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
198 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
199 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
200 @rm tests/Xumemc.pid
201
202 test-memdump: clients/memdump clients/memcp
203 @echo "Testing memdump"
204 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
205 @clients/memcp --servers="localhost:12555" clients/memcat
206 @clients/memdump --servers="localhost:12555" > /dev/null
207 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
208 @rm tests/Xumemc.pid
209
210 valgrind-memdump: clients/memcat clients/memcp
211 @echo "Testing memdump"
212 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
213 @clients/memcp --servers="localhost:12555" clients/memcat
214 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
215 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
216 @rm tests/Xumemc.pid
217
218 test-memstat: clients/memstat
219 @echo "Testing memstat"
220 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
221 @clients/memstat --servers="localhost:12555" > /dev/null
222 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
223 @rm tests/Xumemc.pid
224
225 valgrind-memstat: clients/memstat
226 @echo "Testing memstat"
227 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
228 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
229 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
230 @rm tests/Xumemc.pid
231
232 test-memerror: clients/memerror
233 @echo "Testing memerror"
234 @clients/memerror 0 > /dev/null
235
236 valgrind-memerror: clients/memerror
237 @echo "Testing memerror"
238 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
239
240
241
242
243
244 MEMSLAP_COMMAND= clients/memslap $(COLLECTION) $(SUITE)
245
246 MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
247
248 TESTPLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
249
250 HASHPLUS_COMMAND= tests/hashplus $(COLLECTION) $(SUITE)
251
252 CYCLE_COMMAND= tests/cycle $(COLLECTION) $(SUITE)
253
254 ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
255
256 UDP_COMMAND= tests/testudp $(COLLECTION) $(SUITE)
257
258 HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
259
260 test-mem: tests/var tests/testapp
261 $(MEM_COMMAND)
262
263 test-udp: tests/var tests/testudp
264 $(UDP_COMMAND)
265
266 test-atom: tests/var tests/atomsmasher
267 $(ATOM_COMMAND)
268
269 test-plus: tests/var tests/testplus
270 $(TESTPLUS_COMMAND)
271
272 test-hash: tests/var tests/testhashkit
273 $(HASH_COMMAND)
274
275 test-hashplus: tests/var tests/hashplus
276 $(HASHPLUS_COMMAND)
277
278 test-cycle: tests/var tests/cycle
279 $(CYCLE_COMMAND)
280
281 pahole-mem: tests/testapp
282 $(PAHOLE_COMMAND) $(MEM_COMMAND)
283
284 gdb-mem: tests/testapp
285 $(DEBUG_COMMAND) $(MEM_COMMAND)
286
287 gdb-atom: tests/atomsmasher
288 $(DEBUG_COMMAND) $(UDP_COMMAND)
289
290 gdb-udp: tests/testudp
291 $(DEBUG_COMMAND) $(ATOM_COMMAND)
292
293 gdb-plus: tests/testplus
294 $(DEBUG_COMMAND) $(TESTPLUS_COMMAND)
295
296 gdb-hash: tests/testhashkit
297 $(DEBUG_COMMAND) $(HASH_COMMAND)
298
299 gdb-hashplus: tests/hashplus
300 $(DEBUG_COMMAND) $(HASHPLUS_COMMAND)
301
302 gdb-cycle: tests/cycle
303 $(DEBUG_COMMAND) $(CYCLE_COMMAND)
304
305 gdb-memslap: clients/memslap
306 $(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
307
308 valgrind-mem: tests/testapp
309 $(VALGRIND_COMMAND) $(MEM_COMMAND)
310
311 valgrind-atom: tests/atomsmasher
312 $(VALGRIND_COMMAND) $(ATOM_COMMAND)
313
314 valgrind-udp: tests/testudp
315 $(VALGRIND_COMMAND) $(UDP_COMMAND)
316
317 valgrind-plus: tests/testplus
318 $(VALGRIND_COMMAND) $(TESTPLUS_COMMAND)
319
320 valgrind-hash: tests/testhashkit
321 $(VALGRIND_COMMAND) $(HASH_COMMAND)
322
323 valgrind-hashplus: tests/hashplus
324 $(VALGRIND_COMMAND) $(HASHPLUS_COMMAND)
325
326 valgrind-memslap: clients/memslap
327 $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)
328
329 PHONY += valgrind
330 valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash valgrind-memcat valgrind-memcp valgrind-memrm valgrind-memerror valgrind-memdump valgrind-memflush valgrind-memstat
331
332 PHONY += cachegrind
333 CLEANFILES += tests/cachegrind.out
334 cachegrind:
335 rm -f tests/cachegrind.out.*
336 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
337 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
338
339 PHONY += callgrind
340 CLEANFILES += tests/callgrind.out
341 callgrind:
342 rm -f tests/callgrind.out.*
343 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
344 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
345
346 PHONY += helgrind
347 CLEANFILES+= helgrind.out.*
348 helgrind:
349 rm -f helgrind.out.*
350 $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
351
352 PHONY += helgrind-slap
353 helgrind-slap:
354 $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
355
356 test-no-outputdiff: test
357
358 hudson-valgrind: tests/testapp
359 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out $(MEM_COMMAND)