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