• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Process this file with automake to produce Makefile.in
2
3ACLOCAL_AMFLAGS = -I m4
4
5SUBDIRS = include . doc example fuzz xstc $(PYTHON_SUBDIR)
6
7DIST_SUBDIRS = include . doc example fuzz python xstc
8
9AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include
10
11AM_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)
12
13check_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
14               testThreads testC14N testAutomata testRegexp \
15               testReader testapi testModule runtest runsuite testchar \
16	       testdict runxmlconf testrecurse testlimits
17
18bin_PROGRAMS = xmllint xmlcatalog
19
20bin_SCRIPTS=xml2-config
21
22lib_LTLIBRARIES = libxml2.la
23libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
24
25if USE_VERSION_SCRIPT
26LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
27else
28LIBXML2_VERSION_SCRIPT =
29endif
30
31libxml2_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) \
32		     $(LIBXML2_VERSION_SCRIPT) \
33		     -version-info $(LIBXML_VERSION_INFO) \
34		     $(MODULE_PLATFORM_LIBS)
35
36if WITH_SAX1_SOURCES
37docb_sources = DOCBparser.c
38else
39docb_sources =
40endif
41
42if WITH_TRIO_SOURCES
43trio_sources = triostr.c trio.c
44else
45trio_sources =
46endif
47
48libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c  \
49		parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c  \
50		valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c  \
51		xpointer.c xinclude.c nanohttp.c nanoftp.c \
52		$(docb_sources) \
53		catalog.c globals.c threads.c c14n.c xmlstring.c buf.c \
54		xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
55		$(trio_sources) \
56		xmlreader.c relaxng.c dict.c SAX2.c \
57		xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \
58		xmlmodule.c schematron.c xzlib.c
59
60DEPS = $(top_builddir)/libxml2.la
61LDADDS = $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
62
63
64man_MANS = xml2-config.1 libxml.3
65
66m4datadir = $(datadir)/aclocal
67m4data_DATA = libxml.m4
68
69runtest_SOURCES=runtest.c
70runtest_LDFLAGS =
71runtest_DEPENDENCIES = $(DEPS)
72runtest_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
73
74testrecurse_SOURCES=testrecurse.c
75testrecurse_LDFLAGS =
76testrecurse_DEPENDENCIES = $(DEPS)
77testrecurse_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
78
79testlimits_SOURCES=testlimits.c
80testlimits_LDFLAGS =
81testlimits_DEPENDENCIES = $(DEPS)
82testlimits_LDADD= $(BASE_THREAD_LIBS) $(RDL_LIBS) $(LDADDS)
83
84testchar_SOURCES=testchar.c
85testchar_LDFLAGS =
86testchar_DEPENDENCIES = $(DEPS)
87testchar_LDADD= $(RDL_LIBS) $(LDADDS)
88
89testdict_SOURCES=testdict.c
90testdict_LDFLAGS =
91testdict_DEPENDENCIES = $(DEPS)
92testdict_LDADD= $(RDL_LIBS) $(LDADDS)
93
94runsuite_SOURCES=runsuite.c
95runsuite_LDFLAGS =
96runsuite_DEPENDENCIES = $(DEPS)
97runsuite_LDADD= $(RDL_LIBS) $(LDADDS)
98
99xmllint_SOURCES=xmllint.c
100xmllint_LDFLAGS =
101xmllint_DEPENDENCIES = $(DEPS)
102xmllint_LDADD=  $(RDL_LIBS) $(LDADDS)
103
104testSAX_SOURCES=testSAX.c
105testSAX_LDFLAGS =
106testSAX_DEPENDENCIES = $(DEPS)
107testSAX_LDADD= $(LDADDS)
108
109testHTML_SOURCES=testHTML.c
110testHTML_LDFLAGS =
111testHTML_DEPENDENCIES = $(DEPS)
112testHTML_LDADD= $(LDADDS)
113
114xmlcatalog_SOURCES=xmlcatalog.c
115xmlcatalog_LDFLAGS =
116xmlcatalog_DEPENDENCIES = $(DEPS)
117xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS)
118
119testXPath_SOURCES=testXPath.c
120testXPath_LDFLAGS =
121testXPath_DEPENDENCIES = $(DEPS)
122testXPath_LDADD= $(LDADDS)
123
124testC14N_SOURCES=testC14N.c
125testC14N_LDFLAGS =
126testC14N_DEPENDENCIES = $(DEPS)
127testC14N_LDADD= $(LDADDS)
128
129testThreads_SOURCES = testThreads.c
130testThreads_LDFLAGS =
131testThreads_DEPENDENCIES = $(DEPS)
132testThreads_LDADD= $(BASE_THREAD_LIBS) $(LDADDS)
133
134testURI_SOURCES=testURI.c
135testURI_LDFLAGS =
136testURI_DEPENDENCIES = $(DEPS)
137testURI_LDADD= $(LDADDS)
138
139testRegexp_SOURCES=testRegexp.c
140testRegexp_LDFLAGS =
141testRegexp_DEPENDENCIES = $(DEPS)
142testRegexp_LDADD= $(LDADDS)
143
144testAutomata_SOURCES=testAutomata.c
145testAutomata_LDFLAGS =
146testAutomata_DEPENDENCIES = $(DEPS)
147testAutomata_LDADD= $(LDADDS)
148
149testSchemas_SOURCES=testSchemas.c
150testSchemas_LDFLAGS =
151testSchemas_DEPENDENCIES = $(DEPS)
152testSchemas_LDADD= $(LDADDS)
153
154testRelax_SOURCES=testRelax.c
155testRelax_LDFLAGS =
156testRelax_DEPENDENCIES = $(DEPS)
157testRelax_LDADD= $(LDADDS)
158
159testReader_SOURCES=testReader.c
160testReader_LDFLAGS =
161testReader_DEPENDENCIES = $(DEPS)
162testReader_LDADD= $(LDADDS)
163
164testModule_SOURCES=testModule.c
165testModule_LDFLAGS =
166testModule_DEPENDENCIES = $(DEPS)
167testModule_LDADD= $(LDADDS)
168
169noinst_LTLIBRARIES = testdso.la
170testdso_la_SOURCES = testdso.c
171testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
172
173# that one forces the rebuild when "make rebuild" is run on doc/
174rebuild_testapi:
175	-@(if [ "$(PYTHON)" != "" ] ; then \
176	    $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
177
178# that one is just to make sure it is rebuilt if missing
179# but adding the dependances generate mess
180testapi.c: $(srcdir)/gentest.py
181	-@(if [ "$(PYTHON)" != "" ] ; then \
182	    $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
183
184BUILT_SOURCES = testapi.c
185
186testapi_SOURCES=testapi.c
187testapi_LDFLAGS =
188testapi_DEPENDENCIES = $(DEPS)
189testapi_LDADD= $(LDADDS)
190
191runxmlconf_SOURCES=runxmlconf.c
192runxmlconf_LDFLAGS =
193runxmlconf_DEPENDENCIES = $(DEPS)
194runxmlconf_LDADD= $(LDADDS)
195
196#testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c
197#testOOM_LDFLAGS =
198#testOOM_DEPENDENCIES = $(DEPS)
199#testOOM_LDADD= $(LDADDS)
200
201runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
202          testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
203	[ -d test   ] || $(LN_S) $(srcdir)/test   .
204	[ -d result ] || $(LN_S) $(srcdir)/result .
205	$(CHECKER) ./runtest$(EXEEXT) && \
206	    $(CHECKER) ./testrecurse$(EXEEXT) && \
207	    ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) ./testapi$(EXEEXT) && \
208	    $(CHECKER) ./testchar$(EXEEXT) && \
209	    $(CHECKER) ./testdict$(EXEEXT) && \
210	    $(CHECKER) ./runxmlconf$(EXEEXT)
211	@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
212	    $(MAKE) tests ; fi)
213	@cd fuzz; $(MAKE) tests
214
215check: all runtests
216
217check-valgrind valgrind: all
218	@echo '## Running the regression tests under Valgrind'
219	@echo '## Go get a cup of coffee it is gonna take a while ...'
220	$(MAKE) CHECKER='valgrind -q' runtests
221
222asan:
223	@echo '## rebuilding for ASAN'
224	./configure CFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" CXXFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" LDFLAGS="-fsanitize=address,undefined" CC="clang" CXX="clang++" --disable-shared ; OptimOff  ; $(MAKE) clean ; $(MAKE)
225
226testall : tests SVGtests SAXtests
227
228tests: XMLtests XMLenttests NStests IDtests Errtests APItests $(READER_TEST) $(TEST_SAX) $(TEST_PUSH) $(TEST_HTML) $(TEST_PHTML) $(TEST_VALID) URItests $(TEST_PATTERN) $(TEST_XPATH) $(TEST_XPTR) $(TEST_XINCLUDE) $(TEST_C14N) $(TEST_DEBUG) $(TEST_CATALOG) $(TEST_REGEXPS) $(TEST_SCHEMAS) $(TEST_SCHEMATRON) $(TEST_THREADS) Timingtests $(TEST_VTIME) $(PYTHON_TESTS) $(TEST_MODULES)
229	@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
230	    $(MAKE) -s tests ; fi)
231	@(cd doc/examples ; $(MAKE) -s tests)
232
233APItests: testapi$(EXEEXT)
234	@echo "## Running the API regression tests this may take a little while"
235	-@(ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) $(top_builddir)/testapi -q)
236
237HTMLtests : testHTML$(EXEEXT)
238	@(echo > .memdump)
239	@echo "## HTML regression tests"
240	-@(for i in $(srcdir)/test/HTML/* ; do \
241	  name=`basename $$i`; \
242	  if [ ! -d $$i ] ; then \
243	  if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
244	      echo New test file $$name ; \
245	      $(CHECKER) $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
246	  else \
247	      log=`$(CHECKER) $(top_builddir)/testHTML $$i > result.$$name 2> error.$$name ; \
248	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
249	      diff $(srcdir)/result/HTML/$$name result.$$name ; \
250	      diff -b $(srcdir)/result/HTML/$$name.err error.$$name ; \
251	      $(CHECKER) $(top_builddir)/testHTML result.$$name > result2.$$name 2>error.$$name ; \
252	      diff result.$$name result2.$$name` ; \
253	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
254	      rm result.$$name result2.$$name error.$$name ; \
255	  fi ; fi ; done)
256
257HTMLPushtests : testHTML$(EXEEXT)
258	@echo "## Push HTML regression tests"
259	-@(for i in $(srcdir)/test/HTML/* ; do \
260	  name=`basename $$i`; \
261	  if [ ! -d $$i ] ; then \
262	  if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
263	      echo New test file $$name ; \
264	      $(CHECKER) $(top_builddir)/testHTML --push $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
265	  else \
266	      log=`$(CHECKER) $(top_builddir)/testHTML --push $$i > result.$$name 2> error.$$name ; \
267	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
268	      diff $(srcdir)/result/HTML/$$name result.$$name ; \
269	      cut -b 1-15 $(srcdir)/result/HTML/$$name.err > errorcut.$$name; \
270	      cut -b 1-15 error.$$name > errorcut2.$$name; \
271	      diff -b errorcut.$$name errorcut2.$$name ; \
272	      $(CHECKER) $(top_builddir)/testHTML --push result.$$name > result2.$$name 2>error.$$name ; \
273	      diff result.$$name result2.$$name` ; \
274	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
275	      rm result.$$name result2.$$name error.$$name errorcut.$$name errorcut2.$$name ; \
276	  fi ; fi ; done)
277	@echo "## HTML SAX regression tests"
278	-@(for i in $(srcdir)/test/HTML/* ; do \
279	  name=`basename $$i`; \
280	  if [ ! -d $$i ] ; then \
281	  if [ ! -f $(srcdir)/result/HTML/$$name.sax ] ; then \
282	      echo New test file $$name ; \
283	      $(CHECKER) $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
284	  else \
285	      log=`$(CHECKER) $(top_builddir)/testHTML --sax $$i > result.$$name.sax ; \
286	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
287	      diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \
288	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
289	      rm result.$$name.sax ; \
290	  fi ; fi ; done)
291	@echo "## Push HTML SAX regression tests"
292	-@(for i in $(srcdir)/test/HTML/* ; do \
293	  name=`basename $$i`; \
294	  if [ ! -d $$i ] ; then \
295	  if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
296	      echo New test file $$name ; \
297	      $(CHECKER) $(top_builddir)/testHTML --push --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
298	  else \
299	      log=`$(CHECKER) $(top_builddir)/testHTML --push --sax $$i 2>&1 > result.$$name.sax ; \
300	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
301	      diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \
302	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
303	      rm result.$$name.sax ; \
304	  fi ; fi ; done)
305
306XMLtests : xmllint$(EXEEXT)
307	@(echo > .memdump)
308	@echo "## XML regression tests"
309	-@(for i in $(srcdir)/test/* ; do \
310	  name=`basename $$i`; \
311	  if [ ! -d $$i ] ; then \
312	  if [ ! -f $(srcdir)/result/$$name ] ; then \
313	      echo New test file $$name ; \
314	      $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/$$name ; \
315	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
316	  else \
317	      log=`$(CHECKER) $(top_builddir)/xmllint $$i 2>&1 > result.$$name ; \
318	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
319	      diff $(srcdir)/result/$$name result.$$name ; \
320	      $(CHECKER) $(top_builddir)/xmllint result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
321	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
322	      diff result.$$name result2.$$name` ;\
323	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
324	      rm result.$$name result2.$$name ; \
325	  fi ; fi ; done)
326	@echo "## XML regression tests on memory"
327	-@(for i in $(srcdir)/test/* ; do \
328	  name=`basename $$i`; \
329	  if [ ! -d $$i ] ; then \
330	  if [ ! -f $(srcdir)/result/$$name ] ; then \
331	      echo New test file $$name ; \
332	      $(CHECKER) $(top_builddir)/xmllint --memory $$i > $(srcdir)/result/$$name ; \
333	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
334	  else \
335	      log=`$(CHECKER) $(top_builddir)/xmllint --memory $$i 2>&1 > result.$$name ; \
336	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
337	      diff $(srcdir)/result/$$name result.$$name ; \
338	      $(CHECKER) $(top_builddir)/xmllint --memory result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
339	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"`; \
340	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
341	      diff result.$$name result2.$$name ; \
342	      rm result.$$name result2.$$name ; \
343	  fi ; fi ; done)
344
345XMLPushtests: xmllint$(EXEEXT)
346	@(echo > .memdump)
347	@echo "## XML push regression tests"
348	-@(for i in $(srcdir)/test/* ; do \
349	  name=`basename $$i`; \
350	  if [ ! -d $$i ] ; then \
351	  if [ ! -f $(srcdir)/result/$$name ] ; then \
352	      echo New test file $$name ; \
353	      $(CHECKER) $(top_builddir)/xmllint --push $$i > $(srcdir)/result/$$name ; \
354	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
355	  else \
356	      log=`$(CHECKER) $(top_builddir)/xmllint --push $$i 2>&1 > result.$$name ; \
357	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
358	      diff $(srcdir)/result/$$name result.$$name ; \
359	      $(CHECKER) $(top_builddir)/xmllint --push result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
360	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
361	      diff result.$$name result2.$$name` ; \
362	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
363	      rm result.$$name result2.$$name ; \
364	  fi ; fi ; done)
365
366NStests : xmllint$(EXEEXT)
367	@(echo > .memdump)
368	@echo "## XML Namespaces regression tests"
369	-@(for i in $(srcdir)/test/namespaces/* ; do \
370	  name=`basename $$i`; \
371	  if [ ! -d $$i ] ; then \
372	  if [ ! -f $(srcdir)/result/namespaces/$$name ] ; then \
373	      echo New test file $$name ; \
374	      $(CHECKER) $(top_builddir)/xmllint $$i \
375	         2> $(srcdir)/result/namespaces/$$name.err \
376		 > $(srcdir)/result/namespaces/$$name ; \
377	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
378	  else \
379	      log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \
380	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
381	      diff $(srcdir)/result/namespaces/$$name result.$$name ; \
382	      diff $(srcdir)/result/namespaces/$$name.err error.$$name`; \
383	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
384	      rm result.$$name error.$$name ; \
385	  fi ; fi ; done)
386
387IDtests : xmllint$(EXEEXT) testXPath$(EXEEXT)
388	@(echo > .memdump)
389	@echo "## xml:id regression tests"
390	-@(for i in $(srcdir)/test/xmlid/id_*.xml ; do \
391	  name=`basename $$i`; \
392	  if [ ! -d $$i ] ; then \
393	  if [ ! -f $(srcdir)/result/xmlid/$$name ] ; then \
394	      echo New test file $$name ; \
395	      $(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" \
396	         2> $(srcdir)/result/xmlid/$$name.err \
397		 > $(srcdir)/result/xmlid/$$name ; \
398	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
399	  else \
400	      log=`$(CHECKER) $(top_builddir)/testXPath -i $$i "id('bar')" 2> error.$$name > result.$$name ; \
401	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
402	      diff $(srcdir)/result/xmlid/$$name result.$$name ; \
403	      diff $(srcdir)/result/xmlid/$$name.err error.$$name` ; \
404	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
405	      rm result.$$name error.$$name ; \
406	  fi ; fi ; done)
407
408Errtests : xmllint$(EXEEXT)
409	@(echo > .memdump)
410	@echo "## Error cases regression tests"
411	-@(for i in $(srcdir)/test/errors/*.xml ; do \
412	  name=`basename $$i`; \
413	  if [ ! -d $$i ] ; then \
414	  if [ ! -f $(srcdir)/result/errors/$$name ] ; then \
415	      echo New test file $$name ; \
416	      $(CHECKER) $(top_builddir)/xmllint $$i \
417	         2> $(srcdir)/result/errors/$$name.err \
418		 > $(srcdir)/result/errors/$$name ; \
419	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
420	  else \
421	      log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \
422	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
423	      diff $(srcdir)/result/errors/$$name result.$$name ; \
424	      diff $(srcdir)/result/errors/$$name.err error.$$name` ; \
425	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
426	      rm result.$$name error.$$name ; \
427	  fi ; fi ; done)
428	@echo "## Error cases regression tests (old 1.0)"
429	-@(for i in $(srcdir)/test/errors10/*.xml ; do \
430	  name=`basename $$i`; \
431	  if [ ! -d $$i ] ; then \
432	  if [ ! -f $(srcdir)/result/errors10/$$name ] ; then \
433	      echo New test file $$name ; \
434	      $(CHECKER) $(top_builddir)/xmllint --oldxml10 $$i \
435	         2> $(srcdir)/result/errors10/$$name.err \
436		 > $(srcdir)/result/errors10/$$name ; \
437	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
438	  else \
439	      log=`$(CHECKER) $(top_builddir)/xmllint --oldxml10 $$i 2> error.$$name > result.$$name ; \
440	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
441	      diff $(srcdir)/result/errors10/$$name result.$$name ; \
442	      diff $(srcdir)/result/errors10/$$name.err error.$$name` ; \
443	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
444	      rm result.$$name error.$$name ; \
445	  fi ; fi ; done)
446	@echo "## Error cases stream regression tests"
447	-@(for i in $(srcdir)/test/errors/*.xml ; do \
448	  name=`basename $$i`; \
449	  if [ ! -d $$i ] ; then \
450	  if [ ! -f $(srcdir)/result/errors/$$name.str ] ; then \
451	      echo New test file $$name ; \
452	      $(CHECKER) $(top_builddir)/xmllint --stream $$i \
453	         2> $(srcdir)/result/errors/$$name.str \
454		 > /dev/null ; \
455	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
456	  else \
457	      log=`$(CHECKER) $(top_builddir)/xmllint --stream $$i 2> error.$$name > /dev/null ; \
458	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
459	      diff $(srcdir)/result/errors/$$name.str error.$$name` ; \
460	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
461	      rm error.$$name ; \
462	  fi ; fi ; done)
463
464Docbtests : xmllint$(EXEEXT)
465
466XMLenttests : xmllint$(EXEEXT)
467	@(echo > .memdump)
468	@echo "## XML entity subst regression tests"
469	-@(for i in $(srcdir)/test/* ; do \
470	  name=`basename $$i`; \
471	  if [ ! -d $$i ] ; then \
472	  if [ ! -f $(srcdir)/result/noent/$$name ] ; then \
473	      echo New test file $$name ; \
474	      $(CHECKER) $(top_builddir)/xmllint --noent $$i > $(srcdir)/result/noent/$$name ; \
475	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
476	  else \
477	      log=`$(CHECKER) $(top_builddir)/xmllint --noent $$i 2>&1 > result.$$name ; \
478	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
479	      diff $(srcdir)/result/noent/$$name result.$$name ; \
480	      $(CHECKER) $(top_builddir)/xmllint --noent result.$$name 2>&1 > result2.$$name ; \
481	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
482	      diff result.$$name result2.$$name` ; \
483	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
484	      rm result.$$name result2.$$name ; \
485	  fi ; fi ; done)
486
487URItests : testURI$(EXEEXT)
488	@(echo > .memdump)
489	@echo "## URI module regression tests"
490	-@(for i in $(srcdir)/test/URI/*.data ; do \
491	  name=`basename $$i`; \
492	  if [ ! -d $$i ] ; then \
493	  if [ ! -f $(srcdir)/result/URI/$$name ] ; then \
494	      echo New test file $$name ; \
495	      $(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i > $(srcdir)/result/URI/$$name ; \
496	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
497	  else \
498	      log=`$(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i 2>&1 > result.$$name ; \
499	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
500	      diff $(srcdir)/result/URI/$$name result.$$name` ; \
501	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
502	      rm result.$$name ; \
503	  fi ; fi ; done)
504	-@(for i in $(srcdir)/test/URI/*.uri ; do \
505	  name=`basename $$i`; \
506	  if [ ! -d $$i ] ; then \
507	  if [ ! -f $(srcdir)/result/URI/$$name ] ; then \
508	      echo New test file $$name ; \
509	      $(CHECKER) $(top_builddir)/testURI < $$i > $(srcdir)/result/URI/$$name ; \
510	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
511	  else \
512	      log=`$(CHECKER) $(top_builddir)/testURI < $$i 2>&1 > result.$$name ; \
513	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
514	      diff $(srcdir)/result/URI/$$name result.$$name` ; \
515	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
516	      rm result.$$name ; \
517	  fi ; fi ; done)
518
519XPathtests : testXPath$(EXEEXT)
520	@(echo > .memdump)
521	@echo "## XPath regression tests"
522	-@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \
523	  then echo Skipping debug not compiled in ; exit 0 ; fi ; \
524	  for i in $(srcdir)/test/XPath/expr/* ; do \
525	  name=`basename $$i`; \
526	  if [ ! -d $$i ] ; then \
527	  if [ ! -f $(srcdir)/result/XPath/expr/$$name ] ; then \
528	      echo New test file $$name ; \
529	      $(CHECKER) $(top_builddir)/testXPath -f --expr $$i > $(srcdir)/result/XPath/expr/$$name 2> /dev/null ; \
530	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
531	  else \
532	      log=`$(CHECKER) $(top_builddir)/testXPath -f --expr $$i > result.$$name 2> /dev/null ; \
533	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
534	      diff $(srcdir)/result/XPath/expr/$$name result.$$name` ; \
535	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
536	      rm result.$$name ; \
537	  fi ; fi ; done ; \
538	  for i in $(srcdir)/test/XPath/docs/* ; do \
539	  if [ ! -d $$i ] ; then \
540	  doc=`basename $$i`; \
541	  for j in $(srcdir)/test/XPath/tests/$$doc* ; do \
542	  if [ ! -f $$j ] ; then continue ; fi ; \
543	  name=`basename $$j`; \
544	  if [ ! -d $$j ] ; then \
545	  if [ ! -f $(srcdir)/result/XPath/tests/$$name ] ; then \
546	      echo New test file $$name ; \
547	      $(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > $(srcdir)/result/XPath/tests/$$name ; \
548	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
549	  else \
550	      log=`$(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > result.$$name ; \
551	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
552	      diff $(srcdir)/result/XPath/tests/$$name result.$$name` ; \
553	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
554	      rm result.$$name ; \
555	  fi ; fi ; done ; fi ; done)
556
557XPtrtests : testXPath$(EXEEXT)
558	@(echo > .memdump)
559	@echo "## XPointer regression tests"
560	-@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \
561	  then echo Skipping debug not compiled in ; exit 0 ; fi ; \
562	  for i in $(srcdir)/test/XPath/docs/* ; do \
563	  if [ ! -d $$i ] ; then \
564	  doc=`basename $$i`; \
565	  for j in $(srcdir)/test/XPath/xptr/$$doc* ; do \
566	  if [ ! -f $$j ] ; then continue ; fi ; \
567	  name=`basename $$j`; \
568	  if [ ! -d $$j ] ; then \
569	  if [ ! -f $(srcdir)/result/XPath/xptr/$$name ] ; then \
570	      echo New test file $$name ; \
571	      $(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > $(srcdir)/result/XPath/xptr/$$name 2> /dev/null ; \
572	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
573	  else \
574	      log=`$(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > result.$$name 2> /dev/null ; \
575	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
576	      diff $(srcdir)/result/XPath/xptr/$$name result.$$name` ; \
577	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
578	      rm result.$$name ; \
579	  fi ; fi ; done ; fi ; done)
580
581XIncludetests : xmllint$(EXEEXT)
582	@(echo > .memdump)
583	@echo "## XInclude regression tests"
584	-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
585	  name=`basename $$i`; \
586	  if [ ! -d $$i ] ; then \
587	  if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \
588	      echo New test file $$name ; \
589	      $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \
590	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
591	  else \
592	      log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > result.$$name 2>error.$$name ; \
593	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
594	      diff $(srcdir)/result/XInclude/$$name result.$$name ; \
595	      diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \
596	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
597	      rm result.$$name error.$$name ; \
598	  fi ; fi ; done)
599	-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
600	  name=`basename $$i`; \
601	  if [ ! -d $$i ] ; then \
602	  if [ ! -f $(srcdir)/result/XInclude/$$name ] ; then \
603	      echo New test file $$name ; \
604	      $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > $(srcdir)/result/XInclude/$$name 2> $(srcdir)/result/XInclude/$$name.err ; \
605	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
606	  else \
607	      log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode $$i > result.$$name 2>error.$$name ; \
608	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
609	      diff $(srcdir)/result/XInclude/$$name result.$$name ; \
610	      diff $(srcdir)/result/XInclude/$$name.err error.$$name` ; \
611	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
612	      rm result.$$name error.$$name ; \
613	  fi ; fi ; done)
614	@(echo > .memdump)
615	@echo "## XInclude xmlReader regression tests"
616	-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
617	  name=`basename $$i`; \
618	  if [ ! -d $$i ] ; then \
619	  if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \
620	      echo New test file $$name ; \
621	      $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \
622	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
623	  else \
624	      log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \
625	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
626	      diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \
627	      diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \
628	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
629	      rm result.$$name error.$$name ; \
630	  fi ; fi ; done)
631	-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
632	  name=`basename $$i`; \
633	  if [ ! -d $$i ] ; then \
634	  if [ ! -f $(srcdir)/result/XInclude/$$name.rdr ] ; then \
635	      echo New test file $$name ; \
636	      $(CHECKER) $(top_builddir)/xmllint --nowarning --noxincludenode --stream --debug $$i > $(srcdir)/result/XInclude/$$name.rdr ; \
637	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
638	  else \
639	      log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude --stream --debug $$i > result.$$name 2>error.$$name ; \
640	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
641	      diff $(srcdir)/result/XInclude/$$name.err error.$$name ; \
642	      diff $(srcdir)/result/XInclude/$$name.rdr result.$$name` ; \
643	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
644	      rm result.$$name error.$$name ; \
645	  fi ; fi ; done)
646
647Scripttests : xmllint$(EXEEXT)
648	@(echo > .memdump)
649	@echo "## Scripts regression tests"
650	@echo "## Some of the base computations may be different if srcdir != ."
651	-@(for i in $(srcdir)/test/scripts/*.script ; do \
652	  name=`basename $$i .script`; \
653	  xml=$(srcdir)/test/scripts/`basename $$i .script`.xml; \
654	  if [ -f $$xml ] ; then \
655	  if [ ! -f $(srcdir)/result/scripts/$$name ] ; then \
656	      echo New test file $$name ; \
657	      $(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > $(srcdir)/result/scripts/$$name 2> $(srcdir)/result/scripts/$$name.err ; \
658	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
659	  else \
660	      log=`$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > result.$$name 2> result.$$name.err ; \
661	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
662	      diff $(srcdir)/result/scripts/$$name result.$$name ; \
663	      diff $(srcdir)/result/scripts/$$name.err result.$$name.err` ; \
664	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
665	      rm result.$$name result.$$name.err ; \
666	  fi ; fi ; done)
667
668Catatests : xmlcatalog$(EXEEXT)
669	@(echo > .memdump)
670	@echo "## Catalog regression tests"
671	-@(for i in $(srcdir)/test/catalogs/*.script ; do \
672	  name=`basename $$i .script`; \
673	  xml=$(srcdir)/test/catalogs/`basename $$i .script`.xml; \
674	  if [ -f $$xml ] ; then \
675	  if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \
676	      echo New test file $$name ; \
677	      $(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > $(srcdir)/result/catalogs/$$name ; \
678	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
679	  else \
680	      log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > result.$$name ; \
681	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
682	      diff $(srcdir)/result/catalogs/$$name result.$$name` ; \
683	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
684	      rm result.$$name ; \
685	  fi ; fi ; done)
686	-@(for i in $(srcdir)/test/catalogs/*.script ; do \
687	  name=`basename $$i .script`; \
688	  sgml=$(srcdir)/test/catalogs/`basename $$i .script`.sgml; \
689	  if [ -f $$sgml ] ; then \
690	  if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \
691	      echo New test file $$name ; \
692	      $(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > $(srcdir)/result/catalogs/$$name ; \
693	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
694	  else \
695	      log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > result.$$name ; \
696	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
697	      diff $(srcdir)/result/catalogs/$$name result.$$name` ; \
698	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
699	      rm result.$$name ; \
700	  fi ; fi ; done)
701	@echo "## Add and del operations on XML Catalogs"
702	-@($(CHECKER) $(top_builddir)/xmlcatalog --create --noout $(srcdir)/result/catalogs/mycatalog; \
703	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
704	$(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid sysid $(srcdir)/result/catalogs/mycatalog; \
705	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
706	$(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid2 sysid2 $(srcdir)/result/catalogs/mycatalog; \
707	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
708	$(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid3 sysid3 $(srcdir)/result/catalogs/mycatalog; \
709	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
710	diff result/catalogs/mycatalog.full $(srcdir)/result/catalogs/mycatalog; \
711	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
712	$(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid $(srcdir)/result/catalogs/mycatalog; \
713	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
714	$(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid3 $(srcdir)/result/catalogs/mycatalog; \
715	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
716	$(CHECKER) $(top_builddir)/xmlcatalog --noout --del sysid2 $(srcdir)/result/catalogs/mycatalog; \
717	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
718	diff result/catalogs/mycatalog.empty $(srcdir)/result/catalogs/mycatalog; \
719	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
720	rm -f $(srcdir)/result/catalogs/mycatalog)
721
722SVGtests : xmllint$(EXEEXT)
723	@echo "## SVG parsing regression tests"
724	-@(for i in $(srcdir)/test/SVG/* ; do \
725	  name=`basename $$i`; \
726	  if [ ! -d $$i ] ; then \
727	  if [ ! -f $(srcdir)/result/SVG/$$name ] ; then \
728	      echo New test file $$name ; \
729	      $(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/SVG/$$name ; \
730	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
731	  else \
732	      echo Testing $$name ; \
733	      $(CHECKER) $(top_builddir)/xmllint $$i > result.$$name ; \
734	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
735	      diff $(srcdir)/result/SVG/$$name result.$$name ; \
736	      $(CHECKER) $(top_builddir)/xmllint result.$$name > result2.$$name ; \
737	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
738	      diff result.$$name result2.$$name ; \
739	      rm result.$$name result2.$$name ; \
740	  fi ; fi ; done)
741
742Threadtests : testThreads$(EXEEXT)
743	@echo "## Threaded regression tests"
744	-@($(CHECKER) $(top_builddir)/testThreads ; \
745	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
746	   exit 0)
747
748Readertests : xmllint$(EXEEXT)
749	@(echo > .memdump)
750	@echo "## Reader regression tests"
751	-@(for i in $(srcdir)/test/* ; do \
752	  name=`basename $$i`; \
753	  if [ ! -d $$i ] ; then \
754	  if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
755	      echo New test file $$name ; \
756	      $(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
757	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
758	  else \
759	      log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
760	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
761	      diff $(srcdir)/result/$$name.rdr result.$$name` ; \
762	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
763	      rm result.$$name ; \
764	  fi ; fi ; done)
765	@echo "## Reader on memory regression tests"
766	-@(for i in $(srcdir)/test/* ; do \
767	  name=`basename $$i`; \
768	  if [ ! -d $$i ] ; then \
769	  if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
770	      echo New test file $$name ; \
771	      $(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
772	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
773	  else \
774	      log=`$(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
775	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
776	      diff $(srcdir)/result/$$name.rdr result.$$name` ; \
777	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
778	      rm result.$$name ; \
779	  fi ; fi ; done)
780	@(echo > .memdump)
781	@echo "## Walker regression tests"
782	-@(for i in $(srcdir)/test/* ; do \
783	  name=`basename $$i`; \
784	  if [ ! -d $$i ] ; then \
785	  if [ ! -f $(srcdir)/result/$$name.rdr ] ; then \
786	      echo New test file $$name ; \
787	      $(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
788	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
789	  else \
790	      log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --walker $$i > result.$$name 2>/dev/null ; \
791	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
792	      diff $(srcdir)/result/$$name.rdr result.$$name` ; \
793	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
794	      rm result.$$name ; \
795	  fi ; fi ; done)
796	@echo "## Reader entities substitution regression tests"
797	-@(for i in $(srcdir)/test/* ; do \
798	  name=`basename $$i`; \
799	  if [ ! -d $$i ] ; then \
800	  if [ ! -f $(srcdir)/result/$$name.rde ] ; then \
801	      echo New test file $$name ; \
802	      $(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > $(srcdir)/result/$$name.rde 2>/dev/null ; \
803	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
804	  else \
805	      log=`$(CHECKER) $(top_builddir)/xmllint --noent --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
806	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
807	      diff $(srcdir)/result/$$name.rde result.$$name` ; \
808	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
809	      rm result.$$name ; \
810	  fi ; fi ; done)
811
812SAXtests : testSAX$(EXEEXT)
813	@(echo > .memdump)
814	@echo "## SAX1 callbacks regression tests"
815	-@(for i in $(srcdir)/test/* ; do \
816	  name=`basename $$i`; \
817	  if [ ! -d $$i ] ; then \
818	  if [ ! -f $(srcdir)/result/$$name.sax ] ; then \
819	      echo New test file $$name ; \
820	      $(CHECKER) $(top_builddir)/testSAX $$i > $(srcdir)/result/$$name.sax 2> /dev/null ; \
821	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
822	  else \
823	      log=`$(CHECKER) $(top_builddir)/testSAX $$i > result.$$name 2> /dev/null ; \
824	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
825	      diff $(srcdir)/result/$$name.sax result.$$name` ; \
826	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
827	      rm result.$$name ; \
828	  fi ; fi ; done)
829	@echo "## SAX2 callbacks regression tests"
830	-@(for i in $(srcdir)/test/* ; do \
831	  name=`basename $$i`; \
832	  if [ ! -d $$i ] ; then \
833	  if [ ! -f $(srcdir)/result/$$name.sax2 ] ; then \
834	      echo New test file $$name ; \
835	      $(CHECKER) $(top_builddir)/testSAX --sax2 $$i > $(srcdir)/result/$$name.sax2 2> /dev/null ; \
836	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
837	  else \
838	      log=`$(CHECKER) $(top_builddir)/testSAX --sax2 $$i > result.$$name 2> /dev/null ; \
839	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
840	      diff $(srcdir)/result/$$name.sax2 result.$$name` ; \
841	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
842	      rm result.$$name ; \
843	  fi ; fi ; done)
844	@echo "## SAX2 callbacks regression tests with entity substitution"
845	-@(for i in $(srcdir)/test/* ; do \
846	  name=`basename $$i`; \
847	  if [ ! -d $$i ] ; then \
848	  if [ ! -f $(srcdir)/result/noent/$$name.sax2 ] ; then \
849	      echo New test file $$name ; \
850	      $(CHECKER) $(top_builddir)/testSAX --sax2 --noent $$i > $(srcdir)/result/noent/$$name.sax2 2> /dev/null ; \
851	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
852	  else \
853	      log=`$(CHECKER) $(top_builddir)/testSAX --sax2 --noent $$i > result.$$name 2> /dev/null ; \
854	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
855	      diff $(srcdir)/result/noent/$$name.sax2 result.$$name` ; \
856	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
857	      rm result.$$name ; \
858	  fi ; fi ; done)
859
860Validtests : xmllint$(EXEEXT)
861	@(echo > .memdump)
862	@echo "## Valid documents regression tests"
863	-@(for i in $(srcdir)/test/VCM/* ; do \
864	  name=`basename $$i`; \
865	  if [ ! -d $$i ] ; then \
866	      log=`$(CHECKER) $(top_builddir)/xmllint --valid --noout --nowarning $$i ; \
867	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"`;\
868	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
869	  fi ; done ; exit 0)
870	@echo "## Validity checking regression tests"
871	-@(for i in $(srcdir)/test/VC/* ; do \
872	  name=`basename $$i`; \
873	  if [ ! -d $$i ] ; then \
874	  if [ ! -f $(srcdir)/result/VC/$$name ] ; then \
875	      echo New test file $$name ; \
876	      $(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> $(srcdir)/result/VC/$$name ; \
877	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
878	  else \
879	      log=`$(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> result.$$name ; \
880	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
881	      diff $(srcdir)/result/VC/$$name result.$$name` ; \
882	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
883	      rm result.$$name ; \
884	  fi ; fi ; done)
885	@echo "## General documents valid regression tests"
886	-@(for i in $(srcdir)/test/valid/* ; do \
887	  name=`basename $$i`; \
888	  if [ ! -d $$i ] ; then \
889	  if [ ! -f $(srcdir)/result/valid/$$name ] ; then \
890	      echo New test file $$name ; \
891	      $(CHECKER) $(top_builddir)/xmllint --valid $$i > $(srcdir)/result/valid/$$name 2>$(srcdir)/result/valid/$$name.err ; \
892	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
893	  else \
894	      log=`$(CHECKER) $(top_builddir)/xmllint --valid $$i > result.$$name 2>error.$$name ; \
895	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
896	      diff $(srcdir)/result/valid/$$name result.$$name ; \
897	      diff $(srcdir)/result/valid/$$name.err error.$$name` ; \
898	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
899	      rm result.$$name error.$$name ; \
900	  fi ; fi ; done)
901
902Regexptests: testRegexp$(EXEEXT)
903	@(echo > .memdump)
904	@echo "## Regexp regression tests"
905	-@(for i in $(srcdir)/test/regexp/* ; do \
906	  name=`basename $$i`; \
907	  if [ ! -d $$i ] ; then \
908	  if [ ! -f $(srcdir)/result/regexp/$$name ] ; then \
909	      echo New test file $$name ; \
910	      $(CHECKER) $(top_builddir)/testRegexp -i $$i > $(srcdir)/result/regexp/$$name 2> $(srcdir)/result/regexp/$$name.err ; \
911	      if [ ! -s "$(srcdir)/result/regexp/$$name.err" ] ; then rm $(srcdir)/result/regexp/$$name.err; fi ; \
912	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
913	  else \
914	      log=`$(CHECKER) $(top_builddir)/testRegexp -i $$i > result.$$name 2> error.$$name ; \
915	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
916	      diff $(srcdir)/result/regexp/$$name result.$$name ; \
917	      if [ -s "$(srcdir)/result/regexp/$$name.err" -o -s "error.$$name" ] ; then diff $(srcdir)/result/regexp/$$name.err error.$$name ; fi` ; \
918	      if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
919	      rm result.$$name error.$$name ; \
920	  fi ; fi ; done)
921
922# Disabled for now
923Exptests: testRegexp$(EXEEXT)
924	@echo "## Formal expressions regression tests"
925	-@(for i in $(srcdir)/test/expr/* ; do \
926	  name=`basename $$i`; \
927	  if [ ! -d $$i ] ; then \
928	  if [ ! -f $(srcdir)/result/expr/$$name ] ; then \
929	      echo New test file $$name ; \
930	      $(CHECKER) $(top_builddir)/testRegexp --expr -i $$i > $(srcdir)/result/expr/$$name; \
931	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
932	  else \
933	      log=`$(CHECKER) $(top_builddir)/testRegexp --expr -i $$i 2>&1 > result.$$name ; \
934	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
935	      diff $(srcdir)/result/expr/$$name result.$$name` ; \
936	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
937	      rm result.$$name ; \
938	  fi ; fi ; done)
939
940Automatatests: testAutomata$(EXEEXT)
941	@(echo > .memdump)
942	@echo "## Automata regression tests"
943	-@(for i in $(srcdir)/test/automata/* ; do \
944	  name=`basename $$i`; \
945	  if [ ! -d $$i ] ; then \
946	  if [ ! -f $(srcdir)/result/automata/$$name ] ; then \
947	      echo New test file $$name ; \
948	      $(CHECKER) $(top_builddir)/testAutomata $$i > $(srcdir)/result/automata/$$name; \
949	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
950	  else \
951	      log=`$(CHECKER) $(top_builddir)/testAutomata $$i 2>&1 > result.$$name ; \
952	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
953	      diff $(srcdir)/result/automata/$$name result.$$name` ; \
954	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
955	      rm result.$$name ; \
956	  fi ; fi ; done)
957
958dba100000.xml: dbgenattr.pl
959	@echo "## generating dba100000.xml"
960	@($(PERL) $(top_srcdir)/dbgenattr.pl 100000 > dba100000.xml)
961
962Timingtests: xmllint$(EXEEXT) dba100000.xml
963	@echo "## Timing tests to try to detect performance"
964	@echo "## as well a memory usage breakage when streaming"
965	@echo "## 1/ using the file interface"
966	@echo "## 2/ using the memory interface"
967	@echo "## 3/ repeated DOM parsing"
968	@echo "## 4/ repeated DOM validation"
969	-@($(top_builddir)/xmllint --stream --timing dba100000.xml; \
970	   MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
971	   if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
972	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
973	   exit 0)
974	-@($(top_builddir)/xmllint --stream --timing --memory dba100000.xml; \
975	   MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
976	   if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
977	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
978	   exit 0)
979	-@($(top_builddir)/xmllint --noout --timing --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \
980	   MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
981	   if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
982	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
983	   exit 0)
984
985VTimingtests: xmllint$(EXEEXT)
986	-@($(top_builddir)/xmllint --noout --timing --valid --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \
987	   MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
988	   if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
989	   grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
990	   exit 0)
991
992C14Ntests : testC14N$(EXEEXT)
993	@echo "## C14N and XPath regression tests"
994	-@(for m in with-comments without-comments 1-1-without-comments exc-without-comments ; do \
995	    for i in $(srcdir)/test/c14n/$$m/*.xml ; do  \
996		if [ ! -d $$i ] ; then \
997		    name=`basename $$i .xml`; \
998		    cmdline="$(CHECKER) $(top_builddir)/testC14N --$$m $$i"; \
999		    if [ -f $(srcdir)/test/c14n/$$m/$$name.xpath ] ; then \
1000			cmdline="$$cmdline $(srcdir)/test/c14n/$$m/$$name.xpath"; \
1001			if [ -f $(srcdir)/test/c14n/$$m/$$name.ns ] ; then \
1002			    cmdline="$$cmdline '`cat $(srcdir)/test/c14n/$$m/$$name.ns`'"; \
1003			fi; \
1004		    fi; \
1005		    $$cmdline > $(srcdir)/test/c14n/test.tmp 2> /dev/null; \
1006		    if [ $$? -eq 0 ]; then \
1007			diff  $(srcdir)/result/c14n/$$m/$$name $(srcdir)/test/c14n/test.tmp; \
1008			if [ $$? -ne 0 ]; then \
1009			    echo "Test $$m/$$name failed"; \
1010			    cat $(srcdir)/test/c14n/test.tmp; \
1011			fi; \
1012		    else \
1013			echo "C14N failed"; \
1014		    fi; \
1015		    grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1016		fi; \
1017		rm -f $(srcdir)/test/c14n/test.tmp; \
1018	    done; \
1019	done)
1020
1021Schemastests: testSchemas$(EXEEXT)
1022	@(echo > .memdump)
1023	@echo "## Schemas regression tests"
1024	-@(for i in $(srcdir)/test/schemas/*_*.xsd ; do \
1025	  name=`basename $$i | sed 's+_.*++'`; \
1026	  sno=`basename $$i | sed 's+.*_\(.*\).xsd+\1+'`; \
1027	  for j in $(srcdir)/test/schemas/"$$name"_*.xml ; do \
1028	      if [ -f $$j ] ; then \
1029	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
1030	      if [ ! -f $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" ]; \
1031	      then \
1032		  echo New test file "$$name"_"$$sno"_"$$xno" ; \
1033		  $(CHECKER) $(top_builddir)/testSchemas $$i $$j \
1034		    > $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
1035		    2> $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err; \
1036	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1037	      else \
1038	          log=`$(CHECKER) $(top_builddir)/testSchemas $$i $$j \
1039		    > res.$$name 2> err.$$name;\
1040	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1041	          diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
1042		       res.$$name;\
1043	          diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err \
1044		       err.$$name;\
1045		  grep Unimplemented err.$$name`; \
1046	          if [ -n "$$log" ] ; then echo "$$name"_"$$sno"_"$$xno" result ; echo "$$log" ; fi ; \
1047	          rm res.$$name err.$$name ; \
1048	       fi ; fi ;\
1049	  done; done)
1050
1051Relaxtests: xmllint$(EXEEXT)
1052	@(echo > .memdump)
1053	@echo "## Relax-NG regression tests"
1054	-@(for i in $(srcdir)/test/relaxng/*.rng ; do \
1055	  name=`basename $$i | sed 's+\.rng++'`; \
1056	  if [ ! -f $(srcdir)/result/relaxng/"$$name"_valid ] ; then \
1057	      echo New schemas $$name ; \
1058	      $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \
1059		      > $(srcdir)/result/relaxng/"$$name"_valid \
1060		      2> $(srcdir)/result/relaxng/"$$name"_err; \
1061	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1062	  else \
1063	      log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \
1064	      > res.$$name 2> err.$$name;\
1065	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1066	      diff $(srcdir)/result/relaxng/"$$name"_valid \
1067		   res.$$name;\
1068	      diff $(srcdir)/result/relaxng/"$$name"_err \
1069		   err.$$name | grep -v "error detected at";\
1070	      grep Unimplemented err.$$name`; \
1071	      if [ -n "$$log" ] ; then echo schemas $$name result ; echo "$$log" ; fi ; \
1072	      rm res.$$name err.$$name ; \
1073	  fi; \
1074	  for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
1075	      if [ -f $$j ] ; then \
1076	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
1077	      if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \
1078	      then \
1079		  echo New test file "$$name"_"$$xno" ; \
1080		  $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
1081		    > $(srcdir)/result/relaxng/"$$name"_"$$xno" \
1082		    2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
1083	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1084	      else \
1085	          log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
1086		    > res.$$name 2> err.$$name;\
1087	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1088	          diff $(srcdir)/result/relaxng/"$$name"_"$$xno" \
1089		       res.$$name;\
1090	          diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
1091		       err.$$name | grep -v "error detected at";\
1092		  grep Unimplemented err.$$name`; \
1093		  if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo "$$log" ; fi ; \
1094	          rm res.$$name err.$$name ; \
1095	       fi ; fi ; \
1096	  done; done)
1097	@echo "## Relax-NG streaming regression tests"
1098	-@(for i in $(srcdir)/test/relaxng/*.rng ; do \
1099	  name=`basename $$i | sed 's+\.rng++'`; \
1100	  for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
1101	      if [ -f $$j ] ; then \
1102	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
1103	      if [ ! -f $(srcdir)/result/relaxng/"$$name"_"$$xno" ]; \
1104	      then \
1105		  echo New test file "$$name"_"$$xno" ; \
1106		  $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
1107		    > $(srcdir)/result/relaxng/"$$name"_"$$xno" \
1108		    2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
1109	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1110	      else \
1111	          log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --stream --relaxng $$i $$j \
1112		    > res.$$name 2> err.$$name;\
1113	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1114	          diff $(srcdir)/result/relaxng/"$$name"_"$$xno" res.$$name;\
1115		  if [ "$$name" != "tutor10_1" -a "$$name" != "tutor10_2" -a "$$name" != "tutor3_2" -a "$$name" != "307377" -a "$$name" != "tutor8_2" ] ; then \
1116		      diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
1117			   err.$$name | grep -v "error detected at";\
1118		  fi ; grep Unimplemented err.$$name`; \
1119	          if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo "$$log" ; fi ; \
1120	          rm res.$$name err.$$name ; \
1121	       fi ; fi ; \
1122	  done; done)
1123
1124Schematrontests: xmllint$(EXEEXT)
1125	@(echo > .memdump)
1126	@echo "## Schematron regression tests"
1127	-@(for i in $(srcdir)/test/schematron/*.sct ; do \
1128	  name=`basename $$i | sed 's+\.sct++'`; \
1129	  for j in $(srcdir)/test/schematron/"$$name"_*.xml ; do \
1130	      if [ -f $$j ] ; then \
1131	      xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
1132	      if [ ! -f $(srcdir)/result/schematron/"$$name"_"$$xno" ]; \
1133	      then \
1134		  echo New test file "$$name"_"$$xno" ; \
1135		  $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --schematron $$i $$j \
1136		    > $(srcdir)/result/schematron/"$$name"_"$$xno" \
1137		    2> $(srcdir)/result/schematron/"$$name"_"$$xno".err; \
1138	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1139	      else \
1140	          log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --schematron $$i $$j \
1141		    > res.$$name 2> err.$$name;\
1142	          grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1143	          diff $(srcdir)/result/schematron/"$$name"_"$$xno" \
1144		       res.$$name;\
1145	          diff $(srcdir)/result/schematron/"$$name"_"$$xno".err \
1146		       err.$$name | grep -v "error detected at";\
1147		  grep Unimplemented err.$$name`; \
1148		  if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo "$$log" ; fi ; \
1149	          rm res.$$name err.$$name ; \
1150	       fi ; fi ; \
1151	  done; done)
1152
1153RelaxNGPythonTests:
1154	@(if [ -x $(PYTHON) ] ; then \
1155	    PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs:$$PYTHONPATH ; \
1156	    export PYTHONPATH; \
1157	    LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
1158	    export LD_LIBRARY_PATH; \
1159	    echo "## Relax-NG Python based test suite 1" ; \
1160	    $(CHECKER) $(PYTHON) $(srcdir)/check-relaxng-test-suite.py ; \
1161	    echo "## Relax-NG Python based test suite 2" ; \
1162	    $(CHECKER) $(PYTHON) $(srcdir)/check-relaxng-test-suite2.py ; \
1163	  fi)
1164
1165SchemasPythonTests:
1166	@(if [ -x $(PYTHON) ] ; then \
1167	    PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs:$$PYTHONPATH; \
1168	    export PYTHONPATH; \
1169	    LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
1170	    export LD_LIBRARY_PATH; \
1171	    echo "## XML Schemas datatypes Python based test suite" ; \
1172	    echo "## It is normal to see 11 errors reported" ; \
1173	    $(CHECKER) $(PYTHON) $(srcdir)/check-xsddata-test-suite.py ; \
1174	  fi)
1175	@(if [ -x $(PYTHON) -a -d xstc ] ; then cd xstc ; $(MAKE) CHECKER="$(CHECKER)" pytests ; fi)
1176
1177Patterntests: xmllint$(EXEEXT)
1178	@(echo > .memdump)
1179	@echo "## Pattern regression tests"
1180	-@(for i in $(srcdir)/test/pattern/*.pat ; do \
1181	  name=`basename $$i .pat`; \
1182	  if [ -f $(srcdir)/test/pattern/$$name.xml ] ; then \
1183	  if [ ! -f $(srcdir)/result/pattern/$$name ] ; then \
1184	      rm -f result.$$name ; \
1185	      echo New test file $$name ; \
1186	      for pat in `cat $$i` ; do \
1187	      $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml >> $(srcdir)/result/pattern/$$name ; \
1188	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1189	      done ;\
1190	  else \
1191	      rm -f result.$$name ; \
1192	      lst=`cat $$i` ; \
1193	      log=`for pat in $$lst ; do $(CHECKER) $(top_builddir)/xmllint --walker --pattern $$pat $(srcdir)/test/pattern/$$name.xml 2>&1 >> result.$$name ; \
1194	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
1195	      done ;\
1196	      diff $(srcdir)/result/pattern/$$name result.$$name` ; \
1197	      if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
1198	      rm result.$$name ; \
1199	  fi ; fi ; done ;)
1200
1201ModuleTests: testModule$(EXEEXT) testdso.la
1202	@echo "## Module tests"
1203	@(./testModule$(EXEEXT))
1204
1205cleanup:
1206	-@(find . -name .\#\* -exec rm {} \;)
1207	-@(find . -name \*.gcda -o -name \*.gcno -exec rm -f {} \;)
1208	-@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm -f {} \;)
1209
1210dist-hook: cleanup libxml2.spec
1211	-cp libxml2.spec $(distdir)
1212	(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git win32 macos os400 vms VxWorks bakefile test result) | (cd $(distdir); tar xf -)
1213
1214dist-source: distdir
1215	$(AMTAR) -chof - --exclude Tests --exclude test --exclude result $(distdir) | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-sources+"`.tar.gz
1216
1217dist-test: distdir
1218	(mkdir -p $(distdir))
1219	(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn --exclude .git xstc/Tests) | (cd $(distdir); tar xf -)
1220	tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests  $(distdir)/Makefile.tests $(distdir)/README $(distdir)/README.tests $(distdir)/AUTHORS $(distdir)/testapi.c $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-tests+"`.tar.gz
1221	@(rm -rf $(distdir)/xstc/Test)
1222
1223cleantar:
1224	@(rm -f libxml*.tar.gz COPYING.LIB)
1225
1226rpm: cleanup cleantar
1227	@(unset CDPATH ; $(MAKE) dist-source dist && rpmbuild -ta $(distdir).tar.gz)
1228
1229## We create xml2Conf.sh here and not from configure because we want
1230## to get the paths expanded correctly.  Macros like srcdir are given
1231## the value NONE in configure if the user doesn't specify them (this
1232## is an autoconf feature, not a bug).
1233
1234xml2Conf.sh: xml2Conf.sh.in Makefile
1235## Use sed and then mv to avoid problems if the user interrupts.
1236	sed -e 's?\@XML_LIBDIR\@?$(XML_LIBDIR)?g' \
1237	    -e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \
1238	    -e 's?\@VERSION\@?$(VERSION)?g' \
1239	    -e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \
1240	    -e 's?\@XML_PRIVATE_LIBS\@?$(XML_PRIVATE_LIBS)?g' \
1241	       < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \
1242	&& mv xml2Conf.tmp xml2Conf.sh
1243
1244CLEANFILES = runxmlconf.log test.out xml2Conf.sh *.gcda *.gcno *.res
1245DISTCLEANFILES = COPYING missing.lst
1246
1247confexecdir=$(libdir)
1248confexec_DATA = xml2Conf.sh
1249CVS_EXTRA_DIST=
1250EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \
1251             libxml.m4 Copyright check-xml-test-suite.py gentest.py \
1252	     check-relaxng-test-suite.py check-relaxng-test-suite2.py \
1253	     check-xsddata-test-suite.py check-xinclude-test-suite.py \
1254             example/Makefile.am example/gjobread.c example/gjobs.xml \
1255	     $(man_MANS) libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \
1256	     libxml2-config.cmake.in autogen.sh \
1257	     trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
1258	     triop.h triodef.h libxml.h elfgcchack.h xzlib.h buf.h \
1259	     enc.h save.h genUnicode.py TODO_SCHEMAS \
1260	     dbgen.pl dbgenattr.pl regressions.py regressions.xml \
1261	     README.tests Makefile.tests libxml2.syms timsort.h \
1262	     README.zOS \
1263	     CMakeLists.txt config.h.cmake.in libxml2-config.cmake.cmake.in \
1264	     $(CVS_EXTRA_DIST)
1265
1266
1267pkgconfigdir = $(libdir)/pkgconfig
1268pkgconfig_DATA = libxml-2.0.pc
1269
1270cmakedir = $(libdir)/cmake/libxml2
1271cmake_DATA = libxml2-config.cmake
1272
1273#
1274# Install the tests program sources as examples
1275#
1276BASE_DIR=$(datadir)/doc
1277DOC_MODULE=libxml2-$(VERSION)
1278EXAMPLES_DIR=$(BASE_DIR)/$(DOC_MODULE)/examples
1279
1280install-data-local:
1281	$(MKDIR_P) $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
1282	-$(INSTALL) -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
1283	$(MKDIR_P) $(DESTDIR)$(EXAMPLES_DIR)
1284	-$(INSTALL) -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR)
1285	-$(INSTALL) -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR)
1286	-$(INSTALL) -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR)
1287	-$(INSTALL) -m 0644 $(srcdir)/testXPath.c $(DESTDIR)$(EXAMPLES_DIR)
1288
1289uninstall-local:
1290	rm -f $(DESTDIR)$(EXAMPLES_DIR)/testXPath.c
1291	rm -f $(DESTDIR)$(EXAMPLES_DIR)/testHTML.c
1292	rm -f $(DESTDIR)$(EXAMPLES_DIR)/testSAX.c
1293	rm -f $(DESTDIR)$(EXAMPLES_DIR)/xmllint.c
1294	rm -rf $(DESTDIR)$(EXAMPLES_DIR)
1295	rm -f $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)/Copyright
1296	rm -rf $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
1297
1298tst: tst.c
1299	$(CC) $(CFLAGS) -Iinclude -o tst tst.c .libs/libxml2.a -lpthread -lm -lz -llzma
1300
1301sparse: clean
1302	$(MAKE) CC=cgcc
1303
1304#
1305# Coverage support, largely borrowed from libvirt
1306# Both binaries comes from the lcov package in Fedora
1307#
1308LCOV = /usr/bin/lcov
1309GENHTML = /usr/bin/genhtml
1310
1311cov: clean-cov
1312	if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \
1313	    echo not configured with coverage; exit 1 ; fi
1314	if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \
1315	    echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi
1316	-@($(MAKE) check)
1317	-@(./runsuite$(EXEEXT))
1318	mkdir $(top_builddir)/coverage
1319	$(LCOV) -c -o $(top_builddir)/coverage/libxml2.info.tmp -d $(top_srcdir)
1320	$(LCOV) -r $(top_builddir)/coverage/libxml2.info.tmp -o $(top_builddir)/coverage/libxml2.info *usr*
1321	rm $(top_builddir)/coverage/libxml2.info.tmp
1322	$(GENHTML) -s -t "libxml2" -o $(top_builddir)/coverage --legend $(top_builddir)/coverage/libxml2.info
1323	echo "Coverage report is in $(top_builddir)/coverage/index.html"
1324
1325clean-cov:
1326	rm -rf $(top_builddir)/coverage
1327
1328