MCPcopy Create free account
hub / github.com/Kitware/VTK / rngStreamTest

Function rngStreamTest

ThirdParty/libxml2/vtklibxml2/runtest.c:3543–3629  ·  view source on GitHub ↗

* rngStreamTest: * @filename: the schemas file * @result: the file with expected result * @err: the file with error messages * * Parse a set of files with streaming, applying an RNG schemas * * Returns 0 in case of success, an error code otherwise */

Source from the content-addressed store, hash-verified

3541 * Returns 0 in case of success, an error code otherwise
3542 */
3543static int
3544rngStreamTest(const char *filename,
3545 const char *resul ATTRIBUTE_UNUSED,
3546 const char *errr ATTRIBUTE_UNUSED,
3547 int options) {
3548 const char *base = baseFilename(filename);
3549 const char *base2;
3550 const char *instance;
3551 int res = 0, len, ret;
3552 char pattern[500];
3553 char prefix[500];
3554 char result[500];
3555 char err[500];
3556 glob_t globbuf;
3557 size_t i;
3558 char count = 0;
3559 xmlTextReaderPtr reader;
3560 int disable_err = 0;
3561
3562 /*
3563 * most of the mess is about the output filenames generated by the Makefile
3564 */
3565 len = strlen(base);
3566 if ((len > 499) || (len < 5)) {
3567 fprintf(stderr, "len(base) == %d !\n", len);
3568 return(-1);
3569 }
3570 len -= 4; /* remove trailing .rng */
3571 memcpy(prefix, base, len);
3572 prefix[len] = 0;
3573
3574 /*
3575 * strictly unifying the error messages is nearly impossible this
3576 * hack is also done in the Makefile
3577 */
3578 if ((!strcmp(prefix, "tutor10_1")) || (!strcmp(prefix, "tutor10_2")) ||
3579 (!strcmp(prefix, "tutor3_2")) || (!strcmp(prefix, "307377")) ||
3580 (!strcmp(prefix, "tutor8_2")))
3581 disable_err = 1;
3582
3583 if (snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix) >= 499)
3584 pattern[499] = 0;
3585
3586 globbuf.gl_offs = 0;
3587 glob(pattern, GLOB_DOOFFS, NULL, &globbuf);
3588 for (i = 0;i < globbuf.gl_pathc;i++) {
3589 testErrorsSize = 0;
3590 testErrors[0] = 0;
3591 instance = globbuf.gl_pathv[i];
3592 base2 = baseFilename(instance);
3593 len = strlen(base2);
3594 if ((len > 6) && (base2[len - 6] == '_')) {
3595 count = base2[len - 5];
3596 ret = snprintf(result, 499, "result/relaxng/%s_%c",
3597 prefix, count);
3598 if (ret >= 499)
3599 result[499] = 0;
3600 ret = snprintf(err, 499, "result/relaxng/%s_%c.err",

Callers

nothing calls this directly

Calls 8

baseFilenameFunction · 0.85
fprintfFunction · 0.85
globFunction · 0.85
xmlReaderForFileFunction · 0.85
streamProcessTestFunction · 0.85
xmlFreeTextReaderFunction · 0.85
globfreeFunction · 0.85

Tested by

no test coverage detected