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