2 # Copyright (C) 2011 Data Differential, http://datadifferential.com/
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.
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.
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
19 # included from Top Level Makefile.am
20 # All paths should be given relative to the root
23 LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute
24 VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
25 VALGRIND_COMMAND= TESTS_ENVIRONMENT="valgrind" $(VALGRIND_EXEC_COMMAND)
26 HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 --read-var-info=yes
27 DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd
28 GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x libtest/run.gdb
29 PTRCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-ptrcheck --error-exitcode=1
31 export LIBTOOL_COMMAND
32 export VALGRIND_COMMAND
33 export HELGRIND_COMMAND
38 @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_EXEC_COMMAND)\""
41 @echo make check TESTS_ENVIRONMENT="\"$(GDB_COMMAND)\""
44 @echo make check TESTS_ENVIRONMENT="\"$(HELGRIND_COMMAND)\""
47 @echo make check TESTS_ENVIRONMENT="\"$(DRD_COMMAND)\""
49 EXTRA_DIST+= libtest/run.gdb
52 tmp_chroot/var/drizzle/* \
53 tmp_chroot/var/log/* \
54 tmp_chroot/var/run/* \
57 .PHONY: distclean-libtest-check
58 distclean-libtest-check:
64 libtest/blobslap_worker.h \
67 libtest/collection.h \
69 libtest/comparison.hpp \
82 libtest/is_local.hpp \
89 libtest/server_container.h \
100 libtest/visibility.h \
103 noinst_LTLIBRARIES+= libtest/libtest.la
105 libtest_libtest_la_CXXFLAGS=
106 libtest_libtest_la_DEPENDENCIES=
107 libtest_libtest_la_LIBADD=
108 libtest_libtest_la_SOURCES=
110 libtest_libtest_la_SOURCES+= libtest/binaries.cc
111 libtest_libtest_la_SOURCES+= libtest/cmdline.cc
112 libtest_libtest_la_SOURCES+= libtest/comparison.cc
113 libtest_libtest_la_SOURCES+= libtest/core.cc
114 libtest_libtest_la_SOURCES+= libtest/cpu.cc
115 libtest_libtest_la_SOURCES+= libtest/dream.cc
116 libtest_libtest_la_SOURCES+= libtest/fatal.cc
117 libtest_libtest_la_SOURCES+= libtest/framework.cc
118 libtest_libtest_la_SOURCES+= libtest/has.cc
119 libtest_libtest_la_SOURCES+= libtest/drizzled.cc
120 libtest_libtest_la_SOURCES+= libtest/http.cc
121 libtest_libtest_la_SOURCES+= libtest/is_local.cc
122 libtest_libtest_la_SOURCES+= libtest/killpid.cc
123 libtest_libtest_la_SOURCES+= libtest/libtool.cc
124 libtest_libtest_la_SOURCES+= libtest/main.cc
125 libtest_libtest_la_SOURCES+= libtest/port.cc
126 libtest_libtest_la_SOURCES+= libtest/runner.cc
127 libtest_libtest_la_SOURCES+= libtest/server.cc
128 libtest_libtest_la_SOURCES+= libtest/server_container.cc
129 libtest_libtest_la_SOURCES+= libtest/signal.cc
130 libtest_libtest_la_SOURCES+= libtest/socket.cc
131 libtest_libtest_la_SOURCES+= libtest/strerror.cc
132 libtest_libtest_la_SOURCES+= libtest/tmpfile.cc
133 libtest_libtest_la_SOURCES+= libtest/vchar.cc
135 libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
136 libtest_libtest_la_CXXFLAGS+= $(PTHREAD_CFLAGS)
137 libtest_libtest_la_CXXFLAGS+= -DLIBTEST_TEMP="\"tmp_chroot\""
138 libtest_libtest_la_CXXFLAGS+= $(CURL_CFLAGS)
140 libtest_libtest_la_LIBADD+= $(PTHREAD_LIBS)
141 libtest_libtest_la_LIBADD+= $(CURL_LIBS)
143 libtest_libtest_la_DEPENDENCIES+= libtest_tmp_dir
144 libtest_libtest_la_DEPENDENCIES+=libtest/abort
145 libtest_libtest_la_DEPENDENCIES+=libtest/wait
147 # Declare unittest so that we can append to it
148 libtest_unittest_CXXFLAGS=
149 libtest_unittest_LDADD=
150 libtest_unittest_DEPENDENCIES=
152 # We are either building in tree, or with
153 if BUILDING_LIBMEMCACHED
154 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcached.la
155 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcachedutil.la
156 libtest_libtest_la_LIBADD+= libmemcached/libmemcached.la
157 libtest_libtest_la_LIBADD+= libmemcached/libmemcachedutil.la
158 libtest_libtest_la_SOURCES+= libtest/memcached.cc
159 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED
161 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED
162 libtest_unittest_LDADD+= libmemcached/libmemcached.la
163 libtest_unittest_LDADD+= libmemcached/libmemcachedutil.la
164 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcached.la
165 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcachedutil.la
168 libtest_libtest_la_LIBADD+= $(libmemcached_LIBS)
169 libtest_libtest_la_SOURCES+= libtest/memcached.cc
171 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
172 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
178 libtest_libtest_la_LIBADD+= $(libdrizzle_LIBS)
179 libtest_libtest_la_CXXFLAGS+= $(libdrizzle_CFLAGS)
184 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
185 libtest_libtest_la_LIBADD+= libgearman/libgearman.la
186 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
187 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
188 libtest_libtest_la_SOURCES+= util/instance.cc
189 libtest_libtest_la_SOURCES+= util/operation.cc
191 libtest_unittest_LDADD+= libgearman/libgearman.la
192 libtest_unittest_DEPENDENCIES+= libgearman/libgearman.la
193 libtest_unittest_DEPENDENCIES+= gearmand/gearmand
196 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
197 libtest_libtest_la_LIBADD+= $(libgearman_LIBS)
198 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
199 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
200 libtest_libtest_la_SOURCES+= util/instance.cc
201 libtest_libtest_la_SOURCES+= util/operation.cc
205 libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run tmp_chroot/var/drizzle
208 @$(mkdir_p) tmp_chroot
210 tmp_chroot/var: tmp_chroot
211 @$(mkdir_p) tmp_chroot/var
213 tmp_chroot/var/log: tmp_chroot/var
214 @$(mkdir_p) tmp_chroot/var/log
216 tmp_chroot/var/tmp: tmp_chroot/var
217 @$(mkdir_p) tmp_chroot/var/tmp
219 tmp_chroot/var/drizzle: tmp_chroot/var
220 @$(mkdir_p) tmp_chroot/var/drizzle
222 tmp_chroot/var/run: tmp_chroot/var
223 @$(mkdir_p) tmp_chroot/var/run
226 libtest_unittest_DEPENDENCIES+= libtest/libtest.la
227 libtest_unittest_LDADD+= libtest/libtest.la
228 libtest_unittest_SOURCES= libtest/unittest.cc
229 check_PROGRAMS+= libtest/unittest
230 noinst_PROGRAMS+= libtest/unittest
231 test-unittest: libtest/unittest
234 valgrind-unittest: libtest/unittest
235 @$(VALGRIND_COMMAND) libtest/unittest TESTS_ENVIRONMENT="valgrind"
237 gdb-unittest: libtest/unittest
238 @$(GDB_COMMAND) libtest/unittest
240 helgrind-unittest: libtest/unittest
241 @$(HELGRIND_COMMAND) libtest/unittest
243 drd-unittest: libtest/unittest
244 @$(DRD_COMMAND) libtest/unittest
246 libtest_skiptest_LDADD= libtest/libtest.la
247 libtest_skiptest_SOURCES= libtest/skiptest.cc
248 check_PROGRAMS+= libtest/skiptest
249 noinst_PROGRAMS+= libtest/skiptest
251 libtest_wait_SOURCES=
252 libtest_wait_SOURCES+= libtest/wait.cc
253 libtest_wait_SOURCES+= libtest/dream.cc
254 noinst_PROGRAMS+= libtest/wait
256 libtest_abort_SOURCES= libtest/abort.cc
257 noinst_PROGRAMS+= libtest/abort