Test: Move much of the logging to stdout

This commit is contained in:
Vicki Pfau 2020-07-11 22:04:47 -07:00
parent fe11f095ec
commit 8b90fa2fe5
1 changed files with 16 additions and 17 deletions

View File

@ -417,7 +417,7 @@ static bool _loadBaseline(struct VDir* dir, struct CInemaImage* image, size_t fr
if (pheight != image->height || pwidth != image->width) { if (pheight != image->height || pwidth != image->width) {
PNGReadClose(png, info, end); PNGReadClose(png, info, end);
baselineVF->close(baselineVF); baselineVF->close(baselineVF);
CIerr(1, "Size mismatch for %s, expected %ux%u, got %ux%u\n", baselineName, pwidth, pheight, image->width, image->height); CIlog(1, "Size mismatch for %s, expected %ux%u, got %ux%u\n", baselineName, pwidth, pheight, image->width, image->height);
if (*status == CI_PASS) { if (*status == CI_PASS) {
*status = CI_FAIL; *status = CI_FAIL;
} }
@ -590,7 +590,7 @@ void CInemaTestRun(struct CInemaTest* test, struct Table* configTree) {
if (frameCounter <= minFrame) { if (frameCounter <= minFrame) {
break; break;
} }
CIerr(3, "Test frame: %u\n", frameCounter); CIlog(3, "Test frame: %u\n", frameCounter);
core->desiredVideoDimensions(core, &image.width, &image.height); core->desiredVideoDimensions(core, &image.width, &image.height);
uint8_t* diff = NULL; uint8_t* diff = NULL;
struct CInemaImage expected = { struct CInemaImage expected = {
@ -624,7 +624,7 @@ void CInemaTestRun(struct CInemaTest* test, struct Table* configTree) {
if (diffs && !diff) { if (diffs && !diff) {
diff = calloc(expected.width * expected.height, BYTES_PER_PIXEL); diff = calloc(expected.width * expected.height, BYTES_PER_PIXEL);
} }
CIerr(3, "Frame %u failed at pixel %" PRIz "ux%" PRIz "u with diff %i,%i,%i (expected %02x%02x%02x, got %02x%02x%02x)\n", CIlog(3, "Frame %u failed at pixel %" PRIz "ux%" PRIz "u with diff %i,%i,%i (expected %02x%02x%02x, got %02x%02x%02x)\n",
frameCounter, x, y, r, g, b, frameCounter, x, y, r, g, b,
expectR, expectG, expectB, expectR, expectG, expectB,
testR, testG, testB); testR, testG, testB);
@ -738,7 +738,7 @@ int main(int argc, char** argv) {
argv += optind; argv += optind;
if (!base[0] && !determineBase(argc, argv)) { if (!base[0] && !determineBase(argc, argv)) {
CIerr(0, "Could not determine CInema test base. Please specify manually."); CIlog(0, "Could not determine CInema test base. Please specify manually.");
status = 1; status = 1;
goto cleanup; goto cleanup;
} }
@ -770,7 +770,7 @@ int main(int argc, char** argv) {
} }
if (CInemaTestListSize(&tests) == 0) { if (CInemaTestListSize(&tests) == 0) {
CIerr(1, "No tests found."); CIlog(1, "No tests found.");
status = 1; status = 1;
} else { } else {
reduceTestList(&tests); reduceTestList(&tests);
@ -785,37 +785,36 @@ int main(int argc, char** argv) {
if (dryRun) { if (dryRun) {
CIlog(-1, "%s\n", test->name); CIlog(-1, "%s\n", test->name);
} else { } else {
CIerr(1, "%s: ", test->name); CIlog(1, "%s: ", test->name);
fflush(stdout);
CInemaTestRun(test, &configTree); CInemaTestRun(test, &configTree);
switch (test->status) { switch (test->status) {
case CI_PASS: case CI_PASS:
CIerr(1, "pass"); CIlog(1, "pass\n");
break; break;
case CI_FAIL: case CI_FAIL:
status = 1; status = 1;
CIerr(1, "fail"); CIlog(1, "fail\n");
break; break;
case CI_XPASS: case CI_XPASS:
CIerr(1, "xpass"); CIlog(1, "xpass\n");
break; break;
case CI_XFAIL: case CI_XFAIL:
CIerr(1, "xfail"); CIlog(1, "xfail\n");
break; break;
case CI_SKIP: case CI_SKIP:
CIerr(1, "skip"); CIlog(1, "skip\n");
break; break;
case CI_ERROR: case CI_ERROR:
status = 1; status = 1;
CIerr(1, "error"); CIlog(1, "error");
break; break;
} }
if (test->failedFrames) { if (test->failedFrames) {
CIerr(2, "\n\tfailed frames: %u/%u (%1.3g%%)", test->failedFrames, test->totalFrames, test->failedFrames / (test->totalFrames * 0.01)); CIlog(2, "\tfailed frames: %u/%u (%1.3g%%)\n", test->failedFrames, test->totalFrames, test->failedFrames / (test->totalFrames * 0.01));
CIerr(2, "\n\tfailed pixels: %" PRIu64 "/%" PRIu64 " (%1.3g%%)", test->failedPixels, test->totalPixels, test->failedPixels / (test->totalPixels * 0.01)); CIlog(2, "\tfailed pixels: %" PRIu64 "/%" PRIu64 " (%1.3g%%)\n", test->failedPixels, test->totalPixels, test->failedPixels / (test->totalPixels * 0.01));
CIerr(2, "\n\tdistance: %" PRIu64 "/%" PRIu64 " (%1.3g%%)", test->totalDistance, test->totalPixels * 765, test->totalDistance / (test->totalPixels * 7.65)); CIlog(2, "\tdistance: %" PRIu64 "/%" PRIu64 " (%1.3g%%)\n", test->totalDistance, test->totalPixels * 765, test->totalDistance / (test->totalPixels * 7.65));
} }
CIerr(1, "\n");
} }
} }