Makefile.am 4.61 KB
Newer Older
1 2 3
#
# Definition for the tests from W3C
#
4
PYSCRIPTS=nist-test.py ms-test.py sun-test.py
5 6 7 8 9 10 11 12 13 14 15 16
TESTDIR=Tests
TESTDIRS=$(TESTDIR)/msxsdtest $(TESTDIR)/suntest $(TESTDIR)/Datatypes
TARBALL=xsts-2002-01-16.tar.gz
TARBALL_2=xsts-2004-01-14.tar.gz
TSNAME=xmlschema2002-01-16
TSNAME_2=xmlschema2004-01-14
TARBALLURL=http://www.w3.org/XML/2004/xml-schema-test-suite/$(TSNAME)/$(TARBALL)
TARBALLURL_2=http://www.w3.org/XML/2004/xml-schema-test-suite/$(TSNAME_2)/$(TARBALL_2)
MSTESTDEF=MSXMLSchema1-0-20020116.testSet
SUNTESTDEF=SunXMLSchema1-0-20020116.testSet
NISTTESTDEF=NISTXMLSchema1-0-20020116.testSet
NISTTESTDEF_2=NISTXMLSchemaDatatypes.testSet
17

18 19 20
#
# The local data and scripts
#
21
EXTRA_DIST=xstc.py xstc-to-python.xsl
22 23 24 25
#
# Nothing is done by make, only make tests and
# only if Python and Schemas are enabled.
#
26 27
all:

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#
# Rule to load the test description and extract the informations
#
$(TESTDIRS) Tests/$(NISTTESTDEF_2) Tests/$(MSTTESTDEF) Tests/$(SUNTESTDEF):
	-@(if [ ! -d Tests ] ; then \
	   mkdir Tests ; \
	   fi)
	-@(if [ ! -f $(TARBALL) ] ; then \
	   echo "Missing the test suite description (2002-01-16), trying to fetch it" ;\
	   if [ -x /usr/bin/wget ] ; then \
	   wget $(TARBALLURL) ; \
	   else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi)
	-@(if [ -f $(TARBALL) ] ; then \
	   echo -n "extracting test data (Sun, Microsoft)..." ; \
	   $(TAR) -C Tests --strip-path 1 -xzf $(TARBALL) '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \
	   echo "done" ; \
	   fi)
	-@(if [ ! -f $(TARBALL_2) ] ; then \
	   echo "Missing the test suite description (2004-01-14), trying to fetch it" ;\
	   if [ -x /usr/bin/wget ] ; then \
	   wget $(TARBALLURL_2) ; \
	   else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi)
	-@(if [ -f $(TARBALL_2) ] ; then \
	   echo -n "extracting test data (NIST)..." ; \
	   $(TAR) -C Tests --strip-path 1 -xzf $(TARBALL_2) '*/Datatypes' ; \
	   $(TAR) -C Tests --strip-path 2 -xzf $(TARBALL_2) '*/Metadata/$(NISTTESTDEF_2)' ; \
	   echo "done" ; \
	   fi)

57 58 59
#
# The python tests are generated via XSLT
#
60 61 62 63 64 65
nist-test.py: Tests/$(NISTTESTDEF_2) xstc-to-python.xsl
	-@(if [ -x $(XSLTPROC) ] ; then \
	  echo "Rebuilding script (NIST)" $@ ; \
	  $(XSLTPROC) --nonet --stringparam vendor NIST-2 \
	                     $(srcdir)/xstc-to-python.xsl \
	                     $(srcdir)/Tests/$(NISTTESTDEF_2) > $@ ; \
66 67
	  chmod +x $@ ; fi )

68 69 70 71 72 73
ms-test.py: Tests/$(MSTTESTDEF) xstc-to-python.xsl
	-@(if [ -x $(XSLTPROC) ] ; then \
	  echo "Rebuilding script (Microsoft)" $@ ; \
	  $(XSLTPROC) --nonet --stringparam vendor MS \
	                     $(srcdir)/xstc-to-python.xsl \
	                     $(srcdir)/Tests/$(MSTESTDEF) > $@ ; \
74 75
	  chmod +x $@ ; fi )

76 77 78 79 80 81
sun-test.py: Tests/$(SUNTESTDEF) xstc-to-python.xsl
	-@(if [ -x $(XSLTPROC) ] ; then \
	  echo "Rebuilding script (Sun)" $@ ; \
	  $(XSLTPROC) --nonet --stringparam vendor SUN \
	                     $(srcdir)/xstc-to-python.xsl \
	                     $(srcdir)/Tests/$(SUNTESTDEF) > $@ ; \
82 83
	  chmod +x $@ ; fi )

84 85 86 87
#
# The actual test run if present. PYTHONPATH is updated to make sure
# we run the version from the loacl build and not preinstalled bindings
#
88
pytests: $(PYSCRIPTS) $(TESTDIRS)
89 90
	-@(if [ -x nist-test.py -a -d $(TESTDIR)/Datatypes ] ; then 		\
	   echo "## Running XML Schema tests (NIST)";			\
91
	   PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\
Daniel Veillard's avatar
Daniel Veillard committed
92
	   export PYTHONPATH;						\
93 94
	   LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ;	\
	   export LD_LIBRARY_PATH;					\
95
	   $(CHECKER) $(PYTHON) nist-test.py -s -b $(srcdir) ; fi)
96 97
	-@(if [ -x sun-test.py -a -d $(TESTDIR)/suntest ] ; then 			\
	   echo "## Running Schema tests (Sun)";				\
98
	   PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\
Daniel Veillard's avatar
Daniel Veillard committed
99
	   export PYTHONPATH;						\
100 101
	   LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ;	\
	   export LD_LIBRARY_PATH;					\
102
	   $(CHECKER) $(PYTHON) sun-test.py -s -b $(srcdir) ; fi)
103 104
	-@(if [ -x ms-test.py -a -d $(TESTDIR)/msxsdtest ] ; then 			\
	   echo "## Running Schema tests (Microsoft)";			\
105
	   PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\
Daniel Veillard's avatar
Daniel Veillard committed
106
	   export PYTHONPATH;						\
107 108
	   LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ;	\
	   export LD_LIBRARY_PATH;					\
109
	   $(CHECKER) $(PYTHON) ms-test.py -s -b $(srcdir) ; fi)
110 111 112 113 114

tests:
	-@(if [ -x $(PYTHON) ] ; then 					\
	   $(MAKE) MAKEFLAGS+=--silent pytests ; fi);

115 116 117
#
# Heavy, works well only on RHEL3
#
118 119 120
valgrind:
	-@(if [ -x $(PYTHON) ] ; then 					\
	   echo '## Running the regression tests under Valgrind' ;	\
121
	   $(MAKE) CHECKER='valgrind' MAKEFLAGS+=--silent pytests ; fi);
122

123
clean:
124
	rm -f $(PYSCRIPTS) test.log
125 126

distclean:
127
	rm -rf $(PYSCRIPTS) $(TESTDIRS) test.log