2 # included from Top Level Makefile.am
3 # All paths should be given relative to the root
5 TESTS_LDADDS = libmemcached/libmemcached.la
7 VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes
9 DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
11 if BUILD_LIBMEMCACHEDUTIL
12 TESTS_LDADDS+= libmemcached/libmemcachedutil.la
24 tests/t/memslap.test \
28 tests/hash_results.h \
29 tests/ketama_test_cases.h \
30 tests/ketama_test_cases_spy.h \
31 tests/libmemcached_world.h \
43 noinst_LTLIBRARIES+= tests/libserver.la
44 tests_libserver_la_SOURCES= tests/server.c
46 noinst_LTLIBRARIES+= tests/libtest.la
47 tests_libtest_la_SOURCES= tests/test.c
49 tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
50 tests_testapp_SOURCES= tests/mem_functions.c
51 tests_testapp_LDADD= \
52 clients/libgenexec.la \
55 libmemcached/libmemcachedinternal.la \
57 tests_testapp_DEPENDENCIES= $(tests_testapp_LDADD)
59 tests_testplus_SOURCES= tests/plus.cpp
60 tests_testplus_LDADD= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
61 tests_testplus_DEPENDENCIES= $(tests_testplus_LDADD)
63 tests_udptest_SOURCES= tests/udp.c
64 tests_udptest_LDADD= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
65 tests_udptest_DEPENDENCIES= $(tests_udptest_LDADD)
67 tests_atomsmasher_SOURCES= tests/atomsmasher.c
68 tests_atomsmasher_LDADD= \
69 clients/libgenexec.la \
73 tests_atomsmasher_DEPENDENCIES= $(tests_atomsmasher_LDADD)
75 tests_startservers_SOURCES= tests/start.c
76 tests_startservers_LDADD= tests/libserver.la $(TESTS_LDADDS)
77 tests_startservers_DEPENDENCIES= $(tests_startservers_LDADD)
79 tests_testhashkit_SOURCES = tests/hashkit_functions.c
80 tests_testhashkit_LDADD = tests/libtest.la libhashkit/libhashkit.la
81 tests_testhashkit_DEPENDENCIES = $(tests_testhashkit_LDADD)
84 sh tests/t/memcat.test > tests/r/memcat.res
85 sh tests/t/memcp.test > tests/r/memcp.res
86 sh tests/t/memrm.test > tests/r/memrm.res
87 sh tests/t/memslap.test > tests/r/memslap.res
88 sh tests/t/memstat.test > tests/r/memstat.res
90 test: test-docs tests/testplus library_test memcapable libmhashkit_test
91 echo "Tests completed"
93 library_test: tests/testapp
96 libmhashkit_test: libhashkit
99 memcapable: clients/memcapable
100 @MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
101 @clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
102 @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
107 @MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
108 export MEMCACHED_SERVERS="localhost:12555"
109 sh tests/t/memcat.test > tests/r/memcat.cmp
110 diff tests/r/memcat.res tests/r/memcat.cmp
111 sh tests/t/memcp.test > tests/r/memcp.cmp
112 diff tests/r/memcp.res tests/r/memcp.cmp
113 sh tests/t/memrm.test > tests/r/memrm.cmp
114 diff tests/r/memrm.res tests/r/memrm.cmp
115 sh tests/t/memslap.test > tests/r/memslap.cmp
116 diff tests/r/memslap.res tests/r/memslap.cmp
117 sh tests/t/memstat.test > tests/r/memstat.cmp
118 diff tests/r/memstat.res tests/r/memstat.cmp
119 cat tests/Xumemc.pid | xargs kill
122 MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
124 HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
133 $(DEBUG_COMMAND) $(MEM_COMMAND)
136 $(DEBUG_COMMAND) $(HASH_COMMAND)
139 $(VALGRIND_COMMAND) $(MEM_COMMAND)
142 $(VALGRIND_COMMAND) $(HASH_COMMAND)
146 valgrind: tests/testapp tests/testhashkit valgrind-mem valgrind-hash
149 CLEANFILES += tests/cachegrind.out
151 rm -f tests/cachegrind.out.*
152 $(LIBTOOL) --mode=execute valgrind --tool=cachegrind --cachegrind-out-file=tests/cachegrind.out.%p --branch-sim=yes tests/testapp
153 cg_annotate tests/cachegrind.out.* --auto=yes > tests/cachegrind.out
156 CLEANFILES += tests/callgrind.out
158 rm -f tests/callgrind.out.*
159 $(LIBTOOL) --mode=execute valgrind --tool=callgrind --callgrind-out-file=tests/callgrind.out.%p tests/testapp
160 callgrind_annotate tests/callgrind.out.* --auto=yes > tests/callgrind.out
163 CLEANFILES+= helgrind.out.*
166 $(LIBTOOL) --mode=execute valgrind --tool=helgrind tests/testapp
168 PHONY += helgrind-slap
170 $(LIBTOOL) --mode=execute valgrind --tool=helgrind clients/memslap --server=localhost --concurrency=30
172 test-no-outputdiff: test
175 $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --log-file=tests/valgrind.out tests/testapp