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