1
0
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:
Nick Wellnhofer 2024-06-22 17:49:14 +02:00
parent e68ccfa988
commit a470378554

View File

@ -3376,14 +3376,11 @@ schemasTest(const char *filename,
static int
rngOneTest(const char *sch,
const char *filename,
const char *result,
int options,
xmlRelaxNGPtr schemas) {
xmlDocPtr doc;
xmlRelaxNGValidCtxtPtr ctxt;
int ret = 0;
char *temp;
FILE *schemasOutput;
doc = xmlReadFile(filename, NULL, options);
if (doc == NULL) {
@ -3391,19 +3388,6 @@ rngOneTest(const char *sch,
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);
xmlRelaxNGSetValidStructuredErrors(ctxt, testStructuredErrorHandler, NULL);
ret = xmlRelaxNGValidateDoc(ctxt, doc);
@ -3415,22 +3399,10 @@ rngOneTest(const char *sch,
testErrorHandler(NULL, "%s validation generated an internal error\n",
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);
xmlFreeDoc(doc);
return(ret);
return(0);
}
/**
* rngTest:
@ -3456,7 +3428,6 @@ rngTest(const char *filename,
int parseErrorsSize;
char pattern[500];
char prefix[500];
char result[500];
char err[500];
glob_t globbuf;
size_t i;
@ -3498,10 +3469,6 @@ rngTest(const char *filename,
len = strlen(base2);
if ((len > 6) && (base2[len - 6] == '_')) {
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",
prefix, count);
if (res >= 499)
@ -3512,7 +3479,7 @@ rngTest(const char *filename,
}
if (schemas != NULL) {
nb_tests++;
res = rngOneTest(filename, instance, result, options, schemas);
res = rngOneTest(filename, instance, options, schemas);
if (res != 0)
ret = res;
}