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