mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-11 05:17:37 +03:00
runtest: Remove result handling from rngOneTest
We only care about errors.
This commit is contained in:
parent
e68ccfa988
commit
a470378554
37
runtest.c
37
runtest.c
@ -3376,14 +3376,11 @@ schemasTest(const char *filename,
|
|||||||
static int
|
static int
|
||||||
rngOneTest(const char *sch,
|
rngOneTest(const char *sch,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
const char *result,
|
|
||||||
int options,
|
int options,
|
||||||
xmlRelaxNGPtr schemas) {
|
xmlRelaxNGPtr schemas) {
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
xmlRelaxNGValidCtxtPtr ctxt;
|
xmlRelaxNGValidCtxtPtr ctxt;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *temp;
|
|
||||||
FILE *schemasOutput;
|
|
||||||
|
|
||||||
doc = xmlReadFile(filename, NULL, options);
|
doc = xmlReadFile(filename, NULL, options);
|
||||||
if (doc == NULL) {
|
if (doc == NULL) {
|
||||||
@ -3391,19 +3388,6 @@ rngOneTest(const char *sch,
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = resultFilename(result, temp_directory, ".res");
|
|
||||||
if (temp == NULL) {
|
|
||||||
fprintf(stderr, "Out of memory\n");
|
|
||||||
fatalError();
|
|
||||||
}
|
|
||||||
schemasOutput = fopen(temp, "wb");
|
|
||||||
if (schemasOutput == NULL) {
|
|
||||||
fprintf(stderr, "failed to open output file %s\n", temp);
|
|
||||||
xmlFreeDoc(doc);
|
|
||||||
free(temp);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctxt = xmlRelaxNGNewValidCtxt(schemas);
|
ctxt = xmlRelaxNGNewValidCtxt(schemas);
|
||||||
xmlRelaxNGSetValidStructuredErrors(ctxt, testStructuredErrorHandler, NULL);
|
xmlRelaxNGSetValidStructuredErrors(ctxt, testStructuredErrorHandler, NULL);
|
||||||
ret = xmlRelaxNGValidateDoc(ctxt, doc);
|
ret = xmlRelaxNGValidateDoc(ctxt, doc);
|
||||||
@ -3415,22 +3399,10 @@ rngOneTest(const char *sch,
|
|||||||
testErrorHandler(NULL, "%s validation generated an internal error\n",
|
testErrorHandler(NULL, "%s validation generated an internal error\n",
|
||||||
filename);
|
filename);
|
||||||
}
|
}
|
||||||
fclose(schemasOutput);
|
|
||||||
ret = 0;
|
|
||||||
if (result) {
|
|
||||||
if (compareFiles(temp, result)) {
|
|
||||||
fprintf(stderr, "Result for %s on %s failed\n", filename, sch);
|
|
||||||
ret = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (temp != NULL) {
|
|
||||||
unlink(temp);
|
|
||||||
free(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
xmlRelaxNGFreeValidCtxt(ctxt);
|
xmlRelaxNGFreeValidCtxt(ctxt);
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
return(ret);
|
return(0);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* rngTest:
|
* rngTest:
|
||||||
@ -3456,7 +3428,6 @@ rngTest(const char *filename,
|
|||||||
int parseErrorsSize;
|
int parseErrorsSize;
|
||||||
char pattern[500];
|
char pattern[500];
|
||||||
char prefix[500];
|
char prefix[500];
|
||||||
char result[500];
|
|
||||||
char err[500];
|
char err[500];
|
||||||
glob_t globbuf;
|
glob_t globbuf;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -3498,10 +3469,6 @@ rngTest(const char *filename,
|
|||||||
len = strlen(base2);
|
len = strlen(base2);
|
||||||
if ((len > 6) && (base2[len - 6] == '_')) {
|
if ((len > 6) && (base2[len - 6] == '_')) {
|
||||||
count = base2[len - 5];
|
count = base2[len - 5];
|
||||||
res = snprintf(result, 499, "result/relaxng/%s_%c",
|
|
||||||
prefix, count);
|
|
||||||
if (res >= 499)
|
|
||||||
result[499] = 0;
|
|
||||||
res = snprintf(err, 499, "result/relaxng/%s_%c.err",
|
res = snprintf(err, 499, "result/relaxng/%s_%c.err",
|
||||||
prefix, count);
|
prefix, count);
|
||||||
if (res >= 499)
|
if (res >= 499)
|
||||||
@ -3512,7 +3479,7 @@ rngTest(const char *filename,
|
|||||||
}
|
}
|
||||||
if (schemas != NULL) {
|
if (schemas != NULL) {
|
||||||
nb_tests++;
|
nb_tests++;
|
||||||
res = rngOneTest(filename, instance, result, options, schemas);
|
res = rngOneTest(filename, instance, options, schemas);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
ret = res;
|
ret = res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user