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

Function streamProcessTest

ThirdParty/libxml2/vtklibxml2/runtest.c:2362–2440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2360 }
2361}
2362static int
2363streamProcessTest(const char *filename, const char *result, const char *err,
2364 xmlTextReaderPtr reader, const char *rng,
2365 int options ATTRIBUTE_UNUSED) {
2366 int ret;
2367 char *temp = NULL;
2368 FILE *t = NULL;
2369
2370 if (reader == NULL)
2371 return(-1);
2372
2373 nb_tests++;
2374 if (result != NULL) {
2375 temp = resultFilename(filename, temp_directory, ".res");
2376 if (temp == NULL) {
2377 fprintf(stderr, "Out of memory\n");
2378 fatalError();
2379 }
2380 t = fopen(temp, "wb");
2381 if (t == NULL) {
2382 fprintf(stderr, "Can't open temp file %s\n", temp);
2383 free(temp);
2384 return(-1);
2385 }
2386 }
2387#ifdef LIBXML_SCHEMAS_ENABLED
2388 if (rng != NULL) {
2389 ret = xmlTextReaderRelaxNGValidate(reader, rng);
2390 if (ret < 0) {
2391 testErrorHandler(NULL, "Relax-NG schema %s failed to compile\n",
2392 rng);
2393 fclose(t);
2394 if (temp != NULL) {
2395 unlink(temp);
2396 free(temp);
2397 }
2398 return(0);
2399 }
2400 }
2401#endif
2402 ret = xmlTextReaderRead(reader);
2403 while (ret == 1) {
2404 if ((t != NULL) && (rng == NULL))
2405 processNode(t, reader);
2406 ret = xmlTextReaderRead(reader);
2407 }
2408 if (ret != 0) {
2409 testErrorHandler(NULL, "%s : failed to parse\n", filename);
2410 }
2411 if (rng != NULL) {
2412 if (xmlTextReaderIsValid(reader) != 1) {
2413 testErrorHandler(NULL, "%s fails to validate\n", filename);
2414 } else {
2415 testErrorHandler(NULL, "%s validates\n", filename);
2416 }
2417 }
2418 if (t != NULL) {
2419 fclose(t);

Callers 4

streamParseTestFunction · 0.85
walkerParseTestFunction · 0.85
streamMemParseTestFunction · 0.85
rngStreamTestFunction · 0.85

Calls 11

resultFilenameFunction · 0.85
fprintfFunction · 0.85
xmlTextReaderReadFunction · 0.85
xmlTextReaderIsValidFunction · 0.85
compareFileMemFunction · 0.85
printfFunction · 0.85
fatalErrorFunction · 0.70
testErrorHandlerFunction · 0.70
processNodeFunction · 0.70
compareFilesFunction · 0.70

Tested by

no test coverage detected