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_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
29 export LIBTOOL_COMMAND
30 export VALGRIND_COMMAND
31 export HELGRIND_COMMAND
36 @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_COMMAND)\""
39 @echo make check TESTS_ENVIRONMENT="\"$(HELGRIND_COMMAND)\""
42 @echo make check TESTS_ENVIRONMENT="\"$(DRD_COMMAND)\""
44 EXTRA_DIST+= libtest/run.gdb
47 tmp_chroot/var/log/* \
48 tmp_chroot/var/run/* \
51 .PHONY: distclean-libtest-check
52 distclean-libtest-check:
57 libtest/blobslap_worker.h \
60 libtest/collection.h \
62 libtest/comparison.hpp \
70 libtest/is_local.hpp \
77 libtest/server_container.h \
86 libtest/visibility.h \
89 noinst_LTLIBRARIES+= libtest/libtest.la
90 libtest_libtest_la_SOURCES= \
94 libtest/framework.cc \
101 libtest/server_container.cc \
104 libtest/strerror.cc \
107 libtest_libtest_la_CXXFLAGS= ${AM_CXXFLAGS}
108 libtest_libtest_la_CXXFLAGS+= ${NO_CONVERSION}
109 libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
110 libtest_libtest_la_CXXFLAGS+= $(PTHREAD_CFLAGS)
111 libtest_libtest_la_CXXFLAGS+= -DLIBTEST_TEMP="\"tmp_chroot\""
112 libtest_libtest_la_LIBADD=
113 libtest_libtest_la_LIBADD+= $(PTHREAD_LIBS)
114 libtest_libtest_la_DEPENDENCIES= libtest_tmp_dir
116 # Declare unittest so that we can append to it
117 libtest_unittest_CXXFLAGS=
118 libtest_unittest_LDADD=
119 libtest_unittest_DEPENDENCIES=
121 # We are either building in tree, or with
122 if BUILDING_LIBMEMCACHED
123 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcached.la
124 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcachedutil.la
125 libtest_libtest_la_LIBADD+= libmemcached/libmemcached.la
126 libtest_libtest_la_LIBADD+= libmemcached/libmemcachedutil.la
127 libtest_libtest_la_SOURCES+= libtest/memcached.cc
128 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED
130 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED
131 libtest_unittest_LDADD+= libmemcached/libmemcached.la
132 libtest_unittest_LDADD+= libmemcached/libmemcachedutil.la
133 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcached.la
134 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcachedutil.la
137 libtest_libtest_la_LIBADD+= $(libmemcached_LIBS)
138 libtest_libtest_la_SOURCES+= libtest/memcached.cc
140 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
141 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
146 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
147 libtest_libtest_la_LIBADD+= libgearman/libgearman.la
148 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
149 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
150 libtest_libtest_la_SOURCES+= util/instance.cc
151 libtest_libtest_la_SOURCES+= util/operation.cc
152 libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BLOBSLAP_WORKER="\"${abs_top_builddir}/benchmark/blobslap_worker\""
154 libtest_unittest_LDADD+= libgearman/libgearman.la
155 libtest_unittest_DEPENDENCIES+= libgearman/libgearman.la
158 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
159 libtest_libtest_la_LIBADD+= $(libgearman_LIBS)
160 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
161 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
162 libtest_libtest_la_SOURCES+= util/instance.cc
163 libtest_libtest_la_SOURCES+= util/operation.cc
164 libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BLOBSLAP_WORKER=0
166 libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BLOBSLAP_WORKER=0
170 libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run
173 @$(mkdir_p) tmp_chroot
175 tmp_chroot/var: tmp_chroot
176 @$(mkdir_p) tmp_chroot/var
178 tmp_chroot/var/log: tmp_chroot/var
179 @$(mkdir_p) tmp_chroot/var/log
181 tmp_chroot/var/tmp: tmp_chroot/var
182 @$(mkdir_p) tmp_chroot/var/tmp
184 tmp_chroot/var/run: tmp_chroot/var
185 @$(mkdir_p) tmp_chroot/var/run
188 libtest_unittest_CXXFLAGS+= ${AM_CXXFLAGS}
189 libtest_unittest_DEPENDENCIES+= libtest/libtest.la libtest_tmp_dir
190 libtest_unittest_LDADD+= libtest/libtest.la
191 libtest_unittest_SOURCES= libtest/unittest.cc
192 check_PROGRAMS+= libtest/unittest
193 noinst_PROGRAMS+= libtest/unittest
194 test-unittest: libtest/unittest
197 valgrind-unittest: libtest/unittest
198 @$(VALGRIND_COMMAND) libtest/unittest
200 gdb-unittest: libtest/unittest
201 @$(GDB_COMMAND) libtest/unittest
203 helgrind-unittest: libtest/unittest
204 @$(HELGRIND_COMMAND) libtest/unittest
206 drd-unittest: libtest/unittest
207 @$(DRD_COMMAND) libtest/unittest
209 libtest_skiptest_LDADD= libtest/libtest.la
210 libtest_skiptest_SOURCES= libtest/skiptest.cc
211 check_PROGRAMS+= libtest/skiptest
212 noinst_PROGRAMS+= libtest/skiptest
214 libtest_wait_SOURCES= libtest/wait.cc
215 noinst_PROGRAMS+= libtest/wait