Merge from build
[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 --read-var-info=yes
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 gdb:
39 @echo make check TESTS_ENVIRONMENT="\"$(GDB_COMMAND)\""
40
41 helgrind:
42 @echo make check TESTS_ENVIRONMENT="\"$(HELGRIND_COMMAND)\""
43
44 drd:
45 @echo make check TESTS_ENVIRONMENT="\"$(DRD_COMMAND)\""
46
47 EXTRA_DIST+= libtest/run.gdb
48
49 CLEANFILES+= \
50 tmp_chroot/var/log/* \
51 tmp_chroot/var/run/* \
52 tmp_chroot/var/tmp/*
53
54 .PHONY: distclean-libtest-check
55 distclean-libtest-check:
56 -rm -rf tmp_chroot
57
58 noinst_HEADERS+= \
59 libtest/binaries.h \
60 libtest/blobslap_worker.h \
61 libtest/callbacks.h \
62 libtest/cmdline.h \
63 libtest/collection.h \
64 libtest/common.h \
65 libtest/comparison.hpp \
66 libtest/core.h \
67 libtest/dream.h \
68 libtest/error.h \
69 libtest/failed.h \
70 libtest/framework.h \
71 libtest/gearmand.h \
72 libtest/get.h \
73 libtest/has.hpp \
74 libtest/http.hpp \
75 libtest/is_pid.hpp \
76 libtest/is_local.hpp \
77 libtest/killpid.h \
78 libtest/libtool.hpp \
79 libtest/memcached.h \
80 libtest/runner.h \
81 libtest/port.h \
82 libtest/server.h \
83 libtest/server_container.h \
84 libtest/signal.h \
85 libtest/socket.hpp \
86 libtest/stats.h \
87 libtest/stream.h \
88 libtest/strerror.h \
89 libtest/string.hpp \
90 libtest/test.h \
91 libtest/test.hpp \
92 libtest/vchar.hpp \
93 libtest/visibility.h \
94 libtest/wait.h
95
96 noinst_LTLIBRARIES+= libtest/libtest.la
97 libtest_libtest_la_SOURCES= \
98 libtest/binaries.cc \
99 libtest/cmdline.cc \
100 libtest/core.cc \
101 libtest/dream.cc \
102 libtest/framework.cc \
103 libtest/has.cc \
104 libtest/http.cc \
105 libtest/is_local.cc \
106 libtest/killpid.cc \
107 libtest/libtool.cc \
108 libtest/port.cc \
109 libtest/runner.cc \
110 libtest/server.cc \
111 libtest/server_container.cc \
112 libtest/signal.cc \
113 libtest/socket.cc \
114 libtest/strerror.cc \
115 libtest/test.cc \
116 libtest/vchar.cc
117
118 libtest_libtest_la_CXXFLAGS=
119 libtest_libtest_la_CXXFLAGS+= ${NO_CONVERSION}
120 libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
121 libtest_libtest_la_CXXFLAGS+= $(PTHREAD_CFLAGS)
122 libtest_libtest_la_CXXFLAGS+= -DLIBTEST_TEMP="\"tmp_chroot\""
123 libtest_libtest_la_CXXFLAGS+= $(CURL_CFLAGS)
124 libtest_libtest_la_LIBADD=
125 libtest_libtest_la_LIBADD+= $(PTHREAD_LIBS)
126 libtest_libtest_la_LIBADD+= $(CURL_LIBS)
127 libtest_libtest_la_DEPENDENCIES= libtest_tmp_dir
128
129 # Declare unittest so that we can append to it
130 libtest_unittest_CXXFLAGS=
131 libtest_unittest_LDADD=
132 libtest_unittest_DEPENDENCIES=
133
134 # We are either building in tree, or with
135 if BUILDING_LIBMEMCACHED
136 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcached.la
137 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcachedutil.la
138 libtest_libtest_la_LIBADD+= libmemcached/libmemcached.la
139 libtest_libtest_la_LIBADD+= libmemcached/libmemcachedutil.la
140 libtest_libtest_la_SOURCES+= libtest/memcached.cc
141 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED
142
143 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED
144 libtest_unittest_LDADD+= libmemcached/libmemcached.la
145 libtest_unittest_LDADD+= libmemcached/libmemcachedutil.la
146 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcached.la
147 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcachedutil.la
148 else
149 if HAVE_LIBMEMCACHED
150 libtest_libtest_la_LIBADD+= $(libmemcached_LIBS)
151 libtest_libtest_la_SOURCES+= libtest/memcached.cc
152 else
153 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
154 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
155 endif
156 endif
157
158 if BUILDING_GEARMAN
159 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
160 libtest_libtest_la_LIBADD+= libgearman/libgearman.la
161 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
162 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
163 libtest_libtest_la_SOURCES+= util/instance.cc
164 libtest_libtest_la_SOURCES+= util/operation.cc
165
166 libtest_unittest_LDADD+= libgearman/libgearman.la
167 libtest_unittest_DEPENDENCIES+= libgearman/libgearman.la
168 libtest_unittest_DEPENDENCIES+= gearmand/gearmand
169 else
170 if HAVE_LIBGEARMAN
171 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
172 libtest_libtest_la_LIBADD+= $(libgearman_LIBS)
173 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
174 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
175 libtest_libtest_la_SOURCES+= util/instance.cc
176 libtest_libtest_la_SOURCES+= util/operation.cc
177 endif
178 endif
179
180 libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run
181
182 tmp_chroot:
183 @$(mkdir_p) tmp_chroot
184
185 tmp_chroot/var: tmp_chroot
186 @$(mkdir_p) tmp_chroot/var
187
188 tmp_chroot/var/log: tmp_chroot/var
189 @$(mkdir_p) tmp_chroot/var/log
190
191 tmp_chroot/var/tmp: tmp_chroot/var
192 @$(mkdir_p) tmp_chroot/var/tmp
193
194 tmp_chroot/var/run: tmp_chroot/var
195 @$(mkdir_p) tmp_chroot/var/run
196
197
198 libtest_unittest_DEPENDENCIES+= libtest/libtest.la libtest_tmp_dir
199 libtest_unittest_LDADD+= libtest/libtest.la
200 libtest_unittest_SOURCES= libtest/unittest.cc
201 check_PROGRAMS+= libtest/unittest
202 noinst_PROGRAMS+= libtest/unittest
203 test-unittest: libtest/unittest
204 @libtest/unittest
205
206 valgrind-unittest: libtest/unittest
207 @$(VALGRIND_COMMAND) libtest/unittest
208
209 gdb-unittest: libtest/unittest
210 @$(GDB_COMMAND) libtest/unittest
211
212 helgrind-unittest: libtest/unittest
213 @$(HELGRIND_COMMAND) libtest/unittest
214
215 drd-unittest: libtest/unittest
216 @$(DRD_COMMAND) libtest/unittest
217
218 libtest_skiptest_LDADD= libtest/libtest.la
219 libtest_skiptest_SOURCES= libtest/skiptest.cc
220 check_PROGRAMS+= libtest/skiptest
221 noinst_PROGRAMS+= libtest/skiptest
222
223 libtest_wait_SOURCES= libtest/wait.cc
224 noinst_PROGRAMS+= libtest/wait