Updating for 1.0.2 release
[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 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/binaries.h \
57 libtest/blobslap_worker.h \
58 libtest/callbacks.h \
59 libtest/cmdline.h \
60 libtest/collection.h \
61 libtest/common.h \
62 libtest/comparison.hpp \
63 libtest/core.h \
64 libtest/error.h \
65 libtest/failed.h \
66 libtest/framework.h \
67 libtest/gearmand.h \
68 libtest/get.h \
69 libtest/is_pid.hpp \
70 libtest/is_local.hpp \
71 libtest/killpid.h \
72 libtest/libtool.hpp \
73 libtest/memcached.h \
74 libtest/runner.h \
75 libtest/port.h \
76 libtest/server.h \
77 libtest/server_container.h \
78 libtest/signal.h \
79 libtest/socket.hpp \
80 libtest/stats.h \
81 libtest/stream.h \
82 libtest/strerror.h \
83 libtest/string.hpp \
84 libtest/test.h \
85 libtest/test.hpp \
86 libtest/visibility.h \
87 libtest/wait.h
88
89 noinst_LTLIBRARIES+= libtest/libtest.la
90 libtest_libtest_la_SOURCES= \
91 libtest/binaries.cc \
92 libtest/cmdline.cc \
93 libtest/core.cc \
94 libtest/framework.cc \
95 libtest/is_local.cc \
96 libtest/killpid.cc \
97 libtest/libtool.cc \
98 libtest/port.cc \
99 libtest/runner.cc \
100 libtest/server.cc \
101 libtest/server_container.cc \
102 libtest/signal.cc \
103 libtest/socket.cc \
104 libtest/strerror.cc \
105 libtest/test.cc
106
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
115
116 # Declare unittest so that we can append to it
117 libtest_unittest_CXXFLAGS=
118 libtest_unittest_LDADD=
119 libtest_unittest_DEPENDENCIES=
120
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
129
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
135 else
136 if HAVE_LIBMEMCACHED
137 libtest_libtest_la_LIBADD+= $(libmemcached_LIBS)
138 libtest_libtest_la_SOURCES+= libtest/memcached.cc
139 else
140 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
141 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
142 endif
143 endif
144
145 if BUILDING_GEARMAN
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\""
153
154 libtest_unittest_LDADD+= libgearman/libgearman.la
155 libtest_unittest_DEPENDENCIES+= libgearman/libgearman.la
156 else
157 if HAVE_LIBGEARMAN
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
165 else
166 libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BLOBSLAP_WORKER=0
167 endif
168 endif
169
170 libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run
171
172 tmp_chroot:
173 @$(mkdir_p) tmp_chroot
174
175 tmp_chroot/var: tmp_chroot
176 @$(mkdir_p) tmp_chroot/var
177
178 tmp_chroot/var/log: tmp_chroot/var
179 @$(mkdir_p) tmp_chroot/var/log
180
181 tmp_chroot/var/tmp: tmp_chroot/var
182 @$(mkdir_p) tmp_chroot/var/tmp
183
184 tmp_chroot/var/run: tmp_chroot/var
185 @$(mkdir_p) tmp_chroot/var/run
186
187
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
195 @libtest/unittest
196
197 valgrind-unittest: libtest/unittest
198 @$(VALGRIND_COMMAND) libtest/unittest
199
200 gdb-unittest: libtest/unittest
201 @$(GDB_COMMAND) libtest/unittest
202
203 helgrind-unittest: libtest/unittest
204 @$(HELGRIND_COMMAND) libtest/unittest
205
206 drd-unittest: libtest/unittest
207 @$(DRD_COMMAND) libtest/unittest
208
209 libtest_skiptest_LDADD= libtest/libtest.la
210 libtest_skiptest_SOURCES= libtest/skiptest.cc
211 check_PROGRAMS+= libtest/skiptest
212 noinst_PROGRAMS+= libtest/skiptest
213
214 libtest_wait_SOURCES= libtest/wait.cc
215 noinst_PROGRAMS+= libtest/wait