| OLD | NEW |
| 1 /* | 1 /* |
| 2 * testlimits.c: C program to run libxml2 regression tests checking various | 2 * testlimits.c: C program to run libxml2 regression tests checking various |
| 3 * limits in document size. Will consume a lot of RAM and CPU cycles | 3 * limits in document size. Will consume a lot of RAM and CPU cycles |
| 4 * | 4 * |
| 5 * To compile on Unixes: | 5 * To compile on Unixes: |
| 6 * cc -o testlimits `xml2-config --cflags` testlimits.c `xml2-config --libs` -lp
thread | 6 * cc -o testlimits `xml2-config --cflags` testlimits.c `xml2-config --libs` -lp
thread |
| 7 * | 7 * |
| 8 * See Copyright for the status of this software. | 8 * See Copyright for the status of this software. |
| 9 * | 9 * |
| 10 * daniel@veillard.com | 10 * daniel@veillard.com |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 doc = xmlCtxtReadFile(ctxt, filename, NULL, options); | 1277 doc = xmlCtxtReadFile(ctxt, filename, NULL, options); |
| 1278 | 1278 |
| 1279 if (doc != NULL) { | 1279 if (doc != NULL) { |
| 1280 fprintf(stderr, "SAX parsing generated a document !\n"); | 1280 fprintf(stderr, "SAX parsing generated a document !\n"); |
| 1281 xmlFreeDoc(doc); | 1281 xmlFreeDoc(doc); |
| 1282 res = 0; | 1282 res = 0; |
| 1283 } else if (ctxt->wellFormed == 0) { | 1283 } else if (ctxt->wellFormed == 0) { |
| 1284 if (fail) | 1284 if (fail) |
| 1285 res = 0; | 1285 res = 0; |
| 1286 else { | 1286 else { |
| 1287 fprintf(stderr, "Failed to parse '%s' %lu\n", filename, limit); | 1287 fprintf(stderr, "Failed to parse '%s' %lu\n", filename, |
| 1288 (unsigned long) limit); |
| 1288 res = 1; | 1289 res = 1; |
| 1289 } | 1290 } |
| 1290 } else { | 1291 } else { |
| 1291 if (fail) { | 1292 if (fail) { |
| 1292 fprintf(stderr, "Failed to get failure for '%s' %lu\n", | 1293 fprintf(stderr, "Failed to get failure for '%s' %lu\n", |
| 1293 filename, limit); | 1294 filename, (unsigned long) limit); |
| 1294 res = 1; | 1295 res = 1; |
| 1295 } else | 1296 } else |
| 1296 res = 0; | 1297 res = 0; |
| 1297 } | 1298 } |
| 1298 ctxt->sax = old_sax; | 1299 ctxt->sax = old_sax; |
| 1299 xmlFreeParserCtxt(ctxt); | 1300 xmlFreeParserCtxt(ctxt); |
| 1300 | 1301 |
| 1301 return(res); | 1302 return(res); |
| 1302 } | 1303 } |
| 1303 #ifdef LIBXML_READER_ENABLED | 1304 #ifdef LIBXML_READER_ENABLED |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1332 } | 1333 } |
| 1333 if (ret != 0) { | 1334 if (ret != 0) { |
| 1334 if (fail) | 1335 if (fail) |
| 1335 res = 0; | 1336 res = 0; |
| 1336 else { | 1337 else { |
| 1337 if (strncmp(filename, "crazy:", 6) == 0) | 1338 if (strncmp(filename, "crazy:", 6) == 0) |
| 1338 fprintf(stderr, "Failed to parse '%s' %u\n", | 1339 fprintf(stderr, "Failed to parse '%s' %u\n", |
| 1339 filename, crazy_indx); | 1340 filename, crazy_indx); |
| 1340 else | 1341 else |
| 1341 fprintf(stderr, "Failed to parse '%s' %lu\n", | 1342 fprintf(stderr, "Failed to parse '%s' %lu\n", |
| 1342 filename, limit); | 1343 filename, (unsigned long) limit); |
| 1343 res = 1; | 1344 res = 1; |
| 1344 } | 1345 } |
| 1345 } else { | 1346 } else { |
| 1346 if (fail) { | 1347 if (fail) { |
| 1347 if (strncmp(filename, "crazy:", 6) == 0) | 1348 if (strncmp(filename, "crazy:", 6) == 0) |
| 1348 fprintf(stderr, "Failed to get failure for '%s' %u\n", | 1349 fprintf(stderr, "Failed to get failure for '%s' %u\n", |
| 1349 filename, crazy_indx); | 1350 filename, crazy_indx); |
| 1350 else | 1351 else |
| 1351 fprintf(stderr, "Failed to get failure for '%s' %lu\n", | 1352 fprintf(stderr, "Failed to get failure for '%s' %lu\n", |
| 1352 filename, limit); | 1353 filename, (unsigned long) limit); |
| 1353 res = 1; | 1354 res = 1; |
| 1354 } else | 1355 } else |
| 1355 res = 0; | 1356 res = 0; |
| 1356 } | 1357 } |
| 1357 if (timeout) | 1358 if (timeout) |
| 1358 res = 1; | 1359 res = 1; |
| 1359 xmlFreeTextReader(reader); | 1360 xmlFreeTextReader(reader); |
| 1360 | 1361 |
| 1361 return(res); | 1362 return(res); |
| 1362 } | 1363 } |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 } else { | 1629 } else { |
| 1629 ret = 1; | 1630 ret = 1; |
| 1630 printf("Total %d tests, %d errors, %d leaks\n", | 1631 printf("Total %d tests, %d errors, %d leaks\n", |
| 1631 nb_tests, nb_errors, nb_leaks); | 1632 nb_tests, nb_errors, nb_leaks); |
| 1632 } | 1633 } |
| 1633 xmlCleanupParser(); | 1634 xmlCleanupParser(); |
| 1634 xmlMemoryDump(); | 1635 xmlMemoryDump(); |
| 1635 | 1636 |
| 1636 return(ret); | 1637 return(ret); |
| 1637 } | 1638 } |
| OLD | NEW |