Update how tests are performed.
[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
8
9 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
10
11 if BUILD_LIBMEMCACHEDUTIL
12 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
13 endif
14
15 EXTRA_DIST+= \
16 tests/r/memcat.res \
17 tests/r/memcp.res \
18 tests/r/memrm.res \
19 tests/r/memslap.res \
20 tests/r/memstat.res \
21 tests/t/memcat.test \
22 tests/t/memcp.test \
23 tests/t/memrm.test \
24 tests/t/memslap.test \
25 tests/t/memstat.test
26
27 noinst_HEADERS+= \
28 tests/hash_results.h \
29 tests/ketama_test_cases.h \
30 tests/ketama_test_cases_spy.h \
31 tests/libmemcached_world.h \
32 tests/server.h \
33 tests/test.h
34
35 noinst_PROGRAMS+= \
36 tests/atomsmasher \
37 tests/startservers \
38 tests/testapp \
39 tests/testhashkit \
40 tests/testplus
41
42 noinst_LTLIBRARIES+= tests/libserver.la
43 tests_libserver_la_SOURCES= tests/server.c
44
45 noinst_LTLIBRARIES+= tests/libtest.la
46 tests_libtest_la_SOURCES= tests/test.c
47
48 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
49 tests_testapp_SOURCES= tests/mem_functions.c
50 tests_testapp_LDADD= \
51 clients/libgenexec.la \
52 tests/libserver.la \
53 tests/libtest.la \
54 libmemcached/libmemcachedinternal.la \
55 $(TESTS_LDADDS)
56 tests_testapp_DEPENDENCIES= $(tests_testapp_LDADD)
57
58 tests_testplus_SOURCES= tests/plus.cpp
59 tests_testplus_LDADD= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
60 tests_testplus_DEPENDENCIES= $(tests_testplus_LDADD)
61
62 tests_atomsmasher_SOURCES= tests/atomsmasher.c
63 tests_atomsmasher_LDADD= \
64 clients/libgenexec.la \
65 tests/libserver.la \
66 tests/libtest.la \
67 $(TESTS_LDADDS)
68 tests_atomsmasher_DEPENDENCIES= $(tests_atomsmasher_LDADD)
69
70 tests_startservers_SOURCES= tests/start.c
71 tests_startservers_LDADD= tests/libserver.la $(TESTS_LDADDS)
72 tests_startservers_DEPENDENCIES= $(tests_startservers_LDADD)
73
74 tests_testhashkit_SOURCES = tests/hashkit_functions.c
75 tests_testhashkit_LDADD = tests/libtest.la libhashkit/libhashkit.la
76 tests_testhashkit_DEPENDENCIES = $(tests_testhashkit_LDADD)
77
78 client-record:
79 sh tests/t/memcat.test > tests/r/memcat.res
80 sh tests/t/memcp.test > tests/r/memcp.res
81 sh tests/t/memrm.test > tests/r/memrm.res
82 sh tests/t/memslap.test > tests/r/memslap.res
83 sh tests/t/memstat.test > tests/r/memstat.res
84
85 test: test-docs test-mem test-plus test-hash memcapable
86 echo "Tests completed"
87
88 memcapable: clients/memcapable
89 @MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
90 @clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
91 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
92 @rm tests/Xumemc.pid
93
94 PHONY += clients
95 clients:
96 @MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
97 export MEMCACHED_SERVERS="localhost:12555"
98 sh tests/t/memcat.test > tests/r/memcat.cmp
99 diff tests/r/memcat.res tests/r/memcat.cmp
100 sh tests/t/memcp.test > tests/r/memcp.cmp
101 diff tests/r/memcp.res tests/r/memcp.cmp
102 sh tests/t/memrm.test > tests/r/memrm.cmp
103 diff tests/r/memrm.res tests/r/memrm.cmp
104 sh tests/t/memslap.test > tests/r/memslap.cmp
105 diff tests/r/memslap.res tests/r/memslap.cmp
106 sh tests/t/memstat.test > tests/r/memstat.cmp
107 diff tests/r/memstat.res tests/r/memstat.cmp
108 cat tests/Xumemc.pid | xargs kill
109 rm tests/Xumemc.pid
110
111 MEMSLAP_COMMAND= clients/memslap $(COLLECTION) $(SUITE)
112
113 MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
114
115 PLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
116
117 ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
118
119 HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
120
121 test-mem: tests/testapp
122 $(MEM_COMMAND)
123
124 test-atom: tests/atomsmasher
125 $(ATOM_COMMAND)
126
127 test-plus: tests/testplus
128 $(PLUS_COMMAND)
129
130 test-hash: tests/testhashkit
131 $(HASH_COMMAND)
132
133 gdb-mem: tests/testapp
134 $(DEBUG_COMMAND) $(MEM_COMMAND)
135
136 gdb-atom: tests/atomsmasher
137 $(DEBUG_COMMAND) $(ATOM_COMMAND)
138
139 gdb-plus: tests/testplus
140 $(DEBUG_COMMAND) $(PLUS_COMMAND)
141
142 gdb-hash: tests/testhashkit
143 $(DEBUG_COMMAND) $(HASH_COMMAND)
144
145 gdb-memslap: clients/memslap
146 $(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
147
148 valgrind-mem: tests/testapp
149 $(VALGRIND_COMMAND) $(MEM_COMMAND)
150
151 valgrind-atom: tests/atomsmasher
152 $(VALGRIND_COMMAND) $(ATOM_COMMAND)
153
154 valgrind-plus: tests/testplus
155 $(VALGRIND_COMMAND) $(PLUS_COMMAND)
156
157 valgrind-hash: tests/testhashkit
158 $(VALGRIND_COMMAND) $(HASH_COMMAND)
159
160 valgrind-memslap: clients/memslap
161 $(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)
162
163 PHONY += valgrind
164 valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash
165
166 PHONY += cachegrind
167 CLEANFILES += tests/cachegrind.out
168 cachegrind:
169 rm -f tests/cachegrind.out.*
170 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
171 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
172
173 PHONY += callgrind
174 CLEANFILES += tests/callgrind.out
175 callgrind:
176 rm -f tests/callgrind.out.*
177 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
178 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
179
180 PHONY += helgrind
181 CLEANFILES+= helgrind.out.*
182 helgrind:
183 rm -f helgrind.out.*
184 $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
185
186 PHONY += helgrind-slap
187 helgrind-slap:
188 $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
189
190 test-no-outputdiff: test
191
192 hudson-valgrind: tests/testapp
193 $(VALGRIND_COMMAND) --log-file=tests/valgrind.out $(MEM_COMMAND)