Update for 1.4.20
[xapian.git] / xapian-core / tests / Makefile.am
blob80d1b0619ad9c6afa97cd0727ce11677880d189b
1 ## Process this file with automake to produce Makefile.in
3 AUTOMAKE_OPTIONS = 1.12.2 serial-tests subdir-objects
5 if MAINTAINER_MODE
6 # Export these so that we run the locally installed autotools when building
7 # from a bootstrapped git tree.
8 export ACLOCAL AUTOCONF AUTOHEADER AUTOM4TE AUTOMAKE
9 endif
11 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/common -I$(top_srcdir)/include \
12  -I$(top_builddir)/include -I$(srcdir)/harness
14 # If tests are run under valgrind and the test is killed at the wrong moment
15 # then a log file is left behind.
16 CLEANFILES = .valgrind.log.*
18 libxapian_la = libxapian@LIBRARY_VERSION_SUFFIX@.la
20 TESTS_ENVIRONMENT = ./runtest
22 .PHONY: check-none check-inmemory \
23         check-chert check-glass \
24         check-multi check-multi-chert check-multi-glass \
25         check-remote check-remoteprog check-remotetcp \
26         check-remoteprog-chert check-remoteprog-glass \
27         check-remotetcp-chert check-remotetcp-glass \
28         up remove-cached-databases
30 up:
31         cd .. && $(MAKE)
33 check-none: apitest$(EXEEXT) \
34             internaltest$(EXEEXT) \
35             stemtest$(EXEEXT) \
36             unittest$(EXEEXT)
37         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b none
38         $(TESTS_ENVIRONMENT) ./internaltest$(EXEEXT)
39         $(TESTS_ENVIRONMENT) ./stemtest$(EXEEXT)
40         $(TESTS_ENVIRONMENT) ./unittest$(EXEEXT)
42 check-inmemory: apitest$(EXEEXT)
43         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b inmemory
45 check-multi: apitest$(EXEEXT)
46         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b multi
48 check-singlefile: apitest$(EXEEXT)
49         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b singlefile
51 if BUILD_BACKEND_REMOTE
52 check-remote: check-remoteprog check-remotetcp
54 check-remoteprog: apitest$(EXEEXT)
55 ## If both chert and glass are enabled, just run remoteprog_chert.
56 if BUILD_BACKEND_CHERT
57         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remoteprog_chert
58 else
59         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remoteprog
60 endif
62 check-remotetcp: apitest$(EXEEXT)
63 ## If both chert and glass are enabled, just run remotetcp_glass.
64 if BUILD_BACKEND_GLASS
65         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remotetcp_glass
66 else
67         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remotetcp
68 endif
70 if BUILD_BACKEND_GLASS
71 check-remoteprog-glass: apitest$(EXEEXT)
72         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remoteprog_glass
73 check-remotetcp-glass: apitest$(EXEEXT)
74         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remotetcp_glass
75 endif
77 if BUILD_BACKEND_CHERT
78 check-remoteprog-chert: apitest$(EXEEXT)
79         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remoteprog_chert
80 check-remotetcp-chert: apitest$(EXEEXT)
81         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remotetcp_chert
82 endif
83 endif
85 if BUILD_BACKEND_GLASS
86 check-multi-glass: apitest$(EXEEXT)
87         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b multi_glass
88 check-glass: apitest$(EXEEXT)
89         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b glass
90 check-singlefile-glass: apitest$(EXEEXT)
91         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b singlefile_glass
92 endif
94 if BUILD_BACKEND_CHERT
95 check-multi-chert: apitest$(EXEEXT)
96         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b multi_chert
97 check-chert: apitest$(EXEEXT)
98         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b chert
99 endif
101 ## Test programs to be run
102 TESTS = apitest$(EXEEXT) internaltest$(EXEEXT) stemtest$(EXEEXT) \
103  unittest$(EXEEXT)
105 ## Programs to build
106 check_PROGRAMS = \
107         apitest internaltest stemtest unittest
109 # Make sure runtest is up to date before running tests
110 check_SCRIPTS = runtest
112 ## Sources:
114 noinst_HEADERS = apitest.h dbcheck.h
116 collated_apitest_sources = \
117  api_anydb.cc \
118  api_backend.cc \
119  api_closedb.cc \
120  api_collapse.cc \
121  api_compact.cc \
122  api_compactold.cc \
123  api_db.cc \
124  api_generated.cc \
125  api_geospatial.cc \
126  api_matchspy.cc \
127  api_metadata.cc \
128  api_nodb.cc \
129  api_none.cc \
130  api_opsynonym.cc \
131  api_opvalue.cc \
132  api_percentages.cc \
133  api_posdb.cc \
134  api_postingsource.cc \
135  api_qpbackend.cc \
136  api_query.cc \
137  api_queryparser.cc \
138  api_replacedoc.cc \
139  api_replicate.cc \
140  api_scalability.cc \
141  api_serialise.cc \
142  api_snippets.cc \
143  api_sorting.cc \
144  api_spelling.cc \
145  api_stem.cc \
146  api_termgen.cc \
147  api_transdb.cc \
148  api_unicode.cc \
149  api_valuestats.cc \
150  api_valuestream.cc \
151  api_weight.cc \
152  api_wrdb.cc
154 apitest_SOURCES = apitest.cc dbcheck.cc $(collated_apitest_sources) \
155  api_all.h api_collated.h $(testharness_sources)
157 apitest_LDFLAGS = $(NO_INSTALL) $(ldflags)
158 apitest_LDADD = ../libgetopt.la ../$(libxapian_la)
160 stemtest_SOURCES = stemtest.cc $(testharness_sources)
161 stemtest_LDFLAGS = $(NO_INSTALL) $(ldflags)
162 stemtest_LDADD = ../libgetopt.la ../$(libxapian_la)
164 internaltest_SOURCES = internaltest.cc $(testharness_sources)
165 internaltest_LDFLAGS = $(NO_INSTALL) $(ldflags)
166 internaltest_LDADD = ../libgetopt.la ../$(libxapian_la)
168 unittest_SOURCES = unittest.cc $(utestharness_sources)
169 unittest_LDFLAGS = $(NO_INSTALL) $(ldflags)
170 unittest_LDADD = ../libgetopt.la $(XAPIAN_LIBS)
172 BUILT_SOURCES =
174 if MAINTAINER_MODE
175 BUILT_SOURCES += api_all.h api_collated.h $(collated_apitest_sources:.cc=.h) \
176  api_collated.stamp api_generated.cc
178 api_all.h api_collated.h $(collated_apitest_sources:.cc=.h): api_collated.stamp
179 ## Recover from the removal of $@.  A full explanation of these rules is in the
180 ## automake manual under the heading "Multiple Outputs".
181         @if test -f $@; then :; else \
182           trap 'rm -rf api_collated.lock api_collated.stamp' 1 2 13 15; \
183           if mkdir api_collated.lock 2>/dev/null; then \
184             rm -f api_collated.stamp; \
185             $(MAKE) $(AM_MAKEFLAGS) api_collated.stamp; \
186             rmdir api_collated.lock; \
187           else \
188             while test -d api_collated.lock; do sleep 1; done; \
189             test -f api_collated.stamp; exit $$?; \
190           fi; \
191         fi
192 api_collated.stamp: $(collated_apitest_sources) collate-test Makefile.am
193         $(PERL) "$(srcdir)/collate-test" "$(srcdir)" api_collated.h api_all.h $(collated_apitest_sources)
194         touch $@
196 api_generated.cc: generate-api_generated
197         $(PERL) "$(srcdir)/generate-api_generated" > api_generated.ccT
198         mv api_generated.ccT api_generated.cc
199 endif
201 EXTRA_DIST = collate-test generate-api_generated api_all.h api_collated.h \
202         $(collated_apitest_sources:.cc=.h) api_collated.stamp
204 ## Distribute test data:
205 EXTRA_DIST +=\
206         runtest.in \
207         valgrind.supp \
208         testdata/apitest_onedoc.txt \
209         testdata/apitest_simpledata.txt \
210         testdata/apitest_simpledata2.txt \
211         testdata/apitest_termorder.txt \
212         testdata/apitest_rset.txt \
213         testdata/apitest_phrase.txt \
214         testdata/apitest_punc.txt \
215         testdata/apitest_space.txt \
216         testdata/apitest_allterms.txt \
217         testdata/apitest_allterms2.txt \
218         testdata/apitest_allterms4.txt \
219         testdata/apitest_poslist.txt \
220         testdata/apitest_manydocs.txt \
221         testdata/apitest_sortconsist.txt \
222         testdata/apitest_sortrel.txt \
223         testdata/apitest_declen.txt \
224         testdata/etext.txt \
225         testdata/phraseweightcheckbug1.txt \
226         testdata/snippet.txt
228 remove-cached-databases:
229         rm -rf .chert .glass .multichert .multiglass \
230                .multiglassremoteprog_glass .multiremoteprog_glass \
231                .replicatmp .singlefileglass .stub
233 clean-local: remove-cached-databases
235 # Remove the cached databases before "make check" to avoid issues with missing
236 # bugs in database creation when we reuse databases from a previous test run.
237 check: remove-cached-databases
239 include harness/Makefile.mk
240 include perftest/Makefile.mk
241 include soaktest/Makefile.mk
243 EXTRA_DIST += zlib-vg.c
244 if USE_ZLIB_VG
245 check_SCRIPTS += zlib-vg.so
246 CLEANFILES += zlib-vg.so
248 zlib-vg.so: zlib-vg.c
249         $(CC) -fPIC -shared -o zlib-vg.so $(srcdir)/zlib-vg.c -ldl
250 endif
252 .PHONY: check-syntax
254 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
256 check-syntax:
257         $(CXXCOMPILE) -fsyntax-only -gstabs+ $(CHK_SOURCES)