diff options
author | Ross Burton <ross.burton@arm.com> | 2022-12-07 16:57:55 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-08 10:50:30 +0000 |
commit | f4ffba353eb7877060c25d264fa10cd60f797f0b (patch) | |
tree | f7163587ea88974eb0b7ba7636f139ffbae0916f | |
parent | 85ec78cc24346f8e0d45ca947a2fecf17913b535 (diff) | |
download | poky-f4ffba353eb7877060c25d264fa10cd60f797f0b.tar.gz |
libxml2: upgrade 2.9.14 -> 2.10.3
Change ptest away from using the upstream Makefiles to manually running
the tests: they're not actually integrated with automake anyway so this
didn't gain us anything apart from patches we can't send upstream. Drops
the following patches:
- 0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch
- 0001-Port-gentest.py-to-Python-3.patch
- fix-execution-of-ptests.patch
- remove-fuzz-from-ptests.patch
- runtest.patch
Add a simple patch to install the test binaries via the Makefile:
- install-tests.patch
The Python module is built differently and a number of patches no longer
apply and appear to be redundant, remove:
- python-sitepackages-dir.patch
libxml-m4-use-pkgconfig.patch has been sent upstream now, mark as
backport.
Remove obsolete --without-docbook option.
Remove obsolete xml2Conf.sh packaging.
(From OE-Core rev: ec5f380a14246e31b2a1a12dda9fe2178b1e5f83)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch | 86 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch | 814 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch | 33 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2/install-tests.patch | 38 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch | 24 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch | 35 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch | 44 | ||||
-rwxr-xr-x[-rw-r--r--] | meta/recipes-core/libxml/libxml2/run-ptest | 18 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2/runtest.patch | 849 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2_2.10.3.bb (renamed from meta/recipes-core/libxml/libxml2_2.9.14.bb) | 61 |
10 files changed, 72 insertions, 1930 deletions
diff --git a/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch b/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch deleted file mode 100644 index 6d9ede6194..0000000000 --- a/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | From ea1993d1d9a18c5e61b9cb271892b0a48f508d32 Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Kjellerstedt <pkj@axis.com> | ||
3 | Date: Fri, 9 Jun 2017 17:50:46 +0200 | ||
4 | Subject: [PATCH] Make ptest run the python tests if python is enabled | ||
5 | |||
6 | One of the tests (tstLastError.py) needed a minor correction. It might | ||
7 | be due to the fact that the tests are forced to run with Python 3. | ||
8 | |||
9 | Upstream-Status: Inappropriate [OE specific] | ||
10 | Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> | ||
11 | --- | ||
12 | Makefile.am | 2 +- | ||
13 | python/Makefile.am | 9 +++++++++ | ||
14 | python/tests/Makefile.am | 10 ++++++++++ | ||
15 | 3 files changed, 20 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/Makefile.am b/Makefile.am | ||
18 | index b428452b..dc18d6dd 100644 | ||
19 | --- a/Makefile.am | ||
20 | +++ b/Makefile.am | ||
21 | @@ -203,9 +203,9 @@ install-ptest: | ||
22 | install $(check_PROGRAMS) $(DESTDIR)) | ||
23 | cp -r $(srcdir)/test $(DESTDIR) | ||
24 | cp -r $(srcdir)/result $(DESTDIR) | ||
25 | - cp -r $(srcdir)/python $(DESTDIR) | ||
26 | cp Makefile $(DESTDIR) | ||
27 | sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile | ||
28 | + $(MAKE) -C python install-ptest | ||
29 | |||
30 | runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \ | ||
31 | testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT) | ||
32 | diff --git a/python/Makefile.am b/python/Makefile.am | ||
33 | index 34aed96c..ba3ec6a4 100644 | ||
34 | --- a/python/Makefile.am | ||
35 | +++ b/python/Makefile.am | ||
36 | @@ -48,7 +48,16 @@ GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES) | ||
37 | |||
38 | $(GENERATED): $(srcdir)/generator.py $(API_DESC) | ||
39 | $(PYTHON) $(srcdir)/generator.py $(srcdir) | ||
40 | + | ||
41 | +install-ptest: | ||
42 | + cp -r $(srcdir) $(DESTDIR) | ||
43 | + sed -e 's|^Makefile:|_Makefile:|' \ | ||
44 | + -e 's|^\(tests test:\) all|\1|' Makefile >$(DESTDIR)/python/Makefile | ||
45 | + $(MAKE) -C tests install-ptest | ||
46 | +else | ||
47 | +install-ptest: | ||
48 | endif | ||
49 | |||
50 | +.PHONY: tests test | ||
51 | tests test: all | ||
52 | cd tests && $(MAKE) tests | ||
53 | diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am | ||
54 | index 227e24df..3568c2d2 100644 | ||
55 | --- a/python/tests/Makefile.am | ||
56 | +++ b/python/tests/Makefile.am | ||
57 | @@ -59,6 +59,11 @@ XMLS= \ | ||
58 | CLEANFILES = core tmp.xml *.pyc | ||
59 | |||
60 | if WITH_PYTHON | ||
61 | +install-ptest: | ||
62 | + cp -r $(srcdir) $(DESTDIR)/python | ||
63 | + sed -e 's|^Makefile:|_Makefile:|' \ | ||
64 | + -e 's|^\(srcdir = \).*|\1.|' Makefile >$(DESTDIR)/python/tests/Makefile | ||
65 | + | ||
66 | tests: $(PYTESTS) | ||
67 | @for f in $(XMLS) ; do test -f $$f || $(LN_S) $(srcdir)/$$f . ; done | ||
68 | @echo "## running Python regression tests" | ||
69 | @@ -70,9 +75,14 @@ tests: $(PYTESTS) | ||
70 | if [ "$$?" -ne 0 ] ; then \ | ||
71 | echo "-- $$test" ; \ | ||
72 | echo "$$log" ; \ | ||
73 | + echo "FAIL: $$test"; \ | ||
74 | exit 1 ; \ | ||
75 | + else \ | ||
76 | + echo "PASS: $$test"; \ | ||
77 | fi ; \ | ||
78 | done) | ||
79 | else | ||
80 | +install-ptest: | ||
81 | + | ||
82 | tests: | ||
83 | endif | ||
84 | -- | ||
85 | 2.25.1 | ||
86 | |||
diff --git a/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch b/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch deleted file mode 100644 index c6567ac878..0000000000 --- a/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch +++ /dev/null | |||
@@ -1,814 +0,0 @@ | |||
1 | From 2c20198b1ddb1bfb47269b8caf929ffb83748f78 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nick Wellnhofer <wellnhofer@aevum.de> | ||
3 | Date: Thu, 21 Apr 2022 00:45:58 +0200 | ||
4 | Subject: [PATCH] Port gentest.py to Python 3 | ||
5 | |||
6 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/343fc1421cdae097fa6c4cffeb1a065a40be6bbb] | ||
7 | |||
8 | * fixes: | ||
9 | |||
10 | make[1]: 'testReader' is up to date. | ||
11 | File "../libxml2-2.9.10/gentest.py", line 11 | ||
12 | print "libxml2 python bindings not available, skipping testapi.c generation" | ||
13 | ^ | ||
14 | SyntaxError: Missing parentheses in call to 'print'. Did you mean print("libxml2 python bindings not available, skipping testapi.c generation")? | ||
15 | make[1]: [Makefile:2078: testapi.c] Error 1 (ignored) | ||
16 | |||
17 | ... | ||
18 | |||
19 | make[1]: 'testReader' is up to date. | ||
20 | File "../libxml2-2.9.10/gentest.py", line 271 | ||
21 | return 1 | ||
22 | ^ | ||
23 | TabError: inconsistent use of tabs and spaces in indentation | ||
24 | make[1]: [Makefile:2078: testapi.c] Error 1 (ignored) | ||
25 | |||
26 | ... | ||
27 | |||
28 | aarch64-oe-linux-gcc: error: testapi.c: No such file or directory | ||
29 | aarch64-oe-linux-gcc: fatal error: no input files | ||
30 | compilation terminated. | ||
31 | make[1]: *** [Makefile:1275: testapi.o] Error 1 | ||
32 | |||
33 | But there is still a bit mystery why it worked before, because check-am | ||
34 | calls gentest.py with $(PYTHON), so it ignores the shebang in the script | ||
35 | and libxml2 is using python3native (through python3targetconfig.bbclass) | ||
36 | so something like: | ||
37 | |||
38 | libxml2/2.9.10-r0/recipe-sysroot-native/usr/bin/python3-native/python3 gentest.py | ||
39 | |||
40 | But that still fails (now without SyntaxError) with: | ||
41 | libxml2 python bindings not available, skipping testapi.c generation | ||
42 | |||
43 | because we don't have dependency on libxml2-native (to provide libxml2 | ||
44 | python bindings form python3native) and exported PYTHON_SITE_PACKAGES | ||
45 | might be useless (e.g. /usr/lib/python3.8/site-packages on Ubuntu-22.10 | ||
46 | which uses python 3.10 and there is no site-packages with libxml2) | ||
47 | |||
48 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
49 | |||
50 | --- | ||
51 | gentest.py | 421 ++++++++++++++++++++++++++--------------------------- | ||
52 | 1 file changed, 209 insertions(+), 212 deletions(-) | ||
53 | |||
54 | diff --git a/gentest.py b/gentest.py | ||
55 | index b6cd866..af15a4f 100755 | ||
56 | --- a/gentest.py | ||
57 | +++ b/gentest.py | ||
58 | @@ -8,7 +8,7 @@ import string | ||
59 | try: | ||
60 | import libxml2 | ||
61 | except: | ||
62 | - print "libxml2 python bindings not available, skipping testapi.c generation" | ||
63 | + print("libxml2 python bindings not available, skipping testapi.c generation") | ||
64 | sys.exit(0) | ||
65 | |||
66 | if len(sys.argv) > 1: | ||
67 | @@ -227,7 +227,7 @@ extra_post_call = { | ||
68 | if (old != NULL) { | ||
69 | xmlUnlinkNode(old); | ||
70 | xmlFreeNode(old) ; old = NULL ; } | ||
71 | - ret_val = NULL;""", | ||
72 | +\t ret_val = NULL;""", | ||
73 | "xmlTextMerge": | ||
74 | """if ((first != NULL) && (first->type != XML_TEXT_NODE)) { | ||
75 | xmlUnlinkNode(second); | ||
76 | @@ -236,7 +236,7 @@ extra_post_call = { | ||
77 | """if ((ret_val != NULL) && (ret_val != ncname) && | ||
78 | (ret_val != prefix) && (ret_val != memory)) | ||
79 | xmlFree(ret_val); | ||
80 | - ret_val = NULL;""", | ||
81 | +\t ret_val = NULL;""", | ||
82 | "xmlNewDocElementContent": | ||
83 | """xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""", | ||
84 | "xmlDictReference": "xmlDictFree(dict);", | ||
85 | @@ -268,29 +268,29 @@ modules = [] | ||
86 | def is_skipped_module(name): | ||
87 | for mod in skipped_modules: | ||
88 | if mod == name: | ||
89 | - return 1 | ||
90 | + return 1 | ||
91 | return 0 | ||
92 | |||
93 | def is_skipped_function(name): | ||
94 | for fun in skipped_functions: | ||
95 | if fun == name: | ||
96 | - return 1 | ||
97 | + return 1 | ||
98 | # Do not test destructors | ||
99 | - if string.find(name, 'Free') != -1: | ||
100 | + if name.find('Free') != -1: | ||
101 | return 1 | ||
102 | return 0 | ||
103 | |||
104 | def is_skipped_memcheck(name): | ||
105 | for fun in skipped_memcheck: | ||
106 | if fun == name: | ||
107 | - return 1 | ||
108 | + return 1 | ||
109 | return 0 | ||
110 | |||
111 | missing_types = {} | ||
112 | def add_missing_type(name, func): | ||
113 | try: | ||
114 | list = missing_types[name] | ||
115 | - list.append(func) | ||
116 | + list.append(func) | ||
117 | except: | ||
118 | missing_types[name] = [func] | ||
119 | |||
120 | @@ -310,7 +310,7 @@ def add_missing_functions(name, module): | ||
121 | missing_functions_nr = missing_functions_nr + 1 | ||
122 | try: | ||
123 | list = missing_functions[module] | ||
124 | - list.append(name) | ||
125 | + list.append(name) | ||
126 | except: | ||
127 | missing_functions[module] = [name] | ||
128 | |||
129 | @@ -319,45 +319,45 @@ def add_missing_functions(name, module): | ||
130 | # | ||
131 | |||
132 | def type_convert(str, name, info, module, function, pos): | ||
133 | -# res = string.replace(str, " ", " ") | ||
134 | -# res = string.replace(str, " ", " ") | ||
135 | -# res = string.replace(str, " ", " ") | ||
136 | - res = string.replace(str, " *", "_ptr") | ||
137 | -# res = string.replace(str, "*", "_ptr") | ||
138 | - res = string.replace(res, " ", "_") | ||
139 | +# res = str.replace(" ", " ") | ||
140 | +# res = str.replace(" ", " ") | ||
141 | +# res = str.replace(" ", " ") | ||
142 | + res = str.replace(" *", "_ptr") | ||
143 | +# res = str.replace("*", "_ptr") | ||
144 | + res = res.replace(" ", "_") | ||
145 | if res == 'const_char_ptr': | ||
146 | - if string.find(name, "file") != -1 or \ | ||
147 | - string.find(name, "uri") != -1 or \ | ||
148 | - string.find(name, "URI") != -1 or \ | ||
149 | - string.find(info, "filename") != -1 or \ | ||
150 | - string.find(info, "URI") != -1 or \ | ||
151 | - string.find(info, "URL") != -1: | ||
152 | - if string.find(function, "Save") != -1 or \ | ||
153 | - string.find(function, "Create") != -1 or \ | ||
154 | - string.find(function, "Write") != -1 or \ | ||
155 | - string.find(function, "Fetch") != -1: | ||
156 | - return('fileoutput') | ||
157 | - return('filepath') | ||
158 | + if name.find("file") != -1 or \ | ||
159 | + name.find("uri") != -1 or \ | ||
160 | + name.find("URI") != -1 or \ | ||
161 | + info.find("filename") != -1 or \ | ||
162 | + info.find("URI") != -1 or \ | ||
163 | + info.find("URL") != -1: | ||
164 | + if function.find("Save") != -1 or \ | ||
165 | + function.find("Create") != -1 or \ | ||
166 | + function.find("Write") != -1 or \ | ||
167 | + function.find("Fetch") != -1: | ||
168 | + return('fileoutput') | ||
169 | + return('filepath') | ||
170 | if res == 'void_ptr': | ||
171 | if module == 'nanoftp' and name == 'ctx': | ||
172 | - return('xmlNanoFTPCtxtPtr') | ||
173 | + return('xmlNanoFTPCtxtPtr') | ||
174 | if function == 'xmlNanoFTPNewCtxt' or \ | ||
175 | - function == 'xmlNanoFTPConnectTo' or \ | ||
176 | - function == 'xmlNanoFTPOpen': | ||
177 | - return('xmlNanoFTPCtxtPtr') | ||
178 | + function == 'xmlNanoFTPConnectTo' or \ | ||
179 | + function == 'xmlNanoFTPOpen': | ||
180 | + return('xmlNanoFTPCtxtPtr') | ||
181 | if module == 'nanohttp' and name == 'ctx': | ||
182 | - return('xmlNanoHTTPCtxtPtr') | ||
183 | - if function == 'xmlNanoHTTPMethod' or \ | ||
184 | - function == 'xmlNanoHTTPMethodRedir' or \ | ||
185 | - function == 'xmlNanoHTTPOpen' or \ | ||
186 | - function == 'xmlNanoHTTPOpenRedir': | ||
187 | - return('xmlNanoHTTPCtxtPtr'); | ||
188 | + return('xmlNanoHTTPCtxtPtr') | ||
189 | + if function == 'xmlNanoHTTPMethod' or \ | ||
190 | + function == 'xmlNanoHTTPMethodRedir' or \ | ||
191 | + function == 'xmlNanoHTTPOpen' or \ | ||
192 | + function == 'xmlNanoHTTPOpenRedir': | ||
193 | + return('xmlNanoHTTPCtxtPtr'); | ||
194 | if function == 'xmlIOHTTPOpen': | ||
195 | - return('xmlNanoHTTPCtxtPtr') | ||
196 | - if string.find(name, "data") != -1: | ||
197 | - return('userdata') | ||
198 | - if string.find(name, "user") != -1: | ||
199 | - return('userdata') | ||
200 | + return('xmlNanoHTTPCtxtPtr') | ||
201 | + if name.find("data") != -1: | ||
202 | + return('userdata') | ||
203 | + if name.find("user") != -1: | ||
204 | + return('userdata') | ||
205 | if res == 'xmlDoc_ptr': | ||
206 | res = 'xmlDocPtr' | ||
207 | if res == 'xmlNode_ptr': | ||
208 | @@ -366,18 +366,18 @@ def type_convert(str, name, info, module, function, pos): | ||
209 | res = 'xmlDictPtr' | ||
210 | if res == 'xmlNodePtr' and pos != 0: | ||
211 | if (function == 'xmlAddChild' and pos == 2) or \ | ||
212 | - (function == 'xmlAddChildList' and pos == 2) or \ | ||
213 | + (function == 'xmlAddChildList' and pos == 2) or \ | ||
214 | (function == 'xmlAddNextSibling' and pos == 2) or \ | ||
215 | (function == 'xmlAddSibling' and pos == 2) or \ | ||
216 | (function == 'xmlDocSetRootElement' and pos == 2) or \ | ||
217 | (function == 'xmlReplaceNode' and pos == 2) or \ | ||
218 | (function == 'xmlTextMerge') or \ | ||
219 | - (function == 'xmlAddPrevSibling' and pos == 2): | ||
220 | - return('xmlNodePtr_in'); | ||
221 | + (function == 'xmlAddPrevSibling' and pos == 2): | ||
222 | + return('xmlNodePtr_in'); | ||
223 | if res == 'const xmlBufferPtr': | ||
224 | res = 'xmlBufferPtr' | ||
225 | if res == 'xmlChar_ptr' and name == 'name' and \ | ||
226 | - string.find(function, "EatName") != -1: | ||
227 | + function.find("EatName") != -1: | ||
228 | return('eaten_name') | ||
229 | if res == 'void_ptr*': | ||
230 | res = 'void_ptr_ptr' | ||
231 | @@ -393,7 +393,7 @@ def type_convert(str, name, info, module, function, pos): | ||
232 | res = 'debug_FILE_ptr'; | ||
233 | if res == 'int' and name == 'options': | ||
234 | if module == 'parser' or module == 'xmlreader': | ||
235 | - res = 'parseroptions' | ||
236 | + res = 'parseroptions' | ||
237 | |||
238 | return res | ||
239 | |||
240 | @@ -402,28 +402,28 @@ known_param_types = [] | ||
241 | def is_known_param_type(name): | ||
242 | for type in known_param_types: | ||
243 | if type == name: | ||
244 | - return 1 | ||
245 | + return 1 | ||
246 | return name[-3:] == 'Ptr' or name[-4:] == '_ptr' | ||
247 | |||
248 | def generate_param_type(name, rtype): | ||
249 | global test | ||
250 | for type in known_param_types: | ||
251 | if type == name: | ||
252 | - return | ||
253 | + return | ||
254 | for type in generated_param_types: | ||
255 | if type == name: | ||
256 | - return | ||
257 | + return | ||
258 | |||
259 | if name[-3:] == 'Ptr' or name[-4:] == '_ptr': | ||
260 | if rtype[0:6] == 'const ': | ||
261 | - crtype = rtype[6:] | ||
262 | - else: | ||
263 | - crtype = rtype | ||
264 | + crtype = rtype[6:] | ||
265 | + else: | ||
266 | + crtype = rtype | ||
267 | |||
268 | define = 0 | ||
269 | - if modules_defines.has_key(module): | ||
270 | - test.write("#ifdef %s\n" % (modules_defines[module])) | ||
271 | - define = 1 | ||
272 | + if module in modules_defines: | ||
273 | + test.write("#ifdef %s\n" % (modules_defines[module])) | ||
274 | + define = 1 | ||
275 | test.write(""" | ||
276 | #define gen_nb_%s 1 | ||
277 | static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { | ||
278 | @@ -433,7 +433,7 @@ static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTR | ||
279 | } | ||
280 | """ % (name, crtype, name, name, rtype)) | ||
281 | if define == 1: | ||
282 | - test.write("#endif\n\n") | ||
283 | + test.write("#endif\n\n") | ||
284 | add_generated_param_type(name) | ||
285 | |||
286 | # | ||
287 | @@ -445,7 +445,7 @@ known_return_types = [] | ||
288 | def is_known_return_type(name): | ||
289 | for type in known_return_types: | ||
290 | if type == name: | ||
291 | - return 1 | ||
292 | + return 1 | ||
293 | return 0 | ||
294 | |||
295 | # | ||
296 | @@ -471,7 +471,7 @@ def compare_and_save(): | ||
297 | try: | ||
298 | os.system("rm testapi.c; mv testapi.c.new testapi.c") | ||
299 | except: | ||
300 | - os.system("mv testapi.c.new testapi.c") | ||
301 | + os.system("mv testapi.c.new testapi.c") | ||
302 | print("Updated testapi.c") | ||
303 | else: | ||
304 | print("Generated testapi.c is identical") | ||
305 | @@ -481,17 +481,17 @@ while line != "": | ||
306 | if line == "/* CUT HERE: everything below that line is generated */\n": | ||
307 | break; | ||
308 | if line[0:15] == "#define gen_nb_": | ||
309 | - type = string.split(line[15:])[0] | ||
310 | - known_param_types.append(type) | ||
311 | + type = line[15:].split()[0] | ||
312 | + known_param_types.append(type) | ||
313 | if line[0:19] == "static void desret_": | ||
314 | - type = string.split(line[19:], '(')[0] | ||
315 | - known_return_types.append(type) | ||
316 | + type = line[19:].split('(')[0] | ||
317 | + known_return_types.append(type) | ||
318 | test.write(line) | ||
319 | line = input.readline() | ||
320 | input.close() | ||
321 | |||
322 | if line == "": | ||
323 | - print "Could not find the CUT marker in testapi.c skipping generation" | ||
324 | + print("Could not find the CUT marker in testapi.c skipping generation") | ||
325 | test.close() | ||
326 | sys.exit(0) | ||
327 | |||
328 | @@ -505,7 +505,7 @@ test.write("/* CUT HERE: everything below that line is generated */\n") | ||
329 | # | ||
330 | doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0) | ||
331 | if doc == None: | ||
332 | - print "Failed to load doc/libxml2-api.xml" | ||
333 | + print("Failed to load doc/libxml2-api.xml") | ||
334 | sys.exit(1) | ||
335 | ctxt = doc.xpathNewContext() | ||
336 | |||
337 | @@ -519,9 +519,9 @@ for arg in args: | ||
338 | mod = arg.xpathEval('string(../@file)') | ||
339 | func = arg.xpathEval('string(../@name)') | ||
340 | if (mod not in skipped_modules) and (func not in skipped_functions): | ||
341 | - type = arg.xpathEval('string(@type)') | ||
342 | - if not argtypes.has_key(type): | ||
343 | - argtypes[type] = func | ||
344 | + type = arg.xpathEval('string(@type)') | ||
345 | + if type not in argtypes: | ||
346 | + argtypes[type] = func | ||
347 | |||
348 | # similarly for return types | ||
349 | rettypes = {} | ||
350 | @@ -531,8 +531,8 @@ for ret in rets: | ||
351 | func = ret.xpathEval('string(../@name)') | ||
352 | if (mod not in skipped_modules) and (func not in skipped_functions): | ||
353 | type = ret.xpathEval('string(@type)') | ||
354 | - if not rettypes.has_key(type): | ||
355 | - rettypes[type] = func | ||
356 | + if type not in rettypes: | ||
357 | + rettypes[type] = func | ||
358 | |||
359 | # | ||
360 | # Generate constructors and return type handling for all enums | ||
361 | @@ -549,49 +549,49 @@ for enum in enums: | ||
362 | continue; | ||
363 | define = 0 | ||
364 | |||
365 | - if argtypes.has_key(name) and is_known_param_type(name) == 0: | ||
366 | - values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name) | ||
367 | - i = 0 | ||
368 | - vals = [] | ||
369 | - for value in values: | ||
370 | - vname = value.xpathEval('string(@name)') | ||
371 | - if vname == None: | ||
372 | - continue; | ||
373 | - i = i + 1 | ||
374 | - if i >= 5: | ||
375 | - break; | ||
376 | - vals.append(vname) | ||
377 | - if vals == []: | ||
378 | - print "Didn't find any value for enum %s" % (name) | ||
379 | - continue | ||
380 | - if modules_defines.has_key(module): | ||
381 | - test.write("#ifdef %s\n" % (modules_defines[module])) | ||
382 | - define = 1 | ||
383 | - test.write("#define gen_nb_%s %d\n" % (name, len(vals))) | ||
384 | - test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" % | ||
385 | - (name, name)) | ||
386 | - i = 1 | ||
387 | - for value in vals: | ||
388 | - test.write(" if (no == %d) return(%s);\n" % (i, value)) | ||
389 | - i = i + 1 | ||
390 | - test.write(""" return(0); | ||
391 | + if (name in argtypes) and is_known_param_type(name) == 0: | ||
392 | + values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name) | ||
393 | + i = 0 | ||
394 | + vals = [] | ||
395 | + for value in values: | ||
396 | + vname = value.xpathEval('string(@name)') | ||
397 | + if vname == None: | ||
398 | + continue; | ||
399 | + i = i + 1 | ||
400 | + if i >= 5: | ||
401 | + break; | ||
402 | + vals.append(vname) | ||
403 | + if vals == []: | ||
404 | + print("Didn't find any value for enum %s" % (name)) | ||
405 | + continue | ||
406 | + if module in modules_defines: | ||
407 | + test.write("#ifdef %s\n" % (modules_defines[module])) | ||
408 | + define = 1 | ||
409 | + test.write("#define gen_nb_%s %d\n" % (name, len(vals))) | ||
410 | + test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" % | ||
411 | + (name, name)) | ||
412 | + i = 1 | ||
413 | + for value in vals: | ||
414 | + test.write(" if (no == %d) return(%s);\n" % (i, value)) | ||
415 | + i = i + 1 | ||
416 | + test.write(""" return(0); | ||
417 | } | ||
418 | |||
419 | static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { | ||
420 | } | ||
421 | |||
422 | """ % (name, name)); | ||
423 | - known_param_types.append(name) | ||
424 | + known_param_types.append(name) | ||
425 | |||
426 | if (is_known_return_type(name) == 0) and (name in rettypes): | ||
427 | - if define == 0 and modules_defines.has_key(module): | ||
428 | - test.write("#ifdef %s\n" % (modules_defines[module])) | ||
429 | - define = 1 | ||
430 | + if define == 0 and (module in modules_defines): | ||
431 | + test.write("#ifdef %s\n" % (modules_defines[module])) | ||
432 | + define = 1 | ||
433 | test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) { | ||
434 | } | ||
435 | |||
436 | """ % (name, name)) | ||
437 | - known_return_types.append(name) | ||
438 | + known_return_types.append(name) | ||
439 | if define == 1: | ||
440 | test.write("#endif\n\n") | ||
441 | |||
442 | @@ -615,9 +615,9 @@ for file in headers: | ||
443 | # do not test deprecated APIs | ||
444 | # | ||
445 | desc = file.xpathEval('string(description)') | ||
446 | - if string.find(desc, 'DEPRECATED') != -1: | ||
447 | - print "Skipping deprecated interface %s" % name | ||
448 | - continue; | ||
449 | + if desc.find('DEPRECATED') != -1: | ||
450 | + print("Skipping deprecated interface %s" % name) | ||
451 | + continue; | ||
452 | |||
453 | test.write("#include <libxml/%s.h>\n" % name) | ||
454 | modules.append(name) | ||
455 | @@ -679,7 +679,7 @@ def generate_test(module, node): | ||
456 | # and store the information for the generation | ||
457 | # | ||
458 | try: | ||
459 | - args = node.xpathEval("arg") | ||
460 | + args = node.xpathEval("arg") | ||
461 | except: | ||
462 | args = [] | ||
463 | t_args = [] | ||
464 | @@ -687,37 +687,37 @@ def generate_test(module, node): | ||
465 | for arg in args: | ||
466 | n = n + 1 | ||
467 | rtype = arg.xpathEval("string(@type)") | ||
468 | - if rtype == 'void': | ||
469 | - break; | ||
470 | - info = arg.xpathEval("string(@info)") | ||
471 | - nam = arg.xpathEval("string(@name)") | ||
472 | + if rtype == 'void': | ||
473 | + break; | ||
474 | + info = arg.xpathEval("string(@info)") | ||
475 | + nam = arg.xpathEval("string(@name)") | ||
476 | type = type_convert(rtype, nam, info, module, name, n) | ||
477 | - if is_known_param_type(type) == 0: | ||
478 | - add_missing_type(type, name); | ||
479 | - no_gen = 1 | ||
480 | + if is_known_param_type(type) == 0: | ||
481 | + add_missing_type(type, name); | ||
482 | + no_gen = 1 | ||
483 | if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \ | ||
484 | - rtype[0:6] == 'const ': | ||
485 | - crtype = rtype[6:] | ||
486 | - else: | ||
487 | - crtype = rtype | ||
488 | - t_args.append((nam, type, rtype, crtype, info)) | ||
489 | + rtype[0:6] == 'const ': | ||
490 | + crtype = rtype[6:] | ||
491 | + else: | ||
492 | + crtype = rtype | ||
493 | + t_args.append((nam, type, rtype, crtype, info)) | ||
494 | |||
495 | try: | ||
496 | - rets = node.xpathEval("return") | ||
497 | + rets = node.xpathEval("return") | ||
498 | except: | ||
499 | rets = [] | ||
500 | t_ret = None | ||
501 | for ret in rets: | ||
502 | rtype = ret.xpathEval("string(@type)") | ||
503 | - info = ret.xpathEval("string(@info)") | ||
504 | + info = ret.xpathEval("string(@info)") | ||
505 | type = type_convert(rtype, 'return', info, module, name, 0) | ||
506 | - if rtype == 'void': | ||
507 | - break | ||
508 | - if is_known_return_type(type) == 0: | ||
509 | - add_missing_type(type, name); | ||
510 | - no_gen = 1 | ||
511 | - t_ret = (type, rtype, info) | ||
512 | - break | ||
513 | + if rtype == 'void': | ||
514 | + break | ||
515 | + if is_known_return_type(type) == 0: | ||
516 | + add_missing_type(type, name); | ||
517 | + no_gen = 1 | ||
518 | + t_ret = (type, rtype, info) | ||
519 | + break | ||
520 | |||
521 | if no_gen == 0: | ||
522 | for t_arg in t_args: | ||
523 | @@ -733,7 +733,7 @@ test_%s(void) { | ||
524 | |||
525 | if no_gen == 1: | ||
526 | add_missing_functions(name, module) | ||
527 | - test.write(""" | ||
528 | + test.write(""" | ||
529 | /* missing type support */ | ||
530 | return(test_ret); | ||
531 | } | ||
532 | @@ -742,22 +742,22 @@ test_%s(void) { | ||
533 | return | ||
534 | |||
535 | try: | ||
536 | - conds = node.xpathEval("cond") | ||
537 | - for cond in conds: | ||
538 | - test.write("#if %s\n" % (cond.get_content())) | ||
539 | - nb_cond = nb_cond + 1 | ||
540 | + conds = node.xpathEval("cond") | ||
541 | + for cond in conds: | ||
542 | + test.write("#if %s\n" % (cond.get_content())) | ||
543 | + nb_cond = nb_cond + 1 | ||
544 | except: | ||
545 | pass | ||
546 | |||
547 | define = 0 | ||
548 | - if function_defines.has_key(name): | ||
549 | + if name in function_defines: | ||
550 | test.write("#ifdef %s\n" % (function_defines[name])) | ||
551 | - define = 1 | ||
552 | + define = 1 | ||
553 | |||
554 | # Declare the memory usage counter | ||
555 | no_mem = is_skipped_memcheck(name) | ||
556 | if no_mem == 0: | ||
557 | - test.write(" int mem_base;\n"); | ||
558 | + test.write(" int mem_base;\n"); | ||
559 | |||
560 | # Declare the return value | ||
561 | if t_ret != None: | ||
562 | @@ -766,29 +766,29 @@ test_%s(void) { | ||
563 | # Declare the arguments | ||
564 | for arg in t_args: | ||
565 | (nam, type, rtype, crtype, info) = arg; | ||
566 | - # add declaration | ||
567 | - test.write(" %s %s; /* %s */\n" % (crtype, nam, info)) | ||
568 | - test.write(" int n_%s;\n" % (nam)) | ||
569 | + # add declaration | ||
570 | + test.write(" %s %s; /* %s */\n" % (crtype, nam, info)) | ||
571 | + test.write(" int n_%s;\n" % (nam)) | ||
572 | test.write("\n") | ||
573 | |||
574 | # Cascade loop on of each argument list of values | ||
575 | for arg in t_args: | ||
576 | (nam, type, rtype, crtype, info) = arg; | ||
577 | - # | ||
578 | - test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % ( | ||
579 | - nam, nam, type, nam)) | ||
580 | + # | ||
581 | + test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % ( | ||
582 | + nam, nam, type, nam)) | ||
583 | |||
584 | # log the memory usage | ||
585 | if no_mem == 0: | ||
586 | - test.write(" mem_base = xmlMemBlocks();\n"); | ||
587 | + test.write(" mem_base = xmlMemBlocks();\n"); | ||
588 | |||
589 | # prepare the call | ||
590 | i = 0; | ||
591 | for arg in t_args: | ||
592 | (nam, type, rtype, crtype, info) = arg; | ||
593 | - # | ||
594 | - test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i)) | ||
595 | - i = i + 1; | ||
596 | + # | ||
597 | + test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i)) | ||
598 | + i = i + 1; | ||
599 | |||
600 | # add checks to avoid out-of-bounds array access | ||
601 | i = 0; | ||
602 | @@ -797,7 +797,7 @@ test_%s(void) { | ||
603 | # assume that "size", "len", and "start" parameters apply to either | ||
604 | # the nearest preceding or following char pointer | ||
605 | if type == "int" and (nam == "size" or nam == "len" or nam == "start"): | ||
606 | - for j in range(i - 1, -1, -1) + range(i + 1, len(t_args)): | ||
607 | + for j in (*range(i - 1, -1, -1), *range(i + 1, len(t_args))): | ||
608 | (bnam, btype) = t_args[j][:2] | ||
609 | if btype == "const_char_ptr" or btype == "const_xmlChar_ptr": | ||
610 | test.write( | ||
611 | @@ -806,42 +806,42 @@ test_%s(void) { | ||
612 | " continue;\n" | ||
613 | % (bnam, nam, bnam)) | ||
614 | break | ||
615 | - i = i + 1; | ||
616 | + i = i + 1; | ||
617 | |||
618 | # do the call, and clanup the result | ||
619 | - if extra_pre_call.has_key(name): | ||
620 | - test.write(" %s\n"% (extra_pre_call[name])) | ||
621 | + if name in extra_pre_call: | ||
622 | + test.write(" %s\n"% (extra_pre_call[name])) | ||
623 | if t_ret != None: | ||
624 | - test.write("\n ret_val = %s(" % (name)) | ||
625 | - need = 0 | ||
626 | - for arg in t_args: | ||
627 | - (nam, type, rtype, crtype, info) = arg | ||
628 | - if need: | ||
629 | - test.write(", ") | ||
630 | - else: | ||
631 | - need = 1 | ||
632 | - if rtype != crtype: | ||
633 | - test.write("(%s)" % rtype) | ||
634 | - test.write("%s" % nam); | ||
635 | - test.write(");\n") | ||
636 | - if extra_post_call.has_key(name): | ||
637 | - test.write(" %s\n"% (extra_post_call[name])) | ||
638 | - test.write(" desret_%s(ret_val);\n" % t_ret[0]) | ||
639 | + test.write("\n ret_val = %s(" % (name)) | ||
640 | + need = 0 | ||
641 | + for arg in t_args: | ||
642 | + (nam, type, rtype, crtype, info) = arg | ||
643 | + if need: | ||
644 | + test.write(", ") | ||
645 | + else: | ||
646 | + need = 1 | ||
647 | + if rtype != crtype: | ||
648 | + test.write("(%s)" % rtype) | ||
649 | + test.write("%s" % nam); | ||
650 | + test.write(");\n") | ||
651 | + if name in extra_post_call: | ||
652 | + test.write(" %s\n"% (extra_post_call[name])) | ||
653 | + test.write(" desret_%s(ret_val);\n" % t_ret[0]) | ||
654 | else: | ||
655 | - test.write("\n %s(" % (name)); | ||
656 | - need = 0; | ||
657 | - for arg in t_args: | ||
658 | - (nam, type, rtype, crtype, info) = arg; | ||
659 | - if need: | ||
660 | - test.write(", ") | ||
661 | - else: | ||
662 | - need = 1 | ||
663 | - if rtype != crtype: | ||
664 | - test.write("(%s)" % rtype) | ||
665 | - test.write("%s" % nam) | ||
666 | - test.write(");\n") | ||
667 | - if extra_post_call.has_key(name): | ||
668 | - test.write(" %s\n"% (extra_post_call[name])) | ||
669 | + test.write("\n %s(" % (name)); | ||
670 | + need = 0; | ||
671 | + for arg in t_args: | ||
672 | + (nam, type, rtype, crtype, info) = arg; | ||
673 | + if need: | ||
674 | + test.write(", ") | ||
675 | + else: | ||
676 | + need = 1 | ||
677 | + if rtype != crtype: | ||
678 | + test.write("(%s)" % rtype) | ||
679 | + test.write("%s" % nam) | ||
680 | + test.write(");\n") | ||
681 | + if name in extra_post_call: | ||
682 | + test.write(" %s\n"% (extra_post_call[name])) | ||
683 | |||
684 | test.write(" call_tests++;\n"); | ||
685 | |||
686 | @@ -849,32 +849,32 @@ test_%s(void) { | ||
687 | i = 0; | ||
688 | for arg in t_args: | ||
689 | (nam, type, rtype, crtype, info) = arg; | ||
690 | - # This is a hack to prevent generating a destructor for the | ||
691 | - # 'input' argument in xmlTextReaderSetup. There should be | ||
692 | - # a better, more generic way to do this! | ||
693 | - if string.find(info, 'destroy') == -1: | ||
694 | - test.write(" des_%s(n_%s, " % (type, nam)) | ||
695 | - if rtype != crtype: | ||
696 | - test.write("(%s)" % rtype) | ||
697 | - test.write("%s, %d);\n" % (nam, i)) | ||
698 | - i = i + 1; | ||
699 | + # This is a hack to prevent generating a destructor for the | ||
700 | + # 'input' argument in xmlTextReaderSetup. There should be | ||
701 | + # a better, more generic way to do this! | ||
702 | + if info.find('destroy') == -1: | ||
703 | + test.write(" des_%s(n_%s, " % (type, nam)) | ||
704 | + if rtype != crtype: | ||
705 | + test.write("(%s)" % rtype) | ||
706 | + test.write("%s, %d);\n" % (nam, i)) | ||
707 | + i = i + 1; | ||
708 | |||
709 | test.write(" xmlResetLastError();\n"); | ||
710 | # Check the memory usage | ||
711 | if no_mem == 0: | ||
712 | - test.write(""" if (mem_base != xmlMemBlocks()) { | ||
713 | + test.write(""" if (mem_base != xmlMemBlocks()) { | ||
714 | printf("Leak of %%d blocks found in %s", | ||
715 | - xmlMemBlocks() - mem_base); | ||
716 | - test_ret++; | ||
717 | +\t xmlMemBlocks() - mem_base); | ||
718 | +\t test_ret++; | ||
719 | """ % (name)); | ||
720 | - for arg in t_args: | ||
721 | - (nam, type, rtype, crtype, info) = arg; | ||
722 | - test.write(""" printf(" %%d", n_%s);\n""" % (nam)) | ||
723 | - test.write(""" printf("\\n");\n""") | ||
724 | - test.write(" }\n") | ||
725 | + for arg in t_args: | ||
726 | + (nam, type, rtype, crtype, info) = arg; | ||
727 | + test.write(""" printf(" %%d", n_%s);\n""" % (nam)) | ||
728 | + test.write(""" printf("\\n");\n""") | ||
729 | + test.write(" }\n") | ||
730 | |||
731 | for arg in t_args: | ||
732 | - test.write(" }\n") | ||
733 | + test.write(" }\n") | ||
734 | |||
735 | test.write(" function_tests++;\n") | ||
736 | # | ||
737 | @@ -882,7 +882,7 @@ test_%s(void) { | ||
738 | # | ||
739 | while nb_cond > 0: | ||
740 | test.write("#endif\n") | ||
741 | - nb_cond = nb_cond -1 | ||
742 | + nb_cond = nb_cond -1 | ||
743 | if define == 1: | ||
744 | test.write("#endif\n") | ||
745 | |||
746 | @@ -900,10 +900,10 @@ test_%s(void) { | ||
747 | for module in modules: | ||
748 | # gather all the functions exported by that module | ||
749 | try: | ||
750 | - functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module)) | ||
751 | + functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module)) | ||
752 | except: | ||
753 | - print "Failed to gather functions from module %s" % (module) | ||
754 | - continue; | ||
755 | + print("Failed to gather functions from module %s" % (module)) | ||
756 | + continue; | ||
757 | |||
758 | # iterate over all functions in the module generating the test | ||
759 | i = 0 | ||
760 | @@ -923,14 +923,14 @@ test_%s(void) { | ||
761 | # iterate over all functions in the module generating the call | ||
762 | for function in functions: | ||
763 | name = function.xpathEval('string(@name)') | ||
764 | - if is_skipped_function(name): | ||
765 | - continue | ||
766 | - test.write(" test_ret += test_%s();\n" % (name)) | ||
767 | + if is_skipped_function(name): | ||
768 | + continue | ||
769 | + test.write(" test_ret += test_%s();\n" % (name)) | ||
770 | |||
771 | # footer | ||
772 | test.write(""" | ||
773 | if (test_ret != 0) | ||
774 | - printf("Module %s: %%d errors\\n", test_ret); | ||
775 | +\tprintf("Module %s: %%d errors\\n", test_ret); | ||
776 | return(test_ret); | ||
777 | } | ||
778 | """ % (module)) | ||
779 | @@ -948,7 +948,7 @@ test.write(""" return(0); | ||
780 | } | ||
781 | """); | ||
782 | |||
783 | -print "Generated test for %d modules and %d functions" %(len(modules), nb_tests) | ||
784 | +print("Generated test for %d modules and %d functions" %(len(modules), nb_tests)) | ||
785 | |||
786 | compare_and_save() | ||
787 | |||
788 | @@ -960,11 +960,8 @@ for missing in missing_types.keys(): | ||
789 | n = len(missing_types[missing]) | ||
790 | missing_list.append((n, missing)) | ||
791 | |||
792 | -def compare_missing(a, b): | ||
793 | - return b[0] - a[0] | ||
794 | - | ||
795 | -missing_list.sort(compare_missing) | ||
796 | -print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list)) | ||
797 | +missing_list.sort(key=lambda a: a[0]) | ||
798 | +print("Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list))) | ||
799 | lst = open("missing.lst", "w") | ||
800 | lst.write("Missing support for %d types" % (len(missing_list))) | ||
801 | lst.write("\n") | ||
802 | @@ -974,9 +971,9 @@ for miss in missing_list: | ||
803 | for n in missing_types[miss[1]]: | ||
804 | i = i + 1 | ||
805 | if i > 5: | ||
806 | - lst.write(" ...") | ||
807 | - break | ||
808 | - lst.write(" %s" % (n)) | ||
809 | + lst.write(" ...") | ||
810 | + break | ||
811 | + lst.write(" %s" % (n)) | ||
812 | lst.write("\n") | ||
813 | lst.write("\n") | ||
814 | lst.write("\n") | ||
diff --git a/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch b/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch deleted file mode 100644 index ad719d4f5f..0000000000 --- a/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | From 395c0f53ec226aaabedb166e6b3a7f8590b95a5f Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Sat, 11 May 2019 20:39:15 +0800 | ||
4 | Subject: [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 | |||
7 | Upstream-Status: Inappropriate [cross-compile specific] | ||
8 | |||
9 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> | ||
10 | |||
11 | Rebase to 2.9.9 | ||
12 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
13 | --- | ||
14 | Makefile.am | 3 +-- | ||
15 | 1 file changed, 1 insertion(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/Makefile.am b/Makefile.am | ||
18 | index 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 | -- | ||
32 | 2.7.4 | ||
33 | |||
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..b770afbeb4 --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/install-tests.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | Add a target to install the test suite. | ||
2 | |||
3 | Upstream-Status: Inappropriate | ||
4 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
5 | |||
6 | From c7809dc6947324ea506a0c2bf132ecd37156f211 Mon Sep 17 00:00:00 2001 | ||
7 | From: Ross Burton <ross.burton@arm.com> | ||
8 | Date: Mon, 5 Dec 2022 17:02:32 +0000 | ||
9 | Subject: [PATCH] add yocto-specific install-ptest target | ||
10 | |||
11 | --- | ||
12 | Makefile.am | 10 ++++++++++ | ||
13 | 1 file changed, 10 insertions(+) | ||
14 | |||
15 | diff --git a/Makefile.am b/Makefile.am | ||
16 | index 316109b1..15e100be 100644 | ||
17 | --- a/Makefile.am | ||
18 | +++ b/Makefile.am | ||
19 | @@ -26,6 +26,16 @@ check_PROGRAMS = \ | ||
20 | testlimits \ | ||
21 | testrecurse | ||
22 | |||
23 | +ptestdir=$(libexecdir) | ||
24 | +install-test-data: $(check_PROGRAMS) | ||
25 | + install -d $(DESTDIR)$(ptestdir) $(DESTDIR)$(ptestdir)/python/ | ||
26 | + for T in $(check_PROGRAMS); do \ | ||
27 | + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$T $(DESTDIR)$(ptestdir) ;\ | ||
28 | + done | ||
29 | + cp -r $(srcdir)/test $(DESTDIR)$(ptestdir) | ||
30 | + cp -r $(srcdir)/result $(DESTDIR)$(ptestdir) | ||
31 | + cp -r $(srcdir)/python/tests $(DESTDIR)$(ptestdir)/python | ||
32 | + | ||
33 | bin_PROGRAMS = xmllint xmlcatalog | ||
34 | |||
35 | nodist_bin_SCRIPTS = xml2-config | ||
36 | -- | ||
37 | 2.34.1 | ||
38 | |||
diff --git a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch index cc9da88a29..639c80bd6c 100644 --- a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch +++ b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch | |||
@@ -1,26 +1,8 @@ | |||
1 | From 7196bce35954c4b46391cb0139aeb15ed628fa54 Mon Sep 17 00:00:00 2001 | 1 | Change the AM_PATH_XML2 macros to use pkg-config instead of xml2-config. |
2 | From: Tony Tascioglu <tony.tascioglu@windriver.com> | ||
3 | Date: Fri, 14 May 2021 11:50:35 -0400 | ||
4 | Subject: [PATCH] AM_PATH_XML2 uses xml-config which we disable through | ||
5 | 2 | ||
6 | binconfig-disabled.bbclass, so port it to use pkg-config instead. | 3 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/d598d8af0913b6e3d4e61ffa62397a275b669dca] |
4 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
7 | 5 | ||
8 | This cannot be upstreamed, as the original macro supports various | ||
9 | optional arguments which cannot be supported with a direct call | ||
10 | to pkg-config. | ||
11 | |||
12 | Upstream-Status: Inappropriate [oe-core specific; see above] | ||
13 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
14 | |||
15 | Rebase to 2.9.9 | ||
16 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
17 | |||
18 | Updated to apply cleanly to v2.9.12 | ||
19 | Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com> | ||
20 | |||
21 | Rebase to 2.9.14 | ||
22 | Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> | ||
23 | --- | ||
24 | libxml.m4 | 189 ++---------------------------------------------------- | 6 | libxml.m4 | 189 ++---------------------------------------------------- |
25 | 1 file changed, 5 insertions(+), 184 deletions(-) | 7 | 1 file changed, 5 insertions(+), 184 deletions(-) |
26 | 8 | ||
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 @@ | |||
1 | From b038c3452667ed17ddb0e791cd7bdc7f8774ac29 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Sat, 11 May 2019 20:35:20 +0800 | ||
4 | Subject: [PATCH] Allow us to pass in PYTHON_SITE_PACKAGES | ||
5 | |||
6 | The python binary used when building for nativesdk doesn't give us the | ||
7 | correct path here so we need to be able to specify it ourselves. | ||
8 | |||
9 | Upstream-Status: Inappropriate [config] | ||
10 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
11 | |||
12 | Rebase to 2.9.9 | ||
13 | |||
14 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
15 | --- | ||
16 | configure.ac | 3 ++- | ||
17 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/configure.ac b/configure.ac | ||
20 | index 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 | -- | ||
34 | 2.7.4 | ||
35 | |||
diff --git a/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch b/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch deleted file mode 100644 index 66694af388..0000000000 --- a/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | From e49a0d4a8f3f725d6f683854e1cad36a3cd02962 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tony Tascioglu <tony.tascioglu@windriver.com> | ||
3 | Date: Wed, 19 May 2021 19:43:56 -0400 | ||
4 | Subject: [PATCH] Remove fuzz testing from executing with ptests. | ||
5 | |||
6 | Upstream version 2.9.12 introduced new fuzz-testing and a corresponding | ||
7 | folder fuzz. These tests are not required for ptests of this package. | ||
8 | |||
9 | This patch removes the fuzz testing targets from the Makefile. | ||
10 | Otherwise, running the ptests will fail due to the invalid directory. | ||
11 | |||
12 | Upstream-Status: Inappropriate [oe specific] | ||
13 | Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com> | ||
14 | --- | ||
15 | Makefile.am | 5 ++--- | ||
16 | 1 file changed, 2 insertions(+), 3 deletions(-) | ||
17 | |||
18 | diff --git a/Makefile.am b/Makefile.am | ||
19 | index a9284b95..3d7b344d 100644 | ||
20 | --- a/Makefile.am | ||
21 | +++ b/Makefile.am | ||
22 | @@ -2,9 +2,9 @@ | ||
23 | |||
24 | ACLOCAL_AMFLAGS = -I m4 | ||
25 | |||
26 | -SUBDIRS = include . doc example fuzz xstc $(PYTHON_SUBDIR) | ||
27 | +SUBDIRS = include . doc example xstc $(PYTHON_SUBDIR) | ||
28 | |||
29 | -DIST_SUBDIRS = include . doc example fuzz python xstc | ||
30 | +DIST_SUBDIRS = include . doc example python xstc | ||
31 | |||
32 | AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include | ||
33 | |||
34 | @@ -210,7 +210,6 @@ runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \ | ||
35 | $(CHECKER) ./runxmlconf$(EXEEXT) | ||
36 | @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \ | ||
37 | $(MAKE) tests ; fi) | ||
38 | - @cd fuzz; $(MAKE) tests | ||
39 | |||
40 | check: all runtests | ||
41 | |||
42 | -- | ||
43 | 2.25.1 | ||
44 | |||
diff --git a/meta/recipes-core/libxml/libxml2/run-ptest b/meta/recipes-core/libxml/libxml2/run-ptest index c313d83263..d5c7bb5b02 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 | ||
3 | set -e | ||
4 | |||
3 | export LC_ALL=en_US.UTF-8 | 5 | export LC_ALL=en_US.UTF-8 |
4 | make -k runtests | 6 | |
7 | # testModule isn't that useful and hard-codes buildtree, so we don't run that | ||
8 | TESTS="runtest testrecurse testchar testdict testThreads runxmlconf testapi" | ||
9 | |||
10 | for T in $TESTS; do | ||
11 | echo Running $T | ||
12 | ./$T && echo PASS: $T || echo FAIL: $T | ||
13 | done | ||
14 | |||
15 | if 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 | ||
20 | fi | ||
diff --git a/meta/recipes-core/libxml/libxml2/runtest.patch b/meta/recipes-core/libxml/libxml2/runtest.patch deleted file mode 100644 index 42bb22cfd4..0000000000 --- a/meta/recipes-core/libxml/libxml2/runtest.patch +++ /dev/null | |||
@@ -1,849 +0,0 @@ | |||
1 | From 6172ccd1e74bc181f5298f19e240234e12876abe Mon Sep 17 00:00:00 2001 | ||
2 | From: Tony Tascioglu <tony.tascioglu@windriver.com> | ||
3 | Date: Tue, 11 May 2021 11:57:46 -0400 | ||
4 | Subject: [PATCH] Add 'install-ptest' rule. | ||
5 | |||
6 | Print a standard result line for each test. | ||
7 | |||
8 | The patch needs a rework according to comments in the merge request. | ||
9 | |||
10 | Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com> | ||
11 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> | ||
12 | Upstream-Status: Inappropriate [https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/137] | ||
13 | |||
14 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
15 | Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com> | ||
16 | --- | ||
17 | Makefile.am | 9 +++ | ||
18 | runsuite.c | 1 + | ||
19 | runtest.c | 2 + | ||
20 | runxmlconf.c | 1 + | ||
21 | testapi.c | 122 ++++++++++++++++++++++++++------------- | ||
22 | testchar.c | 156 +++++++++++++++++++++++++++++++++++--------------- | ||
23 | testdict.c | 1 + | ||
24 | testlimits.c | 1 + | ||
25 | testrecurse.c | 2 + | ||
26 | 9 files changed, 210 insertions(+), 85 deletions(-) | ||
27 | |||
28 | diff --git a/Makefile.am b/Makefile.am | ||
29 | index 05d1671f..ae622745 100644 | ||
30 | --- a/Makefile.am | ||
31 | +++ b/Makefile.am | ||
32 | @@ -198,6 +198,15 @@ runxmlconf_LDADD= $(LDADDS) | ||
33 | #testOOM_DEPENDENCIES = $(DEPS) | ||
34 | #testOOM_LDADD= $(LDADDS) | ||
35 | |||
36 | +install-ptest: | ||
37 | + @(if [ -d .libs ] ; then cd .libs; fi; \ | ||
38 | + install $(check_PROGRAMS) $(DESTDIR)) | ||
39 | + cp -r $(srcdir)/test $(DESTDIR) | ||
40 | + cp -r $(srcdir)/result $(DESTDIR) | ||
41 | + cp -r $(srcdir)/python $(DESTDIR) | ||
42 | + cp Makefile $(DESTDIR) | ||
43 | + sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile | ||
44 | + | ||
45 | runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \ | ||
46 | testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT) | ||
47 | [ -d test ] || $(LN_S) $(srcdir)/test . | ||
48 | diff --git a/runsuite.c b/runsuite.c | ||
49 | index d24b5ec3..f7ff2521 100644 | ||
50 | --- a/runsuite.c | ||
51 | +++ b/runsuite.c | ||
52 | @@ -1147,6 +1147,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { | ||
53 | |||
54 | if (logfile != NULL) | ||
55 | fclose(logfile); | ||
56 | + printf("%s: runsuite\n\n", (ret == 0) ? "PASS" : "FAIL"); | ||
57 | return(ret); | ||
58 | } | ||
59 | #else /* !SCHEMAS */ | ||
60 | diff --git a/runtest.c b/runtest.c | ||
61 | index ffa98d04..470f95cb 100644 | ||
62 | --- a/runtest.c | ||
63 | +++ b/runtest.c | ||
64 | @@ -4508,6 +4508,7 @@ launchTests(testDescPtr tst) { | ||
65 | xmlCharEncCloseFunc(ebcdicHandler); | ||
66 | xmlCharEncCloseFunc(eucJpHandler); | ||
67 | |||
68 | + printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc); | ||
69 | return(err); | ||
70 | } | ||
71 | |||
72 | @@ -4588,6 +4589,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { | ||
73 | xmlCleanupParser(); | ||
74 | xmlMemoryDump(); | ||
75 | |||
76 | + printf("%s: runtest\n\n", (ret == 0) ? "PASS" : "FAIL"); | ||
77 | return(ret); | ||
78 | } | ||
79 | |||
80 | diff --git a/runxmlconf.c b/runxmlconf.c | ||
81 | index 70f61017..e882b3a1 100644 | ||
82 | --- a/runxmlconf.c | ||
83 | +++ b/runxmlconf.c | ||
84 | @@ -595,6 +595,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { | ||
85 | |||
86 | if (logfile != NULL) | ||
87 | fclose(logfile); | ||
88 | + printf("%s: runxmlconf\n", (ret == 0) ? "PASS" : "FAIL"); | ||
89 | return(ret); | ||
90 | } | ||
91 | |||
92 | diff --git a/testapi.c b/testapi.c | ||
93 | index ff8b470d..52b51d78 100644 | ||
94 | --- a/testapi.c | ||
95 | +++ b/testapi.c | ||
96 | @@ -1246,49 +1246,91 @@ static int | ||
97 | testlibxml2(void) | ||
98 | { | ||
99 | int test_ret = 0; | ||
100 | - | ||
101 | - test_ret += test_HTMLparser(); | ||
102 | - test_ret += test_HTMLtree(); | ||
103 | - test_ret += test_SAX2(); | ||
104 | - test_ret += test_c14n(); | ||
105 | - test_ret += test_catalog(); | ||
106 | - test_ret += test_chvalid(); | ||
107 | - test_ret += test_debugXML(); | ||
108 | - test_ret += test_dict(); | ||
109 | - test_ret += test_encoding(); | ||
110 | - test_ret += test_entities(); | ||
111 | - test_ret += test_hash(); | ||
112 | - test_ret += test_list(); | ||
113 | - test_ret += test_nanoftp(); | ||
114 | - test_ret += test_nanohttp(); | ||
115 | - test_ret += test_parser(); | ||
116 | - test_ret += test_parserInternals(); | ||
117 | - test_ret += test_pattern(); | ||
118 | - test_ret += test_relaxng(); | ||
119 | - test_ret += test_schemasInternals(); | ||
120 | - test_ret += test_schematron(); | ||
121 | - test_ret += test_tree(); | ||
122 | - test_ret += test_uri(); | ||
123 | - test_ret += test_valid(); | ||
124 | - test_ret += test_xinclude(); | ||
125 | - test_ret += test_xmlIO(); | ||
126 | - test_ret += test_xmlautomata(); | ||
127 | - test_ret += test_xmlerror(); | ||
128 | - test_ret += test_xmlmodule(); | ||
129 | - test_ret += test_xmlreader(); | ||
130 | - test_ret += test_xmlregexp(); | ||
131 | - test_ret += test_xmlsave(); | ||
132 | - test_ret += test_xmlschemas(); | ||
133 | - test_ret += test_xmlschemastypes(); | ||
134 | - test_ret += test_xmlstring(); | ||
135 | - test_ret += test_xmlunicode(); | ||
136 | - test_ret += test_xmlwriter(); | ||
137 | - test_ret += test_xpath(); | ||
138 | - test_ret += test_xpathInternals(); | ||
139 | - test_ret += test_xpointer(); | ||
140 | + int ret = 0; | ||
141 | + | ||
142 | + test_ret += (ret = test_HTMLparser()); | ||
143 | + printf("%s: HTMLparser\n", (ret == 0) ? "PASS" : "FAIL"); | ||
144 | + test_ret += (ret = test_HTMLtree()); | ||
145 | + printf("%s: HTMLtree\n", (ret == 0) ? "PASS" : "FAIL"); | ||
146 | + test_ret += (ret = test_SAX2()); | ||
147 | + printf("%s: SAX2\n", (ret == 0) ? "PASS" : "FAIL"); | ||
148 | + test_ret += (ret = test_c14n()); | ||
149 | + printf("%s: c14n\n", (ret == 0) ? "PASS" : "FAIL"); | ||
150 | + test_ret += (ret = test_catalog()); | ||
151 | + printf("%s: catalog\n", (ret == 0) ? "PASS" : "FAIL"); | ||
152 | + test_ret += (ret = test_chvalid()); | ||
153 | + printf("%s: chvalid\n", (ret == 0) ? "PASS" : "FAIL"); | ||
154 | + test_ret += (ret = test_debugXML()); | ||
155 | + printf("%s: debugXML\n", (ret == 0) ? "PASS" : "FAIL"); | ||
156 | + test_ret += (ret = test_dict()); | ||
157 | + printf("%s: dict\n", (ret == 0) ? "PASS" : "FAIL"); | ||
158 | + test_ret += (ret = test_encoding()); | ||
159 | + printf("%s: encoding\n", (ret == 0) ? "PASS" : "FAIL"); | ||
160 | + test_ret += (ret = test_entities()); | ||
161 | + printf("%s: entities\n", (ret == 0) ? "PASS" : "FAIL"); | ||
162 | + test_ret += (ret = test_hash()); | ||
163 | + printf("%s: hash\n", (ret == 0) ? "PASS" : "FAIL"); | ||
164 | + test_ret += (ret = test_list()); | ||
165 | + printf("%s: list\n", (ret == 0) ? "PASS" : "FAIL"); | ||
166 | + test_ret += (ret = test_nanoftp()); | ||
167 | + printf("%s: nanoftp\n", (ret == 0) ? "PASS" : "FAIL"); | ||
168 | + test_ret += (ret = test_nanohttp()); | ||
169 | + printf("%s: nanohttp\n", (ret == 0) ? "PASS" : "FAIL"); | ||
170 | + test_ret += (ret = test_parser()); | ||
171 | + printf("%s: parser\n", (ret == 0) ? "PASS" : "FAIL"); | ||
172 | + test_ret += (ret = test_parserInternals()); | ||
173 | + printf("%s: parserInternals\n", (ret == 0) ? "PASS" : "FAIL"); | ||
174 | + test_ret += (ret = test_pattern()); | ||
175 | + printf("%s: pattern\n", (ret == 0) ? "PASS" : "FAIL"); | ||
176 | + test_ret += (ret = test_relaxng()); | ||
177 | + printf("%s: relaxng\n", (ret == 0) ? "PASS" : "FAIL"); | ||
178 | + test_ret += (ret = test_schemasInternals()); | ||
179 | + printf("%s: schemasInternals\n", (ret == 0) ? "PASS" : "FAIL"); | ||
180 | + test_ret += (ret = test_schematron()); | ||
181 | + printf("%s: schematron\n", (ret == 0) ? "PASS" : "FAIL"); | ||
182 | + test_ret += (ret = test_tree()); | ||
183 | + printf("%s: tree\n", (ret == 0) ? "PASS" : "FAIL"); | ||
184 | + test_ret += (ret = test_uri()); | ||
185 | + printf("%s: uri\n", (ret == 0) ? "PASS" : "FAIL"); | ||
186 | + test_ret += (ret = test_valid()); | ||
187 | + printf("%s: valid\n", (ret == 0) ? "PASS" : "FAIL"); | ||
188 | + test_ret += (ret = test_xinclude()); | ||
189 | + printf("%s: xinclude\n", (ret == 0) ? "PASS" : "FAIL"); | ||
190 | + test_ret += (ret = test_xmlIO()); | ||
191 | + printf("%s: xmlIO\n", (ret == 0) ? "PASS" : "FAIL"); | ||
192 | + test_ret += (ret = test_xmlautomata()); | ||
193 | + printf("%s: xmlautomata\n", (ret == 0) ? "PASS" : "FAIL"); | ||
194 | + test_ret += (ret = test_xmlerror()); | ||
195 | + printf("%s: xmlerror\n", (ret == 0) ? "PASS" : "FAIL"); | ||
196 | + test_ret += (ret = test_xmlmodule()); | ||
197 | + printf("%s: xmlmodule\n", (ret == 0) ? "PASS" : "FAIL"); | ||
198 | + test_ret += (ret = test_xmlreader()); | ||
199 | + printf("%s: xmlreader\n", (ret == 0) ? "PASS" : "FAIL"); | ||
200 | + test_ret += (ret = test_xmlregexp()); | ||
201 | + printf("%s: xmlregexp\n", (ret == 0) ? "PASS" : "FAIL"); | ||
202 | + test_ret += (ret = test_xmlsave()); | ||
203 | + printf("%s: xmlsave\n", (ret == 0) ? "PASS" : "FAIL"); | ||
204 | + test_ret += (ret = test_xmlschemas()); | ||
205 | + printf("%s: xmlschemas\n", (ret == 0) ? "PASS" : "FAIL"); | ||
206 | + test_ret += (ret = test_xmlschemastypes()); | ||
207 | + printf("%s: xmlschemastypes\n", (ret == 0) ? "PASS" : "FAIL"); | ||
208 | + test_ret += (ret = test_xmlstring()); | ||
209 | + printf("%s: xmlstring\n", (ret == 0) ? "PASS" : "FAIL"); | ||
210 | + test_ret += (ret = test_xmlunicode()); | ||
211 | + printf("%s: xmlunicode\n", (ret == 0) ? "PASS" : "FAIL"); | ||
212 | + test_ret += (ret = test_xmlwriter()); | ||
213 | + printf("%s: xmlwriter\n", (ret == 0) ? "PASS" : "FAIL"); | ||
214 | + test_ret += (ret = test_xpath()); | ||
215 | + printf("%s: xpath\n", (ret == 0) ? "PASS" : "FAIL"); | ||
216 | + test_ret += (ret = test_xpathInternals()); | ||
217 | + printf("%s: xpathInternals\n", (ret == 0) ? "PASS" : "FAIL"); | ||
218 | + test_ret += (ret = test_xpointer()); | ||
219 | + printf("%s: xpointer\n", (ret == 0) ? "PASS" : "FAIL"); | ||
220 | |||
221 | printf("Total: %d functions, %d tests, %d errors\n", | ||
222 | function_tests, call_tests, test_ret); | ||
223 | + | ||
224 | + printf("%s: testapi\n\n", (test_ret == 0) ? "PASS" : "FAIL"); | ||
225 | return(test_ret); | ||
226 | } | ||
227 | |||
228 | diff --git a/testchar.c b/testchar.c | ||
229 | index 6866a175..7bce0132 100644 | ||
230 | --- a/testchar.c | ||
231 | +++ b/testchar.c | ||
232 | @@ -23,7 +23,7 @@ static void errorHandler(void *unused, xmlErrorPtr err) { | ||
233 | char document1[100] = "<doc>XXXX</doc>"; | ||
234 | char document2[100] = "<doc foo='XXXX'/>"; | ||
235 | |||
236 | -static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, | ||
237 | +static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, | ||
238 | int len, char *data, int forbid1, int forbid2) { | ||
239 | int i; | ||
240 | xmlDocPtr res; | ||
241 | @@ -37,33 +37,41 @@ static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, | ||
242 | res = xmlReadMemory(document, len, "test", NULL, 0); | ||
243 | |||
244 | if ((i == forbid1) || (i == forbid2)) { | ||
245 | - if ((lastError == 0) || (res != NULL)) | ||
246 | + if ((lastError == 0) || (res != NULL)) { | ||
247 | fprintf(stderr, | ||
248 | "Failed to detect invalid char for Byte 0x%02X: %c\n", | ||
249 | i, i); | ||
250 | + return(1); | ||
251 | + } | ||
252 | } | ||
253 | |||
254 | else if ((i == '<') || (i == '&')) { | ||
255 | - if ((lastError == 0) || (res != NULL)) | ||
256 | + if ((lastError == 0) || (res != NULL)) { | ||
257 | fprintf(stderr, | ||
258 | "Failed to detect illegal char %c for Byte 0x%02X\n", i, i); | ||
259 | + return(1); | ||
260 | + } | ||
261 | } | ||
262 | else if (((i < 0x20) || (i >= 0x80)) && | ||
263 | (i != 0x9) && (i != 0xA) && (i != 0xD)) { | ||
264 | - if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) | ||
265 | + if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) { | ||
266 | fprintf(stderr, | ||
267 | "Failed to detect invalid char for Byte 0x%02X\n", i); | ||
268 | + return(1); | ||
269 | + } | ||
270 | } | ||
271 | else if (res == NULL) { | ||
272 | fprintf(stderr, | ||
273 | "Failed to parse valid char for Byte 0x%02X : %c\n", i, i); | ||
274 | + return(1); | ||
275 | } | ||
276 | if (res != NULL) | ||
277 | xmlFreeDoc(res); | ||
278 | } | ||
279 | + return(0); | ||
280 | } | ||
281 | |||
282 | -static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, | ||
283 | +static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, | ||
284 | int len, char *data) { | ||
285 | int i, j; | ||
286 | xmlDocPtr res; | ||
287 | @@ -80,10 +88,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, | ||
288 | |||
289 | /* if first bit of first char is set, then second bit must too */ | ||
290 | if ((i & 0x80) && ((i & 0x40) == 0)) { | ||
291 | - if ((lastError == 0) || (res != NULL)) | ||
292 | + if ((lastError == 0) || (res != NULL)) { | ||
293 | fprintf(stderr, | ||
294 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", | ||
295 | i, j); | ||
296 | + return(1); | ||
297 | + } | ||
298 | } | ||
299 | |||
300 | /* | ||
301 | @@ -91,10 +101,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, | ||
302 | * bits must be 10 | ||
303 | */ | ||
304 | else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { | ||
305 | - if ((lastError == 0) || (res != NULL)) | ||
306 | + if ((lastError == 0) || (res != NULL)) { | ||
307 | fprintf(stderr, | ||
308 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", | ||
309 | i, j); | ||
310 | + return(1); | ||
311 | + } | ||
312 | } | ||
313 | |||
314 | /* | ||
315 | @@ -102,10 +114,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, | ||
316 | * than 0x80, i.e. one of bits 5 to 1 of i must be set | ||
317 | */ | ||
318 | else if ((i & 0x80) && ((i & 0x1E) == 0)) { | ||
319 | - if ((lastError == 0) || (res != NULL)) | ||
320 | + if ((lastError == 0) || (res != NULL)) { | ||
321 | fprintf(stderr, | ||
322 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", | ||
323 | i, j); | ||
324 | + return(1); | ||
325 | + } | ||
326 | } | ||
327 | |||
328 | /* | ||
329 | @@ -113,10 +127,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, | ||
330 | * at least 3 bytes, but we give only 2 ! | ||
331 | */ | ||
332 | else if ((i & 0xE0) == 0xE0) { | ||
333 | - if ((lastError == 0) || (res != NULL)) | ||
334 | + if ((lastError == 0) || (res != NULL)) { | ||
335 | fprintf(stderr, | ||
336 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", | ||
337 | i, j); | ||
338 | + return(1); | ||
339 | + } | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | @@ -125,11 +141,13 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, | ||
344 | else if ((lastError != 0) || (res == NULL)) { | ||
345 | fprintf(stderr, | ||
346 | "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j); | ||
347 | + return(1); | ||
348 | } | ||
349 | if (res != NULL) | ||
350 | xmlFreeDoc(res); | ||
351 | } | ||
352 | } | ||
353 | + return(0); | ||
354 | } | ||
355 | |||
356 | /** | ||
357 | @@ -141,9 +159,10 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, | ||
358 | * CDATA in text or in attribute values. | ||
359 | */ | ||
360 | |||
361 | -static void testDocumentRanges(void) { | ||
362 | +static int testDocumentRanges(void) { | ||
363 | xmlParserCtxtPtr ctxt; | ||
364 | char *data; | ||
365 | + int test_ret = 0; | ||
366 | |||
367 | /* | ||
368 | * Set up a parsing context using the first document as | ||
369 | @@ -152,7 +171,7 @@ static void testDocumentRanges(void) { | ||
370 | ctxt = xmlNewParserCtxt(); | ||
371 | if (ctxt == NULL) { | ||
372 | fprintf(stderr, "Failed to allocate parser context\n"); | ||
373 | - return; | ||
374 | + return(1); | ||
375 | } | ||
376 | |||
377 | printf("testing 1 byte char in document: 1"); | ||
378 | @@ -163,7 +182,7 @@ static void testDocumentRanges(void) { | ||
379 | data[2] = ' '; | ||
380 | data[3] = ' '; | ||
381 | /* test 1 byte injection at beginning of area */ | ||
382 | - testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), | ||
383 | + test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), | ||
384 | data, -1, -1); | ||
385 | printf(" 2"); | ||
386 | fflush(stdout); | ||
387 | @@ -172,7 +191,7 @@ static void testDocumentRanges(void) { | ||
388 | data[2] = ' '; | ||
389 | data[3] = ' '; | ||
390 | /* test 1 byte injection at end of area */ | ||
391 | - testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), | ||
392 | + test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), | ||
393 | data + 3, -1, -1); | ||
394 | |||
395 | printf(" 3"); | ||
396 | @@ -183,7 +202,7 @@ static void testDocumentRanges(void) { | ||
397 | data[2] = ' '; | ||
398 | data[3] = ' '; | ||
399 | /* test 1 byte injection at beginning of area */ | ||
400 | - testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), | ||
401 | + test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), | ||
402 | data, '\'', -1); | ||
403 | printf(" 4"); | ||
404 | fflush(stdout); | ||
405 | @@ -192,7 +211,7 @@ static void testDocumentRanges(void) { | ||
406 | data[2] = ' '; | ||
407 | data[3] = ' '; | ||
408 | /* test 1 byte injection at end of area */ | ||
409 | - testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), | ||
410 | + test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), | ||
411 | data + 3, '\'', -1); | ||
412 | printf(" done\n"); | ||
413 | |||
414 | @@ -204,7 +223,7 @@ static void testDocumentRanges(void) { | ||
415 | data[2] = ' '; | ||
416 | data[3] = ' '; | ||
417 | /* test 2 byte injection at beginning of area */ | ||
418 | - testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), | ||
419 | + test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), | ||
420 | data); | ||
421 | printf(" 2"); | ||
422 | fflush(stdout); | ||
423 | @@ -213,7 +232,7 @@ static void testDocumentRanges(void) { | ||
424 | data[2] = ' '; | ||
425 | data[3] = ' '; | ||
426 | /* test 2 byte injection at end of area */ | ||
427 | - testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), | ||
428 | + test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), | ||
429 | data + 2); | ||
430 | |||
431 | printf(" 3"); | ||
432 | @@ -224,7 +243,7 @@ static void testDocumentRanges(void) { | ||
433 | data[2] = ' '; | ||
434 | data[3] = ' '; | ||
435 | /* test 2 byte injection at beginning of area */ | ||
436 | - testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), | ||
437 | + test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), | ||
438 | data); | ||
439 | printf(" 4"); | ||
440 | fflush(stdout); | ||
441 | @@ -233,14 +252,15 @@ static void testDocumentRanges(void) { | ||
442 | data[2] = ' '; | ||
443 | data[3] = ' '; | ||
444 | /* test 2 byte injection at end of area */ | ||
445 | - testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), | ||
446 | + test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), | ||
447 | data + 2); | ||
448 | printf(" done\n"); | ||
449 | |||
450 | xmlFreeParserCtxt(ctxt); | ||
451 | + return(test_ret); | ||
452 | } | ||
453 | |||
454 | -static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { | ||
455 | +static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { | ||
456 | int i = 0; | ||
457 | int len, c; | ||
458 | |||
459 | @@ -255,19 +275,25 @@ static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { | ||
460 | c = xmlCurrentChar(ctxt, &len); | ||
461 | if ((i == 0) || (i >= 0x80)) { | ||
462 | /* we must see an error there */ | ||
463 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
464 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
465 | fprintf(stderr, | ||
466 | "Failed to detect invalid char for Byte 0x%02X\n", i); | ||
467 | + return(1); | ||
468 | + } | ||
469 | } else if (i == 0xD) { | ||
470 | - if ((c != 0xA) || (len != 1)) | ||
471 | + if ((c != 0xA) || (len != 1)) { | ||
472 | fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i); | ||
473 | + return(1); | ||
474 | + } | ||
475 | } else if ((c != i) || (len != 1)) { | ||
476 | fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i); | ||
477 | + return(1); | ||
478 | } | ||
479 | } | ||
480 | + return(0); | ||
481 | } | ||
482 | |||
483 | -static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { | ||
484 | +static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { | ||
485 | int i, j; | ||
486 | int len, c; | ||
487 | |||
488 | @@ -284,10 +310,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { | ||
489 | |||
490 | /* if first bit of first char is set, then second bit must too */ | ||
491 | if ((i & 0x80) && ((i & 0x40) == 0)) { | ||
492 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
493 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
494 | fprintf(stderr, | ||
495 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", | ||
496 | i, j); | ||
497 | + return(1); | ||
498 | + } | ||
499 | } | ||
500 | |||
501 | /* | ||
502 | @@ -295,10 +323,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { | ||
503 | * bits must be 10 | ||
504 | */ | ||
505 | else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { | ||
506 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
507 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
508 | fprintf(stderr, | ||
509 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", | ||
510 | i, j, c); | ||
511 | + return(1); | ||
512 | + } | ||
513 | } | ||
514 | |||
515 | /* | ||
516 | @@ -306,10 +336,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { | ||
517 | * than 0x80, i.e. one of bits 5 to 1 of i must be set | ||
518 | */ | ||
519 | else if ((i & 0x80) && ((i & 0x1E) == 0)) { | ||
520 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
521 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
522 | fprintf(stderr, | ||
523 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", | ||
524 | i, j, c); | ||
525 | + return(1); | ||
526 | + } | ||
527 | } | ||
528 | |||
529 | /* | ||
530 | @@ -317,10 +349,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { | ||
531 | * at least 3 bytes, but we give only 2 ! | ||
532 | */ | ||
533 | else if ((i & 0xE0) == 0xE0) { | ||
534 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
535 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
536 | fprintf(stderr, | ||
537 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", | ||
538 | i, j); | ||
539 | + return(1); | ||
540 | + } | ||
541 | } | ||
542 | |||
543 | /* | ||
544 | @@ -329,6 +363,7 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { | ||
545 | else if ((lastError != 0) || (len != 2)) { | ||
546 | fprintf(stderr, | ||
547 | "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j); | ||
548 | + return(1); | ||
549 | } | ||
550 | |||
551 | /* | ||
552 | @@ -338,12 +373,14 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { | ||
553 | fprintf(stderr, | ||
554 | "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n", | ||
555 | i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c); | ||
556 | + return(1); | ||
557 | } | ||
558 | } | ||
559 | } | ||
560 | + return(0); | ||
561 | } | ||
562 | |||
563 | -static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { | ||
564 | +static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { | ||
565 | int i, j, k, K; | ||
566 | int len, c; | ||
567 | unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; | ||
568 | @@ -368,20 +405,24 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { | ||
569 | * at least 4 bytes, but we give only 3 ! | ||
570 | */ | ||
571 | if ((i & 0xF0) == 0xF0) { | ||
572 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
573 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
574 | fprintf(stderr, | ||
575 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", | ||
576 | i, j, K, data[3]); | ||
577 | + return(1); | ||
578 | + } | ||
579 | } | ||
580 | |||
581 | /* | ||
582 | * The second and the third bytes must start with 10 | ||
583 | */ | ||
584 | else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) { | ||
585 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
586 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
587 | fprintf(stderr, | ||
588 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", | ||
589 | i, j, K); | ||
590 | + return(1); | ||
591 | + } | ||
592 | } | ||
593 | |||
594 | /* | ||
595 | @@ -390,10 +431,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { | ||
596 | * the 6th byte of data[1] must be set | ||
597 | */ | ||
598 | else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) { | ||
599 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
600 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
601 | fprintf(stderr, | ||
602 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", | ||
603 | i, j, K); | ||
604 | + return(1); | ||
605 | + } | ||
606 | } | ||
607 | |||
608 | /* | ||
609 | @@ -401,10 +444,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { | ||
610 | */ | ||
611 | else if (((value > 0xD7FF) && (value <0xE000)) || | ||
612 | ((value > 0xFFFD) && (value <0x10000))) { | ||
613 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
614 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
615 | fprintf(stderr, | ||
616 | "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n", | ||
617 | value, i, j, K); | ||
618 | + return(1); | ||
619 | + } | ||
620 | } | ||
621 | |||
622 | /* | ||
623 | @@ -414,6 +459,7 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { | ||
624 | fprintf(stderr, | ||
625 | "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", | ||
626 | i, j, K); | ||
627 | + return(1); | ||
628 | } | ||
629 | |||
630 | /* | ||
631 | @@ -423,13 +469,15 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { | ||
632 | fprintf(stderr, | ||
633 | "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", | ||
634 | i, j, data[2], value, c); | ||
635 | + return(1); | ||
636 | } | ||
637 | } | ||
638 | } | ||
639 | } | ||
640 | + return(0); | ||
641 | } | ||
642 | |||
643 | -static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
644 | +static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
645 | int i, j, k, K, l, L; | ||
646 | int len, c; | ||
647 | unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; | ||
648 | @@ -458,10 +506,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
649 | * at least 5 bytes, but we give only 4 ! | ||
650 | */ | ||
651 | if ((i & 0xF8) == 0xF8) { | ||
652 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
653 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
654 | fprintf(stderr, | ||
655 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", | ||
656 | i, j, K, data[3]); | ||
657 | + return(1); | ||
658 | + } | ||
659 | } | ||
660 | |||
661 | /* | ||
662 | @@ -469,10 +519,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
663 | */ | ||
664 | else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) || | ||
665 | ((L & 0xC0) != 0x80)) { | ||
666 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
667 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
668 | fprintf(stderr, | ||
669 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", | ||
670 | i, j, K, L); | ||
671 | + return(1); | ||
672 | + } | ||
673 | } | ||
674 | |||
675 | /* | ||
676 | @@ -481,10 +533,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
677 | * the 6 or 5th byte of j must be set | ||
678 | */ | ||
679 | else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) { | ||
680 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
681 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
682 | fprintf(stderr, | ||
683 | "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", | ||
684 | i, j, K, L); | ||
685 | + return(1); | ||
686 | + } | ||
687 | } | ||
688 | |||
689 | /* | ||
690 | @@ -493,10 +547,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
691 | else if (((value > 0xD7FF) && (value <0xE000)) || | ||
692 | ((value > 0xFFFD) && (value <0x10000)) || | ||
693 | (value > 0x10FFFF)) { | ||
694 | - if (lastError != XML_ERR_INVALID_CHAR) | ||
695 | + if (lastError != XML_ERR_INVALID_CHAR) { | ||
696 | fprintf(stderr, | ||
697 | "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", | ||
698 | value, i, j, K, L); | ||
699 | + return(1); | ||
700 | + } | ||
701 | } | ||
702 | |||
703 | /* | ||
704 | @@ -506,6 +562,7 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
705 | fprintf(stderr, | ||
706 | "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", | ||
707 | i, j, K); | ||
708 | + return(1); | ||
709 | } | ||
710 | |||
711 | /* | ||
712 | @@ -515,11 +572,13 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
713 | fprintf(stderr, | ||
714 | "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", | ||
715 | i, j, data[2], value, c); | ||
716 | + return(1); | ||
717 | } | ||
718 | } | ||
719 | } | ||
720 | } | ||
721 | } | ||
722 | + return(0); | ||
723 | } | ||
724 | |||
725 | /** | ||
726 | @@ -530,11 +589,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { | ||
727 | * cover the full range of UTF-8 chars accepted by XML-1.0 | ||
728 | */ | ||
729 | |||
730 | -static void testCharRanges(void) { | ||
731 | +static int testCharRanges(void) { | ||
732 | char data[5]; | ||
733 | xmlParserCtxtPtr ctxt; | ||
734 | xmlParserInputBufferPtr buf; | ||
735 | xmlParserInputPtr input; | ||
736 | + int test_ret = 0; | ||
737 | |||
738 | memset(data, 0, 5); | ||
739 | |||
740 | @@ -545,17 +605,19 @@ static void testCharRanges(void) { | ||
741 | ctxt = xmlNewParserCtxt(); | ||
742 | if (ctxt == NULL) { | ||
743 | fprintf(stderr, "Failed to allocate parser context\n"); | ||
744 | - return; | ||
745 | + return(1); | ||
746 | } | ||
747 | buf = xmlParserInputBufferCreateStatic(data, sizeof(data), | ||
748 | XML_CHAR_ENCODING_NONE); | ||
749 | if (buf == NULL) { | ||
750 | fprintf(stderr, "Failed to allocate input buffer\n"); | ||
751 | + test_ret = 1; | ||
752 | goto error; | ||
753 | } | ||
754 | input = xmlNewInputStream(ctxt); | ||
755 | if (input == NULL) { | ||
756 | xmlFreeParserInputBuffer(buf); | ||
757 | + test_ret = 1; | ||
758 | goto error; | ||
759 | } | ||
760 | input->filename = NULL; | ||
761 | @@ -567,25 +629,28 @@ static void testCharRanges(void) { | ||
762 | |||
763 | printf("testing char range: 1"); | ||
764 | fflush(stdout); | ||
765 | - testCharRangeByte1(ctxt, data); | ||
766 | + test_ret += testCharRangeByte1(ctxt, data); | ||
767 | printf(" 2"); | ||
768 | fflush(stdout); | ||
769 | - testCharRangeByte2(ctxt, data); | ||
770 | + test_ret += testCharRangeByte2(ctxt, data); | ||
771 | printf(" 3"); | ||
772 | fflush(stdout); | ||
773 | - testCharRangeByte3(ctxt, data); | ||
774 | + test_ret += testCharRangeByte3(ctxt, data); | ||
775 | printf(" 4"); | ||
776 | fflush(stdout); | ||
777 | - testCharRangeByte4(ctxt, data); | ||
778 | + test_ret += testCharRangeByte4(ctxt, data); | ||
779 | printf(" done\n"); | ||
780 | fflush(stdout); | ||
781 | |||
782 | error: | ||
783 | xmlFreeParserCtxt(ctxt); | ||
784 | + return(test_ret); | ||
785 | } | ||
786 | |||
787 | int main(void) { | ||
788 | |||
789 | + int ret = 0; | ||
790 | + | ||
791 | /* | ||
792 | * this initialize the library and check potential ABI mismatches | ||
793 | * between the version it was compiled for and the actual shared | ||
794 | @@ -602,8 +667,9 @@ int main(void) { | ||
795 | /* | ||
796 | * Run the tests | ||
797 | */ | ||
798 | - testCharRanges(); | ||
799 | - testDocumentRanges(); | ||
800 | + ret += testCharRanges(); | ||
801 | + ret += testDocumentRanges(); | ||
802 | + printf("%s: testchar\n\n", (ret == 0) ? "PASS" : "FAIL"); | ||
803 | |||
804 | /* | ||
805 | * Cleanup function for the XML library. | ||
806 | diff --git a/testdict.c b/testdict.c | ||
807 | index 40bebd05..114b9347 100644 | ||
808 | --- a/testdict.c | ||
809 | +++ b/testdict.c | ||
810 | @@ -440,5 +440,6 @@ int main(void) | ||
811 | clean_strings(); | ||
812 | xmlCleanupParser(); | ||
813 | xmlMemoryDump(); | ||
814 | + printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL"); | ||
815 | return(ret); | ||
816 | } | ||
817 | diff --git a/testlimits.c b/testlimits.c | ||
818 | index 059116a6..f0bee68d 100644 | ||
819 | --- a/testlimits.c | ||
820 | +++ b/testlimits.c | ||
821 | @@ -1634,5 +1634,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { | ||
822 | xmlCleanupParser(); | ||
823 | xmlMemoryDump(); | ||
824 | |||
825 | + printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL"); | ||
826 | return(ret); | ||
827 | } | ||
828 | diff --git a/testrecurse.c b/testrecurse.c | ||
829 | index 0cbe25a6..3ecadb40 100644 | ||
830 | --- a/testrecurse.c | ||
831 | +++ b/testrecurse.c | ||
832 | @@ -892,6 +892,7 @@ launchTests(testDescPtr tst) { | ||
833 | err++; | ||
834 | } | ||
835 | } | ||
836 | + printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc); | ||
837 | return(err); | ||
838 | } | ||
839 | |||
840 | @@ -961,5 +962,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { | ||
841 | xmlCleanupParser(); | ||
842 | xmlMemoryDump(); | ||
843 | |||
844 | + printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL"); | ||
845 | return(ret); | ||
846 | } | ||
847 | -- | ||
848 | 2.25.1 | ||
849 | |||
diff --git a/meta/recipes-core/libxml/libxml2_2.9.14.bb b/meta/recipes-core/libxml/libxml2_2.10.3.bb index a2ed8d71bc..32b37aacdb 100644 --- a/meta/recipes-core/libxml/libxml2_2.9.14.bb +++ b/meta/recipes-core/libxml/libxml2_2.10.3.bb | |||
@@ -14,18 +14,13 @@ DEPENDS = "zlib virtual/libiconv" | |||
14 | inherit gnomebase | 14 | inherit gnomebase |
15 | 15 | ||
16 | SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=testtar \ | 16 | SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=testtar \ |
17 | file://libxml-64bit.patch \ | ||
18 | file://runtest.patch \ | ||
19 | file://run-ptest \ | 17 | file://run-ptest \ |
20 | file://python-sitepackages-dir.patch \ | 18 | file://libxml-64bit.patch \ |
21 | file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \ | 19 | file://install-tests.patch \ |
22 | file://fix-execution-of-ptests.patch \ | ||
23 | file://remove-fuzz-from-ptests.patch \ | ||
24 | file://libxml-m4-use-pkgconfig.patch \ | 20 | file://libxml-m4-use-pkgconfig.patch \ |
25 | file://0001-Port-gentest.py-to-Python-3.patch \ | ||
26 | " | 21 | " |
27 | 22 | ||
28 | SRC_URI[archive.sha256sum] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee" | 23 | SRC_URI[archive.sha256sum] = "5d2cc3d78bec3dbe212a9d7fa629ada25a7da928af432c93060ff5c17ee28a9c" |
29 | SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7" | 24 | SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7" |
30 | 25 | ||
31 | BINCONFIG = "${bindir}/xml2-config" | 26 | BINCONFIG = "${bindir}/xml2-config" |
@@ -44,7 +39,7 @@ inherit autotools pkgconfig binconfig-disabled ptest | |||
44 | 39 | ||
45 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)} | 40 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)} |
46 | 41 | ||
47 | RDEPENDS:${PN}-ptest += "bash make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}" | 42 | RDEPENDS:${PN}-ptest += "bash make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}" |
48 | 43 | ||
49 | RDEPENDS:${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}" | 44 | RDEPENDS:${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}" |
50 | 45 | ||
@@ -55,13 +50,11 @@ RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-ebcdic-us \ | |||
55 | locale-base-en-us \ | 50 | locale-base-en-us \ |
56 | " | 51 | " |
57 | 52 | ||
58 | export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}" | ||
59 | |||
60 | # WARNING: zlib is required for RPM use | 53 | # WARNING: zlib is required for RPM use |
61 | EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions" | 54 | EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --with-c14n --without-lzma --with-fexceptions" |
62 | EXTRA_OECONF:class-native = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib" | 55 | EXTRA_OECONF:class-native = "--without-legacy --with-c14n --without-lzma --with-zlib" |
63 | EXTRA_OECONF:class-nativesdk = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib" | 56 | EXTRA_OECONF:class-nativesdk = "--without-legacy --with-c14n --without-lzma --with-zlib" |
64 | EXTRA_OECONF:linuxstdbase = "--with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib" | 57 | EXTRA_OECONF:linuxstdbase = "--with-debug --with-legacy --with-c14n --without-lzma --with-zlib" |
65 | 58 | ||
66 | python populate_packages:prepend () { | 59 | python populate_packages:prepend () { |
67 | # autonamer would call this libxml2-2, but we don't want that | 60 | # autonamer would call this libxml2-2, but we don't want that |
@@ -73,7 +66,6 @@ PACKAGE_BEFORE_PN += "${PN}-utils" | |||
73 | PACKAGES += "${PN}-python" | 66 | PACKAGES += "${PN}-python" |
74 | 67 | ||
75 | FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" | 68 | FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" |
76 | FILES:${PN}-dev += "${libdir}/xml2Conf.sh" | ||
77 | FILES:${PN}-utils = "${bindir}/*" | 69 | FILES:${PN}-utils = "${bindir}/*" |
78 | FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}" | 70 | FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}" |
79 | 71 | ||
@@ -82,39 +74,14 @@ do_configure:prepend () { | |||
82 | find ${S}/xmlconf/ -type f -exec chmod -x {} \+ | 74 | find ${S}/xmlconf/ -type f -exec chmod -x {} \+ |
83 | } | 75 | } |
84 | 76 | ||
85 | do_compile_ptest() { | ||
86 | # Make sure that testapi.c is newer than gentests.py, because | ||
87 | # with reproducible builds, they will both get e.g. Jan 1 1970 | ||
88 | # modification time from SOURCE_DATE_EPOCH and then check-am | ||
89 | # might try to rebuild_testapi, which will fail even with | ||
90 | # 0001-Port-gentest.py-to-Python-3.patch, because it needs | ||
91 | # libxml2 module (libxml2-native dependency and correctly | ||
92 | # set PYTHON_SITE_PACKAGES), it's easier to | ||
93 | # just rely on pre-generated testapi.c from the release | ||
94 | touch ${S}/testapi.c | ||
95 | |||
96 | oe_runmake check-am | ||
97 | } | ||
98 | |||
99 | do_install_ptest () { | 77 | do_install_ptest () { |
78 | oe_runmake DESTDIR=${D} ptestdir=${PTEST_PATH} install-test-data | ||
79 | |||
100 | cp -r ${S}/xmlconf ${D}${PTEST_PATH} | 80 | cp -r ${S}/xmlconf ${D}${PTEST_PATH} |
101 | if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then | 81 | |
102 | sed -i -e 's|^\(PYTHON = \).*|\1${USRBINPATH}/${PYTHON_PN}|' \ | 82 | if ! ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then |
103 | ${D}${PTEST_PATH}/python/tests/Makefile | 83 | rm -rf ${D}${PTEST_DIR}/python |
104 | grep -lrZ '#!/usr/bin/python' ${D}${PTEST_PATH}/python | | 84 | fi |
105 | xargs -0 sed -i -e 's|/usr/bin/python|${USRBINPATH}/${PYTHON_PN}|' | ||
106 | fi | ||
107 | #Remove build host references from various Makefiles | ||
108 | find "${D}${PTEST_PATH}" -name Makefile -type f -exec \ | ||
109 | sed -i \ | ||
110 | -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ | ||
111 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
112 | -e 's:${HOSTTOOLS_DIR}/::g' \ | ||
113 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ | ||
114 | -e 's:${RECIPE_SYSROOT}::g' \ | ||
115 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ | ||
116 | -e '/^RELDATE/d' \ | ||
117 | {} + | ||
118 | } | 85 | } |
119 | 86 | ||
120 | do_install:append:class-native () { | 87 | do_install:append:class-native () { |