Merge in dist fix from Monty
[m6w6/libmemcached] / tests / include.am
1 # vim:ft=automake
2 # included from Top Level Makefile.am
3 # All paths should be given relative to the root
4
5 TESTS_LDADDS = libmemcached/libmemcached.la
6
7 VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --track-fds=yes
8
9 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
10
11 PAHOLE_COMMAND= $(LIBTOOL) --mode=execute pahole
12
13 if BUILD_LIBMEMCACHEDUTIL
14 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
15 endif
16
17 EXTRA_DIST+= \
18 tests/cpp_example.cc \
19 tests/output_plus.res
20
21 noinst_HEADERS+= \
22 tests/hash_results.h \
23 tests/ketama_test_cases.h \
24 tests/ketama_test_cases_spy.h \
25 tests/libmemcached_world.h \
26 tests/server.h \
27 tests/test.h
28
29 noinst_PROGRAMS+= \
30 tests/atomsmasher \
31 tests/hashplus \
32 tests/memplus \
33 tests/startservers \
34 tests/testapp \
35 tests/testhashkit \
36 tests/testplus \
37 tests/testudp
38
39 noinst_LTLIBRARIES+= tests/libserver.la
40 tests_libserver_la_SOURCES= tests/server.c
41
42 noinst_LTLIBRARIES+= tests/libtest.la
43 tests_libtest_la_SOURCES= tests/test.c
44
45 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
46 tests_testapp_SOURCES= tests/mem_functions.c
47 tests_testapp_DEPENDENCIES= \
48 $(BUILT_SOURCES) \
49 clients/libgenexec.la \
50 tests/libserver.la \
51 tests/libtest.la \
52 libmemcached/libmemcachedinternal.la \
53 $(TESTS_LDADDS)
54 tests_testapp_LDADD= clients/libgenexec.la \
55 tests/libserver.la \
56 tests/libtest.la \
57 libmemcached/libmemcachedinternal.la \
58 $(TESTS_LDADDS) $(LIBSASL)
59
60 tests_testplus_SOURCES= tests/plus.cpp
61 tests_testplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
62 tests_testplus_DEPENDENCIES= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
63 tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) $(LIBSASL)
64
65 tests_atomsmasher_SOURCES= tests/atomsmasher.c
66 tests_atomsmasher_DEPENDENCIES= \
67 clients/libgenexec.la \
68 tests/libserver.la \
69 tests/libtest.la \
70 $(TESTS_LDADDS)
71 tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
72
73 tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
74 tests_testudp_SOURCES= tests/mem_udp.c
75 tests_testudp_DEPENDENCIES= \
76 clients/libgenexec.la \
77 tests/libserver.la \
78 tests/libtest.la \
79 $(TESTS_LDADDS)
80 tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
81
82 tests_startservers_SOURCES= tests/start.c
83 tests_startservers_DEPENDENCIES= tests/libserver.la $(TESTS_LDADDS)
84 tests_startservers_LDADD= $(tests_startservers_DEPENDENCIES) $(LIBSASL)
85
86 tests_testhashkit_SOURCES = tests/hashkit_functions.c
87 tests_testhashkit_DEPENDENCIES = tests/libtest.la libhashkit/libhashkit.la
88 tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL)
89
90 tests_hashplus_SOURCES = tests/hash_plus.cc
91 tests_hashplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
92 tests_hashplus_DEPENDENCIES = $(tests_testhashkit_DEPENDENCIES)
93 tests_hashplus_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL)
94
95 tests_memplus_SOURCES = tests/mem_plus.cc
96 tests_memplus_CXXFLAGS = $(AM_CXXFLAGS) $(NO_EFF_CXX)
97 tests_memplus_DEPENDENCIES = tests/libtest.la tests/libserver.la libmemcached/libmemcached.la
98 tests_memplus_LDADD = $(tests_memplus_DEPENDENCIES) $(LIBSASL)
99
100 test: check
101
102 check-local: $(TEST_DOCS) test-mem test-hash memcapable
103 @echo "Tests completed"
104
105 test-x: check-local test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
106 @echo "Tests completed"
107
108 memcapable: clients/memcapable
109 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
110 @clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
111 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
112 @rm tests/Xumemc.pid
113
114 test-memcat: clients/memcat clients/memcp
115 @echo "Testing memcat"
116 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
117 @clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
118 @clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
119 @clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
120 # @diff clients/memcp tests/scratch
121 @cat `pwd`/tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
122 @rm `pwd`/tests/Xumemc.pid
123 @rm `pwd`/tests/scratch
124 @rm `pwd`/tests/scratch2
125
126 valgrind-memcat: clients/memcat clients/memcp
127 @echo "Testing memcat"
128 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
129 @clients/memcp --servers="localhost:12555" clients/memcp
130 @$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
131 # @diff clients/memcp tests/scratch
132 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
133 @rm tests/Xumemc.pid
134 @rm tests/scratch
135
136 test-memcp: clients/memcp
137 @echo "Testing memcp"
138 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
139 @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
140 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
141 @rm tests/Xumemc.pid
142
143 valgrind-memcp: clients/memcat clients/memcp
144 @echo "Testing memcp"
145 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
146 @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
147 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
148 @rm tests/Xumemc.pid
149
150 test-memrm: clients/memrm clients/memcp
151 @echo "Testing memrm"
152 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
153 @clients/memcp --servers="localhost:12555" clients/memcat
154 @clients/memrm --servers="localhost:12555" memcat
155 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
156 @rm tests/Xumemc.pid
157
158 valgrind-memrm: clients/memcat clients/memcp
159 @echo "Testing memrm"
160 @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
161 @clients/memcp --servers="localhost:12555" clients/memcat
162 @$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
163 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
164 @rm tests/Xumemc.pid
165
166 test-memflush: clients/memflush
167 @echo "Testing memflush"
168 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
169 @clients/memflush --servers="localhost:12555"
170 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
171 @rm tests/Xumemc.pid
172
173 valgrind-memflush: clients/memflush
174 @echo "Testing memflush"
175 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
176 @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
177 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
178 @rm tests/Xumemc.pid
179
180 test-memdump: clients/memdump clients/memcp
181 @echo "Testing memdump"
182 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
183 @clients/memcp --servers="localhost:12555" clients/memcat
184 @clients/memdump --servers="localhost:12555" > /dev/null
185 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
186 @rm tests/Xumemc.pid
187
188 valgrind-memdump: clients/memcat clients/memcp
189 @echo "Testing memdump"
190 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
191 @clients/memcp --servers="localhost:12555" clients/memcat
192 @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
193 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
194 @rm tests/Xumemc.pid
195
196 test-memstat: clients/memstat
197 @echo "Testing memstat"
198 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
199 @clients/memstat --servers="localhost:12555" > /dev/null
200 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
201 @rm tests/Xumemc.pid
202
203 valgrind-memstat: clients/memstat
204 @echo "Testing memstat"
205 @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
206 @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
207 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
208 @rm tests/Xumemc.pid
209
210 test-memerror: clients/memerror
211 @echo "Testing memerror"
212 @clients/memerror 0 > /dev/null
213
214 valgrind-memerror: clients/memerror
215 @echo "Testing memerror"
216 @$(VALGRIND_COMMAND) clients/memerror 0 > /dev/null
217
218
219
220
221
222 MEMSLAP_COMMAND= clients/memslap $(COLLECTION) $(SUITE)
223
224 MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
225
226 TESTPLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
227
228 MEMPLUS_COMMAND= tests/memplus $(COLLECTION) $(SUITE)
229
230 HASHPLUS_COMMAND= tests/hashplus $(COLLECTION) $(SUITE)
231
232 ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
233
234 UDP_COMMAND= tests/testudp $(COLLECTION) $(SUITE)
235
236 HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
237
238 test-mem: tests/testapp
239 $(MEM_COMMAND)
240
241 test-udp: tests/testudp
242 $(UDP_COMMAND)
243
244 test-atom: tests/atomsmasher
245 $(ATOM_COMMAND)
246
247 test-plus: tests/testplus
248 $(TESTPLUS_COMMAND)
249
250 test-hash: tests/testhashkit
251 $(HASH_COMMAND)
252
253 test-hashplus: tests/hashplus
254 $(HASHPLUS_COMMAND)
255
256 test-memplus: tests/memplus
257 $(MEMPLUS_COMMAND)
258
259 pahole-mem: tests/testapp
260 $(PAHOLE_COMMAND) $(MEM_COMMAND)
261
262 gdb-mem: tests/testapp
263 $(DEBUG_COMMAND) $(MEM_COMMAND)
264
265 gdb-atom: tests/atomsmasher
266 $(DEBUG_COMMAND) $(UDP_COMMAND)
267
268 gdb-udp: tests/testudp
269 $(DEBUG_COMMAND) $(ATOM_COMMAND)
270
271 gdb-plus: tests/testplus
272 $(DEBUG_COMMAND) $(TESTPLUS_COMMAND)
273
274 gdb-hash: tests/testhashkit
275 $(DEBUG_COMMAND) $(HASH_COMMAND)
276
277 gdb-hashplus: tests/hashplus
278 $(DEBUG_COMMAND) $(HASHPLUS_COMMAND)
279
280 gdb-memplus: tests/memplus
281 $(DEBUG_COMMAND) $(MEMPLUS_COMMAND)
282
283 gdb-memslap: clients/memslap
284 $(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
285
286 valgrind-mem: tests/testapp
287 $(VALGRIND_COMMAND) $(MEM_COMMAND)
288
289 valgrind-atom: tests/atomsmasher
290 $(VALGRIND_COMMAND) $(ATOM_COMMAND)
291
292 valgrind-udp: tests/testudp
293 $(VALGRIND_COMMAND) $(UDP_COMMAND)
294
295 valgrind-plus: tests/testplus
296 $(VALGRIND_COMMAND) $(TESTPLUS_COMMAND)
297
298 valgrind-hash: tests/testhashkit
299 $(VALGRIND_COMMAND) $(HASH_COMMAND)
300
301 valgrind-hashplus: tests/hashplus
302 $(VALGRIND_COMMAND) $(HASHPLUS_COMMAND)
303
304 valgrind-memplus: tests/memplus
305 $(VALGRIND_COMMAND) $(MEMPLUS_COMMAND)
306
307 valgrind-memslap: clients/memslap
308 $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)
309
310 PHONY += valgrind
311 valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash valgrind-memcat valgrind-memcp valgrind-memrm valgrind-memerror valgrind-memdump valgrind-memflush valgrind-memstat
312
313 PHONY += cachegrind
314 CLEANFILES += tests/cachegrind.out
315 cachegrind:
316 rm -f tests/cachegrind.out.*
317 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
318 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
319
320 PHONY += callgrind
321 CLEANFILES += tests/callgrind.out
322 callgrind:
323 rm -f tests/callgrind.out.*
324 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
325 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
326
327 PHONY += helgrind
328 CLEANFILES+= helgrind.out.*
329 helgrind:
330 rm -f helgrind.out.*
331 $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
332
333 PHONY += helgrind-slap
334 helgrind-slap:
335 $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
336
337 test-no-outputdiff: test
338
339 hudson-valgrind: tests/testapp
340 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out $(MEM_COMMAND)