summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/libxml/libxml2
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/libxml/libxml2')
-rw-r--r--meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch98
-rw-r--r--meta/recipes-core/libxml/libxml2/CVE-2019-20388.patch37
-rw-r--r--meta/recipes-core/libxml/libxml2/CVE-2020-24977.patch41
-rw-r--r--meta/recipes-core/libxml/libxml2/CVE-2020-7595.patch36
-rw-r--r--meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch33
-rw-r--r--meta/recipes-core/libxml/libxml2/fix-python39.patch94
-rw-r--r--meta/recipes-core/libxml/libxml2/install-tests.patch34
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml-64bit.patch28
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch216
-rw-r--r--meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch35
-rwxr-xr-x[-rw-r--r--]meta/recipes-core/libxml/libxml2/run-ptest18
-rw-r--r--meta/recipes-core/libxml/libxml2/runtest.patch842
12 files changed, 51 insertions, 1461 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 5e9a0a506b..0000000000
--- a/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch
+++ /dev/null
@@ -1,98 +0,0 @@
1From 2b5fb416aa275fd2a17a0139a2f783998bcb42cc Mon Sep 17 00:00:00 2001
2From: Peter Kjellerstedt <pkj@axis.com>
3Date: Fri, 9 Jun 2017 17:50:46 +0200
4Subject: [PATCH] Make ptest run the python tests if python is enabled
5
6One of the tests (tstLastError.py) needed a minor correction. It might
7be due to the fact that the tests are forced to run with Python 3.
8
9Upstream-Status: Inappropriate [OE specific]
10Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
11
12---
13 Makefile.am | 2 +-
14 python/Makefile.am | 9 +++++++++
15 python/tests/Makefile.am | 10 ++++++++++
16 python/tests/tstLastError.py | 2 +-
17 4 files changed, 21 insertions(+), 2 deletions(-)
18
19diff --git a/Makefile.am b/Makefile.am
20index ae62274..bd1e425 100644
21--- a/Makefile.am
22+++ b/Makefile.am
23@@ -203,9 +203,9 @@ install-ptest:
24 install $(check_PROGRAMS) $(DESTDIR))
25 cp -r $(srcdir)/test $(DESTDIR)
26 cp -r $(srcdir)/result $(DESTDIR)
27- cp -r $(srcdir)/python $(DESTDIR)
28 cp Makefile $(DESTDIR)
29 sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
30+ $(MAKE) -C python install-ptest
31
32 runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
33 testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
34diff --git a/python/Makefile.am b/python/Makefile.am
35index 34aed96..ba3ec6a 100644
36--- a/python/Makefile.am
37+++ b/python/Makefile.am
38@@ -48,7 +48,16 @@ GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES)
39
40 $(GENERATED): $(srcdir)/generator.py $(API_DESC)
41 $(PYTHON) $(srcdir)/generator.py $(srcdir)
42+
43+install-ptest:
44+ cp -r $(srcdir) $(DESTDIR)
45+ sed -e 's|^Makefile:|_Makefile:|' \
46+ -e 's|^\(tests test:\) all|\1|' Makefile >$(DESTDIR)/python/Makefile
47+ $(MAKE) -C tests install-ptest
48+else
49+install-ptest:
50 endif
51
52+.PHONY: tests test
53 tests test: all
54 cd tests && $(MAKE) tests
55diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
56index 227e24d..021bb29 100644
57--- a/python/tests/Makefile.am
58+++ b/python/tests/Makefile.am
59@@ -59,6 +59,11 @@ XMLS= \
60 CLEANFILES = core tmp.xml *.pyc
61
62 if WITH_PYTHON
63+install-ptest:
64+ cp -r $(srcdir) $(DESTDIR)/python
65+ sed -e 's|^Makefile:|_Makefile:|' \
66+ -e 's|^\(srcdir = \).*|\1.|' Makefile >$(DESTDIR)/python/tests/Makefile
67+
68 tests: $(PYTESTS)
69 @for f in $(XMLS) ; do test -f $$f || $(LN_S) $(srcdir)/$$f . ; done
70 @echo "## running Python regression tests"
71@@ -70,9 +75,14 @@ tests: $(PYTESTS)
72 if [ "$$?" -ne 0 ] ; then \
73 echo "-- $$test" ; \
74 echo "$$log" ; \
75+ echo "FAIL: $$test"; \
76 exit 1 ; \
77+ else \
78+ echo "PASS: $$test"; \
79 fi ; \
80 done)
81 else
82+install-ptest:
83+
84 tests:
85 endif
86diff --git a/python/tests/tstLastError.py b/python/tests/tstLastError.py
87index 81d0acc..162c8db 100755
88--- a/python/tests/tstLastError.py
89+++ b/python/tests/tstLastError.py
90@@ -25,7 +25,7 @@ class TestCase(unittest.TestCase):
91 when the exception is raised, check the libxml2.lastError for
92 expected values."""
93 # disable the default error handler
94- libxml2.registerErrorHandler(None,None)
95+ libxml2.registerErrorHandler(lambda ctx,str: None,None)
96 try:
97 f(*args)
98 except exc:
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2019-20388.patch b/meta/recipes-core/libxml/libxml2/CVE-2019-20388.patch
deleted file mode 100644
index 88eb65a6a5..0000000000
--- a/meta/recipes-core/libxml/libxml2/CVE-2019-20388.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 7ffcd44d7e6c46704f8af0321d9314cd26e0e18a Mon Sep 17 00:00:00 2001
2From: Zhipeng Xie <xiezhipeng1@huawei.com>
3Date: Tue, 20 Aug 2019 16:33:06 +0800
4Subject: [PATCH] Fix memory leak in xmlSchemaValidateStream
5
6When ctxt->schema is NULL, xmlSchemaSAXPlug->xmlSchemaPreRun
7alloc a new schema for ctxt->schema and set vctxt->xsiAssemble
8to 1. Then xmlSchemaVStart->xmlSchemaPreRun initialize
9vctxt->xsiAssemble to 0 again which cause the alloced schema
10can not be freed anymore.
11
12Found with libFuzzer.
13
14Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/commit/7ffcd44d7e6c46704f8af0321d9314cd26e0e18a]
15CVE: CVE-2019-20388
16
17Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
18Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
19---
20 xmlschemas.c | 1 -
21 1 file changed, 1 deletion(-)
22
23diff --git a/xmlschemas.c b/xmlschemas.c
24index 301c8449..39d92182 100644
25--- a/xmlschemas.c
26+++ b/xmlschemas.c
27@@ -28090,7 +28090,6 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) {
28 vctxt->nberrors = 0;
29 vctxt->depth = -1;
30 vctxt->skipDepth = -1;
31- vctxt->xsiAssemble = 0;
32 vctxt->hasKeyrefs = 0;
33 #ifdef ENABLE_IDC_NODE_TABLES_TEST
34 vctxt->createIDCNodeTables = 1;
35--
362.24.1
37
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2020-24977.patch b/meta/recipes-core/libxml/libxml2/CVE-2020-24977.patch
deleted file mode 100644
index 8224346660..0000000000
--- a/meta/recipes-core/libxml/libxml2/CVE-2020-24977.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 50f06b3efb638efb0abd95dc62dca05ae67882c2 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Fri, 7 Aug 2020 21:54:27 +0200
4Subject: [PATCH] Fix out-of-bounds read with 'xmllint --htmlout'
5
6Make sure that truncated UTF-8 sequences don't cause an out-of-bounds
7array access.
8
9Thanks to @SuhwanSong and the Agency for Defense Development (ADD) for
10the report.
11
12Fixes #178.
13
14CVE: CVE-2020-24977
15Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/50f06b3efb638efb0abd95dc62dca05ae67882c2]
16
17Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
18---
19 xmllint.c | 6 ++++++
20 1 file changed, 6 insertions(+)
21
22diff --git a/xmllint.c b/xmllint.c
23index f6a8e463..c647486f 100644
24--- a/xmllint.c
25+++ b/xmllint.c
26@@ -528,6 +528,12 @@ static void
27 xmlHTMLEncodeSend(void) {
28 char *result;
29
30+ /*
31+ * xmlEncodeEntitiesReentrant assumes valid UTF-8, but the buffer might
32+ * end with a truncated UTF-8 sequence. This is a hack to at least avoid
33+ * an out-of-bounds read.
34+ */
35+ memset(&buffer[sizeof(buffer)-4], 0, 4);
36 result = (char *) xmlEncodeEntitiesReentrant(NULL, BAD_CAST buffer);
37 if (result) {
38 xmlGenericError(xmlGenericErrorContext, "%s", result);
39--
402.17.1
41
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2020-7595.patch b/meta/recipes-core/libxml/libxml2/CVE-2020-7595.patch
deleted file mode 100644
index facfefd362..0000000000
--- a/meta/recipes-core/libxml/libxml2/CVE-2020-7595.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From 0e1a49c8907645d2e155f0d89d4d9895ac5112b5 Mon Sep 17 00:00:00 2001
2From: Zhipeng Xie <xiezhipeng1@huawei.com>
3Date: Thu, 12 Dec 2019 17:30:55 +0800
4Subject: [PATCH] Fix infinite loop in xmlStringLenDecodeEntities
5
6When ctxt->instate == XML_PARSER_EOF,xmlParseStringEntityRef
7return NULL which cause a infinite loop in xmlStringLenDecodeEntities
8
9Found with libFuzzer.
10
11Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
12
13Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/commit/0e1a49c89076]
14CVE: CVE-2020-7595
15Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
16---
17 parser.c | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20diff --git a/parser.c b/parser.c
21index d1c31963..a34bb6cd 100644
22--- a/parser.c
23+++ b/parser.c
24@@ -2646,7 +2646,8 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
25 else
26 c = 0;
27 while ((c != 0) && (c != end) && /* non input consuming loop */
28- (c != end2) && (c != end3)) {
29+ (c != end2) && (c != end3) &&
30+ (ctxt->instate != XML_PARSER_EOF)) {
31
32 if (c == 0) break;
33 if ((c == '&') && (str[1] == '#')) {
34--
352.24.1
36
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 @@
1From 395c0f53ec226aaabedb166e6b3a7f8590b95a5f Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sat, 11 May 2019 20:39:15 +0800
4Subject: [PATCH] Make sure that Makefile doesn't try to compile these tests
5 again on the target where the source dependencies won't be available.
6
7Upstream-Status: Inappropriate [cross-compile specific]
8
9Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
10
11Rebase to 2.9.9
12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
13---
14 Makefile.am | 3 +--
15 1 file changed, 1 insertion(+), 2 deletions(-)
16
17diff --git a/Makefile.am b/Makefile.am
18index 8f4e43d..5edb930 100644
19--- a/Makefile.am
20+++ b/Makefile.am
21@@ -211,8 +211,7 @@ install-ptest:
22 sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
23 $(MAKE) -C python install-ptest
24
25-runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
26- testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
27+runtests:
28 [ -d test ] || $(LN_S) $(srcdir)/test .
29 [ -d result ] || $(LN_S) $(srcdir)/result .
30 $(CHECKER) ./runtest$(EXEEXT) && \
31--
322.7.4
33
diff --git a/meta/recipes-core/libxml/libxml2/fix-python39.patch b/meta/recipes-core/libxml/libxml2/fix-python39.patch
deleted file mode 100644
index 32590f9ddf..0000000000
--- a/meta/recipes-core/libxml/libxml2/fix-python39.patch
+++ /dev/null
@@ -1,94 +0,0 @@
1From e4fb36841800038c289997432ca547c9bfef9db1 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
3Date: Fri, 28 Feb 2020 12:48:14 +0100
4Subject: [PATCH] Parenthesize Py<type>_Check() in ifs
5
6In C, if expressions should be parenthesized.
7PyLong_Check, PyUnicode_Check etc. happened to expand to a parenthesized
8expression before, but that's not API to rely on.
9
10Since Python 3.9.0a4 it needs to be parenthesized explicitly.
11
12Fixes https://gitlab.gnome.org/GNOME/libxml2/issues/149
13Upstream-Status: Backport
14Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
15---
16 python/libxml.c | 4 ++--
17 python/types.c | 12 ++++++------
18 2 files changed, 8 insertions(+), 8 deletions(-)
19
20diff --git a/python/libxml.c b/python/libxml.c
21index bc676c4e0..81e709f34 100644
22--- a/python/libxml.c
23+++ b/python/libxml.c
24@@ -294,7 +294,7 @@ xmlPythonFileReadRaw (void * context, char * buffer, int len) {
25 lenread = PyBytes_Size(ret);
26 data = PyBytes_AsString(ret);
27 #ifdef PyUnicode_Check
28- } else if PyUnicode_Check (ret) {
29+ } else if (PyUnicode_Check (ret)) {
30 #if PY_VERSION_HEX >= 0x03030000
31 Py_ssize_t size;
32 const char *tmp;
33@@ -359,7 +359,7 @@ xmlPythonFileRead (void * context, char * buffer, int len) {
34 lenread = PyBytes_Size(ret);
35 data = PyBytes_AsString(ret);
36 #ifdef PyUnicode_Check
37- } else if PyUnicode_Check (ret) {
38+ } else if (PyUnicode_Check (ret)) {
39 #if PY_VERSION_HEX >= 0x03030000
40 Py_ssize_t size;
41 const char *tmp;
42diff --git a/python/types.c b/python/types.c
43index c2bafeb19..ed284ec74 100644
44--- a/python/types.c
45+++ b/python/types.c
46@@ -602,16 +602,16 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj)
47 if (obj == NULL) {
48 return (NULL);
49 }
50- if PyFloat_Check (obj) {
51+ if (PyFloat_Check (obj)) {
52 ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj));
53- } else if PyLong_Check(obj) {
54+ } else if (PyLong_Check(obj)) {
55 #ifdef PyLong_AS_LONG
56 ret = xmlXPathNewFloat((double) PyLong_AS_LONG(obj));
57 #else
58 ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj));
59 #endif
60 #ifdef PyBool_Check
61- } else if PyBool_Check (obj) {
62+ } else if (PyBool_Check (obj)) {
63
64 if (obj == Py_True) {
65 ret = xmlXPathNewBoolean(1);
66@@ -620,14 +620,14 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj)
67 ret = xmlXPathNewBoolean(0);
68 }
69 #endif
70- } else if PyBytes_Check (obj) {
71+ } else if (PyBytes_Check (obj)) {
72 xmlChar *str;
73
74 str = xmlStrndup((const xmlChar *) PyBytes_AS_STRING(obj),
75 PyBytes_GET_SIZE(obj));
76 ret = xmlXPathWrapString(str);
77 #ifdef PyUnicode_Check
78- } else if PyUnicode_Check (obj) {
79+ } else if (PyUnicode_Check (obj)) {
80 #if PY_VERSION_HEX >= 0x03030000
81 xmlChar *str;
82 const char *tmp;
83@@ -650,7 +650,7 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj)
84 ret = xmlXPathWrapString(str);
85 #endif
86 #endif
87- } else if PyList_Check (obj) {
88+ } else if (PyList_Check (obj)) {
89 int i;
90 PyObject *node;
91 xmlNodePtr cur;
92--
93GitLab
94
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 @@
1From 0779511838a8cbd1e0f431c22f28f286a2a37b1b Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com>
3Date: Mon, 5 Dec 2022 17:02:32 +0000
4Subject: [PATCH] add yocto-specific install-ptest target
5
6Add a target to install the test suite.
7
8Upstream-Status: Inappropriate
9Signed-off-by: Ross Burton <ross.burton@arm.com>
10---
11 Makefile.am | 10 ++++++++++
12 1 file changed, 10 insertions(+)
13
14diff --git a/Makefile.am b/Makefile.am
15index 0a49d37..1097c63 100644
16--- a/Makefile.am
17+++ b/Makefile.am
18@@ -27,6 +27,16 @@ check_PROGRAMS = \
19 testparser \
20 testrecurse
21
22+ptestdir=$(libexecdir)
23+install-test-data: $(check_PROGRAMS)
24+ install -d $(DESTDIR)$(ptestdir) $(DESTDIR)$(ptestdir)/python/
25+ for T in $(check_PROGRAMS); do \
26+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$T $(DESTDIR)$(ptestdir) ;\
27+ done
28+ cp -r $(srcdir)/test $(DESTDIR)$(ptestdir)
29+ cp -r $(srcdir)/result $(DESTDIR)$(ptestdir)
30+ cp -r $(srcdir)/python/tests $(DESTDIR)$(ptestdir)/python
31+
32 bin_PROGRAMS = xmllint xmlcatalog
33
34 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 @@
1From 056b14345b1abd76a761ab14538f1bc21302781a Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sat, 11 May 2019 20:26:51 +0800
4Subject: [PATCH] libxml 64bit
5
6Upstream-Status: Backport [from debian: bugs.debian.org/439843]
7Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
8---
9 libxml.h | 3 +++
10 1 file changed, 3 insertions(+)
11
12diff --git a/libxml.h b/libxml.h
13index 64e30f7..4e80d90 100644
14--- a/libxml.h
15+++ b/libxml.h
16@@ -15,6 +15,9 @@
17 #ifndef _LARGEFILE_SOURCE
18 #define _LARGEFILE_SOURCE
19 #endif
20+#ifndef _LARGEFILE64_SOURCE
21+#define _LARGEFILE64_SOURCE
22+#endif
23 #ifndef _FILE_OFFSET_BITS
24 #define _FILE_OFFSET_BITS 64
25 #endif
26--
272.7.4
28
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 e6998f6e68..0000000000
--- a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
+++ /dev/null
@@ -1,216 +0,0 @@
1From 43edc9a445ed66cceb7533eadeef242940b4592c Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sat, 11 May 2019 20:37:12 +0800
4Subject: [PATCH] AM_PATH_XML2 uses xml-config which we disable through
5binconfig-disabled.bbclass, so port it to use pkg-config instead.
6
7Upstream-Status: Pending
8Signed-off-by: Ross Burton <ross.burton@intel.com>
9
10Rebase to 2.9.9
11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
12---
13 libxml.m4 | 186 ++------------------------------------------------------------
14 1 file changed, 5 insertions(+), 181 deletions(-)
15
16diff --git a/libxml.m4 b/libxml.m4
17index 2d7a6f5..1c53585 100644
18--- a/libxml.m4
19+++ b/libxml.m4
20@@ -1,188 +1,12 @@
21-# Configure paths for LIBXML2
22-# Mike Hommey 2004-06-19
23-# use CPPFLAGS instead of CFLAGS
24-# Toshio Kuratomi 2001-04-21
25-# Adapted from:
26-# Configure paths for GLIB
27-# Owen Taylor 97-11-3
28-
29 dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
30 dnl Test for XML, and define XML_CPPFLAGS and XML_LIBS
31 dnl
32-AC_DEFUN([AM_PATH_XML2],[
33-AC_ARG_WITH(xml-prefix,
34- [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)],
35- xml_config_prefix="$withval", xml_config_prefix="")
36-AC_ARG_WITH(xml-exec-prefix,
37- [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
38- xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
39-AC_ARG_ENABLE(xmltest,
40- [ --disable-xmltest Do not try to compile and run a test LIBXML program],,
41- enable_xmltest=yes)
42-
43- if test x$xml_config_exec_prefix != x ; then
44- xml_config_args="$xml_config_args"
45- if test x${XML2_CONFIG+set} != xset ; then
46- XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
47- fi
48- fi
49- if test x$xml_config_prefix != x ; then
50- xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
51- if test x${XML2_CONFIG+set} != xset ; then
52- XML2_CONFIG=$xml_config_prefix/bin/xml2-config
53- fi
54- fi
55-
56- AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
57- min_xml_version=ifelse([$1], ,2.0.0,[$1])
58- AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
59- no_xml=""
60- if test "$XML2_CONFIG" = "no" ; then
61- no_xml=yes
62- else
63- XML_CPPFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
64- XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
65- xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
66- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
67- xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
68- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
69- xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
70- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
71- if test "x$enable_xmltest" = "xyes" ; then
72- ac_save_CPPFLAGS="$CPPFLAGS"
73- ac_save_LIBS="$LIBS"
74- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
75- LIBS="$XML_LIBS $LIBS"
76-dnl
77-dnl Now check if the installed libxml is sufficiently new.
78-dnl (Also sanity checks the results of xml2-config to some extent)
79-dnl
80- rm -f conf.xmltest
81- AC_TRY_RUN([
82-#include <stdlib.h>
83-#include <stdio.h>
84-#include <string.h>
85-#include <libxml/xmlversion.h>
86-
87-int
88-main()
89-{
90- int xml_major_version, xml_minor_version, xml_micro_version;
91- int major, minor, micro;
92- char *tmp_version;
93-
94- system("touch conf.xmltest");
95-
96- /* Capture xml2-config output via autoconf/configure variables */
97- /* HP/UX 9 (%@#!) writes to sscanf strings */
98- tmp_version = (char *)strdup("$min_xml_version");
99- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
100- printf("%s, bad version string from xml2-config\n", "$min_xml_version");
101- exit(1);
102- }
103- free(tmp_version);
104-
105- /* Capture the version information from the header files */
106- tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
107- if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
108- printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
109- exit(1);
110- }
111- free(tmp_version);
112-
113- /* Compare xml2-config output to the libxml headers */
114- if ((xml_major_version != $xml_config_major_version) ||
115- (xml_minor_version != $xml_config_minor_version) ||
116- (xml_micro_version != $xml_config_micro_version))
117- {
118- printf("*** libxml header files (version %d.%d.%d) do not match\n",
119- xml_major_version, xml_minor_version, xml_micro_version);
120- printf("*** xml2-config (version %d.%d.%d)\n",
121- $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
122- return 1;
123- }
124-/* Compare the headers to the library to make sure we match */
125- /* Less than ideal -- doesn't provide us with return value feedback,
126- * only exits if there's a serious mismatch between header and library.
127- */
128- LIBXML_TEST_VERSION;
129-
130- /* Test that the library is greater than our minimum version */
131- if ((xml_major_version > major) ||
132- ((xml_major_version == major) && (xml_minor_version > minor)) ||
133- ((xml_major_version == major) && (xml_minor_version == minor) &&
134- (xml_micro_version >= micro)))
135- {
136- return 0;
137- }
138- else
139- {
140- printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
141- xml_major_version, xml_minor_version, xml_micro_version);
142- printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
143- major, minor, micro);
144- printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
145- printf("***\n");
146- printf("*** If you have already installed a sufficiently new version, this error\n");
147- printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
148- printf("*** being found. The easiest way to fix this is to remove the old version\n");
149- printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
150- printf("*** correct copy of xml2-config. (In this case, you will have to\n");
151- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
152- printf("*** so that the correct libraries are found at run-time))\n");
153- }
154- return 1;
155-}
156-],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
157- CPPFLAGS="$ac_save_CPPFLAGS"
158- LIBS="$ac_save_LIBS"
159- fi
160- fi
161+AC_DEFUN([AM_PATH_XML2],[
162+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
163
164- if test "x$no_xml" = x ; then
165- AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
166- ifelse([$2], , :, [$2])
167- else
168- AC_MSG_RESULT(no)
169- if test "$XML2_CONFIG" = "no" ; then
170- echo "*** The xml2-config script installed by LIBXML could not be found"
171- echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
172- echo "*** your path, or set the XML2_CONFIG environment variable to the"
173- echo "*** full path to xml2-config."
174- else
175- if test -f conf.xmltest ; then
176- :
177- else
178- echo "*** Could not run libxml test program, checking why..."
179- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
180- LIBS="$LIBS $XML_LIBS"
181- AC_TRY_LINK([
182-#include <libxml/xmlversion.h>
183-#include <stdio.h>
184-], [ LIBXML_TEST_VERSION; return 0;],
185- [ echo "*** The test program compiled, but did not run. This usually means"
186- echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
187- echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
188- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
189- echo "*** to the installed location Also, make sure you have run ldconfig if that"
190- echo "*** is required on your system"
191- echo "***"
192- echo "*** If you have an old version installed, it is best to remove it, although"
193- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
194- [ echo "*** The test program failed to compile or link. See the file config.log for the"
195- echo "*** exact error that occurred. This usually means LIBXML was incorrectly installed"
196- echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
197- echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
198- CPPFLAGS="$ac_save_CPPFLAGS"
199- LIBS="$ac_save_LIBS"
200- fi
201- fi
202+ verdep=ifelse([$1], [], [], [">= $1"])
203+ PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3])
204
205- XML_CPPFLAGS=""
206- XML_LIBS=""
207- ifelse([$3], , :, [$3])
208- fi
209+ XML_CPPFLAGS=$XML_CFLAGS
210 AC_SUBST(XML_CPPFLAGS)
211- AC_SUBST(XML_LIBS)
212- rm -f conf.xmltest
213 ])
214--
2152.7.4
216
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 @@
1From b038c3452667ed17ddb0e791cd7bdc7f8774ac29 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sat, 11 May 2019 20:35:20 +0800
4Subject: [PATCH] Allow us to pass in PYTHON_SITE_PACKAGES
5
6The python binary used when building for nativesdk doesn't give us the
7correct path here so we need to be able to specify it ourselves.
8
9Upstream-Status: Inappropriate [config]
10Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
11
12Rebase to 2.9.9
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16 configure.ac | 3 ++-
17 1 file changed, 2 insertions(+), 1 deletion(-)
18
19diff --git a/configure.ac b/configure.ac
20index ca911f3..3bbd654 100644
21--- a/configure.ac
22+++ b/configure.ac
23@@ -808,7 +808,8 @@ dnl
24
25 PYTHON_VERSION=
26 PYTHON_INCLUDES=
27-PYTHON_SITE_PACKAGES=
28+# Allow this to be set externally
29+#PYTHON_SITE_PACKAGES=
30 PYTHON_TESTS=
31 pythondir=
32 if test "$with_python" != "no" ; then
33--
342.7.4
35
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 @@
1#!/bin/sh 1#!/bin/sh
2 2
3set -e
4
3export LC_ALL=en_US.UTF-8 5export LC_ALL=en_US.UTF-8
4make -k runtests 6
7# testModule isn't that useful and hard-codes buildtree, so we don't run that
8TESTS="runtest runsuite testrecurse testchar testdict testThreads runxmlconf testapi"
9
10for T in $TESTS; do
11 echo Running $T
12 ./$T && echo PASS: $T || echo FAIL: $T
13done
14
15if test -d python/tests; then
16 cd python/tests
17 for T in *.py; do
18 python3 ./$T && echo PASS: $T || echo FAIL: $T
19 done
20fi
diff --git a/meta/recipes-core/libxml/libxml2/runtest.patch b/meta/recipes-core/libxml/libxml2/runtest.patch
deleted file mode 100644
index 0dbb353c0f..0000000000
--- a/meta/recipes-core/libxml/libxml2/runtest.patch
+++ /dev/null
@@ -1,842 +0,0 @@
1Add 'install-ptest' rule. Print a standard result line for
2each test.
3
4Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
5Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
6Upstream-Status: Backport
7
8Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
9---
10 Makefile.am | 9 ++++
11 runsuite.c | 1 +
12 runtest.c | 2 +
13 runxmlconf.c | 1 +
14 testapi.c | 122 ++++++++++++++++++++++++++++++---------------
15 testchar.c | 156 +++++++++++++++++++++++++++++++++++++++++-----------------
16 testdict.c | 1 +
17 testlimits.c | 1 +
18 testrecurse.c | 2 +
19 9 files changed, 210 insertions(+), 85 deletions(-)
20
21diff --git a/Makefile.am b/Makefile.am
22index 9c630be..7cfd04b 100644
23--- a/Makefile.am
24+++ b/Makefile.am
25@@ -202,6 +202,15 @@ runxmlconf_LDADD= $(LDADDS)
26 #testOOM_DEPENDENCIES = $(DEPS)
27 #testOOM_LDADD= $(LDADDS)
28
29+install-ptest:
30+ @(if [ -d .libs ] ; then cd .libs; fi; \
31+ install $(check_PROGRAMS) $(DESTDIR))
32+ cp -r $(srcdir)/test $(DESTDIR)
33+ cp -r $(srcdir)/result $(DESTDIR)
34+ cp -r $(srcdir)/python $(DESTDIR)
35+ cp Makefile $(DESTDIR)
36+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
37+
38 runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
39 testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
40 [ -d test ] || $(LN_S) $(srcdir)/test .
41diff --git a/runsuite.c b/runsuite.c
42index aaab13e..9ba2c5d 100644
43--- a/runsuite.c
44+++ b/runsuite.c
45@@ -1162,6 +1162,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
46
47 if (logfile != NULL)
48 fclose(logfile);
49+ printf("%s: runsuite\n\n", (ret == 0) ? "PASS" : "FAIL");
50 return(ret);
51 }
52 #else /* !SCHEMAS */
53diff --git a/runtest.c b/runtest.c
54index addda5c..8ba5d59 100644
55--- a/runtest.c
56+++ b/runtest.c
57@@ -4501,6 +4501,7 @@ launchTests(testDescPtr tst) {
58 xmlCharEncCloseFunc(ebcdicHandler);
59 xmlCharEncCloseFunc(eucJpHandler);
60
61+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
62 return(err);
63 }
64
65@@ -4577,6 +4578,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
66 xmlCleanupParser();
67 xmlMemoryDump();
68
69+ printf("%s: runtest\n\n", (ret == 0) ? "PASS" : "FAIL");
70 return(ret);
71 }
72
73diff --git a/runxmlconf.c b/runxmlconf.c
74index cef20f4..4f291fb 100644
75--- a/runxmlconf.c
76+++ b/runxmlconf.c
77@@ -595,6 +595,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
78
79 if (logfile != NULL)
80 fclose(logfile);
81+ printf("%s: runxmlconf\n", (ret == 0) ? "PASS" : "FAIL");
82 return(ret);
83 }
84
85diff --git a/testapi.c b/testapi.c
86index 4a751e2..7ccc066 100644
87--- a/testapi.c
88+++ b/testapi.c
89@@ -1246,49 +1246,91 @@ static int
90 testlibxml2(void)
91 {
92 int test_ret = 0;
93-
94- test_ret += test_HTMLparser();
95- test_ret += test_HTMLtree();
96- test_ret += test_SAX2();
97- test_ret += test_c14n();
98- test_ret += test_catalog();
99- test_ret += test_chvalid();
100- test_ret += test_debugXML();
101- test_ret += test_dict();
102- test_ret += test_encoding();
103- test_ret += test_entities();
104- test_ret += test_hash();
105- test_ret += test_list();
106- test_ret += test_nanoftp();
107- test_ret += test_nanohttp();
108- test_ret += test_parser();
109- test_ret += test_parserInternals();
110- test_ret += test_pattern();
111- test_ret += test_relaxng();
112- test_ret += test_schemasInternals();
113- test_ret += test_schematron();
114- test_ret += test_tree();
115- test_ret += test_uri();
116- test_ret += test_valid();
117- test_ret += test_xinclude();
118- test_ret += test_xmlIO();
119- test_ret += test_xmlautomata();
120- test_ret += test_xmlerror();
121- test_ret += test_xmlmodule();
122- test_ret += test_xmlreader();
123- test_ret += test_xmlregexp();
124- test_ret += test_xmlsave();
125- test_ret += test_xmlschemas();
126- test_ret += test_xmlschemastypes();
127- test_ret += test_xmlstring();
128- test_ret += test_xmlunicode();
129- test_ret += test_xmlwriter();
130- test_ret += test_xpath();
131- test_ret += test_xpathInternals();
132- test_ret += test_xpointer();
133+ int ret = 0;
134+
135+ test_ret += (ret = test_HTMLparser());
136+ printf("%s: HTMLparser\n", (ret == 0) ? "PASS" : "FAIL");
137+ test_ret += (ret = test_HTMLtree());
138+ printf("%s: HTMLtree\n", (ret == 0) ? "PASS" : "FAIL");
139+ test_ret += (ret = test_SAX2());
140+ printf("%s: SAX2\n", (ret == 0) ? "PASS" : "FAIL");
141+ test_ret += (ret = test_c14n());
142+ printf("%s: c14n\n", (ret == 0) ? "PASS" : "FAIL");
143+ test_ret += (ret = test_catalog());
144+ printf("%s: catalog\n", (ret == 0) ? "PASS" : "FAIL");
145+ test_ret += (ret = test_chvalid());
146+ printf("%s: chvalid\n", (ret == 0) ? "PASS" : "FAIL");
147+ test_ret += (ret = test_debugXML());
148+ printf("%s: debugXML\n", (ret == 0) ? "PASS" : "FAIL");
149+ test_ret += (ret = test_dict());
150+ printf("%s: dict\n", (ret == 0) ? "PASS" : "FAIL");
151+ test_ret += (ret = test_encoding());
152+ printf("%s: encoding\n", (ret == 0) ? "PASS" : "FAIL");
153+ test_ret += (ret = test_entities());
154+ printf("%s: entities\n", (ret == 0) ? "PASS" : "FAIL");
155+ test_ret += (ret = test_hash());
156+ printf("%s: hash\n", (ret == 0) ? "PASS" : "FAIL");
157+ test_ret += (ret = test_list());
158+ printf("%s: list\n", (ret == 0) ? "PASS" : "FAIL");
159+ test_ret += (ret = test_nanoftp());
160+ printf("%s: nanoftp\n", (ret == 0) ? "PASS" : "FAIL");
161+ test_ret += (ret = test_nanohttp());
162+ printf("%s: nanohttp\n", (ret == 0) ? "PASS" : "FAIL");
163+ test_ret += (ret = test_parser());
164+ printf("%s: parser\n", (ret == 0) ? "PASS" : "FAIL");
165+ test_ret += (ret = test_parserInternals());
166+ printf("%s: parserInternals\n", (ret == 0) ? "PASS" : "FAIL");
167+ test_ret += (ret = test_pattern());
168+ printf("%s: pattern\n", (ret == 0) ? "PASS" : "FAIL");
169+ test_ret += (ret = test_relaxng());
170+ printf("%s: relaxng\n", (ret == 0) ? "PASS" : "FAIL");
171+ test_ret += (ret = test_schemasInternals());
172+ printf("%s: schemasInternals\n", (ret == 0) ? "PASS" : "FAIL");
173+ test_ret += (ret = test_schematron());
174+ printf("%s: schematron\n", (ret == 0) ? "PASS" : "FAIL");
175+ test_ret += (ret = test_tree());
176+ printf("%s: tree\n", (ret == 0) ? "PASS" : "FAIL");
177+ test_ret += (ret = test_uri());
178+ printf("%s: uri\n", (ret == 0) ? "PASS" : "FAIL");
179+ test_ret += (ret = test_valid());
180+ printf("%s: valid\n", (ret == 0) ? "PASS" : "FAIL");
181+ test_ret += (ret = test_xinclude());
182+ printf("%s: xinclude\n", (ret == 0) ? "PASS" : "FAIL");
183+ test_ret += (ret = test_xmlIO());
184+ printf("%s: xmlIO\n", (ret == 0) ? "PASS" : "FAIL");
185+ test_ret += (ret = test_xmlautomata());
186+ printf("%s: xmlautomata\n", (ret == 0) ? "PASS" : "FAIL");
187+ test_ret += (ret = test_xmlerror());
188+ printf("%s: xmlerror\n", (ret == 0) ? "PASS" : "FAIL");
189+ test_ret += (ret = test_xmlmodule());
190+ printf("%s: xmlmodule\n", (ret == 0) ? "PASS" : "FAIL");
191+ test_ret += (ret = test_xmlreader());
192+ printf("%s: xmlreader\n", (ret == 0) ? "PASS" : "FAIL");
193+ test_ret += (ret = test_xmlregexp());
194+ printf("%s: xmlregexp\n", (ret == 0) ? "PASS" : "FAIL");
195+ test_ret += (ret = test_xmlsave());
196+ printf("%s: xmlsave\n", (ret == 0) ? "PASS" : "FAIL");
197+ test_ret += (ret = test_xmlschemas());
198+ printf("%s: xmlschemas\n", (ret == 0) ? "PASS" : "FAIL");
199+ test_ret += (ret = test_xmlschemastypes());
200+ printf("%s: xmlschemastypes\n", (ret == 0) ? "PASS" : "FAIL");
201+ test_ret += (ret = test_xmlstring());
202+ printf("%s: xmlstring\n", (ret == 0) ? "PASS" : "FAIL");
203+ test_ret += (ret = test_xmlunicode());
204+ printf("%s: xmlunicode\n", (ret == 0) ? "PASS" : "FAIL");
205+ test_ret += (ret = test_xmlwriter());
206+ printf("%s: xmlwriter\n", (ret == 0) ? "PASS" : "FAIL");
207+ test_ret += (ret = test_xpath());
208+ printf("%s: xpath\n", (ret == 0) ? "PASS" : "FAIL");
209+ test_ret += (ret = test_xpathInternals());
210+ printf("%s: xpathInternals\n", (ret == 0) ? "PASS" : "FAIL");
211+ test_ret += (ret = test_xpointer());
212+ printf("%s: xpointer\n", (ret == 0) ? "PASS" : "FAIL");
213
214 printf("Total: %d functions, %d tests, %d errors\n",
215 function_tests, call_tests, test_ret);
216+
217+ printf("%s: testapi\n\n", (test_ret == 0) ? "PASS" : "FAIL");
218 return(test_ret);
219 }
220
221diff --git a/testchar.c b/testchar.c
222index 0d08792..f555d3b 100644
223--- a/testchar.c
224+++ b/testchar.c
225@@ -23,7 +23,7 @@ static void errorHandler(void *unused, xmlErrorPtr err) {
226 char document1[100] = "<doc>XXXX</doc>";
227 char document2[100] = "<doc foo='XXXX'/>";
228
229-static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
230+static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
231 int len, char *data, int forbid1, int forbid2) {
232 int i;
233 xmlDocPtr res;
234@@ -37,33 +37,41 @@ static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
235 res = xmlReadMemory(document, len, "test", NULL, 0);
236
237 if ((i == forbid1) || (i == forbid2)) {
238- if ((lastError == 0) || (res != NULL))
239+ if ((lastError == 0) || (res != NULL)) {
240 fprintf(stderr,
241 "Failed to detect invalid char for Byte 0x%02X: %c\n",
242 i, i);
243+ return(1);
244+ }
245 }
246
247 else if ((i == '<') || (i == '&')) {
248- if ((lastError == 0) || (res != NULL))
249+ if ((lastError == 0) || (res != NULL)) {
250 fprintf(stderr,
251 "Failed to detect illegal char %c for Byte 0x%02X\n", i, i);
252+ return(1);
253+ }
254 }
255 else if (((i < 0x20) || (i >= 0x80)) &&
256 (i != 0x9) && (i != 0xA) && (i != 0xD)) {
257- if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL))
258+ if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) {
259 fprintf(stderr,
260 "Failed to detect invalid char for Byte 0x%02X\n", i);
261+ return(1);
262+ }
263 }
264 else if (res == NULL) {
265 fprintf(stderr,
266 "Failed to parse valid char for Byte 0x%02X : %c\n", i, i);
267+ return(1);
268 }
269 if (res != NULL)
270 xmlFreeDoc(res);
271 }
272+ return(0);
273 }
274
275-static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
276+static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
277 int len, char *data) {
278 int i, j;
279 xmlDocPtr res;
280@@ -80,10 +88,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
281
282 /* if first bit of first char is set, then second bit must too */
283 if ((i & 0x80) && ((i & 0x40) == 0)) {
284- if ((lastError == 0) || (res != NULL))
285+ if ((lastError == 0) || (res != NULL)) {
286 fprintf(stderr,
287 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
288 i, j);
289+ return(1);
290+ }
291 }
292
293 /*
294@@ -91,10 +101,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
295 * bits must be 10
296 */
297 else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
298- if ((lastError == 0) || (res != NULL))
299+ if ((lastError == 0) || (res != NULL)) {
300 fprintf(stderr,
301 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
302 i, j);
303+ return(1);
304+ }
305 }
306
307 /*
308@@ -102,10 +114,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
309 * than 0x80, i.e. one of bits 5 to 1 of i must be set
310 */
311 else if ((i & 0x80) && ((i & 0x1E) == 0)) {
312- if ((lastError == 0) || (res != NULL))
313+ if ((lastError == 0) || (res != NULL)) {
314 fprintf(stderr,
315 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
316 i, j);
317+ return(1);
318+ }
319 }
320
321 /*
322@@ -113,10 +127,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
323 * at least 3 bytes, but we give only 2 !
324 */
325 else if ((i & 0xE0) == 0xE0) {
326- if ((lastError == 0) || (res != NULL))
327+ if ((lastError == 0) || (res != NULL)) {
328 fprintf(stderr,
329 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
330 i, j);
331+ return(1);
332+ }
333 }
334
335 /*
336@@ -125,11 +141,13 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
337 else if ((lastError != 0) || (res == NULL)) {
338 fprintf(stderr,
339 "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j);
340+ return(1);
341 }
342 if (res != NULL)
343 xmlFreeDoc(res);
344 }
345 }
346+ return(0);
347 }
348
349 /**
350@@ -141,9 +159,10 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
351 * CDATA in text or in attribute values.
352 */
353
354-static void testDocumentRanges(void) {
355+static int testDocumentRanges(void) {
356 xmlParserCtxtPtr ctxt;
357 char *data;
358+ int test_ret = 0;
359
360 /*
361 * Set up a parsing context using the first document as
362@@ -152,7 +171,7 @@ static void testDocumentRanges(void) {
363 ctxt = xmlNewParserCtxt();
364 if (ctxt == NULL) {
365 fprintf(stderr, "Failed to allocate parser context\n");
366- return;
367+ return(1);
368 }
369
370 printf("testing 1 byte char in document: 1");
371@@ -163,7 +182,7 @@ static void testDocumentRanges(void) {
372 data[2] = ' ';
373 data[3] = ' ';
374 /* test 1 byte injection at beginning of area */
375- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
376+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
377 data, -1, -1);
378 printf(" 2");
379 fflush(stdout);
380@@ -172,7 +191,7 @@ static void testDocumentRanges(void) {
381 data[2] = ' ';
382 data[3] = ' ';
383 /* test 1 byte injection at end of area */
384- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
385+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
386 data + 3, -1, -1);
387
388 printf(" 3");
389@@ -183,7 +202,7 @@ static void testDocumentRanges(void) {
390 data[2] = ' ';
391 data[3] = ' ';
392 /* test 1 byte injection at beginning of area */
393- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
394+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
395 data, '\'', -1);
396 printf(" 4");
397 fflush(stdout);
398@@ -192,7 +211,7 @@ static void testDocumentRanges(void) {
399 data[2] = ' ';
400 data[3] = ' ';
401 /* test 1 byte injection at end of area */
402- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
403+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
404 data + 3, '\'', -1);
405 printf(" done\n");
406
407@@ -204,7 +223,7 @@ static void testDocumentRanges(void) {
408 data[2] = ' ';
409 data[3] = ' ';
410 /* test 2 byte injection at beginning of area */
411- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
412+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
413 data);
414 printf(" 2");
415 fflush(stdout);
416@@ -213,7 +232,7 @@ static void testDocumentRanges(void) {
417 data[2] = ' ';
418 data[3] = ' ';
419 /* test 2 byte injection at end of area */
420- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
421+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
422 data + 2);
423
424 printf(" 3");
425@@ -224,7 +243,7 @@ static void testDocumentRanges(void) {
426 data[2] = ' ';
427 data[3] = ' ';
428 /* test 2 byte injection at beginning of area */
429- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
430+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
431 data);
432 printf(" 4");
433 fflush(stdout);
434@@ -233,14 +252,15 @@ static void testDocumentRanges(void) {
435 data[2] = ' ';
436 data[3] = ' ';
437 /* test 2 byte injection at end of area */
438- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
439+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
440 data + 2);
441 printf(" done\n");
442
443 xmlFreeParserCtxt(ctxt);
444+ return(test_ret);
445 }
446
447-static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
448+static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
449 int i = 0;
450 int len, c;
451
452@@ -255,19 +275,25 @@ static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
453 c = xmlCurrentChar(ctxt, &len);
454 if ((i == 0) || (i >= 0x80)) {
455 /* we must see an error there */
456- if (lastError != XML_ERR_INVALID_CHAR)
457+ if (lastError != XML_ERR_INVALID_CHAR) {
458 fprintf(stderr,
459 "Failed to detect invalid char for Byte 0x%02X\n", i);
460+ return(1);
461+ }
462 } else if (i == 0xD) {
463- if ((c != 0xA) || (len != 1))
464+ if ((c != 0xA) || (len != 1)) {
465 fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i);
466+ return(1);
467+ }
468 } else if ((c != i) || (len != 1)) {
469 fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i);
470+ return(1);
471 }
472 }
473+ return(0);
474 }
475
476-static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
477+static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
478 int i, j;
479 int len, c;
480
481@@ -284,10 +310,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
482
483 /* if first bit of first char is set, then second bit must too */
484 if ((i & 0x80) && ((i & 0x40) == 0)) {
485- if (lastError != XML_ERR_INVALID_CHAR)
486+ if (lastError != XML_ERR_INVALID_CHAR) {
487 fprintf(stderr,
488 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
489 i, j);
490+ return(1);
491+ }
492 }
493
494 /*
495@@ -295,10 +323,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
496 * bits must be 10
497 */
498 else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
499- if (lastError != XML_ERR_INVALID_CHAR)
500+ if (lastError != XML_ERR_INVALID_CHAR) {
501 fprintf(stderr,
502 "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
503 i, j, c);
504+ return(1);
505+ }
506 }
507
508 /*
509@@ -306,10 +336,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
510 * than 0x80, i.e. one of bits 5 to 1 of i must be set
511 */
512 else if ((i & 0x80) && ((i & 0x1E) == 0)) {
513- if (lastError != XML_ERR_INVALID_CHAR)
514+ if (lastError != XML_ERR_INVALID_CHAR) {
515 fprintf(stderr,
516 "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
517 i, j, c);
518+ return(1);
519+ }
520 }
521
522 /*
523@@ -317,10 +349,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
524 * at least 3 bytes, but we give only 2 !
525 */
526 else if ((i & 0xE0) == 0xE0) {
527- if (lastError != XML_ERR_INVALID_CHAR)
528+ if (lastError != XML_ERR_INVALID_CHAR) {
529 fprintf(stderr,
530 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
531 i, j);
532+ return(1);
533+ }
534 }
535
536 /*
537@@ -329,6 +363,7 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
538 else if ((lastError != 0) || (len != 2)) {
539 fprintf(stderr,
540 "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j);
541+ return(1);
542 }
543
544 /*
545@@ -338,12 +373,14 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
546 fprintf(stderr,
547 "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n",
548 i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c);
549+ return(1);
550 }
551 }
552 }
553+ return(0);
554 }
555
556-static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
557+static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
558 int i, j, k, K;
559 int len, c;
560 unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
561@@ -368,20 +405,24 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
562 * at least 4 bytes, but we give only 3 !
563 */
564 if ((i & 0xF0) == 0xF0) {
565- if (lastError != XML_ERR_INVALID_CHAR)
566+ if (lastError != XML_ERR_INVALID_CHAR) {
567 fprintf(stderr,
568 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
569 i, j, K, data[3]);
570+ return(1);
571+ }
572 }
573
574 /*
575 * The second and the third bytes must start with 10
576 */
577 else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) {
578- if (lastError != XML_ERR_INVALID_CHAR)
579+ if (lastError != XML_ERR_INVALID_CHAR) {
580 fprintf(stderr,
581 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
582 i, j, K);
583+ return(1);
584+ }
585 }
586
587 /*
588@@ -390,10 +431,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
589 * the 6th byte of data[1] must be set
590 */
591 else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) {
592- if (lastError != XML_ERR_INVALID_CHAR)
593+ if (lastError != XML_ERR_INVALID_CHAR) {
594 fprintf(stderr,
595 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
596 i, j, K);
597+ return(1);
598+ }
599 }
600
601 /*
602@@ -401,10 +444,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
603 */
604 else if (((value > 0xD7FF) && (value <0xE000)) ||
605 ((value > 0xFFFD) && (value <0x10000))) {
606- if (lastError != XML_ERR_INVALID_CHAR)
607+ if (lastError != XML_ERR_INVALID_CHAR) {
608 fprintf(stderr,
609 "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n",
610 value, i, j, K);
611+ return(1);
612+ }
613 }
614
615 /*
616@@ -414,6 +459,7 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
617 fprintf(stderr,
618 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
619 i, j, K);
620+ return(1);
621 }
622
623 /*
624@@ -423,13 +469,15 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
625 fprintf(stderr,
626 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
627 i, j, data[2], value, c);
628+ return(1);
629 }
630 }
631 }
632 }
633+ return(0);
634 }
635
636-static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
637+static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
638 int i, j, k, K, l, L;
639 int len, c;
640 unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
641@@ -458,10 +506,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
642 * at least 5 bytes, but we give only 4 !
643 */
644 if ((i & 0xF8) == 0xF8) {
645- if (lastError != XML_ERR_INVALID_CHAR)
646+ if (lastError != XML_ERR_INVALID_CHAR) {
647 fprintf(stderr,
648 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
649 i, j, K, data[3]);
650+ return(1);
651+ }
652 }
653
654 /*
655@@ -469,10 +519,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
656 */
657 else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) ||
658 ((L & 0xC0) != 0x80)) {
659- if (lastError != XML_ERR_INVALID_CHAR)
660+ if (lastError != XML_ERR_INVALID_CHAR) {
661 fprintf(stderr,
662 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
663 i, j, K, L);
664+ return(1);
665+ }
666 }
667
668 /*
669@@ -481,10 +533,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
670 * the 6 or 5th byte of j must be set
671 */
672 else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) {
673- if (lastError != XML_ERR_INVALID_CHAR)
674+ if (lastError != XML_ERR_INVALID_CHAR) {
675 fprintf(stderr,
676 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
677 i, j, K, L);
678+ return(1);
679+ }
680 }
681
682 /*
683@@ -493,10 +547,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
684 else if (((value > 0xD7FF) && (value <0xE000)) ||
685 ((value > 0xFFFD) && (value <0x10000)) ||
686 (value > 0x10FFFF)) {
687- if (lastError != XML_ERR_INVALID_CHAR)
688+ if (lastError != XML_ERR_INVALID_CHAR) {
689 fprintf(stderr,
690 "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
691 value, i, j, K, L);
692+ return(1);
693+ }
694 }
695
696 /*
697@@ -506,6 +562,7 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
698 fprintf(stderr,
699 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
700 i, j, K);
701+ return(1);
702 }
703
704 /*
705@@ -515,11 +572,13 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
706 fprintf(stderr,
707 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
708 i, j, data[2], value, c);
709+ return(1);
710 }
711 }
712 }
713 }
714 }
715+ return(0);
716 }
717
718 /**
719@@ -530,11 +589,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
720 * cover the full range of UTF-8 chars accepted by XML-1.0
721 */
722
723-static void testCharRanges(void) {
724+static int testCharRanges(void) {
725 char data[5];
726 xmlParserCtxtPtr ctxt;
727 xmlParserInputBufferPtr buf;
728 xmlParserInputPtr input;
729+ int test_ret = 0;
730
731 memset(data, 0, 5);
732
733@@ -545,17 +605,19 @@ static void testCharRanges(void) {
734 ctxt = xmlNewParserCtxt();
735 if (ctxt == NULL) {
736 fprintf(stderr, "Failed to allocate parser context\n");
737- return;
738+ return(1);
739 }
740 buf = xmlParserInputBufferCreateStatic(data, sizeof(data),
741 XML_CHAR_ENCODING_NONE);
742 if (buf == NULL) {
743 fprintf(stderr, "Failed to allocate input buffer\n");
744+ test_ret = 1;
745 goto error;
746 }
747 input = xmlNewInputStream(ctxt);
748 if (input == NULL) {
749 xmlFreeParserInputBuffer(buf);
750+ test_ret = 1;
751 goto error;
752 }
753 input->filename = NULL;
754@@ -567,25 +629,28 @@ static void testCharRanges(void) {
755
756 printf("testing char range: 1");
757 fflush(stdout);
758- testCharRangeByte1(ctxt, data);
759+ test_ret += testCharRangeByte1(ctxt, data);
760 printf(" 2");
761 fflush(stdout);
762- testCharRangeByte2(ctxt, data);
763+ test_ret += testCharRangeByte2(ctxt, data);
764 printf(" 3");
765 fflush(stdout);
766- testCharRangeByte3(ctxt, data);
767+ test_ret += testCharRangeByte3(ctxt, data);
768 printf(" 4");
769 fflush(stdout);
770- testCharRangeByte4(ctxt, data);
771+ test_ret += testCharRangeByte4(ctxt, data);
772 printf(" done\n");
773 fflush(stdout);
774
775 error:
776 xmlFreeParserCtxt(ctxt);
777+ return(test_ret);
778 }
779
780 int main(void) {
781
782+ int ret = 0;
783+
784 /*
785 * this initialize the library and check potential ABI mismatches
786 * between the version it was compiled for and the actual shared
787@@ -602,8 +667,9 @@ int main(void) {
788 /*
789 * Run the tests
790 */
791- testCharRanges();
792- testDocumentRanges();
793+ ret += testCharRanges();
794+ ret += testDocumentRanges();
795+ printf("%s: testchar\n\n", (ret == 0) ? "PASS" : "FAIL");
796
797 /*
798 * Cleanup function for the XML library.
799diff --git a/testdict.c b/testdict.c
800index 40bebd0..114b934 100644
801--- a/testdict.c
802+++ b/testdict.c
803@@ -440,5 +440,6 @@ int main(void)
804 clean_strings();
805 xmlCleanupParser();
806 xmlMemoryDump();
807+ printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL");
808 return(ret);
809 }
810diff --git a/testlimits.c b/testlimits.c
811index 68c94db..1584434 100644
812--- a/testlimits.c
813+++ b/testlimits.c
814@@ -1634,5 +1634,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
815 xmlCleanupParser();
816 xmlMemoryDump();
817
818+ printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL");
819 return(ret);
820 }
821diff --git a/testrecurse.c b/testrecurse.c
822index f95ae1c..74c8f8b 100644
823--- a/testrecurse.c
824+++ b/testrecurse.c
825@@ -892,6 +892,7 @@ launchTests(testDescPtr tst) {
826 err++;
827 }
828 }
829+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
830 return(err);
831 }
832
833@@ -961,5 +962,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
834 xmlCleanupParser();
835 xmlMemoryDump();
836
837+ printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL");
838 return(ret);
839 }
840--
8412.7.4
842