VirtualBox

source: vbox/trunk/src/libs/libxml2-2.9.2/python/tests/tstmem.py@ 58072

Last change on this file since 58072 was 58072, checked in by vboxsync, 9 years ago

libxml 2.9.2 unmodified

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 720 bytes
Line 
1#!/usr/bin/python -u
2import libxml2
3import libxml2mod
4import sys
5
6def error(msg, data):
7 pass
8
9# Memory debug specific
10libxml2.debugMemory(1)
11
12dtd="""<!ELEMENT foo EMPTY>"""
13instance="""<?xml version="1.0"?>
14<foo></foo>"""
15
16dtd = libxml2.parseDTD(None, 'test.dtd')
17ctxt = libxml2.newValidCtxt()
18libxml2mod.xmlSetValidErrors(ctxt._o, error, error)
19doc = libxml2.parseDoc(instance)
20ret = doc.validateDtd(ctxt, dtd)
21if ret != 1:
22 print("error doing DTD validation")
23 sys.exit(1)
24
25doc.freeDoc()
26dtd.freeDtd()
27del dtd
28del ctxt
29
30# Memory debug specific
31libxml2.cleanupParser()
32if libxml2.debugMemory(1) == 0:
33 print("OK")
34else:
35 print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
36 libxml2.dumpMemory()
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette