libxml2: upgrade 2.9.14 -> 2.10.3

Change ptest away from using the upstream Makefiles to manually running
the tests: they're not actually integrated with automake anyway so this
didn't gain us anything apart from patches we can't send upstream. Drops
the following patches:
- 0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch
- 0001-Port-gentest.py-to-Python-3.patch
- fix-execution-of-ptests.patch
- remove-fuzz-from-ptests.patch
- runtest.patch

Add a simple patch to install the test binaries via the Makefile:
- install-tests.patch

The Python module is built differently and a number of patches no longer
apply and appear to be redundant, remove:
- python-sitepackages-dir.patch

libxml-m4-use-pkgconfig.patch has been sent upstream now, mark as
backport.

Remove obsolete --without-docbook option.

Remove obsolete xml2Conf.sh packaging.

(From OE-Core rev: ec5f380a14246e31b2a1a12dda9fe2178b1e5f83)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton 2022-12-07 16:57:55 +00:00 committed by Richard Purdie
parent 85ec78cc24
commit f4ffba353e
10 changed files with 72 additions and 1930 deletions

View File

@ -1,86 +0,0 @@
From ea1993d1d9a18c5e61b9cb271892b0a48f508d32 Mon Sep 17 00:00:00 2001
From: Peter Kjellerstedt <pkj@axis.com>
Date: Fri, 9 Jun 2017 17:50:46 +0200
Subject: [PATCH] Make ptest run the python tests if python is enabled
One of the tests (tstLastError.py) needed a minor correction. It might
be due to the fact that the tests are forced to run with Python 3.
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
Makefile.am | 2 +-
python/Makefile.am | 9 +++++++++
python/tests/Makefile.am | 10 ++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index b428452b..dc18d6dd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -203,9 +203,9 @@ install-ptest:
install $(check_PROGRAMS) $(DESTDIR))
cp -r $(srcdir)/test $(DESTDIR)
cp -r $(srcdir)/result $(DESTDIR)
- cp -r $(srcdir)/python $(DESTDIR)
cp Makefile $(DESTDIR)
sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
+ $(MAKE) -C python install-ptest
runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
diff --git a/python/Makefile.am b/python/Makefile.am
index 34aed96c..ba3ec6a4 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -48,7 +48,16 @@ GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES)
$(GENERATED): $(srcdir)/generator.py $(API_DESC)
$(PYTHON) $(srcdir)/generator.py $(srcdir)
+
+install-ptest:
+ cp -r $(srcdir) $(DESTDIR)
+ sed -e 's|^Makefile:|_Makefile:|' \
+ -e 's|^\(tests test:\) all|\1|' Makefile >$(DESTDIR)/python/Makefile
+ $(MAKE) -C tests install-ptest
+else
+install-ptest:
endif
+.PHONY: tests test
tests test: all
cd tests && $(MAKE) tests
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index 227e24df..3568c2d2 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -59,6 +59,11 @@ XMLS= \
CLEANFILES = core tmp.xml *.pyc
if WITH_PYTHON
+install-ptest:
+ cp -r $(srcdir) $(DESTDIR)/python
+ sed -e 's|^Makefile:|_Makefile:|' \
+ -e 's|^\(srcdir = \).*|\1.|' Makefile >$(DESTDIR)/python/tests/Makefile
+
tests: $(PYTESTS)
@for f in $(XMLS) ; do test -f $$f || $(LN_S) $(srcdir)/$$f . ; done
@echo "## running Python regression tests"
@@ -70,9 +75,14 @@ tests: $(PYTESTS)
if [ "$$?" -ne 0 ] ; then \
echo "-- $$test" ; \
echo "$$log" ; \
+ echo "FAIL: $$test"; \
exit 1 ; \
+ else \
+ echo "PASS: $$test"; \
fi ; \
done)
else
+install-ptest:
+
tests:
endif
--
2.25.1

View File

@ -1,814 +0,0 @@
From 2c20198b1ddb1bfb47269b8caf929ffb83748f78 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Thu, 21 Apr 2022 00:45:58 +0200
Subject: [PATCH] Port gentest.py to Python 3
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/343fc1421cdae097fa6c4cffeb1a065a40be6bbb]
* fixes:
make[1]: 'testReader' is up to date.
File "../libxml2-2.9.10/gentest.py", line 11
print "libxml2 python bindings not available, skipping testapi.c generation"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("libxml2 python bindings not available, skipping testapi.c generation")?
make[1]: [Makefile:2078: testapi.c] Error 1 (ignored)
...
make[1]: 'testReader' is up to date.
File "../libxml2-2.9.10/gentest.py", line 271
return 1
^
TabError: inconsistent use of tabs and spaces in indentation
make[1]: [Makefile:2078: testapi.c] Error 1 (ignored)
...
aarch64-oe-linux-gcc: error: testapi.c: No such file or directory
aarch64-oe-linux-gcc: fatal error: no input files
compilation terminated.
make[1]: *** [Makefile:1275: testapi.o] Error 1
But there is still a bit mystery why it worked before, because check-am
calls gentest.py with $(PYTHON), so it ignores the shebang in the script
and libxml2 is using python3native (through python3targetconfig.bbclass)
so something like:
libxml2/2.9.10-r0/recipe-sysroot-native/usr/bin/python3-native/python3 gentest.py
But that still fails (now without SyntaxError) with:
libxml2 python bindings not available, skipping testapi.c generation
because we don't have dependency on libxml2-native (to provide libxml2
python bindings form python3native) and exported PYTHON_SITE_PACKAGES
might be useless (e.g. /usr/lib/python3.8/site-packages on Ubuntu-22.10
which uses python 3.10 and there is no site-packages with libxml2)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
gentest.py | 421 ++++++++++++++++++++++++++---------------------------
1 file changed, 209 insertions(+), 212 deletions(-)
diff --git a/gentest.py b/gentest.py
index b6cd866..af15a4f 100755
--- a/gentest.py
+++ b/gentest.py
@@ -8,7 +8,7 @@ import string
try:
import libxml2
except:
- print "libxml2 python bindings not available, skipping testapi.c generation"
+ print("libxml2 python bindings not available, skipping testapi.c generation")
sys.exit(0)
if len(sys.argv) > 1:
@@ -227,7 +227,7 @@ extra_post_call = {
if (old != NULL) {
xmlUnlinkNode(old);
xmlFreeNode(old) ; old = NULL ; }
- ret_val = NULL;""",
+\t ret_val = NULL;""",
"xmlTextMerge":
"""if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
xmlUnlinkNode(second);
@@ -236,7 +236,7 @@ extra_post_call = {
"""if ((ret_val != NULL) && (ret_val != ncname) &&
(ret_val != prefix) && (ret_val != memory))
xmlFree(ret_val);
- ret_val = NULL;""",
+\t ret_val = NULL;""",
"xmlNewDocElementContent":
"""xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""",
"xmlDictReference": "xmlDictFree(dict);",
@@ -268,29 +268,29 @@ modules = []
def is_skipped_module(name):
for mod in skipped_modules:
if mod == name:
- return 1
+ return 1
return 0
def is_skipped_function(name):
for fun in skipped_functions:
if fun == name:
- return 1
+ return 1
# Do not test destructors
- if string.find(name, 'Free') != -1:
+ if name.find('Free') != -1:
return 1
return 0
def is_skipped_memcheck(name):
for fun in skipped_memcheck:
if fun == name:
- return 1
+ return 1
return 0
missing_types = {}
def add_missing_type(name, func):
try:
list = missing_types[name]
- list.append(func)
+ list.append(func)
except:
missing_types[name] = [func]
@@ -310,7 +310,7 @@ def add_missing_functions(name, module):
missing_functions_nr = missing_functions_nr + 1
try:
list = missing_functions[module]
- list.append(name)
+ list.append(name)
except:
missing_functions[module] = [name]
@@ -319,45 +319,45 @@ def add_missing_functions(name, module):
#
def type_convert(str, name, info, module, function, pos):
-# res = string.replace(str, " ", " ")
-# res = string.replace(str, " ", " ")
-# res = string.replace(str, " ", " ")
- res = string.replace(str, " *", "_ptr")
-# res = string.replace(str, "*", "_ptr")
- res = string.replace(res, " ", "_")
+# res = str.replace(" ", " ")
+# res = str.replace(" ", " ")
+# res = str.replace(" ", " ")
+ res = str.replace(" *", "_ptr")
+# res = str.replace("*", "_ptr")
+ res = res.replace(" ", "_")
if res == 'const_char_ptr':
- if string.find(name, "file") != -1 or \
- string.find(name, "uri") != -1 or \
- string.find(name, "URI") != -1 or \
- string.find(info, "filename") != -1 or \
- string.find(info, "URI") != -1 or \
- string.find(info, "URL") != -1:
- if string.find(function, "Save") != -1 or \
- string.find(function, "Create") != -1 or \
- string.find(function, "Write") != -1 or \
- string.find(function, "Fetch") != -1:
- return('fileoutput')
- return('filepath')
+ if name.find("file") != -1 or \
+ name.find("uri") != -1 or \
+ name.find("URI") != -1 or \
+ info.find("filename") != -1 or \
+ info.find("URI") != -1 or \
+ info.find("URL") != -1:
+ if function.find("Save") != -1 or \
+ function.find("Create") != -1 or \
+ function.find("Write") != -1 or \
+ function.find("Fetch") != -1:
+ return('fileoutput')
+ return('filepath')
if res == 'void_ptr':
if module == 'nanoftp' and name == 'ctx':
- return('xmlNanoFTPCtxtPtr')
+ return('xmlNanoFTPCtxtPtr')
if function == 'xmlNanoFTPNewCtxt' or \
- function == 'xmlNanoFTPConnectTo' or \
- function == 'xmlNanoFTPOpen':
- return('xmlNanoFTPCtxtPtr')
+ function == 'xmlNanoFTPConnectTo' or \
+ function == 'xmlNanoFTPOpen':
+ return('xmlNanoFTPCtxtPtr')
if module == 'nanohttp' and name == 'ctx':
- return('xmlNanoHTTPCtxtPtr')
- if function == 'xmlNanoHTTPMethod' or \
- function == 'xmlNanoHTTPMethodRedir' or \
- function == 'xmlNanoHTTPOpen' or \
- function == 'xmlNanoHTTPOpenRedir':
- return('xmlNanoHTTPCtxtPtr');
+ return('xmlNanoHTTPCtxtPtr')
+ if function == 'xmlNanoHTTPMethod' or \
+ function == 'xmlNanoHTTPMethodRedir' or \
+ function == 'xmlNanoHTTPOpen' or \
+ function == 'xmlNanoHTTPOpenRedir':
+ return('xmlNanoHTTPCtxtPtr');
if function == 'xmlIOHTTPOpen':
- return('xmlNanoHTTPCtxtPtr')
- if string.find(name, "data") != -1:
- return('userdata')
- if string.find(name, "user") != -1:
- return('userdata')
+ return('xmlNanoHTTPCtxtPtr')
+ if name.find("data") != -1:
+ return('userdata')
+ if name.find("user") != -1:
+ return('userdata')
if res == 'xmlDoc_ptr':
res = 'xmlDocPtr'
if res == 'xmlNode_ptr':
@@ -366,18 +366,18 @@ def type_convert(str, name, info, module, function, pos):
res = 'xmlDictPtr'
if res == 'xmlNodePtr' and pos != 0:
if (function == 'xmlAddChild' and pos == 2) or \
- (function == 'xmlAddChildList' and pos == 2) or \
+ (function == 'xmlAddChildList' and pos == 2) or \
(function == 'xmlAddNextSibling' and pos == 2) or \
(function == 'xmlAddSibling' and pos == 2) or \
(function == 'xmlDocSetRootElement' and pos == 2) or \
(function == 'xmlReplaceNode' and pos == 2) or \
(function == 'xmlTextMerge') or \
- (function == 'xmlAddPrevSibling' and pos == 2):
- return('xmlNodePtr_in');
+ (function == 'xmlAddPrevSibling' and pos == 2):
+ return('xmlNodePtr_in');
if res == 'const xmlBufferPtr':
res = 'xmlBufferPtr'
if res == 'xmlChar_ptr' and name == 'name' and \
- string.find(function, "EatName") != -1:
+ function.find("EatName") != -1:
return('eaten_name')
if res == 'void_ptr*':
res = 'void_ptr_ptr'
@@ -393,7 +393,7 @@ def type_convert(str, name, info, module, function, pos):
res = 'debug_FILE_ptr';
if res == 'int' and name == 'options':
if module == 'parser' or module == 'xmlreader':
- res = 'parseroptions'
+ res = 'parseroptions'
return res
@@ -402,28 +402,28 @@ known_param_types = []
def is_known_param_type(name):
for type in known_param_types:
if type == name:
- return 1
+ return 1
return name[-3:] == 'Ptr' or name[-4:] == '_ptr'
def generate_param_type(name, rtype):
global test
for type in known_param_types:
if type == name:
- return
+ return
for type in generated_param_types:
if type == name:
- return
+ return
if name[-3:] == 'Ptr' or name[-4:] == '_ptr':
if rtype[0:6] == 'const ':
- crtype = rtype[6:]
- else:
- crtype = rtype
+ crtype = rtype[6:]
+ else:
+ crtype = rtype
define = 0
- if modules_defines.has_key(module):
- test.write("#ifdef %s\n" % (modules_defines[module]))
- define = 1
+ if module in modules_defines:
+ test.write("#ifdef %s\n" % (modules_defines[module]))
+ define = 1
test.write("""
#define gen_nb_%s 1
static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
@@ -433,7 +433,7 @@ static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTR
}
""" % (name, crtype, name, name, rtype))
if define == 1:
- test.write("#endif\n\n")
+ test.write("#endif\n\n")
add_generated_param_type(name)
#
@@ -445,7 +445,7 @@ known_return_types = []
def is_known_return_type(name):
for type in known_return_types:
if type == name:
- return 1
+ return 1
return 0
#
@@ -471,7 +471,7 @@ def compare_and_save():
try:
os.system("rm testapi.c; mv testapi.c.new testapi.c")
except:
- os.system("mv testapi.c.new testapi.c")
+ os.system("mv testapi.c.new testapi.c")
print("Updated testapi.c")
else:
print("Generated testapi.c is identical")
@@ -481,17 +481,17 @@ while line != "":
if line == "/* CUT HERE: everything below that line is generated */\n":
break;
if line[0:15] == "#define gen_nb_":
- type = string.split(line[15:])[0]
- known_param_types.append(type)
+ type = line[15:].split()[0]
+ known_param_types.append(type)
if line[0:19] == "static void desret_":
- type = string.split(line[19:], '(')[0]
- known_return_types.append(type)
+ type = line[19:].split('(')[0]
+ known_return_types.append(type)
test.write(line)
line = input.readline()
input.close()
if line == "":
- print "Could not find the CUT marker in testapi.c skipping generation"
+ print("Could not find the CUT marker in testapi.c skipping generation")
test.close()
sys.exit(0)
@@ -505,7 +505,7 @@ test.write("/* CUT HERE: everything below that line is generated */\n")
#
doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0)
if doc == None:
- print "Failed to load doc/libxml2-api.xml"
+ print("Failed to load doc/libxml2-api.xml")
sys.exit(1)
ctxt = doc.xpathNewContext()
@@ -519,9 +519,9 @@ for arg in args:
mod = arg.xpathEval('string(../@file)')
func = arg.xpathEval('string(../@name)')
if (mod not in skipped_modules) and (func not in skipped_functions):
- type = arg.xpathEval('string(@type)')
- if not argtypes.has_key(type):
- argtypes[type] = func
+ type = arg.xpathEval('string(@type)')
+ if type not in argtypes:
+ argtypes[type] = func
# similarly for return types
rettypes = {}
@@ -531,8 +531,8 @@ for ret in rets:
func = ret.xpathEval('string(../@name)')
if (mod not in skipped_modules) and (func not in skipped_functions):
type = ret.xpathEval('string(@type)')
- if not rettypes.has_key(type):
- rettypes[type] = func
+ if type not in rettypes:
+ rettypes[type] = func
#
# Generate constructors and return type handling for all enums
@@ -549,49 +549,49 @@ for enum in enums:
continue;
define = 0
- if argtypes.has_key(name) and is_known_param_type(name) == 0:
- values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name)
- i = 0
- vals = []
- for value in values:
- vname = value.xpathEval('string(@name)')
- if vname == None:
- continue;
- i = i + 1
- if i >= 5:
- break;
- vals.append(vname)
- if vals == []:
- print "Didn't find any value for enum %s" % (name)
- continue
- if modules_defines.has_key(module):
- test.write("#ifdef %s\n" % (modules_defines[module]))
- define = 1
- test.write("#define gen_nb_%s %d\n" % (name, len(vals)))
- test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" %
- (name, name))
- i = 1
- for value in vals:
- test.write(" if (no == %d) return(%s);\n" % (i, value))
- i = i + 1
- test.write(""" return(0);
+ if (name in argtypes) and is_known_param_type(name) == 0:
+ values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name)
+ i = 0
+ vals = []
+ for value in values:
+ vname = value.xpathEval('string(@name)')
+ if vname == None:
+ continue;
+ i = i + 1
+ if i >= 5:
+ break;
+ vals.append(vname)
+ if vals == []:
+ print("Didn't find any value for enum %s" % (name))
+ continue
+ if module in modules_defines:
+ test.write("#ifdef %s\n" % (modules_defines[module]))
+ define = 1
+ test.write("#define gen_nb_%s %d\n" % (name, len(vals)))
+ test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" %
+ (name, name))
+ i = 1
+ for value in vals:
+ test.write(" if (no == %d) return(%s);\n" % (i, value))
+ i = i + 1
+ test.write(""" return(0);
}
static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
""" % (name, name));
- known_param_types.append(name)
+ known_param_types.append(name)
if (is_known_return_type(name) == 0) and (name in rettypes):
- if define == 0 and modules_defines.has_key(module):
- test.write("#ifdef %s\n" % (modules_defines[module]))
- define = 1
+ if define == 0 and (module in modules_defines):
+ test.write("#ifdef %s\n" % (modules_defines[module]))
+ define = 1
test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) {
}
""" % (name, name))
- known_return_types.append(name)
+ known_return_types.append(name)
if define == 1:
test.write("#endif\n\n")
@@ -615,9 +615,9 @@ for file in headers:
# do not test deprecated APIs
#
desc = file.xpathEval('string(description)')
- if string.find(desc, 'DEPRECATED') != -1:
- print "Skipping deprecated interface %s" % name
- continue;
+ if desc.find('DEPRECATED') != -1:
+ print("Skipping deprecated interface %s" % name)
+ continue;
test.write("#include <libxml/%s.h>\n" % name)
modules.append(name)
@@ -679,7 +679,7 @@ def generate_test(module, node):
# and store the information for the generation
#
try:
- args = node.xpathEval("arg")
+ args = node.xpathEval("arg")
except:
args = []
t_args = []
@@ -687,37 +687,37 @@ def generate_test(module, node):
for arg in args:
n = n + 1
rtype = arg.xpathEval("string(@type)")
- if rtype == 'void':
- break;
- info = arg.xpathEval("string(@info)")
- nam = arg.xpathEval("string(@name)")
+ if rtype == 'void':
+ break;
+ info = arg.xpathEval("string(@info)")
+ nam = arg.xpathEval("string(@name)")
type = type_convert(rtype, nam, info, module, name, n)
- if is_known_param_type(type) == 0:
- add_missing_type(type, name);
- no_gen = 1
+ if is_known_param_type(type) == 0:
+ add_missing_type(type, name);
+ no_gen = 1
if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
- rtype[0:6] == 'const ':
- crtype = rtype[6:]
- else:
- crtype = rtype
- t_args.append((nam, type, rtype, crtype, info))
+ rtype[0:6] == 'const ':
+ crtype = rtype[6:]
+ else:
+ crtype = rtype
+ t_args.append((nam, type, rtype, crtype, info))
try:
- rets = node.xpathEval("return")
+ rets = node.xpathEval("return")
except:
rets = []
t_ret = None
for ret in rets:
rtype = ret.xpathEval("string(@type)")
- info = ret.xpathEval("string(@info)")
+ info = ret.xpathEval("string(@info)")
type = type_convert(rtype, 'return', info, module, name, 0)
- if rtype == 'void':
- break
- if is_known_return_type(type) == 0:
- add_missing_type(type, name);
- no_gen = 1
- t_ret = (type, rtype, info)
- break
+ if rtype == 'void':
+ break
+ if is_known_return_type(type) == 0:
+ add_missing_type(type, name);
+ no_gen = 1
+ t_ret = (type, rtype, info)
+ break
if no_gen == 0:
for t_arg in t_args:
@@ -733,7 +733,7 @@ test_%s(void) {
if no_gen == 1:
add_missing_functions(name, module)
- test.write("""
+ test.write("""
/* missing type support */
return(test_ret);
}
@@ -742,22 +742,22 @@ test_%s(void) {
return
try:
- conds = node.xpathEval("cond")
- for cond in conds:
- test.write("#if %s\n" % (cond.get_content()))
- nb_cond = nb_cond + 1
+ conds = node.xpathEval("cond")
+ for cond in conds:
+ test.write("#if %s\n" % (cond.get_content()))
+ nb_cond = nb_cond + 1
except:
pass
define = 0
- if function_defines.has_key(name):
+ if name in function_defines:
test.write("#ifdef %s\n" % (function_defines[name]))
- define = 1
+ define = 1
# Declare the memory usage counter
no_mem = is_skipped_memcheck(name)
if no_mem == 0:
- test.write(" int mem_base;\n");
+ test.write(" int mem_base;\n");
# Declare the return value
if t_ret != None:
@@ -766,29 +766,29 @@ test_%s(void) {
# Declare the arguments
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
- # add declaration
- test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
- test.write(" int n_%s;\n" % (nam))
+ # add declaration
+ test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
+ test.write(" int n_%s;\n" % (nam))
test.write("\n")
# Cascade loop on of each argument list of values
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
- #
- test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
- nam, nam, type, nam))
+ #
+ test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
+ nam, nam, type, nam))
# log the memory usage
if no_mem == 0:
- test.write(" mem_base = xmlMemBlocks();\n");
+ test.write(" mem_base = xmlMemBlocks();\n");
# prepare the call
i = 0;
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
- #
- test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
- i = i + 1;
+ #
+ test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
+ i = i + 1;
# add checks to avoid out-of-bounds array access
i = 0;
@@ -797,7 +797,7 @@ test_%s(void) {
# assume that "size", "len", and "start" parameters apply to either
# the nearest preceding or following char pointer
if type == "int" and (nam == "size" or nam == "len" or nam == "start"):
- for j in range(i - 1, -1, -1) + range(i + 1, len(t_args)):
+ for j in (*range(i - 1, -1, -1), *range(i + 1, len(t_args))):
(bnam, btype) = t_args[j][:2]
if btype == "const_char_ptr" or btype == "const_xmlChar_ptr":
test.write(
@@ -806,42 +806,42 @@ test_%s(void) {
" continue;\n"
% (bnam, nam, bnam))
break
- i = i + 1;
+ i = i + 1;
# do the call, and clanup the result
- if extra_pre_call.has_key(name):
- test.write(" %s\n"% (extra_pre_call[name]))
+ if name in extra_pre_call:
+ test.write(" %s\n"% (extra_pre_call[name]))
if t_ret != None:
- test.write("\n ret_val = %s(" % (name))
- need = 0
- for arg in t_args:
- (nam, type, rtype, crtype, info) = arg
- if need:
- test.write(", ")
- else:
- need = 1
- if rtype != crtype:
- test.write("(%s)" % rtype)
- test.write("%s" % nam);
- test.write(");\n")
- if extra_post_call.has_key(name):
- test.write(" %s\n"% (extra_post_call[name]))
- test.write(" desret_%s(ret_val);\n" % t_ret[0])
+ test.write("\n ret_val = %s(" % (name))
+ need = 0
+ for arg in t_args:
+ (nam, type, rtype, crtype, info) = arg
+ if need:
+ test.write(", ")
+ else:
+ need = 1
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
+ test.write("%s" % nam);
+ test.write(");\n")
+ if name in extra_post_call:
+ test.write(" %s\n"% (extra_post_call[name]))
+ test.write(" desret_%s(ret_val);\n" % t_ret[0])
else:
- test.write("\n %s(" % (name));
- need = 0;
- for arg in t_args:
- (nam, type, rtype, crtype, info) = arg;
- if need:
- test.write(", ")
- else:
- need = 1
- if rtype != crtype:
- test.write("(%s)" % rtype)
- test.write("%s" % nam)
- test.write(");\n")
- if extra_post_call.has_key(name):
- test.write(" %s\n"% (extra_post_call[name]))
+ test.write("\n %s(" % (name));
+ need = 0;
+ for arg in t_args:
+ (nam, type, rtype, crtype, info) = arg;
+ if need:
+ test.write(", ")
+ else:
+ need = 1
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
+ test.write("%s" % nam)
+ test.write(");\n")
+ if name in extra_post_call:
+ test.write(" %s\n"% (extra_post_call[name]))
test.write(" call_tests++;\n");
@@ -849,32 +849,32 @@ test_%s(void) {
i = 0;
for arg in t_args:
(nam, type, rtype, crtype, info) = arg;
- # This is a hack to prevent generating a destructor for the
- # 'input' argument in xmlTextReaderSetup. There should be
- # a better, more generic way to do this!
- if string.find(info, 'destroy') == -1:
- test.write(" des_%s(n_%s, " % (type, nam))
- if rtype != crtype:
- test.write("(%s)" % rtype)
- test.write("%s, %d);\n" % (nam, i))
- i = i + 1;
+ # This is a hack to prevent generating a destructor for the
+ # 'input' argument in xmlTextReaderSetup. There should be
+ # a better, more generic way to do this!
+ if info.find('destroy') == -1:
+ test.write(" des_%s(n_%s, " % (type, nam))
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
+ test.write("%s, %d);\n" % (nam, i))
+ i = i + 1;
test.write(" xmlResetLastError();\n");
# Check the memory usage
if no_mem == 0:
- test.write(""" if (mem_base != xmlMemBlocks()) {
+ test.write(""" if (mem_base != xmlMemBlocks()) {
printf("Leak of %%d blocks found in %s",
- xmlMemBlocks() - mem_base);
- test_ret++;
+\t xmlMemBlocks() - mem_base);
+\t test_ret++;
""" % (name));
- for arg in t_args:
- (nam, type, rtype, crtype, info) = arg;
- test.write(""" printf(" %%d", n_%s);\n""" % (nam))
- test.write(""" printf("\\n");\n""")
- test.write(" }\n")
+ for arg in t_args:
+ (nam, type, rtype, crtype, info) = arg;
+ test.write(""" printf(" %%d", n_%s);\n""" % (nam))
+ test.write(""" printf("\\n");\n""")
+ test.write(" }\n")
for arg in t_args:
- test.write(" }\n")
+ test.write(" }\n")
test.write(" function_tests++;\n")
#
@@ -882,7 +882,7 @@ test_%s(void) {
#
while nb_cond > 0:
test.write("#endif\n")
- nb_cond = nb_cond -1
+ nb_cond = nb_cond -1
if define == 1:
test.write("#endif\n")
@@ -900,10 +900,10 @@ test_%s(void) {
for module in modules:
# gather all the functions exported by that module
try:
- functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module))
+ functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module))
except:
- print "Failed to gather functions from module %s" % (module)
- continue;
+ print("Failed to gather functions from module %s" % (module))
+ continue;
# iterate over all functions in the module generating the test
i = 0
@@ -923,14 +923,14 @@ test_%s(void) {
# iterate over all functions in the module generating the call
for function in functions:
name = function.xpathEval('string(@name)')
- if is_skipped_function(name):
- continue
- test.write(" test_ret += test_%s();\n" % (name))
+ if is_skipped_function(name):
+ continue
+ test.write(" test_ret += test_%s();\n" % (name))
# footer
test.write("""
if (test_ret != 0)
- printf("Module %s: %%d errors\\n", test_ret);
+\tprintf("Module %s: %%d errors\\n", test_ret);
return(test_ret);
}
""" % (module))
@@ -948,7 +948,7 @@ test.write(""" return(0);
}
""");
-print "Generated test for %d modules and %d functions" %(len(modules), nb_tests)
+print("Generated test for %d modules and %d functions" %(len(modules), nb_tests))
compare_and_save()
@@ -960,11 +960,8 @@ for missing in missing_types.keys():
n = len(missing_types[missing])
missing_list.append((n, missing))
-def compare_missing(a, b):
- return b[0] - a[0]
-
-missing_list.sort(compare_missing)
-print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list))
+missing_list.sort(key=lambda a: a[0])
+print("Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list)))
lst = open("missing.lst", "w")
lst.write("Missing support for %d types" % (len(missing_list)))
lst.write("\n")
@@ -974,9 +971,9 @@ for miss in missing_list:
for n in missing_types[miss[1]]:
i = i + 1
if i > 5:
- lst.write(" ...")
- break
- lst.write(" %s" % (n))
+ lst.write(" ...")
+ break
+ lst.write(" %s" % (n))
lst.write("\n")
lst.write("\n")
lst.write("\n")

View File

@ -1,33 +0,0 @@
From 395c0f53ec226aaabedb166e6b3a7f8590b95a5f Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Sat, 11 May 2019 20:39:15 +0800
Subject: [PATCH] Make sure that Makefile doesn't try to compile these tests
again on the target where the source dependencies won't be available.
Upstream-Status: Inappropriate [cross-compile specific]
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Rebase to 2.9.9
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
Makefile.am | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8f4e43d..5edb930 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -211,8 +211,7 @@ install-ptest:
sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
$(MAKE) -C python install-ptest
-runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
- testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
+runtests:
[ -d test ] || $(LN_S) $(srcdir)/test .
[ -d result ] || $(LN_S) $(srcdir)/result .
$(CHECKER) ./runtest$(EXEEXT) && \
--
2.7.4

View File

@ -0,0 +1,38 @@
Add a target to install the test suite.
Upstream-Status: Inappropriate
Signed-off-by: Ross Burton <ross.burton@arm.com>
From c7809dc6947324ea506a0c2bf132ecd37156f211 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@arm.com>
Date: Mon, 5 Dec 2022 17:02:32 +0000
Subject: [PATCH] add yocto-specific install-ptest target
---
Makefile.am | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index 316109b1..15e100be 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,6 +26,16 @@ check_PROGRAMS = \
testlimits \
testrecurse
+ptestdir=$(libexecdir)
+install-test-data: $(check_PROGRAMS)
+ install -d $(DESTDIR)$(ptestdir) $(DESTDIR)$(ptestdir)/python/
+ for T in $(check_PROGRAMS); do \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$T $(DESTDIR)$(ptestdir) ;\
+ done
+ cp -r $(srcdir)/test $(DESTDIR)$(ptestdir)
+ cp -r $(srcdir)/result $(DESTDIR)$(ptestdir)
+ cp -r $(srcdir)/python/tests $(DESTDIR)$(ptestdir)/python
+
bin_PROGRAMS = xmllint xmlcatalog
nodist_bin_SCRIPTS = xml2-config
--
2.34.1

View File

@ -1,26 +1,8 @@
From 7196bce35954c4b46391cb0139aeb15ed628fa54 Mon Sep 17 00:00:00 2001
From: Tony Tascioglu <tony.tascioglu@windriver.com>
Date: Fri, 14 May 2021 11:50:35 -0400
Subject: [PATCH] AM_PATH_XML2 uses xml-config which we disable through
Change the AM_PATH_XML2 macros to use pkg-config instead of xml2-config.
binconfig-disabled.bbclass, so port it to use pkg-config instead.
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/d598d8af0913b6e3d4e61ffa62397a275b669dca]
Signed-off-by: Ross Burton <ross.burton@arm.com>
This cannot be upstreamed, as the original macro supports various
optional arguments which cannot be supported with a direct call
to pkg-config.
Upstream-Status: Inappropriate [oe-core specific; see above]
Signed-off-by: Ross Burton <ross.burton@intel.com>
Rebase to 2.9.9
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Updated to apply cleanly to v2.9.12
Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
Rebase to 2.9.14
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
---
libxml.m4 | 189 ++----------------------------------------------------
1 file changed, 5 insertions(+), 184 deletions(-)

View File

@ -1,35 +0,0 @@
From b038c3452667ed17ddb0e791cd7bdc7f8774ac29 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Sat, 11 May 2019 20:35:20 +0800
Subject: [PATCH] Allow us to pass in PYTHON_SITE_PACKAGES
The python binary used when building for nativesdk doesn't give us the
correct path here so we need to be able to specify it ourselves.
Upstream-Status: Inappropriate [config]
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Rebase to 2.9.9
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
configure.ac | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index ca911f3..3bbd654 100644
--- a/configure.ac
+++ b/configure.ac
@@ -808,7 +808,8 @@ dnl
PYTHON_VERSION=
PYTHON_INCLUDES=
-PYTHON_SITE_PACKAGES=
+# Allow this to be set externally
+#PYTHON_SITE_PACKAGES=
PYTHON_TESTS=
pythondir=
if test "$with_python" != "no" ; then
--
2.7.4

View File

@ -1,44 +0,0 @@
From e49a0d4a8f3f725d6f683854e1cad36a3cd02962 Mon Sep 17 00:00:00 2001
From: Tony Tascioglu <tony.tascioglu@windriver.com>
Date: Wed, 19 May 2021 19:43:56 -0400
Subject: [PATCH] Remove fuzz testing from executing with ptests.
Upstream version 2.9.12 introduced new fuzz-testing and a corresponding
folder fuzz. These tests are not required for ptests of this package.
This patch removes the fuzz testing targets from the Makefile.
Otherwise, running the ptests will fail due to the invalid directory.
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
---
Makefile.am | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a9284b95..3d7b344d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,9 +2,9 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = include . doc example fuzz xstc $(PYTHON_SUBDIR)
+SUBDIRS = include . doc example xstc $(PYTHON_SUBDIR)
-DIST_SUBDIRS = include . doc example fuzz python xstc
+DIST_SUBDIRS = include . doc example python xstc
AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include
@@ -210,7 +210,6 @@ runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
$(CHECKER) ./runxmlconf$(EXEEXT)
@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
$(MAKE) tests ; fi)
- @cd fuzz; $(MAKE) tests
check: all runtests
--
2.25.1

18
meta/recipes-core/libxml/libxml2/run-ptest Normal file → Executable file
View File

@ -1,4 +1,20 @@
#!/bin/sh
set -e
export LC_ALL=en_US.UTF-8
make -k runtests
# testModule isn't that useful and hard-codes buildtree, so we don't run that
TESTS="runtest testrecurse testchar testdict testThreads runxmlconf testapi"
for T in $TESTS; do
echo Running $T
./$T && echo PASS: $T || echo FAIL: $T
done
if test -d python/tests; then
cd python/tests
for T in *.py; do
python3 ./$T && echo PASS: $T || echo FAIL: $T
done
fi

View File

@ -1,849 +0,0 @@
From 6172ccd1e74bc181f5298f19e240234e12876abe Mon Sep 17 00:00:00 2001
From: Tony Tascioglu <tony.tascioglu@windriver.com>
Date: Tue, 11 May 2021 11:57:46 -0400
Subject: [PATCH] Add 'install-ptest' rule.
Print a standard result line for each test.
The patch needs a rework according to comments in the merge request.
Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Upstream-Status: Inappropriate [https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/137]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
---
Makefile.am | 9 +++
runsuite.c | 1 +
runtest.c | 2 +
runxmlconf.c | 1 +
testapi.c | 122 ++++++++++++++++++++++++++-------------
testchar.c | 156 +++++++++++++++++++++++++++++++++++---------------
testdict.c | 1 +
testlimits.c | 1 +
testrecurse.c | 2 +
9 files changed, 210 insertions(+), 85 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 05d1671f..ae622745 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -198,6 +198,15 @@ runxmlconf_LDADD= $(LDADDS)
#testOOM_DEPENDENCIES = $(DEPS)
#testOOM_LDADD= $(LDADDS)
+install-ptest:
+ @(if [ -d .libs ] ; then cd .libs; fi; \
+ install $(check_PROGRAMS) $(DESTDIR))
+ cp -r $(srcdir)/test $(DESTDIR)
+ cp -r $(srcdir)/result $(DESTDIR)
+ cp -r $(srcdir)/python $(DESTDIR)
+ cp Makefile $(DESTDIR)
+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
+
runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
[ -d test ] || $(LN_S) $(srcdir)/test .
diff --git a/runsuite.c b/runsuite.c
index d24b5ec3..f7ff2521 100644
--- a/runsuite.c
+++ b/runsuite.c
@@ -1147,6 +1147,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
if (logfile != NULL)
fclose(logfile);
+ printf("%s: runsuite\n\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
#else /* !SCHEMAS */
diff --git a/runtest.c b/runtest.c
index ffa98d04..470f95cb 100644
--- a/runtest.c
+++ b/runtest.c
@@ -4508,6 +4508,7 @@ launchTests(testDescPtr tst) {
xmlCharEncCloseFunc(ebcdicHandler);
xmlCharEncCloseFunc(eucJpHandler);
+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
return(err);
}
@@ -4588,6 +4589,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
xmlCleanupParser();
xmlMemoryDump();
+ printf("%s: runtest\n\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
diff --git a/runxmlconf.c b/runxmlconf.c
index 70f61017..e882b3a1 100644
--- a/runxmlconf.c
+++ b/runxmlconf.c
@@ -595,6 +595,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
if (logfile != NULL)
fclose(logfile);
+ printf("%s: runxmlconf\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
diff --git a/testapi.c b/testapi.c
index ff8b470d..52b51d78 100644
--- a/testapi.c
+++ b/testapi.c
@@ -1246,49 +1246,91 @@ static int
testlibxml2(void)
{
int test_ret = 0;
-
- test_ret += test_HTMLparser();
- test_ret += test_HTMLtree();
- test_ret += test_SAX2();
- test_ret += test_c14n();
- test_ret += test_catalog();
- test_ret += test_chvalid();
- test_ret += test_debugXML();
- test_ret += test_dict();
- test_ret += test_encoding();
- test_ret += test_entities();
- test_ret += test_hash();
- test_ret += test_list();
- test_ret += test_nanoftp();
- test_ret += test_nanohttp();
- test_ret += test_parser();
- test_ret += test_parserInternals();
- test_ret += test_pattern();
- test_ret += test_relaxng();
- test_ret += test_schemasInternals();
- test_ret += test_schematron();
- test_ret += test_tree();
- test_ret += test_uri();
- test_ret += test_valid();
- test_ret += test_xinclude();
- test_ret += test_xmlIO();
- test_ret += test_xmlautomata();
- test_ret += test_xmlerror();
- test_ret += test_xmlmodule();
- test_ret += test_xmlreader();
- test_ret += test_xmlregexp();
- test_ret += test_xmlsave();
- test_ret += test_xmlschemas();
- test_ret += test_xmlschemastypes();
- test_ret += test_xmlstring();
- test_ret += test_xmlunicode();
- test_ret += test_xmlwriter();
- test_ret += test_xpath();
- test_ret += test_xpathInternals();
- test_ret += test_xpointer();
+ int ret = 0;
+
+ test_ret += (ret = test_HTMLparser());
+ printf("%s: HTMLparser\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_HTMLtree());
+ printf("%s: HTMLtree\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_SAX2());
+ printf("%s: SAX2\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_c14n());
+ printf("%s: c14n\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_catalog());
+ printf("%s: catalog\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_chvalid());
+ printf("%s: chvalid\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_debugXML());
+ printf("%s: debugXML\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_dict());
+ printf("%s: dict\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_encoding());
+ printf("%s: encoding\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_entities());
+ printf("%s: entities\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_hash());
+ printf("%s: hash\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_list());
+ printf("%s: list\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_nanoftp());
+ printf("%s: nanoftp\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_nanohttp());
+ printf("%s: nanohttp\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_parser());
+ printf("%s: parser\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_parserInternals());
+ printf("%s: parserInternals\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_pattern());
+ printf("%s: pattern\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_relaxng());
+ printf("%s: relaxng\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_schemasInternals());
+ printf("%s: schemasInternals\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_schematron());
+ printf("%s: schematron\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_tree());
+ printf("%s: tree\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_uri());
+ printf("%s: uri\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_valid());
+ printf("%s: valid\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xinclude());
+ printf("%s: xinclude\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlIO());
+ printf("%s: xmlIO\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlautomata());
+ printf("%s: xmlautomata\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlerror());
+ printf("%s: xmlerror\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlmodule());
+ printf("%s: xmlmodule\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlreader());
+ printf("%s: xmlreader\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlregexp());
+ printf("%s: xmlregexp\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlsave());
+ printf("%s: xmlsave\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlschemas());
+ printf("%s: xmlschemas\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlschemastypes());
+ printf("%s: xmlschemastypes\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlstring());
+ printf("%s: xmlstring\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlunicode());
+ printf("%s: xmlunicode\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xmlwriter());
+ printf("%s: xmlwriter\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xpath());
+ printf("%s: xpath\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xpathInternals());
+ printf("%s: xpathInternals\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_xpointer());
+ printf("%s: xpointer\n", (ret == 0) ? "PASS" : "FAIL");
printf("Total: %d functions, %d tests, %d errors\n",
function_tests, call_tests, test_ret);
+
+ printf("%s: testapi\n\n", (test_ret == 0) ? "PASS" : "FAIL");
return(test_ret);
}
diff --git a/testchar.c b/testchar.c
index 6866a175..7bce0132 100644
--- a/testchar.c
+++ b/testchar.c
@@ -23,7 +23,7 @@ static void errorHandler(void *unused, xmlErrorPtr err) {
char document1[100] = "<doc>XXXX</doc>";
char document2[100] = "<doc foo='XXXX'/>";
-static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
+static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
int len, char *data, int forbid1, int forbid2) {
int i;
xmlDocPtr res;
@@ -37,33 +37,41 @@ static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
res = xmlReadMemory(document, len, "test", NULL, 0);
if ((i == forbid1) || (i == forbid2)) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Byte 0x%02X: %c\n",
i, i);
+ return(1);
+ }
}
else if ((i == '<') || (i == '&')) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect illegal char %c for Byte 0x%02X\n", i, i);
+ return(1);
+ }
}
else if (((i < 0x20) || (i >= 0x80)) &&
(i != 0x9) && (i != 0xA) && (i != 0xD)) {
- if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL))
+ if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Byte 0x%02X\n", i);
+ return(1);
+ }
}
else if (res == NULL) {
fprintf(stderr,
"Failed to parse valid char for Byte 0x%02X : %c\n", i, i);
+ return(1);
}
if (res != NULL)
xmlFreeDoc(res);
}
+ return(0);
}
-static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
+static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
int len, char *data) {
int i, j;
xmlDocPtr res;
@@ -80,10 +88,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
/* if first bit of first char is set, then second bit must too */
if ((i & 0x80) && ((i & 0x40) == 0)) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
+ }
}
/*
@@ -91,10 +101,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* bits must be 10
*/
else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
+ }
}
/*
@@ -102,10 +114,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* than 0x80, i.e. one of bits 5 to 1 of i must be set
*/
else if ((i & 0x80) && ((i & 0x1E) == 0)) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
+ }
}
/*
@@ -113,10 +127,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* at least 3 bytes, but we give only 2 !
*/
else if ((i & 0xE0) == 0xE0) {
- if ((lastError == 0) || (res != NULL))
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
i, j);
+ return(1);
+ }
}
/*
@@ -125,11 +141,13 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
else if ((lastError != 0) || (res == NULL)) {
fprintf(stderr,
"Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j);
+ return(1);
}
if (res != NULL)
xmlFreeDoc(res);
}
}
+ return(0);
}
/**
@@ -141,9 +159,10 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* CDATA in text or in attribute values.
*/
-static void testDocumentRanges(void) {
+static int testDocumentRanges(void) {
xmlParserCtxtPtr ctxt;
char *data;
+ int test_ret = 0;
/*
* Set up a parsing context using the first document as
@@ -152,7 +171,7 @@ static void testDocumentRanges(void) {
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
fprintf(stderr, "Failed to allocate parser context\n");
- return;
+ return(1);
}
printf("testing 1 byte char in document: 1");
@@ -163,7 +182,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at beginning of area */
- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
data, -1, -1);
printf(" 2");
fflush(stdout);
@@ -172,7 +191,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at end of area */
- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
data + 3, -1, -1);
printf(" 3");
@@ -183,7 +202,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at beginning of area */
- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
data, '\'', -1);
printf(" 4");
fflush(stdout);
@@ -192,7 +211,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at end of area */
- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
data + 3, '\'', -1);
printf(" done\n");
@@ -204,7 +223,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at beginning of area */
- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
data);
printf(" 2");
fflush(stdout);
@@ -213,7 +232,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at end of area */
- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
data + 2);
printf(" 3");
@@ -224,7 +243,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at beginning of area */
- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
data);
printf(" 4");
fflush(stdout);
@@ -233,14 +252,15 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at end of area */
- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
data + 2);
printf(" done\n");
xmlFreeParserCtxt(ctxt);
+ return(test_ret);
}
-static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
int i = 0;
int len, c;
@@ -255,19 +275,25 @@ static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
c = xmlCurrentChar(ctxt, &len);
if ((i == 0) || (i >= 0x80)) {
/* we must see an error there */
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Byte 0x%02X\n", i);
+ return(1);
+ }
} else if (i == 0xD) {
- if ((c != 0xA) || (len != 1))
+ if ((c != 0xA) || (len != 1)) {
fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i);
+ return(1);
+ }
} else if ((c != i) || (len != 1)) {
fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i);
+ return(1);
}
}
+ return(0);
}
-static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
int i, j;
int len, c;
@@ -284,10 +310,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
/* if first bit of first char is set, then second bit must too */
if ((i & 0x80) && ((i & 0x40) == 0)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
+ }
}
/*
@@ -295,10 +323,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* bits must be 10
*/
else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
i, j, c);
+ return(1);
+ }
}
/*
@@ -306,10 +336,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* than 0x80, i.e. one of bits 5 to 1 of i must be set
*/
else if ((i & 0x80) && ((i & 0x1E) == 0)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
i, j, c);
+ return(1);
+ }
}
/*
@@ -317,10 +349,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* at least 3 bytes, but we give only 2 !
*/
else if ((i & 0xE0) == 0xE0) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
i, j);
+ return(1);
+ }
}
/*
@@ -329,6 +363,7 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
else if ((lastError != 0) || (len != 2)) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j);
+ return(1);
}
/*
@@ -338,12 +373,14 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n",
i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c);
+ return(1);
}
}
}
+ return(0);
}
-static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
int i, j, k, K;
int len, c;
unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
@@ -368,20 +405,24 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
* at least 4 bytes, but we give only 3 !
*/
if ((i & 0xF0) == 0xF0) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, data[3]);
+ return(1);
+ }
}
/*
* The second and the third bytes must start with 10
*/
else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
+ }
}
/*
@@ -390,10 +431,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
* the 6th byte of data[1] must be set
*/
else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
+ }
}
/*
@@ -401,10 +444,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
*/
else if (((value > 0xD7FF) && (value <0xE000)) ||
((value > 0xFFFD) && (value <0x10000))) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n",
value, i, j, K);
+ return(1);
+ }
}
/*
@@ -414,6 +459,7 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
}
/*
@@ -423,13 +469,15 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
i, j, data[2], value, c);
+ return(1);
}
}
}
}
+ return(0);
}
-static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
int i, j, k, K, l, L;
int len, c;
unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
@@ -458,10 +506,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* at least 5 bytes, but we give only 4 !
*/
if ((i & 0xF8) == 0xF8) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, data[3]);
+ return(1);
+ }
}
/*
@@ -469,10 +519,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
*/
else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) ||
((L & 0xC0) != 0x80)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, L);
+ return(1);
+ }
}
/*
@@ -481,10 +533,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* the 6 or 5th byte of j must be set
*/
else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, L);
+ return(1);
+ }
}
/*
@@ -493,10 +547,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
else if (((value > 0xD7FF) && (value <0xE000)) ||
((value > 0xFFFD) && (value <0x10000)) ||
(value > 0x10FFFF)) {
- if (lastError != XML_ERR_INVALID_CHAR)
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
value, i, j, K, L);
+ return(1);
+ }
}
/*
@@ -506,6 +562,7 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
}
/*
@@ -515,11 +572,13 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
i, j, data[2], value, c);
+ return(1);
}
}
}
}
}
+ return(0);
}
/**
@@ -530,11 +589,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* cover the full range of UTF-8 chars accepted by XML-1.0
*/
-static void testCharRanges(void) {
+static int testCharRanges(void) {
char data[5];
xmlParserCtxtPtr ctxt;
xmlParserInputBufferPtr buf;
xmlParserInputPtr input;
+ int test_ret = 0;
memset(data, 0, 5);
@@ -545,17 +605,19 @@ static void testCharRanges(void) {
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
fprintf(stderr, "Failed to allocate parser context\n");
- return;
+ return(1);
}
buf = xmlParserInputBufferCreateStatic(data, sizeof(data),
XML_CHAR_ENCODING_NONE);
if (buf == NULL) {
fprintf(stderr, "Failed to allocate input buffer\n");
+ test_ret = 1;
goto error;
}
input = xmlNewInputStream(ctxt);
if (input == NULL) {
xmlFreeParserInputBuffer(buf);
+ test_ret = 1;
goto error;
}
input->filename = NULL;
@@ -567,25 +629,28 @@ static void testCharRanges(void) {
printf("testing char range: 1");
fflush(stdout);
- testCharRangeByte1(ctxt, data);
+ test_ret += testCharRangeByte1(ctxt, data);
printf(" 2");
fflush(stdout);
- testCharRangeByte2(ctxt, data);
+ test_ret += testCharRangeByte2(ctxt, data);
printf(" 3");
fflush(stdout);
- testCharRangeByte3(ctxt, data);
+ test_ret += testCharRangeByte3(ctxt, data);
printf(" 4");
fflush(stdout);
- testCharRangeByte4(ctxt, data);
+ test_ret += testCharRangeByte4(ctxt, data);
printf(" done\n");
fflush(stdout);
error:
xmlFreeParserCtxt(ctxt);
+ return(test_ret);
}
int main(void) {
+ int ret = 0;
+
/*
* this initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
@@ -602,8 +667,9 @@ int main(void) {
/*
* Run the tests
*/
- testCharRanges();
- testDocumentRanges();
+ ret += testCharRanges();
+ ret += testDocumentRanges();
+ printf("%s: testchar\n\n", (ret == 0) ? "PASS" : "FAIL");
/*
* Cleanup function for the XML library.
diff --git a/testdict.c b/testdict.c
index 40bebd05..114b9347 100644
--- a/testdict.c
+++ b/testdict.c
@@ -440,5 +440,6 @@ int main(void)
clean_strings();
xmlCleanupParser();
xmlMemoryDump();
+ printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
diff --git a/testlimits.c b/testlimits.c
index 059116a6..f0bee68d 100644
--- a/testlimits.c
+++ b/testlimits.c
@@ -1634,5 +1634,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
xmlCleanupParser();
xmlMemoryDump();
+ printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
diff --git a/testrecurse.c b/testrecurse.c
index 0cbe25a6..3ecadb40 100644
--- a/testrecurse.c
+++ b/testrecurse.c
@@ -892,6 +892,7 @@ launchTests(testDescPtr tst) {
err++;
}
}
+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
return(err);
}
@@ -961,5 +962,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
xmlCleanupParser();
xmlMemoryDump();
+ printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
--
2.25.1

View File

@ -14,18 +14,13 @@ DEPENDS = "zlib virtual/libiconv"
inherit gnomebase
SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=testtar \
file://libxml-64bit.patch \
file://runtest.patch \
file://run-ptest \
file://python-sitepackages-dir.patch \
file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \
file://fix-execution-of-ptests.patch \
file://remove-fuzz-from-ptests.patch \
file://libxml-64bit.patch \
file://install-tests.patch \
file://libxml-m4-use-pkgconfig.patch \
file://0001-Port-gentest.py-to-Python-3.patch \
"
SRC_URI[archive.sha256sum] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"
SRC_URI[archive.sha256sum] = "5d2cc3d78bec3dbe212a9d7fa629ada25a7da928af432c93060ff5c17ee28a9c"
SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7"
BINCONFIG = "${bindir}/xml2-config"
@ -44,7 +39,7 @@ inherit autotools pkgconfig binconfig-disabled ptest
inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)}
RDEPENDS:${PN}-ptest += "bash make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}"
RDEPENDS:${PN}-ptest += "bash make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}"
RDEPENDS:${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}"
@ -55,13 +50,11 @@ RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-ebcdic-us \
locale-base-en-us \
"
export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}"
# WARNING: zlib is required for RPM use
EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions"
EXTRA_OECONF:class-native = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
EXTRA_OECONF:class-nativesdk = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
EXTRA_OECONF:linuxstdbase = "--with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib"
EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --with-c14n --without-lzma --with-fexceptions"
EXTRA_OECONF:class-native = "--without-legacy --with-c14n --without-lzma --with-zlib"
EXTRA_OECONF:class-nativesdk = "--without-legacy --with-c14n --without-lzma --with-zlib"
EXTRA_OECONF:linuxstdbase = "--with-debug --with-legacy --with-c14n --without-lzma --with-zlib"
python populate_packages:prepend () {
# autonamer would call this libxml2-2, but we don't want that
@ -73,7 +66,6 @@ PACKAGE_BEFORE_PN += "${PN}-utils"
PACKAGES += "${PN}-python"
FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
FILES:${PN}-dev += "${libdir}/xml2Conf.sh"
FILES:${PN}-utils = "${bindir}/*"
FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
@ -82,39 +74,14 @@ do_configure:prepend () {
find ${S}/xmlconf/ -type f -exec chmod -x {} \+
}
do_compile_ptest() {
# Make sure that testapi.c is newer than gentests.py, because
# with reproducible builds, they will both get e.g. Jan 1 1970
# modification time from SOURCE_DATE_EPOCH and then check-am
# might try to rebuild_testapi, which will fail even with
# 0001-Port-gentest.py-to-Python-3.patch, because it needs
# libxml2 module (libxml2-native dependency and correctly
# set PYTHON_SITE_PACKAGES), it's easier to
# just rely on pre-generated testapi.c from the release
touch ${S}/testapi.c
oe_runmake check-am
}
do_install_ptest () {
oe_runmake DESTDIR=${D} ptestdir=${PTEST_PATH} install-test-data
cp -r ${S}/xmlconf ${D}${PTEST_PATH}
if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then
sed -i -e 's|^\(PYTHON = \).*|\1${USRBINPATH}/${PYTHON_PN}|' \
${D}${PTEST_PATH}/python/tests/Makefile
grep -lrZ '#!/usr/bin/python' ${D}${PTEST_PATH}/python |
xargs -0 sed -i -e 's|/usr/bin/python|${USRBINPATH}/${PYTHON_PN}|'
fi
#Remove build host references from various Makefiles
find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
sed -i \
-e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
-e 's|${DEBUG_PREFIX_MAP}||g' \
-e 's:${HOSTTOOLS_DIR}/::g' \
-e 's:${RECIPE_SYSROOT_NATIVE}::g' \
-e 's:${RECIPE_SYSROOT}::g' \
-e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
-e '/^RELDATE/d' \
{} +
if ! ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then
rm -rf ${D}${PTEST_DIR}/python
fi
}
do_install:append:class-native () {