diff options
author | Mike Hommey <mh@glandium.org> | 2004-09-10 05:26:00 +0000 |
---|---|---|
committer | Mike Hommey <mh@glandium.org> | 2004-09-10 05:26:00 +0000 |
commit | 09deb06614c3408ec0816a3c88920138bae2083c (patch) | |
tree | a1b841a7dc28eecb98ca361c9371ecd1449a1908 /python/tests | |
parent | c14c53a3645d81281058d4bb4cff24fa8d6faf33 (diff) | |
download | libxml2-09deb06614c3408ec0816a3c88920138bae2083c.tar.gz |
Load /tmp/tmp.BmUFjT/libxml2-2.6.13 intoupstream/2.6.13
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/Makefile.am | 3 | ||||
-rw-r--r-- | python/tests/Makefile.in | 7 | ||||
-rwxr-xr-x | python/tests/schema.py | 52 |
3 files changed, 60 insertions, 2 deletions
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 259a1bf..722e0ec 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -32,6 +32,7 @@ PYTESTS= \ ctxterror.py\ readererr.py\ relaxng.py \ + schema.py \ thread2.py \ sync.py \ tstLastError.py \ @@ -46,7 +47,7 @@ EXTRA_DIST = $(PYTESTS) $(XMLS) if WITH_PYTHON tests: $(PYTESTS) - echo "## running Python regression tests" + @echo "## running Python regression tests" -@(PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; \ export PYTHONPATH; \ for test in $(PYTESTS) ; \ diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in index f5e50ec..dfef491 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -69,6 +69,8 @@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ +CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ +CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@ DEBUG_OBJ = @DEBUG_OBJ@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -101,6 +103,7 @@ LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@ LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@ LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@ LIBXML_VERSION = @LIBXML_VERSION@ +LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@ LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@ LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@ LN_S = @LN_S@ @@ -118,6 +121,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PATTERN_TEST = @PATTERN_TEST@ +PERL = @PERL@ PYTHON = @PYTHON@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@ @@ -274,6 +278,7 @@ PYTESTS = \ ctxterror.py\ readererr.py\ relaxng.py \ + schema.py \ thread2.py \ sync.py \ tstLastError.py \ @@ -445,7 +450,7 @@ uninstall-am: uninstall-info-am @WITH_PYTHON_TRUE@tests: $(PYTESTS) -@WITH_PYTHON_TRUE@ echo "## running Python regression tests" +@WITH_PYTHON_TRUE@ @echo "## running Python regression tests" @WITH_PYTHON_TRUE@ -@(PYTHONPATH="..:../.libs:$(srcdir)/..:$$PYTHONPATH" ; \ @WITH_PYTHON_TRUE@ export PYTHONPATH; \ @WITH_PYTHON_TRUE@ for test in $(PYTESTS) ; \ diff --git a/python/tests/schema.py b/python/tests/schema.py new file mode 100755 index 0000000..bfa8423 --- /dev/null +++ b/python/tests/schema.py @@ -0,0 +1,52 @@ +#!/usr/bin/python -u +import libxml2 +import sys + +# Memory debug specific +libxml2.debugMemory(1) + +schema="""<?xml version="1.0" encoding="iso-8859-1"?> +<schema xmlns = "http://www.w3.org/2001/XMLSchema"> + <element name = "Customer"> + <complexType> + <sequence> + <element name = "FirstName" type = "string" /> + <element name = "MiddleInitial" type = "string" /> + <element name = "LastName" type = "string" /> + </sequence> + <attribute name = "customerID" type = "integer" /> + </complexType> + </element> +</schema>""" + +instance="""<?xml version="1.0" encoding="iso-8859-1"?> +<Customer customerID = "24332"> + <FirstName>Raymond</FirstName> + <MiddleInitial>G</MiddleInitial> + <LastName>Bayliss</LastName> +</Customer> +""" + +ctxt_parser = libxml2.schemaNewMemParserCtxt(schema, len(schema)) +ctxt_schema = ctxt_parser.schemaParse() +ctxt_valid = ctxt_schema.schemaNewValidCtxt() +doc = libxml2.parseDoc(instance) +ret = doc.schemaValidateDoc(ctxt_valid) +if ret != 0: + print "error doing schema validation" + sys.exit(1) + +doc.freeDoc() +del ctxt_parser +del ctxt_schema +del ctxt_valid +libxml2.schemaCleanupTypes() + +# Memory debug specific +libxml2.cleanupParser() +if libxml2.debugMemory(1) == 0: + print "OK" +else: + print "Memory leak %d bytes" % (libxml2.debugMemory(1)) + libxml2.dumpMemory() + |