2 # Definition for the tests from W3C
4 PYSCRIPTS=nist-test.py ms-test.py sun-test.py
6 TESTDIRS=$(TESTDIR)/msxsdtest $(TESTDIR)/suntest $(TESTDIR)/Datatypes
7 TARBALL=xsts-2002-01-16.tar.gz
8 TARBALL_2=xsts-2004-01-14.tar.gz
9 TSNAME=xmlschema2002-01-16
10 TSNAME_2=xmlschema2004-01-14
11 TARBALLURL=http://www.w3.org/XML/2004/xml-schema-test-suite/$(TSNAME)/$(TARBALL)
12 TARBALLURL_2=http://www.w3.org/XML/2004/xml-schema-test-suite/$(TSNAME_2)/$(TARBALL_2)
13 MSTESTDEF=MSXMLSchema1-0-20020116.testSet
14 SUNTESTDEF=SunXMLSchema1-0-20020116.testSet
15 NISTTESTDEF=NISTXMLSchema1-0-20020116.testSet
16 NISTTESTDEF_2=NISTXMLSchemaDatatypes.testSet
19 # The local data and scripts
21 EXTRA_DIST=xstc.py xstc-to-python.xsl
23 # Nothing is done by make, only make tests and
24 # only if Python and Schemas are enabled.
29 # Rule to load the test description and extract the informations
31 $(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/Metadata/$(SUNTESTDEF):
32 -@(if [ ! -d Tests ] ; then \
35 -@(if [ ! -f $(TARBALL_2) ] ; then \
36 if [ -f $(srcdir)/$(TARBALL_2) ] ; then \
37 $(LN_S) $(srcdir)/$(TARBALL_2) $(TARBALL_2) ; else \
38 echo "Missing the test suite description (2004-01-14), trying to fetch it" ;\
39 if [ -x "$(WGET)" ] ; then \
40 $(WGET) $(TARBALLURL_2) ; \
41 else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi ; fi)
42 -@(if [ -f $(TARBALL_2) ] ; then \
43 echo -n "extracting test data (NIST)..." ; \
44 $(TAR) -xzf $(TARBALL_2) --wildcards '*/Datatypes' '*/Metadata/$(NISTTESTDEF_2)' ; \
47 -@(if [ ! -f $(TARBALL) ] ; then \
48 if [ -f $(srcdir)/$(TARBALL) ] ; then \
49 $(LN_S) $(srcdir)/$(TARBALL) $(TARBALL) ; else \
50 echo "Missing the test suite description (2002-01-16), trying to fetch it" ;\
51 if [ -x "$(WGET)" ] ; then \
52 $(WGET) $(TARBALLURL) ; \
53 else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi ; fi)
54 -@(if [ -f $(TARBALL) ] ; then \
55 echo -n "extracting test data (Sun, Microsoft)..." ; \
56 $(TAR) -C Tests -xzf $(TARBALL) --wildcards '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \
57 if [ -d Tests/suntest ] ; then rm -r Tests/suntest ; fi ; \
58 if [ -d Tests/msxsdtest ] ; then rm -r Tests/msxsdtest ; fi ; \
59 mv Tests/xmlschema2002-01-16/* Tests ; \
60 mv Tests/*.testSet Tests/Metadata ; \
61 rm -r Tests/xmlschema2002-01-16 ; \
66 # The python tests are generated via XSLT
68 nist-test.py: Tests/Metadata/$(NISTTESTDEF_2) xstc-to-python.xsl
69 -@(if [ -x $(XSLTPROC) ] ; then \
70 echo "Rebuilding script (NIST)" $@ ; \
71 $(XSLTPROC) --nonet --stringparam vendor NIST-2 \
72 $(srcdir)/xstc-to-python.xsl \
73 $(srcdir)/Tests/Metadata/$(NISTTESTDEF_2) > $@ ; \
76 ms-test.py: Tests/Metadata/$(MSTTESTDEF) xstc-to-python.xsl
77 -@(if [ -x $(XSLTPROC) ] ; then \
78 echo "Rebuilding script (Microsoft)" $@ ; \
79 $(XSLTPROC) --nonet --stringparam vendor MS \
80 $(srcdir)/xstc-to-python.xsl \
81 $(srcdir)/Tests/Metadata/$(MSTESTDEF) > $@ ; \
84 sun-test.py: Tests/Metadata/$(SUNTESTDEF) xstc-to-python.xsl
85 -@(if [ -x $(XSLTPROC) ] ; then \
86 echo "Rebuilding script (Sun)" $@ ; \
87 $(XSLTPROC) --nonet --stringparam vendor SUN \
88 $(srcdir)/xstc-to-python.xsl \
89 $(srcdir)/Tests/Metadata/$(SUNTESTDEF) > $@ ; \
93 # The actual test run if present. PYTHONPATH is updated to make sure
94 # we run the version from the loacl build and not preinstalled bindings
96 pytests: $(PYSCRIPTS) $(TESTDIRS)
97 -@(if [ -x nist-test.py -a -d $(TESTDIR)/Datatypes ] ; then \
98 echo "## Running XML Schema tests (NIST)"; \
99 PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\
101 LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
102 export LD_LIBRARY_PATH; \
103 $(CHECKER) $(PYTHON) nist-test.py -s -b $(srcdir) ; fi)
104 -@(if [ -x sun-test.py -a -d $(TESTDIR)/suntest ] ; then \
105 echo "## Running Schema tests (Sun)"; \
106 PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\
108 LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
109 export LD_LIBRARY_PATH; \
110 $(CHECKER) $(PYTHON) sun-test.py -s -b $(srcdir) ; fi)
111 -@(if [ -x ms-test.py -a -d $(TESTDIR)/msxsdtest ] ; then \
112 echo "## Running Schema tests (Microsoft)"; \
113 PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\
115 LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \
116 export LD_LIBRARY_PATH; \
117 $(CHECKER) $(PYTHON) ms-test.py -s -b $(srcdir) ; fi)
120 -@(if [ -x $(PYTHON) ] ; then \
121 $(MAKE) pytests ; fi);
124 # Heavy, works well only on RHEL3
127 -@(if [ -x $(PYTHON) ] ; then \
128 echo '## Running the regression tests under Valgrind' ; \
129 $(MAKE) CHECKER='valgrind -q' pytests ; fi);
131 CLEANFILES=$(PYSCRIPTS) test.log