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