Fix the test_xxx macros, and generate coredump if the test fails
[m6w6/libmemcached] / tests / Makefile.am
1 LDADDS = $(top_builddir)/libmemcached/libmemcached.la
2
3 if BUILD_LIBMEMCACHEDUTIL
4 LDADDS+= $(top_builddir)/libmemcached/libmemcachedutil.la
5 endif
6
7 EXTRA_DIST = output.res output2.res\
8 r/memcat.res\
9 r/memcp.res\
10 r/memrm.res\
11 r/memslap.res\
12 r/memstat.res\
13 t/memcat.test\
14 t/memcp.test\
15 t/memrm.test\
16 t/memslap.test\
17 t/memstat.test
18
19 LIBS =
20
21 noinst_HEADERS = test.h server.h ketama_test_cases.h ketama_test_cases_spy.h
22 noinst_PROGRAMS = testapp testplus udptest atomsmasher startservers
23 noinst_LTLIBRARIES= libserver.la libtest.la
24
25 libserver_la_SOURCES= server.c
26 libtest_la_SOURCES= test.c
27
28 testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
29 testapp_SOURCES = function.c
30 testapp_LDADD = $(top_builddir)/clients/libgenexec.la libtest.la libserver.la $(LDADDS)
31
32 testplus_SOURCES = plus.cpp
33 testplus_LDADD = libtest.la libserver.la $(LDADDS)
34
35 udptest_SOURCES = udp.c
36 udptest_LDADD = libtest.la libserver.la $(LDADDS)
37
38 atomsmasher_SOURCES = atomsmasher.c
39 atomsmasher_LDADD = $(top_builddir)/clients/libgenexec.la libtest.la libserver.la $(LDADDS)
40
41 startservers_SOURCES = start.c
42 startservers_LDADD = libserver.la $(LDADDS)
43
44 record:
45 ./testapp > output.res
46 ./testplus > output_plus.res
47
48 client-record:
49 sh t/memcat.test > r/memcat.res
50 sh t/memcp.test > r/memcp.res
51 sh t/memrm.test > r/memrm.res
52 sh t/memslap.test > r/memslap.res
53 sh t/memstat.test > r/memstat.res
54
55 record-extended:
56 ./testapp extended > output2.res
57
58 test: testapp testplus library_test memcapable
59 echo "Tests completed"
60
61 library_test:
62 ./testapp > output.cmp
63 diff output.res output.cmp
64 # ./testplus > output_plus.cmp
65 # diff output_plus.res output_plus.cmp
66
67 memcapable:
68 @MEMC_BINARY@ -d -P /tmp/Xumemc.pid -p 12555
69 @$(top_builddir)/clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
70 @cat /tmp/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
71 @rm /tmp/Xumemc.pid
72
73 clients:
74 @MEMC_BINARY@ -d -P /tmp/Xumemc.pid -p 12555
75 export MEMCACHED_SERVERS="localhost:12555"
76 sh t/memcat.test > r/memcat.cmp
77 diff r/memcat.res r/memcat.cmp
78 sh t/memcp.test > r/memcp.cmp
79 diff r/memcp.res r/memcp.cmp
80 sh t/memrm.test > r/memrm.cmp
81 diff r/memrm.res r/memrm.cmp
82 sh t/memslap.test > r/memslap.cmp
83 diff r/memslap.res r/memslap.cmp
84 sh t/memstat.test > r/memstat.cmp
85 diff r/memstat.res r/memstat.cmp
86 cat /tmp/Xumemc.pid | xargs kill
87 rm /tmp/Xumemc.pid
88
89 valgrind:
90 libtool --mode=execute valgrind --leak-check=yes --show-reachable=yes testapp
91
92 cachegrind:
93 rm -f cachegrind.out.*
94 libtool --mode=execute valgrind --tool=cachegrind --branch-sim=yes testapp
95 cg_annotate cachegrind.out.* --auto=yes > /tmp/cachegrind.out
96
97 callgrind:
98 rm -f callgrind.out.*
99 libtool --mode=execute valgrind --tool=callgrind testapp
100 callgrind_annotate callgrind.out.* --auto=yes > /tmp/callgrind.out
101
102 helgrind:
103 rm -f helgrind.out.*
104 libtool --mode=execute valgrind --tool=helgrind testapp
105
106 helgrind-slap:
107 libtool --mode=execute valgrind --tool=helgrind ${top_builddir}/clients/memslap --server=localhost --concurrency=30
108
109 test-no-outputdiff: testapp
110 ./testapp > /dev/null
111 @echo "Test completed"