summaryrefslogtreecommitdiff
path: root/xstc/Makefile.am
blob: 5ef18192dfaebb4302be72f184f1b2179b015054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#
# Definition for the tests from W3C
#
PYSCRIPTS=nist-test.py ms-test.py sun-test.py
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

#
# The local data and scripts
#
EXTRA_DIST=xstc.py xstc-to-python.xsl
#
# Nothing is done by make, only make tests and
# only if Python and Schemas are enabled.
#
all:

#
# Rule to load the test description and extract the informations
#
$(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/Metadata/$(SUNTESTDEF):
	-@(if [ ! -d Tests ] ; then \
	   mkdir Tests ; \
	   fi)
	-@(if [ ! -f $(TARBALL_2) ] ; then \
	   if [ -f $(srcdir)/$(TARBALL_2) ] ; then \
	   $(LN_S) $(srcdir)/$(TARBALL_2) $(TARBALL_2) ; else \
	   echo "Missing the test suite description (2004-01-14), trying to fetch it" ;\
	   if [ -x "$(WGET)" ] ; then \
	   $(WGET) $(TARBALLURL_2) ; \
	   else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi ; fi)
	-@(if [ -f $(TARBALL_2) ] ; then \
	   echo -n "extracting test data (NIST)..." ; \
	   $(TAR) -xzf $(TARBALL_2) --wildcards '*/Datatypes' '*/Metadata/$(NISTTESTDEF_2)' ; \
	   echo "done" ; \
	   fi)
	-@(if [ ! -f $(TARBALL) ] ; then \
	   if [ -f $(srcdir)/$(TARBALL) ] ; then \
	   $(LN_S) $(srcdir)/$(TARBALL) $(TARBALL) ; else \
	   echo "Missing the test suite description (2002-01-16), trying to fetch it" ;\
	   if [ -x "$(WGET)" ] ; then \
	   $(WGET) $(TARBALLURL) ; \
	   else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi ; fi)
	-@(if [ -f $(TARBALL) ] ; then \
	   echo -n "extracting test data (Sun, Microsoft)..." ; \
	   $(TAR) -C Tests -xzf $(TARBALL) --wildcards '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \
	   if [ -d Tests/suntest ] ; then rm -r Tests/suntest ; fi ; \
	   if [ -d Tests/msxsdtest ] ; then rm -r Tests/msxsdtest ; fi ; \
	   mv Tests/xmlschema2002-01-16/* Tests ; \
	   mv Tests/*.testSet Tests/Metadata ; \
	   rm -r Tests/xmlschema2002-01-16 ; \
	   echo "done" ; \
	   fi)

#
# The python tests are generated via XSLT
#
nist-test.py: Tests/Metadata/$(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/Metadata/$(NISTTESTDEF_2) > $@ ; \
	  chmod +x $@ ; fi )

ms-test.py: Tests/Metadata/$(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/Metadata/$(MSTESTDEF) > $@ ; \
	  chmod +x $@ ; fi )

sun-test.py: Tests/Metadata/$(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/Metadata/$(SUNTESTDEF) > $@ ; \
	  chmod +x $@ ; fi )

#
# The actual test run if present. PYTHONPATH is updated to make sure
# we run the version from the loacl build and not preinstalled bindings
#
pytests: $(PYSCRIPTS) $(TESTDIRS)
	-@(if [ -x nist-test.py -a -d $(TESTDIR)/Datatypes ] ; then 		\
	   echo "## Running XML Schema tests (NIST)";			\
	   PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\
	   export PYTHONPATH;						\
	   LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ;	\
	   export LD_LIBRARY_PATH;					\
	   $(CHECKER) $(PYTHON) nist-test.py -s -b $(srcdir) ; fi)
	-@(if [ -x sun-test.py -a -d $(TESTDIR)/suntest ] ; then 			\
	   echo "## Running Schema tests (Sun)";				\
	   PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\
	   export PYTHONPATH;						\
	   LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ;	\
	   export LD_LIBRARY_PATH;					\
	   $(CHECKER) $(PYTHON) sun-test.py -s -b $(srcdir) ; fi)
	-@(if [ -x ms-test.py -a -d $(TESTDIR)/msxsdtest ] ; then 			\
	   echo "## Running Schema tests (Microsoft)";			\
	   PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\
	   export PYTHONPATH;						\
	   LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ;	\
	   export LD_LIBRARY_PATH;					\
	   $(CHECKER) $(PYTHON) ms-test.py -s -b $(srcdir) ; fi)

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

#
# Heavy, works well only on RHEL3
#
valgrind:
	-@(if [ -x $(PYTHON) ] ; then 					\
	   echo '## Running the regression tests under Valgrind' ;	\
	   $(MAKE) CHECKER='valgrind -q' pytests ; fi);

CLEANFILES=$(PYSCRIPTS) test.log