diff options
Diffstat (limited to 'meta/recipes-core/libxml/libxml2')
10 files changed, 51 insertions, 2120 deletions
diff --git a/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch b/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch deleted file mode 100644 index 6d9ede6194..0000000000 --- a/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch +++ /dev/null @@ -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 - diff --git a/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch b/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch deleted file mode 100644 index c6567ac878..0000000000 --- a/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch +++ /dev/null @@ -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") diff --git a/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch b/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch deleted file mode 100644 index ad719d4f5f..0000000000 --- a/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch +++ /dev/null @@ -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 - diff --git a/meta/recipes-core/libxml/libxml2/install-tests.patch b/meta/recipes-core/libxml/libxml2/install-tests.patch new file mode 100644 index 0000000000..478eeea81b --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/install-tests.patch @@ -0,0 +1,34 @@ +From 0779511838a8cbd1e0f431c22f28f286a2a37b1b 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 + +Add a target to install the test suite. + +Upstream-Status: Inappropriate +Signed-off-by: Ross Burton <ross.burton@arm.com> +--- + Makefile.am | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index 0a49d37..1097c63 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -27,6 +27,16 @@ check_PROGRAMS = \ + testparser \ + 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 + + bin_SCRIPTS = xml2-config diff --git a/meta/recipes-core/libxml/libxml2/libxml-64bit.patch b/meta/recipes-core/libxml/libxml2/libxml-64bit.patch deleted file mode 100644 index fd8e469dd3..0000000000 --- a/meta/recipes-core/libxml/libxml2/libxml-64bit.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 056b14345b1abd76a761ab14538f1bc21302781a Mon Sep 17 00:00:00 2001 -From: Hongxu Jia <hongxu.jia@windriver.com> -Date: Sat, 11 May 2019 20:26:51 +0800 -Subject: [PATCH] libxml 64bit - -Upstream-Status: Backport [from debian: bugs.debian.org/439843] -Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> ---- - libxml.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libxml.h b/libxml.h -index 64e30f7..4e80d90 100644 ---- a/libxml.h -+++ b/libxml.h -@@ -15,6 +15,9 @@ - #ifndef _LARGEFILE_SOURCE - #define _LARGEFILE_SOURCE - #endif -+#ifndef _LARGEFILE64_SOURCE -+#define _LARGEFILE64_SOURCE -+#endif - #ifndef _FILE_OFFSET_BITS - #define _FILE_OFFSET_BITS 64 - #endif --- -2.7.4 - diff --git a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch deleted file mode 100644 index cc9da88a29..0000000000 --- a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch +++ /dev/null @@ -1,230 +0,0 @@ -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 - -binconfig-disabled.bbclass, so port it to use pkg-config instead. - -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(-) - -diff --git a/libxml.m4 b/libxml.m4 -index fc7790c..1c53585 100644 ---- a/libxml.m4 -+++ b/libxml.m4 -@@ -1,191 +1,12 @@ --# Configure paths for LIBXML2 --# Simon Josefsson 2020-02-12 --# Fix autoconf 2.70+ warnings --# Mike Hommey 2004-06-19 --# use CPPFLAGS instead of CFLAGS --# Toshio Kuratomi 2001-04-21 --# Adapted from: --# Configure paths for GLIB --# Owen Taylor 97-11-3 -- - dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) - dnl Test for XML, and define XML_CPPFLAGS and XML_LIBS - dnl --AC_DEFUN([AM_PATH_XML2],[ --AC_ARG_WITH(xml-prefix, -- [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)], -- xml_config_prefix="$withval", xml_config_prefix="") --AC_ARG_WITH(xml-exec-prefix, -- [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)], -- xml_config_exec_prefix="$withval", xml_config_exec_prefix="") --AC_ARG_ENABLE(xmltest, -- [ --disable-xmltest Do not try to compile and run a test LIBXML program],, -- enable_xmltest=yes) -- -- if test x$xml_config_exec_prefix != x ; then -- xml_config_args="$xml_config_args" -- if test x${XML2_CONFIG+set} != xset ; then -- XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config -- fi -- fi -- if test x$xml_config_prefix != x ; then -- xml_config_args="$xml_config_args --prefix=$xml_config_prefix" -- if test x${XML2_CONFIG+set} != xset ; then -- XML2_CONFIG=$xml_config_prefix/bin/xml2-config -- fi -- fi -- -- AC_PATH_PROG(XML2_CONFIG, xml2-config, no) -- min_xml_version=ifelse([$1], ,2.0.0,[$1]) -- AC_MSG_CHECKING(for libxml - version >= $min_xml_version) -- no_xml="" -- if test "$XML2_CONFIG" = "no" ; then -- no_xml=yes -- else -- XML_CPPFLAGS=`$XML2_CONFIG $xml_config_args --cflags` -- XML_LIBS=`$XML2_CONFIG $xml_config_args --libs` -- xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \ -- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` -- xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \ -- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` -- xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \ -- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` -- if test "x$enable_xmltest" = "xyes" ; then -- ac_save_CPPFLAGS="$CPPFLAGS" -- ac_save_LIBS="$LIBS" -- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS" -- LIBS="$XML_LIBS $LIBS" --dnl --dnl Now check if the installed libxml is sufficiently new. --dnl (Also sanity checks the results of xml2-config to some extent) --dnl -- rm -f conf.xmltest -- AC_RUN_IFELSE( -- [AC_LANG_SOURCE([[ --#include <stdlib.h> --#include <stdio.h> --#include <string.h> --#include <libxml/xmlversion.h> -- --int --main() --{ -- int xml_major_version, xml_minor_version, xml_micro_version; -- int major, minor, micro; -- char *tmp_version; -- -- system("touch conf.xmltest"); -- -- /* Capture xml2-config output via autoconf/configure variables */ -- /* HP/UX 9 (%@#!) writes to sscanf strings */ -- tmp_version = (char *)strdup("$min_xml_version"); -- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { -- printf("%s, bad version string from xml2-config\n", "$min_xml_version"); -- exit(1); -- } -- free(tmp_version); -- -- /* Capture the version information from the header files */ -- tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION); -- if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) { -- printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION"); -- exit(1); -- } -- free(tmp_version); -- -- /* Compare xml2-config output to the libxml headers */ -- if ((xml_major_version != $xml_config_major_version) || -- (xml_minor_version != $xml_config_minor_version) || -- (xml_micro_version != $xml_config_micro_version)) -- { -- printf("*** libxml header files (version %d.%d.%d) do not match\n", -- xml_major_version, xml_minor_version, xml_micro_version); -- printf("*** xml2-config (version %d.%d.%d)\n", -- $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version); -- return 1; -- } --/* Compare the headers to the library to make sure we match */ -- /* Less than ideal -- doesn't provide us with return value feedback, -- * only exits if there's a serious mismatch between header and library. -- */ -- LIBXML_TEST_VERSION; -- -- /* Test that the library is greater than our minimum version */ -- if ((xml_major_version > major) || -- ((xml_major_version == major) && (xml_minor_version > minor)) || -- ((xml_major_version == major) && (xml_minor_version == minor) && -- (xml_micro_version >= micro))) -- { -- return 0; -- } -- else -- { -- printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", -- xml_major_version, xml_minor_version, xml_micro_version); -- printf("*** You need a version of libxml newer than %d.%d.%d.\n", -- major, minor, micro); -- printf("***\n"); -- printf("*** If you have already installed a sufficiently new version, this error\n"); -- printf("*** probably means that the wrong copy of the xml2-config shell script is\n"); -- printf("*** being found. The easiest way to fix this is to remove the old version\n"); -- printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n"); -- printf("*** correct copy of xml2-config. (In this case, you will have to\n"); -- printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n"); -- printf("*** so that the correct libraries are found at run-time))\n"); -- } -- return 1; --} --]])],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) -- CPPFLAGS="$ac_save_CPPFLAGS" -- LIBS="$ac_save_LIBS" -- fi -- fi -+AC_DEFUN([AM_PATH_XML2],[ -+ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) - -- if test "x$no_xml" = x ; then -- AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)) -- ifelse([$2], , :, [$2]) -- else -- AC_MSG_RESULT(no) -- if test "$XML2_CONFIG" = "no" ; then -- echo "*** The xml2-config script installed by LIBXML could not be found" -- echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in" -- echo "*** your path, or set the XML2_CONFIG environment variable to the" -- echo "*** full path to xml2-config." -- else -- if test -f conf.xmltest ; then -- : -- else -- echo "*** Could not run libxml test program, checking why..." -- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS" -- LIBS="$LIBS $XML_LIBS" -- AC_LINK_IFELSE( -- [AC_LANG_PROGRAM([[ --#include <libxml/xmlversion.h> --#include <stdio.h> --]], [[ LIBXML_TEST_VERSION; return 0;]])], -- [ echo "*** The test program compiled, but did not run. This usually means" -- echo "*** that the run-time linker is not finding LIBXML or finding the wrong" -- echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your" -- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" -- echo "*** to the installed location Also, make sure you have run ldconfig if that" -- echo "*** is required on your system" -- echo "***" -- echo "*** If you have an old version installed, it is best to remove it, although" -- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], -- [ echo "*** The test program failed to compile or link. See the file config.log for the" -- echo "*** exact error that occurred. This usually means LIBXML was incorrectly installed" -- echo "*** or that you have moved LIBXML since it was installed. In the latter case, you" -- echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ]) -- CPPFLAGS="$ac_save_CPPFLAGS" -- LIBS="$ac_save_LIBS" -- fi -- fi -+ verdep=ifelse([$1], [], [], [">= $1"]) -+ PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3]) - -- XML_CPPFLAGS="" -- XML_LIBS="" -- ifelse([$3], , :, [$3]) -- fi -+ XML_CPPFLAGS=$XML_CFLAGS - AC_SUBST(XML_CPPFLAGS) -- AC_SUBST(XML_LIBS) -- rm -f conf.xmltest - ]) --- -2.34.1 - diff --git a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch deleted file mode 100644 index 956ff3f33e..0000000000 --- a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch +++ /dev/null @@ -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 - diff --git a/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch b/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch deleted file mode 100644 index 66694af388..0000000000 --- a/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch +++ /dev/null @@ -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 - diff --git a/meta/recipes-core/libxml/libxml2/run-ptest b/meta/recipes-core/libxml/libxml2/run-ptest index c313d83263..f252a78f17 100644..100755 --- a/meta/recipes-core/libxml/libxml2/run-ptest +++ b/meta/recipes-core/libxml/libxml2/run-ptest @@ -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 runsuite 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 diff --git a/meta/recipes-core/libxml/libxml2/runtest.patch b/meta/recipes-core/libxml/libxml2/runtest.patch deleted file mode 100644 index 42bb22cfd4..0000000000 --- a/meta/recipes-core/libxml/libxml2/runtest.patch +++ /dev/null @@ -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 - |