summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/libxml
diff options
context:
space:
mode:
authorMihaela Sendrea <mihaela.sendrea@enea.com>2013-07-04 16:23:43 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-07-10 09:42:01 +0100
commit4b0ab26071909713e7b21ac4a544e6641139f8cd (patch)
tree323f71ed7e48dee15f288ed8bb625401fc545241 /meta/recipes-core/libxml
parentd8cba3391230f546e2830aebe1dabafbb789aa36 (diff)
downloadpoky-4b0ab26071909713e7b21ac4a544e6641139f8cd.tar.gz
libxml2: Add ptest
Install libxml2 test suite and run it as ptest. (From OE-Core rev: 22cf4cc85fbe21a53ca4684b0b06b9af20b2ecc5) Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/libxml')
-rw-r--r--meta/recipes-core/libxml/libxml2.inc14
-rw-r--r--meta/recipes-core/libxml/libxml2/run-ptest3
-rw-r--r--meta/recipes-core/libxml/libxml2/runtest.patch820
-rw-r--r--meta/recipes-core/libxml/libxml2_2.9.1.bb7
4 files changed, 839 insertions, 5 deletions
diff --git a/meta/recipes-core/libxml/libxml2.inc b/meta/recipes-core/libxml/libxml2.inc
index 9b2af0ff8a..7fb2644416 100644
--- a/meta/recipes-core/libxml/libxml2.inc
+++ b/meta/recipes-core/libxml/libxml2.inc
@@ -13,12 +13,16 @@ DEPENDS_class-nativesdk = "nativesdk-python"
13DEPENDS_class-native = "python-native" 13DEPENDS_class-native = "python-native"
14DEPENDS =+ "zlib" 14DEPENDS =+ "zlib"
15 15
16SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz \ 16SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \
17 file://libxml-64bit.patch \ 17 file://libxml-64bit.patch \
18 file://ansidecl.patch" 18 file://ansidecl.patch \
19 file://runtest.patch \
20 file://run-ptest \
21 "
19 22
23inherit autotools pkgconfig binconfig pythonnative ptest
20 24
21inherit autotools pkgconfig binconfig pythonnative 25RDEPENDS_${PN}-ptest_append_libc-glibc += "eglibc-gconv-ebcdic-us eglibc-gconv-ibm1141"
22 26
23# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header 27# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header
24do_configure_prepend () { 28do_configure_prepend () {
@@ -49,4 +53,8 @@ PACKAGES += "${PN}-utils"
49FILES_${PN}-dev += "${libdir}/xml2Conf.sh" 53FILES_${PN}-dev += "${libdir}/xml2Conf.sh"
50FILES_${PN}-utils += "${bindir}/*" 54FILES_${PN}-utils += "${bindir}/*"
51 55
56do_install_ptest () {
57 cp -r ${WORKDIR}/xmlconf ${D}${PTEST_PATH}
58}
59
52BBCLASSEXTEND = "native nativesdk" 60BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/libxml/libxml2/run-ptest b/meta/recipes-core/libxml/libxml2/run-ptest
new file mode 100644
index 0000000000..473d0b67a7
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/run-ptest
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3make -k runtests
diff --git a/meta/recipes-core/libxml/libxml2/runtest.patch b/meta/recipes-core/libxml/libxml2/runtest.patch
new file mode 100644
index 0000000000..fce69d94b4
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/runtest.patch
@@ -0,0 +1,820 @@
1Add 'install-ptest' rule.
2Print a standard result line for each test.
3
4Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
5Upstream-status: Pending
6
7diff -uNr a/Makefile.am b/Makefile.am
8--- a/Makefile.am 2013-04-17 14:51:42.633386477 +0200
9+++ b/Makefile.am 2013-04-19 14:47:51.544720568 +0200
10@@ -202,10 +202,19 @@
11 #testOOM_DEPENDENCIES = $(DEPS)
12 #testOOM_LDADD= $(LDADDS)
13
14+install-ptest:
15+ @(if [ -d .libs ] ; then cd .libs; fi; \
16+ install $(noinst_PROGRAMS) $(DESTDIR))
17+ cp -r $(srcdir)/test $(DESTDIR)
18+ cp -r $(srcdir)/result $(DESTDIR)
19+ cp -r $(srcdir)/python $(DESTDIR)
20+ cp Makefile $(DESTDIR)
21+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
22+
23 runtests:
24 [ -d test ] || $(LN_S) $(srcdir)/test .
25 [ -d result ] || $(LN_S) $(srcdir)/result .
26- $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
27+ ./runtest$(EXEEXT) ; ./testrecurse$(EXEEXT) ; ./testapi$(EXEEXT) ; ./testchar$(EXEEXT) ; ./testdict$(EXEEXT) ; ./runxmlconf$(EXEEXT)
28 @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
29 $(MAKE) tests ; fi)
30
31diff -uNr a/runsuite.c b/runsuite.c
32--- a/runsuite.c 2013-04-12 16:17:11.462823238 +0200
33+++ b/runsuite.c 2013-04-17 14:07:24.352693211 +0200
34@@ -1162,6 +1162,7 @@
35
36 if (logfile != NULL)
37 fclose(logfile);
38+ printf("%s: runsuite\n\n", (ret == 0) ? "PASS" : "FAIL");
39 return(ret);
40 }
41 #else /* !SCHEMAS */
42diff -uNr a/runtest.c b/runtest.c
43--- a/runtest.c 2013-04-16 13:19:15.087997290 +0200
44+++ b/runtest.c 2013-04-17 14:08:29.529949655 +0200
45@@ -4386,6 +4386,7 @@
46 err++;
47 }
48 }
49+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
50 return(err);
51 }
52
53@@ -4455,6 +4456,7 @@
54 xmlCleanupParser();
55 xmlMemoryDump();
56
57+ printf("%s: runtest\n\n", (ret == 0) ? "PASS" : "FAIL");
58 return(ret);
59 }
60
61diff -uNr a/runxmlconf.c b/runxmlconf.c
62--- a/runxmlconf.c 2013-04-16 12:53:49.900982990 +0200
63+++ b/runxmlconf.c 2013-04-17 14:09:21.111778104 +0200
64@@ -595,6 +595,7 @@
65
66 if (logfile != NULL)
67 fclose(logfile);
68+ printf("%s: runxmlconf\n", (ret == 0) ? "PASS" : "FAIL");
69 return(ret);
70 }
71
72diff -uNr a/testapi.c b/testapi.c
73--- a/testapi.c 2013-04-12 16:16:57.763417659 +0200
74+++ b/testapi.c 2013-04-17 14:10:28.876924881 +0200
75@@ -1245,49 +1245,91 @@
76 testlibxml2(void)
77 {
78 int test_ret = 0;
79+ int ret = 0;
80
81- test_ret += test_HTMLparser();
82- test_ret += test_HTMLtree();
83- test_ret += test_SAX2();
84- test_ret += test_c14n();
85- test_ret += test_catalog();
86- test_ret += test_chvalid();
87- test_ret += test_debugXML();
88- test_ret += test_dict();
89- test_ret += test_encoding();
90- test_ret += test_entities();
91- test_ret += test_hash();
92- test_ret += test_list();
93- test_ret += test_nanoftp();
94- test_ret += test_nanohttp();
95- test_ret += test_parser();
96- test_ret += test_parserInternals();
97- test_ret += test_pattern();
98- test_ret += test_relaxng();
99- test_ret += test_schemasInternals();
100- test_ret += test_schematron();
101- test_ret += test_tree();
102- test_ret += test_uri();
103- test_ret += test_valid();
104- test_ret += test_xinclude();
105- test_ret += test_xmlIO();
106- test_ret += test_xmlautomata();
107- test_ret += test_xmlerror();
108- test_ret += test_xmlmodule();
109- test_ret += test_xmlreader();
110- test_ret += test_xmlregexp();
111- test_ret += test_xmlsave();
112- test_ret += test_xmlschemas();
113- test_ret += test_xmlschemastypes();
114- test_ret += test_xmlstring();
115- test_ret += test_xmlunicode();
116- test_ret += test_xmlwriter();
117- test_ret += test_xpath();
118- test_ret += test_xpathInternals();
119- test_ret += test_xpointer();
120+ test_ret += (ret = test_HTMLparser());
121+ printf("%s: HTMLparser\n", (ret == 0) ? "PASS" : "FAIL");
122+ test_ret += (ret = test_HTMLtree());
123+ printf("%s: HTMLtree\n", (ret == 0) ? "PASS" : "FAIL");
124+ test_ret += (ret = test_SAX2());
125+ printf("%s: SAX2\n", (ret == 0) ? "PASS" : "FAIL");
126+ test_ret += (ret = test_c14n());
127+ printf("%s: c14n\n", (ret == 0) ? "PASS" : "FAIL");
128+ test_ret += (ret = test_catalog());
129+ printf("%s: catalog\n", (ret == 0) ? "PASS" : "FAIL");
130+ test_ret += (ret = test_chvalid());
131+ printf("%s: chvalid\n", (ret == 0) ? "PASS" : "FAIL");
132+ test_ret += (ret = test_debugXML());
133+ printf("%s: debugXML\n", (ret == 0) ? "PASS" : "FAIL");
134+ test_ret += (ret = test_dict());
135+ printf("%s: dict\n", (ret == 0) ? "PASS" : "FAIL");
136+ test_ret += (ret = test_encoding());
137+ printf("%s: encoding\n", (ret == 0) ? "PASS" : "FAIL");
138+ test_ret += (ret = test_entities());
139+ printf("%s: entities\n", (ret == 0) ? "PASS" : "FAIL");
140+ test_ret += (ret = test_hash());
141+ printf("%s: hash\n", (ret == 0) ? "PASS" : "FAIL");
142+ test_ret += (ret = test_list());
143+ printf("%s: list\n", (ret == 0) ? "PASS" : "FAIL");
144+ test_ret += (ret = test_nanoftp());
145+ printf("%s: nanoftp\n", (ret == 0) ? "PASS" : "FAIL");
146+ test_ret += (ret = test_nanohttp());
147+ printf("%s: nanohttp\n", (ret == 0) ? "PASS" : "FAIL");
148+ test_ret += (ret = test_parser());
149+ printf("%s: parser\n", (ret == 0) ? "PASS" : "FAIL");
150+ test_ret += (ret = test_parserInternals());
151+ printf("%s: parserInternals\n", (ret == 0) ? "PASS" : "FAIL");
152+ test_ret += (ret = test_pattern());
153+ printf("%s: pattern\n", (ret == 0) ? "PASS" : "FAIL");
154+ test_ret += (ret = test_relaxng());
155+ printf("%s: relaxng\n", (ret == 0) ? "PASS" : "FAIL");
156+ test_ret += (ret = test_schemasInternals());
157+ printf("%s: schemasInternals\n", (ret == 0) ? "PASS" : "FAIL");
158+ test_ret += (ret = test_schematron());
159+ printf("%s: schematron\n", (ret == 0) ? "PASS" : "FAIL");
160+ test_ret += (ret = test_tree());
161+ printf("%s: tree\n", (ret == 0) ? "PASS" : "FAIL");
162+ test_ret += (ret = test_uri());
163+ printf("%s: uri\n", (ret == 0) ? "PASS" : "FAIL");
164+ test_ret += (ret = test_valid());
165+ printf("%s: valid\n", (ret == 0) ? "PASS" : "FAIL");
166+ test_ret += (ret = test_xinclude());
167+ printf("%s: xinclude\n", (ret == 0) ? "PASS" : "FAIL");
168+ test_ret += (ret = test_xmlIO());
169+ printf("%s: xmlIO\n", (ret == 0) ? "PASS" : "FAIL");
170+ test_ret += (ret = test_xmlautomata());
171+ printf("%s: xmlautomata\n", (ret == 0) ? "PASS" : "FAIL");
172+ test_ret += (ret = test_xmlerror());
173+ printf("%s: xmlerror\n", (ret == 0) ? "PASS" : "FAIL");
174+ test_ret += (ret = test_xmlmodule());
175+ printf("%s: xmlmodule\n", (ret == 0) ? "PASS" : "FAIL");
176+ test_ret += (ret = test_xmlreader());
177+ printf("%s: xmlreader\n", (ret == 0) ? "PASS" : "FAIL");
178+ test_ret += (ret = test_xmlregexp());
179+ printf("%s: xmlregexp\n", (ret == 0) ? "PASS" : "FAIL");
180+ test_ret += (ret = test_xmlsave());
181+ printf("%s: xmlsave\n", (ret == 0) ? "PASS" : "FAIL");
182+ test_ret += (ret = test_xmlschemas());
183+ printf("%s: xmlschemas\n", (ret == 0) ? "PASS" : "FAIL");
184+ test_ret += (ret = test_xmlschemastypes());
185+ printf("%s: xmlschemastypes\n", (ret == 0) ? "PASS" : "FAIL");
186+ test_ret += (ret = test_xmlstring());
187+ printf("%s: xmlstring\n", (ret == 0) ? "PASS" : "FAIL");
188+ test_ret += (ret = test_xmlunicode());
189+ printf("%s: xmlunicode\n", (ret == 0) ? "PASS" : "FAIL");
190+ test_ret += (ret = test_xmlwriter());
191+ printf("%s: xmlwriter\n", (ret == 0) ? "PASS" : "FAIL");
192+ test_ret += (ret = test_xpath());
193+ printf("%s: xpath\n", (ret == 0) ? "PASS" : "FAIL");
194+ test_ret += (ret = test_xpathInternals());
195+ printf("%s: xpathInternals\n", (ret == 0) ? "PASS" : "FAIL");
196+ test_ret += (ret = test_xpointer());
197+ printf("%s: xpointer\n", (ret == 0) ? "PASS" : "FAIL");
198
199 printf("Total: %d functions, %d tests, %d errors\n",
200 function_tests, call_tests, test_ret);
201+
202+ printf("%s: testapi\n\n", (test_ret == 0) ? "PASS" : "FAIL");
203 return(test_ret);
204 }
205
206diff -uNr a/testchar.c b/testchar.c
207--- a/testchar.c 2013-04-17 10:50:30.250147418 +0200
208+++ b/testchar.c 2013-04-18 16:11:28.455733800 +0200
209@@ -23,7 +23,7 @@
210 char document1[100] = "<doc>XXXX</doc>";
211 char document2[100] = "<doc foo='XXXX'/>";
212
213-static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
214+static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
215 int len, char *data, int forbid1, int forbid2) {
216 int i;
217 xmlDocPtr res;
218@@ -37,33 +37,41 @@
219 res = xmlReadMemory(document, len, "test", NULL, 0);
220
221 if ((i == forbid1) || (i == forbid2)) {
222- if ((lastError == 0) || (res != NULL))
223+ if ((lastError == 0) || (res != NULL)) {
224 fprintf(stderr,
225 "Failed to detect invalid char for Byte 0x%02X: %c\n",
226 i, i);
227+ return(1);
228+ }
229 }
230
231 else if ((i == '<') || (i == '&')) {
232- if ((lastError == 0) || (res != NULL))
233+ if ((lastError == 0) || (res != NULL)) {
234 fprintf(stderr,
235 "Failed to detect illegal char %c for Byte 0x%02X\n", i, i);
236+ return(1);
237+ }
238 }
239 else if (((i < 0x20) || (i >= 0x80)) &&
240 (i != 0x9) && (i != 0xA) && (i != 0xD)) {
241- if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL))
242+ if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) {
243 fprintf(stderr,
244 "Failed to detect invalid char for Byte 0x%02X\n", i);
245+ return(1);
246+ }
247 }
248 else if (res == NULL) {
249 fprintf(stderr,
250 "Failed to parse valid char for Byte 0x%02X : %c\n", i, i);
251+ return(1);
252 }
253 if (res != NULL)
254 xmlFreeDoc(res);
255 }
256+ return(0);
257 }
258
259-static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
260+static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
261 int len, char *data) {
262 int i, j;
263 xmlDocPtr res;
264@@ -80,10 +88,12 @@
265
266 /* if first bit of first char is set, then second bit must too */
267 if ((i & 0x80) && ((i & 0x40) == 0)) {
268- if ((lastError == 0) || (res != NULL))
269+ if ((lastError == 0) || (res != NULL)) {
270 fprintf(stderr,
271 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
272 i, j);
273+ return(1);
274+ }
275 }
276
277 /*
278@@ -91,10 +101,12 @@
279 * bits must be 10
280 */
281 else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
282- if ((lastError == 0) || (res != NULL))
283+ if ((lastError == 0) || (res != NULL)) {
284 fprintf(stderr,
285 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
286 i, j);
287+ return(1);
288+ }
289 }
290
291 /*
292@@ -102,10 +114,12 @@
293 * than 0x80, i.e. one of bits 5 to 1 of i must be set
294 */
295 else if ((i & 0x80) && ((i & 0x1E) == 0)) {
296- if ((lastError == 0) || (res != NULL))
297+ if ((lastError == 0) || (res != NULL)) {
298 fprintf(stderr,
299 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
300 i, j);
301+ return(1);
302+ }
303 }
304
305 /*
306@@ -113,10 +127,12 @@
307 * at least 3 bytes, but we give only 2 !
308 */
309 else if ((i & 0xE0) == 0xE0) {
310- if ((lastError == 0) || (res != NULL))
311+ if ((lastError == 0) || (res != NULL)) {
312 fprintf(stderr,
313 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
314 i, j);
315+ return(1);
316+ }
317 }
318
319 /*
320@@ -125,11 +141,13 @@
321 else if ((lastError != 0) || (res == NULL)) {
322 fprintf(stderr,
323 "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j);
324+ return(1);
325 }
326 if (res != NULL)
327 xmlFreeDoc(res);
328 }
329 }
330+ return(0);
331 }
332
333 /**
334@@ -141,9 +159,10 @@
335 * CDATA in text or in attribute values.
336 */
337
338-static void testDocumentRanges(void) {
339+static int testDocumentRanges(void) {
340 xmlParserCtxtPtr ctxt;
341 char *data;
342+ int test_ret = 0;
343
344 /*
345 * Set up a parsing context using the first document as
346@@ -152,7 +171,7 @@
347 ctxt = xmlNewParserCtxt();
348 if (ctxt == NULL) {
349 fprintf(stderr, "Failed to allocate parser context\n");
350- return;
351+ return(1);
352 }
353
354 printf("testing 1 byte char in document: 1");
355@@ -163,7 +182,7 @@
356 data[2] = ' ';
357 data[3] = ' ';
358 /* test 1 byte injection at beginning of area */
359- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
360+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
361 data, -1, -1);
362 printf(" 2");
363 fflush(stdout);
364@@ -172,7 +191,7 @@
365 data[2] = ' ';
366 data[3] = ' ';
367 /* test 1 byte injection at end of area */
368- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
369+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
370 data + 3, -1, -1);
371
372 printf(" 3");
373@@ -183,7 +202,7 @@
374 data[2] = ' ';
375 data[3] = ' ';
376 /* test 1 byte injection at beginning of area */
377- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
378+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
379 data, '\'', -1);
380 printf(" 4");
381 fflush(stdout);
382@@ -192,7 +211,7 @@
383 data[2] = ' ';
384 data[3] = ' ';
385 /* test 1 byte injection at end of area */
386- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
387+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
388 data + 3, '\'', -1);
389 printf(" done\n");
390
391@@ -204,7 +223,7 @@
392 data[2] = ' ';
393 data[3] = ' ';
394 /* test 2 byte injection at beginning of area */
395- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
396+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
397 data);
398 printf(" 2");
399 fflush(stdout);
400@@ -213,7 +232,7 @@
401 data[2] = ' ';
402 data[3] = ' ';
403 /* test 2 byte injection at end of area */
404- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
405+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
406 data + 2);
407
408 printf(" 3");
409@@ -224,7 +243,7 @@
410 data[2] = ' ';
411 data[3] = ' ';
412 /* test 2 byte injection at beginning of area */
413- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
414+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
415 data);
416 printf(" 4");
417 fflush(stdout);
418@@ -233,14 +252,15 @@
419 data[2] = ' ';
420 data[3] = ' ';
421 /* test 2 byte injection at end of area */
422- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
423+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
424 data + 2);
425 printf(" done\n");
426
427 xmlFreeParserCtxt(ctxt);
428+ return(test_ret);
429 }
430
431-static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
432+static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
433 int i = 0;
434 int len, c;
435
436@@ -255,19 +275,25 @@
437 c = xmlCurrentChar(ctxt, &len);
438 if ((i == 0) || (i >= 0x80)) {
439 /* we must see an error there */
440- if (lastError != XML_ERR_INVALID_CHAR)
441+ if (lastError != XML_ERR_INVALID_CHAR) {
442 fprintf(stderr,
443 "Failed to detect invalid char for Byte 0x%02X\n", i);
444+ return(1);
445+ }
446 } else if (i == 0xD) {
447- if ((c != 0xA) || (len != 1))
448+ if ((c != 0xA) || (len != 1)) {
449 fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i);
450+ return(1);
451+ }
452 } else if ((c != i) || (len != 1)) {
453 fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i);
454+ return(1);
455 }
456 }
457+ return(0);
458 }
459
460-static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
461+static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
462 int i, j;
463 int len, c;
464
465@@ -284,10 +310,12 @@
466
467 /* if first bit of first char is set, then second bit must too */
468 if ((i & 0x80) && ((i & 0x40) == 0)) {
469- if (lastError != XML_ERR_INVALID_CHAR)
470+ if (lastError != XML_ERR_INVALID_CHAR) {
471 fprintf(stderr,
472 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
473 i, j);
474+ return(1);
475+ }
476 }
477
478 /*
479@@ -295,10 +323,12 @@
480 * bits must be 10
481 */
482 else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
483- if (lastError != XML_ERR_INVALID_CHAR)
484+ if (lastError != XML_ERR_INVALID_CHAR) {
485 fprintf(stderr,
486 "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
487 i, j, c);
488+ return(1);
489+ }
490 }
491
492 /*
493@@ -306,10 +336,12 @@
494 * than 0x80, i.e. one of bits 5 to 1 of i must be set
495 */
496 else if ((i & 0x80) && ((i & 0x1E) == 0)) {
497- if (lastError != XML_ERR_INVALID_CHAR)
498+ if (lastError != XML_ERR_INVALID_CHAR) {
499 fprintf(stderr,
500 "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
501 i, j, c);
502+ return(1);
503+ }
504 }
505
506 /*
507@@ -317,10 +349,12 @@
508 * at least 3 bytes, but we give only 2 !
509 */
510 else if ((i & 0xE0) == 0xE0) {
511- if (lastError != XML_ERR_INVALID_CHAR)
512+ if (lastError != XML_ERR_INVALID_CHAR) {
513 fprintf(stderr,
514 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
515 i, j);
516+ return(1);
517+ }
518 }
519
520 /*
521@@ -329,6 +363,7 @@
522 else if ((lastError != 0) || (len != 2)) {
523 fprintf(stderr,
524 "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j);
525+ return(1);
526 }
527
528 /*
529@@ -338,12 +373,14 @@
530 fprintf(stderr,
531 "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n",
532 i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c);
533+ return(1);
534 }
535 }
536 }
537+ return(0);
538 }
539
540-static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
541+static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
542 int i, j, k, K;
543 int len, c;
544 unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
545@@ -368,20 +405,24 @@
546 * at least 4 bytes, but we give only 3 !
547 */
548 if ((i & 0xF0) == 0xF0) {
549- if (lastError != XML_ERR_INVALID_CHAR)
550+ if (lastError != XML_ERR_INVALID_CHAR) {
551 fprintf(stderr,
552 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
553 i, j, K, data[3]);
554+ return(1);
555+ }
556 }
557
558 /*
559 * The second and the third bytes must start with 10
560 */
561 else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) {
562- if (lastError != XML_ERR_INVALID_CHAR)
563+ if (lastError != XML_ERR_INVALID_CHAR) {
564 fprintf(stderr,
565 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
566 i, j, K);
567+ return(1);
568+ }
569 }
570
571 /*
572@@ -390,10 +431,12 @@
573 * the 6th byte of data[1] must be set
574 */
575 else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) {
576- if (lastError != XML_ERR_INVALID_CHAR)
577+ if (lastError != XML_ERR_INVALID_CHAR) {
578 fprintf(stderr,
579 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
580 i, j, K);
581+ return(1);
582+ }
583 }
584
585 /*
586@@ -401,10 +444,12 @@
587 */
588 else if (((value > 0xD7FF) && (value <0xE000)) ||
589 ((value > 0xFFFD) && (value <0x10000))) {
590- if (lastError != XML_ERR_INVALID_CHAR)
591+ if (lastError != XML_ERR_INVALID_CHAR) {
592 fprintf(stderr,
593 "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n",
594 value, i, j, K);
595+ return(1);
596+ }
597 }
598
599 /*
600@@ -414,6 +459,7 @@
601 fprintf(stderr,
602 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
603 i, j, K);
604+ return(1);
605 }
606
607 /*
608@@ -423,13 +469,15 @@
609 fprintf(stderr,
610 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
611 i, j, data[2], value, c);
612+ return(1);
613 }
614 }
615 }
616 }
617+ return(0);
618 }
619
620-static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
621+static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
622 int i, j, k, K, l, L;
623 int len, c;
624 unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
625@@ -458,10 +506,12 @@
626 * at least 5 bytes, but we give only 4 !
627 */
628 if ((i & 0xF8) == 0xF8) {
629- if (lastError != XML_ERR_INVALID_CHAR)
630+ if (lastError != XML_ERR_INVALID_CHAR) {
631 fprintf(stderr,
632 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
633 i, j, K, data[3]);
634+ return(1);
635+ }
636 }
637
638 /*
639@@ -469,10 +519,12 @@
640 */
641 else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) ||
642 ((L & 0xC0) != 0x80)) {
643- if (lastError != XML_ERR_INVALID_CHAR)
644+ if (lastError != XML_ERR_INVALID_CHAR) {
645 fprintf(stderr,
646 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
647 i, j, K, L);
648+ return(1);
649+ }
650 }
651
652 /*
653@@ -481,10 +533,12 @@
654 * the 6 or 5th byte of j must be set
655 */
656 else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) {
657- if (lastError != XML_ERR_INVALID_CHAR)
658+ if (lastError != XML_ERR_INVALID_CHAR) {
659 fprintf(stderr,
660 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
661 i, j, K, L);
662+ return(1);
663+ }
664 }
665
666 /*
667@@ -493,10 +547,12 @@
668 else if (((value > 0xD7FF) && (value <0xE000)) ||
669 ((value > 0xFFFD) && (value <0x10000)) ||
670 (value > 0x10FFFF)) {
671- if (lastError != XML_ERR_INVALID_CHAR)
672+ if (lastError != XML_ERR_INVALID_CHAR) {
673 fprintf(stderr,
674 "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
675 value, i, j, K, L);
676+ return(1);
677+ }
678 }
679
680 /*
681@@ -506,6 +562,7 @@
682 fprintf(stderr,
683 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
684 i, j, K);
685+ return(1);
686 }
687
688 /*
689@@ -515,11 +572,13 @@
690 fprintf(stderr,
691 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
692 i, j, data[2], value, c);
693+ return(1);
694 }
695 }
696 }
697 }
698 }
699+ return(0);
700 }
701
702 /**
703@@ -530,11 +589,12 @@
704 * cover the full range of UTF-8 chars accepted by XML-1.0
705 */
706
707-static void testCharRanges(void) {
708+static int testCharRanges(void) {
709 char data[5];
710 xmlParserCtxtPtr ctxt;
711 xmlParserInputBufferPtr buf;
712 xmlParserInputPtr input;
713+ int test_ret = 0;
714
715 memset(data, 0, 5);
716
717@@ -545,17 +605,19 @@
718 ctxt = xmlNewParserCtxt();
719 if (ctxt == NULL) {
720 fprintf(stderr, "Failed to allocate parser context\n");
721- return;
722+ return(1);
723 }
724 buf = xmlParserInputBufferCreateStatic(data, sizeof(data),
725 XML_CHAR_ENCODING_NONE);
726 if (buf == NULL) {
727 fprintf(stderr, "Failed to allocate input buffer\n");
728+ test_ret = 1;
729 goto error;
730 }
731 input = xmlNewInputStream(ctxt);
732 if (input == NULL) {
733 xmlFreeParserInputBuffer(buf);
734+ test_ret = 1;
735 goto error;
736 }
737 input->filename = NULL;
738@@ -567,25 +629,28 @@
739
740 printf("testing char range: 1");
741 fflush(stdout);
742- testCharRangeByte1(ctxt, data);
743+ test_ret += testCharRangeByte1(ctxt, data);
744 printf(" 2");
745 fflush(stdout);
746- testCharRangeByte2(ctxt, data);
747+ test_ret += testCharRangeByte2(ctxt, data);
748 printf(" 3");
749 fflush(stdout);
750- testCharRangeByte3(ctxt, data);
751+ test_ret += testCharRangeByte3(ctxt, data);
752 printf(" 4");
753 fflush(stdout);
754- testCharRangeByte4(ctxt, data);
755+ test_ret += testCharRangeByte4(ctxt, data);
756 printf(" done\n");
757 fflush(stdout);
758
759 error:
760 xmlFreeParserCtxt(ctxt);
761+ return(test_ret);
762 }
763
764 int main(void) {
765
766+ int ret = 0;
767+
768 /*
769 * this initialize the library and check potential ABI mismatches
770 * between the version it was compiled for and the actual shared
771@@ -602,8 +667,9 @@
772 /*
773 * Run the tests
774 */
775- testCharRanges();
776- testDocumentRanges();
777+ ret += testCharRanges();
778+ ret += testDocumentRanges();
779+ printf("%s: testchar\n\n", (ret == 0) ? "PASS" : "FAIL");
780
781 /*
782 * Cleanup function for the XML library.
783diff -uNr a/testdict.c b/testdict.c
784--- a/testdict.c 2013-04-16 15:08:42.971177193 +0200
785+++ b/testdict.c 2013-04-18 15:59:00.699482439 +0200
786@@ -440,5 +440,6 @@
787 clean_strings();
788 xmlCleanupParser();
789 xmlMemoryDump();
790+ printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL");
791 return(ret);
792 }
793diff -uNr a/testlimits.c b/testlimits.c
794--- a/testlimits.c 2013-04-12 16:16:36.180354177 +0200
795+++ b/testlimits.c 2013-04-17 14:03:17.203092987 +0200
796@@ -1630,5 +1630,6 @@
797 xmlCleanupParser();
798 xmlMemoryDump();
799
800+ printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL");
801 return(ret);
802 }
803diff -uNr a/testrecurse.c b/testrecurse.c
804--- a/testrecurse.c 2013-04-16 13:19:49.366536295 +0200
805+++ b/testrecurse.c 2013-04-17 14:06:27.367091622 +0200
806@@ -892,6 +892,7 @@
807 err++;
808 }
809 }
810+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
811 return(err);
812 }
813
814@@ -961,5 +962,6 @@
815 xmlCleanupParser();
816 xmlMemoryDump();
817
818+ printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL");
819 return(ret);
820 }
diff --git a/meta/recipes-core/libxml/libxml2_2.9.1.bb b/meta/recipes-core/libxml/libxml2_2.9.1.bb
index a1093ed86c..fa9c65752d 100644
--- a/meta/recipes-core/libxml/libxml2_2.9.1.bb
+++ b/meta/recipes-core/libxml/libxml2_2.9.1.bb
@@ -1,7 +1,10 @@
1require libxml2.inc 1require libxml2.inc
2 2
3SRC_URI += "file://libxml2-CVE-2012-2871.patch \ 3SRC_URI += "file://libxml2-CVE-2012-2871.patch \
4 http://www.w3.org/XML/Test/xmlts20080827.tar.gz;name=testtar \
4 " 5 "
5 6
6SRC_URI[md5sum] = "9c0cfef285d5c4a5c80d00904ddab380" 7SRC_URI[libtar.md5sum] = "9c0cfef285d5c4a5c80d00904ddab380"
7SRC_URI[sha256sum] = "fd3c64cb66f2c4ea27e934d275904d92cec494a8e8405613780cbc8a71680fdb" 8SRC_URI[libtar.sha256sum] = "fd3c64cb66f2c4ea27e934d275904d92cec494a8e8405613780cbc8a71680fdb"
9SRC_URI[testtar.md5sum] = "ae3d1ebe000a3972afa104ca7f0e1b4a"
10SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7"