Merge in tests 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/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_atomsmasher_SOURCES= \
134 tests/atomsmasher.cc \
135 tests/debug.cc \
136 tests/print.cc \
137 clients/generator.cc \
138 clients/execute.cc
139 tests_atomsmasher_DEPENDENCIES= $(TESTS_LDADDS)
140 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES)
141 noinst_PROGRAMS+= tests/atomsmasher
142
143 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
144 tests_testudp_SOURCES= tests/mem_udp.cc
145 tests_testudp_DEPENDENCIES= $(TESTS_LDADDS)
146 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES)
147 check_PROGRAMS+= tests/testudp
148 noinst_PROGRAMS+= tests/testudp
149
150 tests_testhashkit_SOURCES = tests/hashkit_functions.cc
151 tests_testhashkit_DEPENDENCIES = libtest/libtest.la libhashkit/libhashkit.la $(TESTS_LDADDS)
152 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES)
153 check_PROGRAMS+= tests/testhashkit
154 noinst_PROGRAMS+= tests/testhashkit
155
156 tests_hash_plus_SOURCES= tests/hash_plus.cc
157 tests_hash_plus_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
158 tests_hash_plus_DEPENDENCIES= $(tests_testhashkit_DEPENDENCIES)
159 tests_hash_plus_LDADD= $(tests_testhashkit_DEPENDENCIES)
160 check_PROGRAMS+= tests/hash_plus
161 noinst_PROGRAMS+= tests/hash_plus
162
163 tests_memcapable_SOURCES= tests/memcapable.cc
164 tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
165 tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
166 tests_memcapable_LDADD= $(tests_memcapable_DEPENDENCIES)
167 check_PROGRAMS+= tests/memcapable
168 noinst_PROGRAMS+= tests/memcapable
169
170 tests_memslap_SOURCES= tests/memslap.cc
171 tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
172 tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS)
173 tests_memslap_LDADD= $(tests_memslap_DEPENDENCIES)
174 check_PROGRAMS+= tests/memslap
175 noinst_PROGRAMS+= tests/memslap
176
177 # Test linking with C application
178 tests_c_test_SOURCES= tests/c_test.c
179 tests_c_test_LDADD= libmemcached/libmemcached.la
180 tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la
181 check_PROGRAMS+=tests/c_test
182 noinst_PROGRAMS+=tests/c_test
183
184 # Test linking with C application/SASL include
185 tests_c_sasl_test_SOURCES= tests/c_sasl_test.c
186 tests_c_sasl_test_LDADD= libmemcached/libmemcached.la
187 tests_c_sasl_test_DEPENDENCIES= libmemcached/libmemcached.la
188 check_PROGRAMS+=tests/c_sasl_test
189 noinst_PROGRAMS+=tests/c_sasl_test
190
191 test: check
192
193 check-local: $(TEST_DOCS)
194 @echo "Tests completed"
195
196 test-x: test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
197 @echo "Tests completed"
198
199 test-memcat: clients/memcat clients/memcp
200 @echo "Testing memcat"
201 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
202 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
203 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
204 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
205 # @diff clients/memcp tests/scratch
206 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
207 @rm `pwd`/tests/Xumemc.pid
208 @rm `pwd`/tests/scratch
209 @rm `pwd`/tests/scratch2
210
211 valgrind-memcat: clients/memcat clients/memcp
212 @echo "Testing memcat"
213 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
214 @clients/memcp --servers="localhost:12555" clients/memcp
215 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
216 # @diff clients/memcp tests/scratch
217 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
218 @rm tests/Xumemc.pid
219 @rm tests/scratch
220
221 test-memcp: clients/memcp
222 @echo "Testing memcp"
223 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
224 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
225 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
226 @rm tests/Xumemc.pid
227
228 valgrind-memcp: clients/memcat clients/memcp
229 @echo "Testing memcp"
230 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
231 @$(VALGRIND_COMMAND) 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 test-memrm: clients/memrm clients/memcp
236 @echo "Testing memrm"
237 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
238 @clients/memcp --servers="localhost:12555" clients/memcat
239 @clients/memrm --servers="localhost:12555" memcat
240 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
241 @rm tests/Xumemc.pid
242
243 valgrind-memrm: clients/memcat clients/memcp
244 @echo "Testing memrm"
245 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
246 @clients/memcp --servers="localhost:12555" clients/memcat
247 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
248 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
249 @rm tests/Xumemc.pid
250
251 test-memflush: clients/memflush
252 @echo "Testing memflush"
253 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
254 @clients/memflush --servers="localhost:12555"
255 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
256 @rm tests/Xumemc.pid
257
258 valgrind-memflush: clients/memflush
259 @echo "Testing memflush"
260 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
261 @$(VALGRIND_COMMAND) 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 test-memdump: clients/memdump clients/memcp
266 @echo "Testing memdump"
267 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
268 @clients/memcp --servers="localhost:12555" clients/memcat
269 @clients/memdump --servers="localhost:12555" > /dev/null
270 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
271 @rm tests/Xumemc.pid
272
273 valgrind-memdump: clients/memcat clients/memcp
274 @echo "Testing memdump"
275 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
276 @clients/memcp --servers="localhost:12555" clients/memcat
277 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
278 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
279 @rm tests/Xumemc.pid
280
281 test-memstat: clients/memstat
282 @echo "Testing memstat"
283 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
284 @clients/memstat --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 valgrind-memstat: clients/memstat
289 @echo "Testing memstat"
290 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
291 @$(VALGRIND_COMMAND) 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 test-memerror: clients/memerror
296 @echo "Testing memerror"
297 @clients/memerror 0 > /dev/null
298
299 valgrind-memerror: clients/memerror
300 @echo "Testing memerror"
301 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
302
303 test-mem: tests/var tests/testapp
304 @tests/testapp
305
306 test-sasl: tests/sasl
307 @tests/sasl
308
309
310 test-udp: tests/var tests/testudp
311 @tests/testudp
312
313 test-atom: tests/var tests/atomsmasher
314 @tests/atomsmasher
315
316 test-plus: tests/var tests/testplus
317 @tests/testplus
318
319 test-hash: tests/var tests/testhashkit
320 @tests/testhashkit
321
322 test-hashplus: tests/var tests/hash_plus
323 @tests/hash_plus
324
325 test-cycle: tests/var tests/cycle
326 @tests/cycle
327
328 test-memcapable: tests/var tests/memcapable
329 @tests/memcapable
330
331 pahole-mem: tests/testapp
332 @$(PAHOLE_COMMAND) tests/testapp
333
334 gdb-mem: tests/testapp
335 @$(DEBUG_COMMAND) tests/testapp
336
337 gdb-sasl: tests/sasl
338 @$(DEBUG_COMMAND) tests/sasl
339
340 gdb-atom: tests/atomsmasher
341 @$(DEBUG_COMMAND) tests/testudp
342
343 gdb-udp: tests/testudp
344 @$(DEBUG_COMMAND) tests/atomsmasher
345
346 gdb-plus: tests/testplus
347 $(DEBUG_COMMAND) tests/testplus
348
349 gdb-hash: tests/testhashkit
350 @$(DEBUG_COMMAND) tests/testhashkit
351
352 gdb-hashplus: tests/hash_plus
353 @$(DEBUG_COMMAND) tests/hash_plus
354
355 gdb-cycle: tests/cycle
356 @$(DEBUG_COMMAND) tests/cycle
357
358 valgrind-cycle: tests/cycle
359 $(VALGRIND_COMMAND) tests/cycle
360
361 valgrind-mem: tests/testapp
362 @$(VALGRIND_COMMAND) tests/testapp
363
364 valgrind-atom: tests/atomsmasher
365 $(VALGRIND_COMMAND) tests/atomsmasher
366
367 valgrind-udp: tests/testudp
368 $(VALGRIND_COMMAND) tests/testudp
369
370 valgrind-plus: tests/testplus
371 @$(VALGRIND_COMMAND) tests/testplus
372
373 valgrind-sasl: tests/sasl
374 @$(VALGRIND_COMMAND) tests/sasl
375
376 valgrind-hash: tests/testhashkit
377 @$(VALGRIND_COMMAND) tests/testhashkit
378
379 valgrind-hashplus: tests/hash_plus
380 @$(VALGRIND_COMMAND) tests/hash_plus
381
382 helgrind-cycle: tests/cycle
383 @$(HELGRIND_COMMAND) tests/cycle
384
385 helgrind-mem: tests/testapp
386 @$(HELGRIND_COMMAND) tests/testapp
387
388 helgrind-atom: tests/atomsmasher
389 @$(HELGRIND_COMMAND) tests/atomsmasher
390
391 helgrind-udp: tests/testudp
392 @$(HELGRIND_COMMAND) tests/testudp
393
394 helgrind-plus: tests/testplus
395 @$(HELGRIND_COMMAND) tests/testplus
396
397 helgrind-hash: tests/testhashkit
398 @$(HELGRIND_COMMAND) tests/testhashkit
399
400 helgrind-hashplus: tests/hash_plus
401 @$(HELGRIND_COMMAND) tests/hash_plus
402
403 .PHONY += helgrind
404 helgrind: helgrind-cycle helgrind-mem helgrind-udp helgrind-plus helgrind-hash helgrind-hashplus
405
406 .PHONY += cachegrind
407 CLEANFILES += tests/cachegrind.out
408 cachegrind:
409 rm -f tests/cachegrind.out.*
410 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
411 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
412
413 .PHONY += callgrind
414 CLEANFILES += tests/callgrind.out
415 callgrind:
416 rm -f tests/callgrind.out.*
417 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
418 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
419
420 hudson-valgrind: tests/testapp
421 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out tests/testapp