diff options
Diffstat (limited to 'meta/recipes-core/libxml/libxml2')
11 files changed, 51 insertions, 1357 deletions
diff --git a/meta/recipes-core/libxml/libxml2/0001-Fix-infinite-loop-in-LZMA-decompression.patch b/meta/recipes-core/libxml/libxml2/0001-Fix-infinite-loop-in-LZMA-decompression.patch deleted file mode 100644 index 16c229574c..0000000000 --- a/meta/recipes-core/libxml/libxml2/0001-Fix-infinite-loop-in-LZMA-decompression.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 28a9dc642ffd759df1e48be247a114f440a6c16e Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Mon, 30 Jul 2018 13:14:11 +0200 -Subject: [PATCH] Fix infinite loop in LZMA decompression -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Check the liblzma error code more thoroughly to avoid infinite loops. - -Closes: https://gitlab.gnome.org/GNOME/libxml2/issues/13 -Closes: https://bugzilla.gnome.org/show_bug.cgi?id=794914 - -This is CVE-2018-9251 and CVE-2018-14567. - -Thanks to Dongliang Mu and Simon Wörner for the reports. - -CVE: CVE-2018-9251 -CVE: CVE-2018-14567 -Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/commit/2240fbf5912054af025fb6e01e26375100275e74] -Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> ---- - xzlib.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/xzlib.c b/xzlib.c -index a839169..0ba88cf 100644 ---- a/xzlib.c -+++ b/xzlib.c -@@ -562,6 +562,10 @@ xz_decomp(xz_statep state) - "internal error: inflate stream corrupt"); - return -1; - } -+ /* -+ * FIXME: Remapping a couple of error codes and falling through -+ * to the LZMA error handling looks fragile. -+ */ - if (ret == Z_MEM_ERROR) - ret = LZMA_MEM_ERROR; - if (ret == Z_DATA_ERROR) -@@ -587,6 +591,11 @@ xz_decomp(xz_statep state) - xz_error(state, LZMA_PROG_ERROR, "compression error"); - return -1; - } -+ if ((state->how != GZIP) && -+ (ret != LZMA_OK) && (ret != LZMA_STREAM_END)) { -+ xz_error(state, ret, "lzma error"); -+ return -1; -+ } - } while (strm->avail_out && ret != LZMA_STREAM_END); - - /* update available output and crc check value */ --- -2.7.4 - 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 2b92dbc8dc..0000000000 --- a/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 78dbd4c09d617a9cb730d796f94ee4d93840d3cc 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 | 12 ++++++++++-- - python/tests/tstLastError.py | 2 +- - 4 files changed, 21 insertions(+), 4 deletions(-) - -Index: libxml2-2.9.7/Makefile.am -=================================================================== ---- libxml2-2.9.7.orig/Makefile.am -+++ libxml2-2.9.7/Makefile.am -@@ -207,9 +207,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) -Index: libxml2-2.9.7/python/Makefile.am -=================================================================== ---- libxml2-2.9.7.orig/python/Makefile.am -+++ libxml2-2.9.7/python/Makefile.am -@@ -48,7 +48,16 @@ GENERATED = libxml2class.py libxml2class - - $(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 -Index: libxml2-2.9.7/python/tests/Makefile.am -=================================================================== ---- libxml2-2.9.7.orig/python/tests/Makefile.am -+++ libxml2-2.9.7/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" -@@ -68,8 +73,11 @@ tests: $(PYTESTS) - export LD_LIBRARY_PATH; \ - for test in $(PYTESTS) ; \ - do log=`$(PYTHON) $(srcdir)/$$test` ; \ -- if [ "`echo $$log | grep OK`" = "" ] ; then \ -- echo "-- $$test" ; echo "$$log" ; fi ; done) -+ if [ "`echo $$log | grep OK`" ]; then \ -+ echo "PASS: $$test"; else \ -+ echo "$$log"; echo "FAIL: $$test"; fi; done) - else -+install-ptest: -+ - tests: - endif -Index: libxml2-2.9.7/python/tests/tstLastError.py -=================================================================== ---- libxml2-2.9.7.orig/python/tests/tstLastError.py -+++ libxml2-2.9.7/python/tests/tstLastError.py -@@ -25,7 +25,7 @@ class TestCase(unittest.TestCase): - when the exception is raised, check the libxml2.lastError for - expected values.""" - # disable the default error handler -- libxml2.registerErrorHandler(None,None) -+ libxml2.registerErrorHandler(lambda ctx,str: None,None) - try: - f(*args) - except exc: diff --git a/meta/recipes-core/libxml/libxml2/fix-CVE-2017-8872.patch b/meta/recipes-core/libxml/libxml2/fix-CVE-2017-8872.patch deleted file mode 100644 index 42a4b0ed60..0000000000 --- a/meta/recipes-core/libxml/libxml2/fix-CVE-2017-8872.patch +++ /dev/null @@ -1,65 +0,0 @@ -Upstream-Status: Backport -CVE: CVE-2017-8872 -Signed-off-by: Ross Burton <ross.burton@intel.com> - -From 123234f2cfcd9e9b9f83047eee1dc17b4c3f4407 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer <wellnhofer@aevum.de> -Date: Tue, 11 Sep 2018 14:52:07 +0200 -Subject: [PATCH] Free input buffer in xmlHaltParser - -This avoids miscalculation of available bytes. - -Thanks to Yunho Kim for the report. - -Closes: #26 ---- - parser.c | 5 +++++ - result/errors/759573.xml.err | 17 +++++++---------- - 2 files changed, 12 insertions(+), 10 deletions(-) - -diff --git a/parser.c b/parser.c -index ca9fde2c..5813a664 100644 ---- a/parser.c -+++ b/parser.c -@@ -12462,7 +12462,12 @@ xmlHaltParser(xmlParserCtxtPtr ctxt) { - ctxt->input->free((xmlChar *) ctxt->input->base); - ctxt->input->free = NULL; - } -+ if (ctxt->input->buf != NULL) { -+ xmlFreeParserInputBuffer(ctxt->input->buf); -+ ctxt->input->buf = NULL; -+ } - ctxt->input->cur = BAD_CAST""; -+ ctxt->input->length = 0; - ctxt->input->base = ctxt->input->cur; - ctxt->input->end = ctxt->input->cur; - } -diff --git a/result/errors/759573.xml.err b/result/errors/759573.xml.err -index 554039f6..38ef5c40 100644 ---- a/result/errors/759573.xml.err -+++ b/result/errors/759573.xml.err -@@ -21,14 +21,11 @@ Entity: line 1: - ^ - ./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration - --<?h?><!DOCTYPEt[<!ELEMENT t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ00 -- ^ -+ -+^ - ./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated --<?h?><!DOCTYPEt[<!ELEMENT t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ00 -- ^ --./test/errors/759573.xml:1: parser error : StartTag: invalid element name --<?h?><!DOCTYPEt[<!ELEMENT t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ00 -- ^ --./test/errors/759573.xml:1: parser error : Extra content at the end of the document --<?h?><!DOCTYPEt[<!ELEMENT t (A)><!ENTITY % xx '%<![INCLUDE[000%ஸ00 -- ^ -+ -+^ -+./test/errors/759573.xml:1: parser error : Start tag expected, '<' not found -+ -+^ --- -2.11.0 - diff --git a/meta/recipes-core/libxml/libxml2/fix-CVE-2018-14404.patch b/meta/recipes-core/libxml/libxml2/fix-CVE-2018-14404.patch deleted file mode 100644 index 21668e25ad..0000000000 --- a/meta/recipes-core/libxml/libxml2/fix-CVE-2018-14404.patch +++ /dev/null @@ -1,45 +0,0 @@ -libxml2-2.9.8: Fix CVE-2018-14404 - -[No upstream tracking] -- https://gitlab.gnome.org/GNOME/libxml2/issues/5 - -- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901817 - -- https://bugzilla.redhat.com/show_bug.cgi?id=1595985 - -xpath: Fix nullptr deref with XPath logic ops - -If the XPath stack is corrupted, for example by a misbehaving extension -function, the "and" and "or" XPath operators could dereference NULL -pointers. Check that the XPath stack isn't empty and optimize the -logic operators slightly. - -Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/commit/a436374994c47b12d5de1b8b1d191a098fa23594] -CVE: CVE-2018-14404 -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> - -diff --git a/xpath.c b/xpath.c -index f440696..75cac5c 100644 ---- a/xpath.c -+++ b/xpath.c -@@ -13297,9 +13297,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) - return(0); - } - xmlXPathBooleanFunction(ctxt, 1); -- arg1 = valuePop(ctxt); -- arg1->boolval &= arg2->boolval; -- valuePush(ctxt, arg1); -+ if (ctxt->value != NULL) -+ ctxt->value->boolval &= arg2->boolval; - xmlXPathReleaseObject(ctxt->context, arg2); - return (total); - case XPATH_OP_OR: -@@ -13323,9 +13322,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) - return(0); - } - xmlXPathBooleanFunction(ctxt, 1); -- arg1 = valuePop(ctxt); -- arg1->boolval |= arg2->boolval; -- valuePush(ctxt, arg1); -+ if (ctxt->value != NULL) -+ ctxt->value->boolval |= arg2->boolval; - xmlXPathReleaseObject(ctxt->context, arg2); - return (total); - case XPATH_OP_EQUAL: 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 51a9e1935f..0000000000 --- a/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch +++ /dev/null @@ -1,21 +0,0 @@ -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> - -Index: libxml2-2.9.7/Makefile.am -=================================================================== ---- libxml2-2.9.7.orig/Makefile.am -+++ libxml2-2.9.7/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) && \ 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 1147017b61..0000000000 --- a/meta/recipes-core/libxml/libxml2/libxml-64bit.patch +++ /dev/null @@ -1,22 +0,0 @@ -Upstream-Status: Backport [from debian: bugs.debian.org/439843] - ---- - libxml.h | 3 +++ - 1 file changed, 3 insertions(+) - ---- libxml2-2.6.29.orig/libxml.h -+++ libxml2-2.6.29/libxml.h -@@ -11,10 +11,13 @@ - - #ifndef NO_LARGEFILE_SOURCE - #ifndef _LARGEFILE_SOURCE - #define _LARGEFILE_SOURCE - #endif -+#ifndef _LARGEFILE64_SOURCE -+#define _LARGEFILE64_SOURCE -+#endif - #ifndef _FILE_OFFSET_BITS - #define _FILE_OFFSET_BITS 64 - #endif - #endif - 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 d9ed1516fe..0000000000 --- a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch +++ /dev/null @@ -1,204 +0,0 @@ -AM_PATH_XML2 uses xml-config which we disable through -binconfig-disabled.bbclass, so port it to use pkg-config instead. - -Upstream-Status: Pending -Signed-off-by: Ross Burton <ross.burton@intel.com> - -diff --git a/libxml.m4 b/libxml.m4 -index 68cd824..5fa0a9b 100644 ---- a/libxml.m4 -+++ b/libxml.m4 -@@ -1,188 +1,12 @@ --# Configure paths for LIBXML2 --# 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_TRY_RUN([ --#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. The latest version of\n", -- major, minor, micro); -- printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n"); -- 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 enviroment 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_TRY_LINK([ --#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 - ]) 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 e83c8325e5..0000000000 --- a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch +++ /dev/null @@ -1,30 +0,0 @@ -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.2 -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 ---- a/configure.ac -+++ b/configure.ac -@@ -813,7 +813,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 --- -1.9.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 544dc05834..0000000000 --- a/meta/recipes-core/libxml/libxml2/runtest.patch +++ /dev/null @@ -1,818 +0,0 @@ -Add 'install-ptest' rule. -Print a standard result line for each test. - -Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com> -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> -Upstream-Status: Backport - -diff -uNr a/Makefile.am b/Makefile.am ---- a/Makefile.am 2017-12-02 09:58:10.000000000 +0100 -+++ b/Makefile.am 2018-03-20 08:27:34.360505864 +0100 -@@ -202,6 +202,15 @@ - #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 -uNr a/runsuite.c b/runsuite.c ---- a/runsuite.c 2016-06-07 12:04:14.000000000 +0200 -+++ b/runsuite.c 2018-03-20 08:27:57.478817247 +0100 -@@ -1162,6 +1162,7 @@ - - if (logfile != NULL) - fclose(logfile); -+ printf("%s: runsuite\n\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } - #else /* !SCHEMAS */ -diff -uNr a/runtest.c b/runtest.c ---- a/runtest.c 2017-11-13 22:00:17.000000000 +0100 -+++ b/runtest.c 2018-03-20 08:28:50.859047551 +0100 -@@ -4496,7 +4496,8 @@ - } - - xmlCharEncCloseFunc(ebcdicHandler); -- -+ -+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc); - return(err); - } - -@@ -4573,6 +4574,7 @@ - xmlCleanupParser(); - xmlMemoryDump(); - -+ printf("%s: runtest\n\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } - -diff -uNr a/runxmlconf.c b/runxmlconf.c ---- a/runxmlconf.c 2016-06-07 12:04:14.000000000 +0200 -+++ b/runxmlconf.c 2018-03-20 08:29:17.944862893 +0100 -@@ -595,6 +595,7 @@ - - if (logfile != NULL) - fclose(logfile); -+ printf("%s: runxmlconf\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } - -diff -uNr a/testapi.c b/testapi.c ---- a/testapi.c 2018-01-25 07:39:15.000000000 +0100 -+++ b/testapi.c 2018-03-20 09:08:35.323980145 +0100 -@@ -1246,49 +1246,91 @@ - testlibxml2(void) - { - int test_ret = 0; -+ int 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(); -+ 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 -uNr a/testdict.c b/testdict.c ---- a/testdict.c 2016-06-07 12:04:14.000000000 +0200 -+++ b/testdict.c 2018-03-20 08:59:16.864275812 +0100 -@@ -440,5 +440,6 @@ - clean_strings(); - xmlCleanupParser(); - xmlMemoryDump(); -+ printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } -diff -uNr a/testchar.c b/testchar.c ---- a/testchar.c 2016-06-07 12:04:14.000000000 +0200 -+++ b/testchar.c 2018-03-20 09:11:20.383573912 +0100 -@@ -23,7 +23,7 @@ - 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 @@ - 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 @@ - - /* 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 @@ - * 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 @@ - * 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 @@ - * 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 @@ - 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 @@ - * 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 @@ - 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 @@ - 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 @@ - 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 @@ - 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 @@ - 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 @@ - 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 @@ - 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 @@ - 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 @@ - 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 @@ - 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 @@ - - /* 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 @@ - * 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 @@ - * 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 @@ - * 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 @@ - 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 @@ - 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 @@ - * 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 @@ - * 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 @@ - */ - 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 @@ - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); -+ return(1); - } - - /* -@@ -423,13 +469,15 @@ - 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 @@ - * 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 @@ - */ - 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 @@ - * 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 @@ - 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 @@ - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); -+ return(1); - } - - /* -@@ -515,11 +572,13 @@ - 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 @@ - * 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 @@ - 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 @@ - - 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 @@ - /* - * 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 -uNr a/testlimits.c b/testlimits.c ---- a/testlimits.c 2016-11-07 09:41:40.000000000 +0100 -+++ b/testlimits.c 2018-03-20 08:59:38.965581280 +0100 -@@ -1634,5 +1634,6 @@ - xmlCleanupParser(); - xmlMemoryDump(); - -+ printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } -diff -uNr a/testrecurse.c b/testrecurse.c ---- a/testrecurse.c 2017-10-26 09:54:40.000000000 +0200 -+++ b/testrecurse.c 2018-03-20 09:00:46.781628749 +0100 -@@ -892,6 +892,7 @@ - err++; - } - } -+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc); - return(err); - } - -@@ -961,5 +962,6 @@ - xmlCleanupParser(); - xmlMemoryDump(); - -+ printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } |