Merge in util update
[awesomized/libmemcached] / libtest / include.am
1 # vim:ft=automake
2 # Copyright (C) 2011 Data Differential, http://datadifferential.com/
3 # All rights reserved.
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 3 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #
19 # included from Top Level Makefile.am
20 # All paths should be given relative to the root
21 #
22
23 LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute
24 VALGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
25 HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1
26 DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd
27 GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x libtest/run.gdb
28
29 export LIBTOOL_COMMAND
30 export VALGRIND_COMMAND
31 export HELGRIND_COMMAND
32 export DRD_COMMAND
33 export GDB_COMMAND
34
35 valgrind:
36 @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_COMMAND)\""
37
38 helgrind:
39 @echo make check TESTS_ENVIRONMENT="\"$(HELGRIND_COMMAND)\""
40
41 drd:
42 @echo make check TESTS_ENVIRONMENT="\"$(DRD_COMMAND)\""
43
44 EXTRA_DIST+= libtest/run.gdb
45
46 CLEANFILES+= \
47 tmp_chroot/var/log/* \
48 tmp_chroot/var/run/* \
49 tmp_chroot/var/tmp/*
50
51 .PHONY: distclean-libtest-check
52 distclean-libtest-check:
53 -rm -rf tmp_chroot
54
55 noinst_HEADERS+= \
56 libtest/blobslap_worker.h \
57 libtest/callbacks.h \
58 libtest/cmdline.h \
59 libtest/collection.h \
60 libtest/common.h \
61 libtest/comparison.hpp \
62 libtest/core.h \
63 libtest/error.h \
64 libtest/failed.h \
65 libtest/framework.h \
66 libtest/gearmand.h \
67 libtest/get.h \
68 libtest/killpid.h \
69 libtest/libtool.hpp \
70 libtest/memcached.h \
71 libtest/runner.h \
72 libtest/port.h \
73 libtest/server.h \
74 libtest/server_container.h \
75 libtest/signal.h \
76 libtest/stats.h \
77 libtest/stream.h \
78 libtest/strerror.h \
79 libtest/string.hpp \
80 libtest/test.h \
81 libtest/test.hpp \
82 libtest/visibility.h \
83 libtest/wait.h
84
85 noinst_LTLIBRARIES+= libtest/libtest.la
86 libtest_libtest_la_SOURCES= \
87 libtest/binaries.cc \
88 libtest/cmdline.cc \
89 libtest/framework.cc \
90 libtest/killpid.cc \
91 libtest/libtool.cc \
92 libtest/port.cc \
93 libtest/runner.cc \
94 libtest/server.cc \
95 libtest/server_container.cc \
96 libtest/signal.cc \
97 libtest/test.cc
98
99 libtest_libtest_la_CXXFLAGS= ${AM_CXXFLAGS}
100 libtest_libtest_la_CXXFLAGS+= ${NO_CONVERSION}
101 libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
102 libtest_libtest_la_CXXFLAGS+= $(PTHREAD_CFLAGS)
103 libtest_libtest_la_CXXFLAGS+= -DLIBTEST_TEMP="\"tmp_chroot\""
104 libtest_libtest_la_LIBADD=
105 libtest_libtest_la_LIBADD+= $(PTHREAD_LIBS)
106 libtest_libtest_la_DEPENDENCIES= libtest_tmp_dir
107
108 # Declare unittest so that we can append to it
109 libtest_unittest_CXXFLAGS=
110 libtest_unittest_LDADD=
111 libtest_unittest_DEPENDENCIES=
112
113 # We are either building in tree, or with
114 if BUILDING_LIBMEMCACHED
115 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcached.la
116 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcachedutil.la
117 libtest_libtest_la_LIBADD+= libmemcached/libmemcached.la
118 libtest_libtest_la_LIBADD+= libmemcached/libmemcachedutil.la
119 libtest_libtest_la_SOURCES+= libtest/memcached.cc
120 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED
121
122 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED
123 libtest_unittest_LDADD+= libmemcached/libmemcached.la
124 libtest_unittest_LDADD+= libmemcached/libmemcachedutil.la
125 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcached.la
126 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcachedutil.la
127 else
128 if HAVE_LIBMEMCACHED
129 libtest_libtest_la_LIBADD+= $(libmemcached_LIBS)
130 libtest_libtest_la_SOURCES+= libtest/memcached.cc
131 else
132 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
133 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
134 endif
135 endif
136
137 if BUILDING_GEARMAN
138 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
139 libtest_libtest_la_LIBADD+= libgearman/libgearman.la
140 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
141 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
142 libtest_libtest_la_SOURCES+= util/instance.cc
143 libtest_libtest_la_SOURCES+= util/operation.cc
144 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBGEARMAN
145 libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BINARY="\"${abs_top_builddir}/gearmand/gearmand\""
146 libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BLOBSLAP_WORKER="\"${abs_top_builddir}/benchmark/blobslap_worker\""
147
148 libtest_unittest_CXXFLAGS+= -DHAVE_LIBGEARMAN
149 libtest_unittest_LDADD+= libgearman/libgearman.la
150 libtest_unittest_DEPENDENCIES+= libgearman/libgearman.la
151 else
152 if HAVE_LIBGEARMAN
153 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
154 libtest_libtest_la_LIBADD+= $(libgearman_LIBS)
155 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
156 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
157 libtest_libtest_la_SOURCES+= util/instance.cc
158 libtest_libtest_la_SOURCES+= util/operation.cc
159 else
160 libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BINARY=0
161 libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BLOBSLAP_WORKER=0
162 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBGEARMAN=0
163 libtest_unittest_CXXFLAGS+= -DGEARMAND_BINARY=0
164 libtest_unittest_CXXFLAGS+= -DHAVE_LIBGEARMAN=0
165 endif
166 endif
167
168 libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run
169
170 tmp_chroot:
171 @$(mkdir_p) tmp_chroot
172
173 tmp_chroot/var: tmp_chroot
174 @$(mkdir_p) tmp_chroot/var
175
176 tmp_chroot/var/log: tmp_chroot/var
177 @$(mkdir_p) tmp_chroot/var/log
178
179 tmp_chroot/var/tmp: tmp_chroot/var
180 @$(mkdir_p) tmp_chroot/var/tmp
181
182 tmp_chroot/var/run: tmp_chroot/var
183 @$(mkdir_p) tmp_chroot/var/run
184
185
186 libtest_unittest_CXXFLAGS+= ${AM_CXXFLAGS}
187 libtest_unittest_DEPENDENCIES+= libtest/libtest.la libtest_tmp_dir
188 libtest_unittest_LDADD+= libtest/libtest.la
189 libtest_unittest_SOURCES= libtest/unittest.cc
190 check_PROGRAMS+= libtest/unittest
191 noinst_PROGRAMS+= libtest/unittest
192 test-unittest: libtest/unittest
193 @libtest/unittest
194
195 valgrind-unittest: libtest/unittest
196 @$(VALGRIND_COMMAND) libtest/unittest
197
198 gdb-unittest: libtest/unittest
199 @$(GDB_COMMAND) libtest/unittest
200
201 helgrind-unittest: libtest/unittest
202 @$(HELGRIND_COMMAND) libtest/unittest
203
204 drd-unittest: libtest/unittest
205 @$(DRD_COMMAND) libtest/unittest
206
207 libtest_skiptest_LDADD= libtest/libtest.la
208 libtest_skiptest_SOURCES= libtest/skiptest.cc
209 check_PROGRAMS+= libtest/skiptest
210 noinst_PROGRAMS+= libtest/skiptest
211
212 libtest_wait_SOURCES= libtest/wait.cc
213 noinst_PROGRAMS+= libtest/wait