Last change
on this file since 97865 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:
1.2 KB
|
Line | |
---|
1 | #!/usr/bin/python
|
---|
2 | import sys, libxml2
|
---|
3 |
|
---|
4 | libxml2.debugMemory(True)
|
---|
5 |
|
---|
6 | expect="""--> Invalid expression
|
---|
7 | --> Invalid expression
|
---|
8 | --> Invalid expression
|
---|
9 | --> Invalid expression
|
---|
10 | --> Invalid expression
|
---|
11 | --> Invalid expression
|
---|
12 | --> Invalid expression
|
---|
13 | --> Invalid expression
|
---|
14 | --> Invalid expression
|
---|
15 | --> Invalid expression
|
---|
16 | """
|
---|
17 | err=""
|
---|
18 | def callback(ctx, str):
|
---|
19 | global err
|
---|
20 |
|
---|
21 | err = err + "%s %s" % (ctx, str)
|
---|
22 |
|
---|
23 | libxml2.registerErrorHandler(callback, "-->")
|
---|
24 |
|
---|
25 | doc = libxml2.parseDoc("<fish/>")
|
---|
26 | ctxt = doc.xpathNewContext()
|
---|
27 | ctxt.setContextNode(doc)
|
---|
28 | badexprs = (
|
---|
29 | ":false()", "bad:()", "bad(:)", ":bad(:)", "bad:(:)", "bad:bad(:)",
|
---|
30 | "a:/b", "/c:/d", "//e:/f", "g://h"
|
---|
31 | )
|
---|
32 | for expr in badexprs:
|
---|
33 | try:
|
---|
34 | ctxt.xpathEval(expr)
|
---|
35 | except libxml2.xpathError:
|
---|
36 | pass
|
---|
37 | else:
|
---|
38 | print("Unexpectedly legal expression:", expr)
|
---|
39 | ctxt.xpathFreeContext()
|
---|
40 | doc.freeDoc()
|
---|
41 |
|
---|
42 | if err != expect:
|
---|
43 | print("error")
|
---|
44 | print("received %s" %(err))
|
---|
45 | print("expected %s" %(expect))
|
---|
46 | sys.exit(1)
|
---|
47 |
|
---|
48 | libxml2.cleanupParser()
|
---|
49 | leakedbytes = libxml2.debugMemory(True)
|
---|
50 | if leakedbytes == 0:
|
---|
51 | print("OK")
|
---|
52 | else:
|
---|
53 | print("Memory leak", leakedbytes, "bytes")
|
---|
54 | # drop file to .memdump file in cwd, but won't work if not compiled in
|
---|
55 | libxml2.dumpMemory()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.