Last change
on this file since 95312 was 95312, checked in by vboxsync, 3 years ago |
libs/{curl,libxml2}: OSE export fixes, bugref:8515
|
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
797 bytes
|
Line | |
---|
1 | #!/usr/bin/python -u
|
---|
2 | import libxml2
|
---|
3 |
|
---|
4 | try:
|
---|
5 | import libxml2mod
|
---|
6 | except ModuleNotFoundError:
|
---|
7 | from libxmlmods import libxml2mod
|
---|
8 |
|
---|
9 | import sys
|
---|
10 |
|
---|
11 | def error(msg, data):
|
---|
12 | pass
|
---|
13 |
|
---|
14 | # Memory debug specific
|
---|
15 | libxml2.debugMemory(1)
|
---|
16 |
|
---|
17 | dtd="""<!ELEMENT foo EMPTY>"""
|
---|
18 | instance="""<?xml version="1.0"?>
|
---|
19 | <foo></foo>"""
|
---|
20 |
|
---|
21 | dtd = libxml2.parseDTD(None, 'test.dtd')
|
---|
22 | ctxt = libxml2.newValidCtxt()
|
---|
23 | libxml2mod.xmlSetValidErrors(ctxt._o, error, error)
|
---|
24 | doc = libxml2.parseDoc(instance)
|
---|
25 | ret = doc.validateDtd(ctxt, dtd)
|
---|
26 | if ret != 1:
|
---|
27 | print("error doing DTD validation")
|
---|
28 | sys.exit(1)
|
---|
29 |
|
---|
30 | doc.freeDoc()
|
---|
31 | dtd.freeDtd()
|
---|
32 | del dtd
|
---|
33 | del ctxt
|
---|
34 |
|
---|
35 | # Memory debug specific
|
---|
36 | libxml2.cleanupParser()
|
---|
37 | if libxml2.debugMemory(1) == 0:
|
---|
38 | print("OK")
|
---|
39 | else:
|
---|
40 | print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
|
---|
41 | libxml2.dumpMemory()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.