aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Makefile.am16
-rwxr-xr-xcheck-relaxng-test-suite.py24
-rwxr-xr-xcheck-relaxng-test-suite2.py39
-rwxr-xr-xcheck-xsddata-test-suite.py29
-rw-r--r--config.h.in5
-rw-r--r--configure.in5
-rw-r--r--relaxng.c24
8 files changed, 116 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 25d25c02..126ca505 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Mar 22 20:07:27 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+ * relaxng.c: remove a memory leak on schemas type facets.
+ * check-relaxng-test-suite.py check-relaxng-test-suite2.py
+ check-xsddata-test-suite.py: reduce verbosity
+ * configure.in Makefile.am: incorporated the Python regressions
+ tests for Relax-NG and Schemas Datatype to "make tests"
+
Mon Mar 22 16:16:18 CET 2004 Daniel Veillard <daniel@veillard.com>
* xmlwriter.c include/libxml/xmlwriter.h doc/* : applied patch from
diff --git a/Makefile.am b/Makefile.am
index 70d350ff..79f278df 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -122,7 +122,7 @@ check-local: tests
testall : tests SVGtests SAXtests
-tests: XMLtests XMLenttests NStests Errtests @READER_TEST@ @TEST_SAX@ @TEST_PUSH@ @TEST_HTML@ @TEST_PHTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@
+tests: XMLtests XMLenttests NStests Errtests @READER_TEST@ @TEST_SAX@ @TEST_PUSH@ @TEST_HTML@ @TEST_PHTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@ @PYTHON_TESTS@
@(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; $(MAKE) tests ; fi)
@(cd doc/examples ; $(MAKE) tests)
@@ -883,6 +883,20 @@ Relaxtests: xmllint$(EXEEXT)
fi ; fi ; \
done; done)
+RelaxNGPythonTests:
+ @(if [ -x $(PYTHON) ] ; then \
+ echo "## Relax-NG Python based test suite 1" ; \
+ $(PYTHON) $(srcdir)/check-relaxng-test-suite.py ; \
+ echo "## Relax-NG Python based test suite 2" ; \
+ $(PYTHON) $(srcdir)/check-relaxng-test-suite2.py ; \
+ fi)
+
+SchemasPythonTests:
+ @(if [ -x $(PYTHON) ] ; then \
+ echo "## XML Schemas datatypes Python based test suite" ; \
+ $(PYTHON) $(srcdir)/check-xsddata-test-suite.py ; \
+ fi)
+
cleanup:
-@(find . -name .\#\* -exec rm {} \;)
diff --git a/check-relaxng-test-suite.py b/check-relaxng-test-suite.py
index 2e378f45..08327583 100755
--- a/check-relaxng-test-suite.py
+++ b/check-relaxng-test-suite.py
@@ -11,6 +11,7 @@ import libxml2
libxml2.debugMemory(1)
debug = 0
verbose = 0
+quiet = 1
#
# the testsuite description
@@ -44,6 +45,8 @@ resources = {}
def resolver(URL, ID, ctxt):
global resources
+ if string.find(URL, '#') != -1:
+ URL = URL[0:string.find(URL, '#')]
if resources.has_key(URL):
return(StringIO.StringIO(resources[URL]))
log.write("Resolver failure: asked %s\n" % (URL))
@@ -306,6 +309,7 @@ def handle_testCase(node):
def handle_testSuite(node, level = 0):
global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
global nb_instances_tests, nb_instances_success, nb_instances_failed
+ global quiet
if level >= 1:
old_schemas_tests = nb_schemas_tests
old_schemas_success = nb_schemas_success
@@ -324,13 +328,15 @@ def handle_testSuite(node, level = 0):
msg = msg + "written by "
for author in authors:
msg = msg + author.content + " "
- print msg
+ if quiet == 0:
+ print msg
sections = node.xpathEval('section')
if sections != [] and level <= 0:
msg = ""
for section in sections:
msg = msg + section.content + " "
- print "Tests for section %s" % (msg)
+ if quiet == 0:
+ print "Tests for section %s" % (msg)
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
@@ -362,12 +368,17 @@ root = testsuite.getRootElement()
if root.name != 'testSuite':
print "%s doesn't start with a testSuite element, aborting" % (CONF)
sys.exit(1)
-print "Running Relax NG testsuite"
+if quiet == 0:
+ print "Running Relax NG testsuite"
handle_testSuite(root)
-print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
+if quiet == 0:
+ print "\nTOTAL:\n"
+if quiet == 0 or nb_schemas_failed != 0:
+ print "found %d test schemas: %d success %d failures" % (
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
-print "found %d test instances: %d success %d failures" % (
+if quiet == 0 or nb_instances_failed != 0:
+ print "found %d test instances: %d success %d failures" % (
nb_instances_tests, nb_instances_success, nb_instances_failed)
testsuite.freeDoc()
@@ -376,7 +387,8 @@ testsuite.freeDoc()
libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ if quiet == 0:
+ print "OK"
else:
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
libxml2.dumpMemory()
diff --git a/check-relaxng-test-suite2.py b/check-relaxng-test-suite2.py
index 6a2b6eb9..639e587d 100755
--- a/check-relaxng-test-suite2.py
+++ b/check-relaxng-test-suite2.py
@@ -10,6 +10,7 @@ import libxml2
# Memory debug specific
libxml2.debugMemory(1)
debug = 0
+quiet = 1
#
# the testsuite description
@@ -67,7 +68,7 @@ def handle_valid(node, schema):
instance = instance + child.serialize()
child = child.next
- mem = libxml2.debugMemory(1);
+# mem = libxml2.debugMemory(1);
try:
doc = libxml2.parseDoc(instance)
except:
@@ -91,9 +92,9 @@ def handle_valid(node, schema):
ret = -1
doc.freeDoc()
- if mem != libxml2.debugMemory(1):
- print "validating instance %d line %d leaks" % (
- nb_instances_tests, node.lineNo())
+# if mem != libxml2.debugMemory(1):
+# print "validating instance %d line %d leaks" % (
+# nb_instances_tests, node.lineNo())
if ret != 0:
log.write("\nFailed to validate correct instance:\n-----\n")
@@ -120,7 +121,7 @@ def handle_invalid(node, schema):
instance = instance + child.serialize()
child = child.next
- mem = libxml2.debugMemory(1);
+# mem = libxml2.debugMemory(1);
try:
doc = libxml2.parseDoc(instance)
@@ -145,9 +146,10 @@ def handle_invalid(node, schema):
ret = -1
doc.freeDoc()
- if mem != libxml2.debugMemory(1):
- print "validating instance %d line %d leaks" % (
- nb_instances_tests, node.lineNo())
+# mem2 = libxml2.debugMemory(1)
+# if mem != mem2:
+# print "validating instance %d line %d leaks %d bytes" % (
+# nb_instances_tests, node.lineNo(), mem2 - mem)
if ret == 0:
log.write("\nFailed to detect validation problem in instance:\n-----\n")
@@ -339,13 +341,15 @@ def handle_testSuite(node, level = 0):
msg = msg + "written by "
for author in authors:
msg = msg + author.content + " "
- print msg
+ if quiet == 0:
+ print msg
sections = node.xpathEval('section')
if sections != [] and level <= 0:
msg = ""
for section in sections:
msg = msg + section.content + " "
- print "Tests for section %s" % (msg)
+ if quiet == 0:
+ print "Tests for section %s" % (msg)
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
@@ -387,21 +391,28 @@ root = testsuite.getRootElement()
if root.name != 'testSuite':
print "%s doesn't start with a testSuite element, aborting" % (CONF)
sys.exit(1)
-print "Running Relax NG testsuite"
+if quiet == 0:
+ print "Running Relax NG testsuite"
handle_testSuite(root)
-print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
+if quiet == 0:
+ print "\nTOTAL:\n"
+if quiet == 0 or nb_schemas_failed != 0:
+ print "found %d test schemas: %d success %d failures" % (
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
-print "found %d test instances: %d success %d failures" % (
+if quiet == 0 or nb_instances_failed != 0:
+ print "found %d test instances: %d success %d failures" % (
nb_instances_tests, nb_instances_success, nb_instances_failed)
+
testsuite.freeDoc()
# Memory debug specific
libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ if quiet == 0:
+ print "OK"
else:
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
libxml2.dumpMemory()
diff --git a/check-xsddata-test-suite.py b/check-xsddata-test-suite.py
index 2fbdc840..f2066e1b 100755
--- a/check-xsddata-test-suite.py
+++ b/check-xsddata-test-suite.py
@@ -10,7 +10,8 @@ import libxml2
# Memory debug specific
libxml2.debugMemory(1)
debug = 0
-verbose = 1
+verbose = 0
+quiet = 1
#
# the testsuite description
@@ -119,7 +120,7 @@ def handle_invalid(node, schema):
instance = instance + child.serialize()
child = child.next
- mem = libxml2.debugMemory(1);
+# mem = libxml2.debugMemory(1);
try:
doc = libxml2.parseDoc(instance)
@@ -144,9 +145,9 @@ def handle_invalid(node, schema):
ret = -1
doc.freeDoc()
- if mem != libxml2.debugMemory(1):
- print "validating instance %d line %d leaks" % (
- nb_instances_tests, node.lineNo())
+# if mem != libxml2.debugMemory(1):
+# print "validating instance %d line %d leaks" % (
+# nb_instances_tests, node.lineNo())
if ret == 0:
log.write("\nFailed to detect validation problem in instance:\n-----\n")
@@ -338,13 +339,15 @@ def handle_testSuite(node, level = 0):
msg = msg + "written by "
for author in authors:
msg = msg + author.content + " "
- print msg
+ if quiet == 0:
+ print msg
sections = node.xpathEval('section')
if verbose and sections != [] and level <= 0:
msg = ""
for section in sections:
msg = msg + section.content + " "
- print "Tests for section %s" % (msg)
+ if quiet == 0:
+ print "Tests for section %s" % (msg)
for test in node.xpathEval('testCase'):
handle_testCase(test)
for test in node.xpathEval('testSuite'):
@@ -393,12 +396,15 @@ root = testsuite.getRootElement()
if root.name != 'testSuite':
print "%s doesn't start with a testSuite element, aborting" % (CONF)
sys.exit(1)
-print "Running Relax NG testsuite"
+if quiet == 0:
+ print "Running Relax NG testsuite"
handle_testSuite(root)
-print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
+if quiet == 0 or nb_schemas_failed != 0:
+ print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
-print "found %d test instances: %d success %d failures" % (
+if quiet == 0 or nb_instances_failed != 0:
+ print "found %d test instances: %d success %d failures" % (
nb_instances_tests, nb_instances_success, nb_instances_failed)
testsuite.freeDoc()
@@ -407,7 +413,8 @@ testsuite.freeDoc()
libxml2.relaxNGCleanupTypes()
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ if quiet == 0:
+ print "OK"
else:
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
libxml2.dumpMemory()
diff --git a/config.h.in b/config.h.in
index 915ef0c8..f54d0bf7 100644
--- a/config.h.in
+++ b/config.h.in
@@ -256,7 +256,7 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* Define if compiler has function prototypes */
+/* Define to 1 if the C compiler supports function prototypes. */
#undef PROTOTYPES
/* Determine what socket length (socklen_t) data type is */
@@ -274,6 +274,9 @@
/* Using the Win32 Socket implementation */
#undef _WINSOCKAPI_
+/* Define like PROTOTYPES; this can be used by system headers. */
+#undef __PROTOTYPES
+
/* Win32 Std C name mangling work-around */
#undef snprintf
diff --git a/configure.in b/configure.in
index 07d6fa50..77771c03 100644
--- a/configure.in
+++ b/configure.in
@@ -326,6 +326,7 @@ PYTHON=
PYTHON_VERSION=
PYTHON_INCLUDES=
PYTHON_SITE_PACKAGES=
+PYTHON_TESTS=
pythondir=
AC_ARG_WITH(python,
[ --with-python[[=DIR]] build Python bindings if found])
@@ -954,6 +955,9 @@ else
echo "Enabled Schemas/Relax-NG support"
WITH_SCHEMAS=1
TEST_SCHEMAS="Schemastests Relaxtests"
+ if test "$PYTHON_INCLUDES" != "" ; then
+ PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
+ fi
with_regexps=yes
fi
AC_SUBST(WITH_SCHEMAS)
@@ -1049,6 +1053,7 @@ AC_SUBST(RDL_LIBS)
dnl for the spec file
RELDATE=`date +'%a %b %e %Y'`
AC_SUBST(RELDATE)
+AC_SUBST(PYTHON_TESTS)
rm -f COPYING.LIB COPYING
ln -s Copyright COPYING
diff --git a/relaxng.c b/relaxng.c
index 92924974..1fd46e91 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -2501,7 +2501,7 @@ xmlRelaxNGSchemaFacetCheck(void *data ATTRIBUTE_UNUSED,
xmlSchemaFreeFacet(facet);
return (-1);
}
- facet->value = xmlStrdup(val);
+ facet->value = val;
ret = xmlSchemaCheckFacet(facet, typ, NULL, type);
if (ret != 0) {
xmlSchemaFreeFacet(facet);
@@ -6871,6 +6871,7 @@ xmlRelaxNGCleanupTree(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr root)
xmlChar *href, *ns, *base, *URL;
xmlRelaxNGDocumentPtr docu;
xmlNodePtr tmp;
+ xmlURIPtr uri;
ns = xmlGetProp(cur, BAD_CAST "ns");
if (ns == NULL) {
@@ -6891,6 +6892,27 @@ xmlRelaxNGCleanupTree(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr root)
delete = cur;
goto skip_children;
}
+ uri = xmlParseURI((const char *) href);
+ if (uri == NULL) {
+ xmlRngPErr(ctxt, cur, XML_RNGP_HREF_ERROR,
+ "Incorrect URI for externalRef %s\n",
+ href, NULL);
+ if (href != NULL)
+ xmlFree(href);
+ delete = cur;
+ goto skip_children;
+ }
+ if (uri->fragment != NULL) {
+ xmlRngPErr(ctxt, cur, XML_RNGP_HREF_ERROR,
+ "Fragment forbidden in URI for externalRef %s\n",
+ href, NULL);
+ xmlFreeURI(uri);
+ if (href != NULL)
+ xmlFree(href);
+ delete = cur;
+ goto skip_children;
+ }
+ xmlFreeURI(uri);
base = xmlNodeGetBase(cur->doc, cur);
URL = xmlBuildURI(href, base);
if (URL == NULL) {