Fix test cases that did not work if memcached was not available.
[awesomized/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 libmemcached/libmemcachedutil.la \
14 libtest/libtest.la
15
16 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
17
18 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
19
20 EXTRA_DIST+= \
21 tests/cpp_example.cc \
22 tests/output_plus.res
23
24 noinst_HEADERS+= \
25 tests/basic.h \
26 tests/debug.h \
27 tests/error_conditions.h \
28 tests/hash_results.h \
29 tests/ketama.h \
30 tests/ketama_test_cases.h \
31 tests/ketama_test_cases_spy.h \
32 tests/libmemcached_world.h \
33 tests/namespace.h \
34 tests/parser.h \
35 tests/deprecated.h \
36 tests/pool.h \
37 tests/print.h \
38 tests/replication.h \
39 tests/server_add.h \
40 tests/string.h \
41 tests/virtual_buckets.h
42
43 # Cycle should always run first
44 tests_cycle_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
45 tests_cycle_CXXFLAGS= $(AM_CXXFLAGS)
46 tests_cycle_CXXFLAGS+= ${PTHREAD_CFLAGS}
47 tests_cycle_SOURCES= tests/cycle.cc
48 tests_cycle_DEPENDENCIES= $(TESTS_LDADDS)
49 tests_cycle_LDADD= $(tests_cycle_DEPENDENCIES)
50 tests_cycle_LDADD+= ${PTHREAD_LIBS}
51 check_PROGRAMS+= tests/cycle
52 noinst_PROGRAMS+= tests/cycle
53
54 # Test internals
55 tests_internals_SOURCES= tests/internals.cc
56 tests_internals_SOURCES+= tests/string.cc
57 tests_internals_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
58 tests_internals_DEPENDENCIES= libmemcachedinternal/libmemcachedinternal.la libtest/libtest.la libmemcachedinternal/libmemcachedutilinternal.la
59 tests_internals_LDADD= libmemcachedinternal/libmemcachedinternal.la
60 tests_internals_LDADD+= ${PTHREAD_LIBS}
61 tests_internals_LDADD+= libmemcachedinternal/libmemcachedutilinternal.la
62 tests_internals_LDADD+= libtest/libtest.la
63 check_PROGRAMS+= tests/internals
64 noinst_PROGRAMS+= tests/internals
65
66
67 tests_testapp_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
68 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
69 tests_testapp_SOURCES= \
70 tests/basic.cc \
71 tests/debug.cc \
72 tests/deprecated.cc \
73 tests/error_conditions.cc \
74 tests/ketama.cc \
75 tests/mem_functions.cc \
76 tests/namespace.cc \
77 tests/parser.cc \
78 tests/pool.cc \
79 tests/print.cc \
80 tests/replication.cc \
81 tests/server_add.cc \
82 tests/virtual_buckets.cc
83 tests_testapp_SOURCES+= clients/generator.cc clients/execute.cc
84 tests_testapp_DEPENDENCIES= \
85 libmemcached/libmemcached.la \
86 libtest/libtest.la
87 libhashkit/libhashkit.la \
88 libmemcached/libmemcachedutil.la
89 tests_testapp_LDADD= \
90 ${PTHREAD_LIBS} \
91 libmemcached/libmemcached.la \
92 libmemcached/libmemcachedutil.la \
93 libtest/libtest.la \
94 libhashkit/libhashkit.la
95 check_PROGRAMS+= tests/testapp
96 noinst_PROGRAMS+= tests/testapp
97
98 tests_sasl_CXXFLAGS = $(AM_CXXFLAGS) ${PTHREAD_CFLAGS}
99 tests_sasl_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
100 tests_sasl_SOURCES= \
101 tests/basic.cc \
102 tests/debug.cc \
103 tests/deprecated.cc \
104 tests/error_conditions.cc \
105 tests/ketama.cc \
106 tests/sasl.cc \
107 tests/namespace.cc \
108 tests/parser.cc \
109 tests/pool.cc \
110 tests/print.cc \
111 tests/replication.cc \
112 tests/virtual_buckets.cc
113 tests_sasl_SOURCES+= clients/generator.cc clients/execute.cc
114 tests_sasl_DEPENDENCIES= \
115 libmemcached/libmemcached.la \
116 libtest/libtest.la
117 tests_sasl_LDADD= \
118 ${PTHREAD_LIBS} \
119 libmemcached/libmemcached.la \
120 libmemcached/libmemcachedutil.la \
121 libtest/libtest.la \
122 libhashkit/libhashkit.la
123 check_PROGRAMS+= tests/sasl
124 noinst_PROGRAMS+= tests/sasl
125
126 tests_testplus_SOURCES= tests/plus.cpp
127 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
128 tests_testplus_DEPENDENCIES= $(TESTS_LDADDS)
129 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES)
130 check_PROGRAMS+= tests/testplus
131 noinst_PROGRAMS+= tests/testplus
132
133 tests_failure_SOURCES= tests/failure.cc
134 tests_failure_CXXFLAGS = $(AM_CXXFLAGS)
135 tests_failure_DEPENDENCIES= $(TESTS_LDADDS)
136 tests_failure_LDADD= $(tests_failure_DEPENDENCIES)
137 check_PROGRAMS+= tests/failure
138 noinst_PROGRAMS+= tests/failure
139
140 tests_atomsmasher_SOURCES= \
141 tests/atomsmasher.cc \
142 tests/debug.cc \
143 tests/print.cc \
144 clients/generator.cc \
145 clients/execute.cc
146 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
147 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES)
148 noinst_PROGRAMS+= tests/atomsmasher
149
150 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
151 tests_testudp_SOURCES= tests/mem_udp.cc
152 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
153 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES)
154 check_PROGRAMS+= tests/testudp
155 noinst_PROGRAMS+= tests/testudp
156
157 tests_testhashkit_SOURCES = tests/hashkit_functions.cc
158 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
159 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
160 check_PROGRAMS+= tests/testhashkit
161 noinst_PROGRAMS+= tests/testhashkit
162
163 tests_hash_plus_SOURCES= tests/hash_plus.cc
164 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
165 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
166 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
167 check_PROGRAMS+= tests/hash_plus
168 noinst_PROGRAMS+= tests/hash_plus
169
170 tests_memcapable_SOURCES= tests/memcapable.cc
171 tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
172 tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
173 tests_memcapable_LDADD= $(tests_memcapable_DEPENDENCIES)
174 check_PROGRAMS+= tests/memcapable
175 noinst_PROGRAMS+= tests/memcapable
176
177 tests_memslap_SOURCES= tests/memslap.cc
178 tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
179 tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
180 tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
181 check_PROGRAMS+= tests/memslap
182 noinst_PROGRAMS+= tests/memslap
183
184 # Test linking with C application
185 tests_c_test_SOURCES= tests/c_test.c
186 tests_c_test_LDADD= libmemcached/libmemcached.la
187 tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la
188 check_PROGRAMS+=tests/c_test
189 noinst_PROGRAMS+=tests/c_test
190
191 # Test linking with C application/SASL include
192 tests_c_sasl_test_SOURCES= tests/c_sasl_test.c
193 tests_c_sasl_test_LDADD= libmemcached/libmemcached.la
194 tests_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la
195 check_PROGRAMS+=tests/c_sasl_test
196 noinst_PROGRAMS+=tests/c_sasl_test
197
198 test: check
199
200 check-local: $(TEST_DOCS)
201 @echo "Tests completed"
202
203 test-x: test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
204 @echo "Tests completed"
205
206 test-memcat: clients/memcat clients/memcp
207 @echo "Testing memcat"
208 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
209 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
210 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
211 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
212 # @diff clients/memcp tests/scratch
213 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
214 @rm `pwd`/tests/Xumemc.pid
215 @rm `pwd`/tests/scratch
216 @rm `pwd`/tests/scratch2
217
218 valgrind-memcat: clients/memcat clients/memcp
219 @echo "Testing memcat"
220 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
221 @clients/memcp --servers="localhost:12555" clients/memcp
222 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
223 # @diff clients/memcp tests/scratch
224 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
225 @rm tests/Xumemc.pid
226 @rm tests/scratch
227
228 test-memcp: clients/memcp
229 @echo "Testing memcp"
230 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
231 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
232 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
233 @rm tests/Xumemc.pid
234
235 valgrind-memcp: clients/memcat clients/memcp
236 @echo "Testing memcp"
237 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
238 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
239 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
240 @rm tests/Xumemc.pid
241
242 test-memrm: clients/memrm clients/memcp
243 @echo "Testing memrm"
244 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
245 @clients/memcp --servers="localhost:12555" clients/memcat
246 @clients/memrm --servers="localhost:12555" memcat
247 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
248 @rm tests/Xumemc.pid
249
250 valgrind-memrm: clients/memcat clients/memcp
251 @echo "Testing memrm"
252 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
253 @clients/memcp --servers="localhost:12555" clients/memcat
254 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
255 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
256 @rm tests/Xumemc.pid
257
258 test-memflush: clients/memflush
259 @echo "Testing memflush"
260 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
261 @clients/memflush --servers="localhost:12555"
262 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
263 @rm tests/Xumemc.pid
264
265 valgrind-memflush: clients/memflush
266 @echo "Testing memflush"
267 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
268 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
269 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
270 @rm tests/Xumemc.pid
271
272 test-memdump: clients/memdump clients/memcp
273 @echo "Testing memdump"
274 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
275 @clients/memcp --servers="localhost:12555" clients/memcat
276 @clients/memdump --servers="localhost:12555" > /dev/null
277 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
278 @rm tests/Xumemc.pid
279
280 valgrind-memdump: clients/memcat clients/memcp
281 @echo "Testing memdump"
282 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
283 @clients/memcp --servers="localhost:12555" clients/memcat
284 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
285 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
286 @rm tests/Xumemc.pid
287
288 test-memstat: clients/memstat
289 @echo "Testing memstat"
290 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
291 @clients/memstat --servers="localhost:12555" > /dev/null
292 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
293 @rm tests/Xumemc.pid
294
295 valgrind-memstat: clients/memstat
296 @echo "Testing memstat"
297 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
298 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
299 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
300 @rm tests/Xumemc.pid
301
302 test-memerror: clients/memerror
303 @echo "Testing memerror"
304 @clients/memerror 0 > /dev/null
305
306 valgrind-memerror: clients/memerror
307 @echo "Testing memerror"
308 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
309
310 test-mem: tests/var tests/testapp
311 @tests/testapp
312
313 test-sasl: tests/sasl
314 @tests/sasl
315
316 test-atom: tests/var tests/atomsmasher
317 @tests/atomsmasher
318
319 test-plus: tests/var tests/testplus
320 @tests/testplus
321
322 test-hash: tests/var tests/testhashkit
323 @tests/testhashkit
324
325 test-hashplus: tests/var tests/hash_plus
326 @tests/hash_plus
327
328 test-cycle: tests/var tests/cycle
329 @tests/cycle
330
331 test-memcapable: tests/var tests/memcapable
332 @tests/memcapable
333
334 pahole-mem: tests/testapp
335 @$(PAHOLE_COMMAND) tests/testapp
336
337 gdb-mem: tests/testapp
338 @$(DEBUG_COMMAND) tests/testapp
339
340 gdb-sasl: tests/sasl
341 @$(DEBUG_COMMAND) tests/sasl
342
343 gdb-atom: tests/atomsmasher
344 @$(DEBUG_COMMAND) tests/testudp
345
346 gdb-udp: tests/testudp
347 @$(DEBUG_COMMAND) tests/atomsmasher
348
349 gdb-plus: tests/testplus
350 $(DEBUG_COMMAND) tests/testplus
351
352 gdb-hash: tests/testhashkit
353 @$(DEBUG_COMMAND) tests/testhashkit
354
355 gdb-hashplus: tests/hash_plus
356 @$(DEBUG_COMMAND) tests/hash_plus
357
358 gdb-cycle: tests/cycle
359 @$(DEBUG_COMMAND) tests/cycle
360
361 gdb-failure: tests/failure
362 @$(DEBUG_COMMAND) tests/failure
363
364 valgrind-cycle: tests/cycle
365 $(VALGRIND_COMMAND) tests/cycle
366
367 valgrind-mem: tests/testapp
368 @$(VALGRIND_COMMAND) tests/testapp
369
370 valgrind-failure: tests/failure
371 @$(VALGRIND_COMMAND) tests/failure
372
373 valgrind-atom: tests/atomsmasher
374 $(VALGRIND_COMMAND) tests/atomsmasher
375
376 valgrind-udp: tests/testudp
377 $(VALGRIND_COMMAND) tests/testudp
378
379 valgrind-plus: tests/testplus
380 @$(VALGRIND_COMMAND) tests/testplus
381
382 valgrind-sasl: tests/sasl
383 @$(VALGRIND_COMMAND) tests/sasl
384
385 valgrind-hash: tests/testhashkit
386 @$(VALGRIND_COMMAND) tests/testhashkit
387
388 valgrind-hashplus: tests/hash_plus
389 @$(VALGRIND_COMMAND) tests/hash_plus
390
391 helgrind-cycle: tests/cycle
392 @$(HELGRIND_COMMAND) tests/cycle
393
394 helgrind-mem: tests/testapp
395 @$(HELGRIND_COMMAND) tests/testapp
396
397 helgrind-atom: tests/atomsmasher
398 @$(HELGRIND_COMMAND) tests/atomsmasher
399
400 helgrind-udp: tests/testudp
401 @$(HELGRIND_COMMAND) tests/testudp
402
403 helgrind-plus: tests/testplus
404 @$(HELGRIND_COMMAND) tests/testplus
405
406 helgrind-hash: tests/testhashkit
407 @$(HELGRIND_COMMAND) tests/testhashkit
408
409 helgrind-hashplus: tests/hash_plus
410 @$(HELGRIND_COMMAND) tests/hash_plus
411
412 .PHONY += helgrind
413 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
414
415 .PHONY += cachegrind
416 CLEANFILES += tests/cachegrind.out
417 cachegrind:
418 rm -f tests/cachegrind.out.*
419 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
420 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
421
422 .PHONY += callgrind
423 CLEANFILES += tests/callgrind.out
424 callgrind:
425 rm -f tests/callgrind.out.*
426 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
427 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
428
429 hudson-valgrind: tests/testapp
430 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp