• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Definition for the tests from W3C
3#
4PYSCRIPTS=nist-test.py ms-test.py sun-test.py
5TESTDIR=Tests
6TESTDIRS=$(TESTDIR)/msxsdtest $(TESTDIR)/suntest $(TESTDIR)/Datatypes
7TARBALL=xsts-2002-01-16.tar.gz
8TARBALL_2=xsts-2004-01-14.tar.gz
9TSNAME=xmlschema2002-01-16
10TSNAME_2=xmlschema2004-01-14
11TARBALLURL=http://www.w3.org/XML/2004/xml-schema-test-suite/$(TSNAME)/$(TARBALL)
12TARBALLURL_2=http://www.w3.org/XML/2004/xml-schema-test-suite/$(TSNAME_2)/$(TARBALL_2)
13MSTESTDEF=MSXMLSchema1-0-20020116.testSet
14SUNTESTDEF=SunXMLSchema1-0-20020116.testSet
15NISTTESTDEF=NISTXMLSchema1-0-20020116.testSet
16NISTTESTDEF_2=NISTXMLSchemaDatatypes.testSet
17
18#
19# The local data and scripts
20#
21EXTRA_DIST=xstc.py xstc-to-python.xsl
22#
23# Nothing is done by make, only make tests and
24# only if Python and Schemas are enabled.
25#
26all:
27
28#
29# Rule to load the test description and extract the information
30#
31$(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/Metadata/$(SUNTESTDEF):
32	-@(if [ ! -d Tests ] ; then \
33	   mkdir Tests ; \
34	   fi)
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)' ; \
45	   echo "done" ; \
46	   fi)
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 ; \
62	   echo "done" ; \
63	   fi)
64
65#
66# The python tests are generated via XSLT
67#
68nist-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) > $@ ; \
74	  chmod +x $@ ; fi )
75
76ms-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) > $@ ; \
82	  chmod +x $@ ; fi )
83
84sun-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) > $@ ; \
90	  chmod +x $@ ; fi )
91
92#
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
95#
96pytests: $(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" ;\
100	   export 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" ;\
107	   export 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" ;\
114	   export 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)
118
119tests:
120	-@(if [ -x $(PYTHON) ] ; then 					\
121	   $(MAKE) pytests ; fi);
122
123#
124# Heavy, works well only on RHEL3
125#
126valgrind:
127	-@(if [ -x $(PYTHON) ] ; then 					\
128	   echo '## Running the regression tests under Valgrind' ;	\
129	   $(MAKE) CHECKER='valgrind -q' pytests ; fi);
130
131CLEANFILES=$(PYSCRIPTS) test.log
132
133