Support: quest -f cjk_ngram
[xapian.git] / xapian-core / tests / Makefile.am
blob50fa279b7c5c5d49bbe8f44476cfb9e3a515950b
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 CLEANFILES =
16 libxapian_la = libxapian@LIBRARY_VERSION_SUFFIX@.la
18 TESTS_ENVIRONMENT = ./runtest
20 .PHONY: check-none check-inmemory \
21         check-chert check-glass \
22         check-multi check-multi-chert check-multi-glass \
23         check-remote check-remoteprog check-remotetcp \
24         check-remoteprog-chert check-remoteprog-glass \
25         check-remotetcp-chert check-remotetcp-glass \
26         up remove-cached-databases
28 up:
29         cd .. && $(MAKE)
31 check-none: apitest$(EXEEXT) \
32             internaltest$(EXEEXT) \
33             stemtest$(EXEEXT) \
34             queryparsertest$(EXEEXT) \
35             termgentest$(EXEEXT) \
36             unittest$(EXEEXT)
37         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b none
38         $(TESTS_ENVIRONMENT) ./internaltest$(EXEEXT)
39         $(TESTS_ENVIRONMENT) ./stemtest$(EXEEXT)
40         $(TESTS_ENVIRONMENT) ./queryparsertest$(EXEEXT)
41         $(TESTS_ENVIRONMENT) ./termgentest$(EXEEXT)
42         $(TESTS_ENVIRONMENT) ./unittest$(EXEEXT)
44 check-inmemory: apitest$(EXEEXT)
45         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b inmemory
47 check-multi: apitest$(EXEEXT)
48         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b multi
50 check-singlefile: apitest$(EXEEXT)
51         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b singlefile
53 if BUILD_BACKEND_REMOTE
54 check-remote: check-remoteprog check-remotetcp
56 check-remoteprog: apitest$(EXEEXT)
57 ## If both chert and glass are enabled, just run remoteprog_chert.
58 if BUILD_BACKEND_CHERT
59         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remoteprog_chert
60 else
61         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remoteprog
62 endif
64 check-remotetcp: apitest$(EXEEXT)
65 ## If both chert and glass are enabled, just run remotetcp_glass.
66 if BUILD_BACKEND_GLASS
67         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remotetcp_glass
68 else
69         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remotetcp
70 endif
72 if BUILD_BACKEND_GLASS
73 check-remoteprog-glass: apitest$(EXEEXT)
74         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remoteprog_glass
75 check-remotetcp-glass: apitest$(EXEEXT)
76         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remotetcp_glass
77 endif
79 if BUILD_BACKEND_CHERT
80 check-remoteprog-chert: apitest$(EXEEXT)
81         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remoteprog_chert
82 check-remotetcp-chert: apitest$(EXEEXT)
83         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b remotetcp_chert
84 endif
85 endif
87 if BUILD_BACKEND_GLASS
88 check-multi-glass: apitest$(EXEEXT)
89         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b multi_glass
90 check-glass: apitest$(EXEEXT)
91         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b glass
92 check-singlefile-glass: apitest$(EXEEXT)
93         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b singlefile_glass
94 endif
96 if BUILD_BACKEND_CHERT
97 check-multi-chert: apitest$(EXEEXT)
98         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b multi_chert
99 check-chert: apitest$(EXEEXT)
100         $(TESTS_ENVIRONMENT) ./apitest$(EXEEXT) -b chert
101 endif
103 ## Test programs to be run
104 TESTS = apitest$(EXEEXT) internaltest$(EXEEXT) stemtest$(EXEEXT) \
105  queryparsertest$(EXEEXT) termgentest$(EXEEXT) unittest$(EXEEXT)
107 ## Programs to build
108 check_PROGRAMS = \
109         apitest internaltest stemtest queryparsertest termgentest unittest
111 # Make sure runtest is up to date before running tests
112 check_SCRIPTS = runtest
114 ## Sources:
116 noinst_HEADERS = apitest.h dbcheck.h
118 collated_apitest_sources = \
119  api_anydb.cc \
120  api_backend.cc \
121  api_closedb.cc \
122  api_collapse.cc \
123  api_compact.cc \
124  api_compactold.cc \
125  api_db.cc \
126  api_generated.cc \
127  api_geospatial.cc \
128  api_matchspy.cc \
129  api_metadata.cc \
130  api_nodb.cc \
131  api_none.cc \
132  api_opsynonym.cc \
133  api_opvalue.cc \
134  api_percentages.cc \
135  api_posdb.cc \
136  api_postingsource.cc \
137  api_qpbackend.cc \
138  api_query.cc \
139  api_replacedoc.cc \
140  api_replicate.cc \
141  api_scalability.cc \
142  api_serialise.cc \
143  api_snipper.cc \
144  api_sorting.cc \
145  api_spelling.cc \
146  api_stem.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 queryparsertest_SOURCES = queryparsertest.cc $(testharness_sources)
169 queryparsertest_LDFLAGS = $(NO_INSTALL) $(ldflags)
170 queryparsertest_LDADD = ../libgetopt.la ../$(libxapian_la)
172 termgentest_SOURCES = termgentest.cc $(testharness_sources)
173 termgentest_LDFLAGS = $(NO_INSTALL) $(ldflags)
174 termgentest_LDADD = ../libgetopt.la ../$(libxapian_la)
176 unittest_SOURCES = unittest.cc $(utestharness_sources)
177 unittest_LDFLAGS = $(NO_INSTALL) $(ldflags)
178 unittest_LDADD = ../libgetopt.la
180 BUILT_SOURCES =
182 if MAINTAINER_MODE
183 BUILT_SOURCES += api_all.h api_collated.h $(collated_apitest_sources:.cc=.h) \
184  api_generated.cc
186 api_all.h api_collated.h $(collated_apitest_sources:.cc=.h): api_collated.stamp
187 ## Recover from the removal of $@.  A full explanation of these rules is in the
188 ## automake manual under the heading "Multiple Outputs".
189         @if test -f $@; then :; else \
190           trap 'rm -rf api_collated.lock api_collated.stamp' 1 2 13 15; \
191           if mkdir api_collated.lock 2>/dev/null; then \
192             rm -f api_collated.stamp; \
193             $(MAKE) $(AM_MAKEFLAGS) api_collated.stamp; \
194             rmdir api_collated.lock; \
195           else \
196             while test -d api_collated.lock; do sleep 1; done; \
197             test -f api_collated.stamp; exit $$?; \
198           fi; \
199         fi
200 api_collated.stamp: $(collated_apitest_sources) collate-test Makefile.am
201         $(PERL) "$(srcdir)/collate-test" "$(srcdir)" api_collated.h api_all.h $(collated_apitest_sources)
202         touch $@
204 api_generated.cc: generate-api_generated
205         $(PERL) "$(srcdir)/generate-api_generated" > api_generated.ccT
206         mv api_generated.ccT api_generated.cc
207 endif
209 EXTRA_DIST = collate-test generate-api_generated api_all.h api_collated.h \
210         $(collated_apitest_sources:.cc=.h)
212 ## Distribute test data:
213 EXTRA_DIST +=\
214         runtest.in \
215         valgrind.supp \
216         testdata/apitest_onedoc.txt \
217         testdata/apitest_simpledata.txt \
218         testdata/apitest_simpledata2.txt \
219         testdata/apitest_termorder.txt \
220         testdata/apitest_rset.txt \
221         testdata/apitest_phrase.txt \
222         testdata/apitest_punc.txt \
223         testdata/apitest_space.txt \
224         testdata/apitest_allterms.txt \
225         testdata/apitest_allterms2.txt \
226         testdata/apitest_allterms4.txt \
227         testdata/apitest_poslist.txt \
228         testdata/apitest_manydocs.txt \
229         testdata/apitest_sortconsist.txt \
230         testdata/apitest_sortrel.txt \
231         testdata/apitest_declen.txt \
232         testdata/etext.txt
234 remove-cached-databases:
235         rm -rf .chert .glass .multichert .multiglass .replicatmp .singlefileglass .stub
237 clean-local: remove-cached-databases
239 # Remove the cached databases before "make check" to avoid issues with missing
240 # bugs in database creation when we reuse databases from a previous test run.
241 check: remove-cached-databases
243 include harness/Makefile.mk
244 include perftest/Makefile.mk
245 include soaktest/Makefile.mk
247 EXTRA_DIST += zlib-vg.c
248 if USE_ZLIB_VG
249 check_SCRIPTS += zlib-vg.so
250 CLEANFILES += zlib-vg.so
252 zlib-vg.so: zlib-vg.c
253         $(CC_FOR_BUILD) -fPIC -shared -o zlib-vg.so $(srcdir)/zlib-vg.c -ldl
254 endif
257 .PHONY: check-syntax
259 check-syntax:
260         $(CXXCOMPILE) -fsyntax-only -gstabs+ $(CHK_SOURCES)