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