Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: gm/gmmain.cpp

Issue 12691009: gm: write all messages to stdout/stderr with "GM:" preamble to distinguish from various debug messa… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: tiny fix Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 /* 8 /*
9 * Code for the "gm" (Golden Master) rendering comparison tool. 9 * Code for the "gm" (Golden Master) rendering comparison tool.
10 * 10 *
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 static void force_all_opaque(const SkBitmap& bitmap) { 216 static void force_all_opaque(const SkBitmap& bitmap) {
217 SkBitmap::Config config = bitmap.config(); 217 SkBitmap::Config config = bitmap.config();
218 switch (config) { 218 switch (config) {
219 case SkBitmap::kARGB_8888_Config: 219 case SkBitmap::kARGB_8888_Config:
220 force_all_opaque_8888(bitmap); 220 force_all_opaque_8888(bitmap);
221 break; 221 break;
222 case SkBitmap::kRGB_565_Config: 222 case SkBitmap::kRGB_565_Config:
223 // nothing to do here; 565 bitmaps are inherently opaque 223 // nothing to do here; 565 bitmaps are inherently opaque
224 break; 224 break;
225 default: 225 default:
226 fprintf(stderr, "unsupported bitmap config %d\n", config); 226 gm_fprintf(stderr, "unsupported bitmap config %d\n", config);
227 SkDEBUGFAIL("unsupported bitmap config"); 227 DEBUGFAIL_SEE_STDERR;
228 } 228 }
229 } 229 }
230 230
231 static void force_all_opaque_8888(const SkBitmap& bitmap) { 231 static void force_all_opaque_8888(const SkBitmap& bitmap) {
232 SkAutoLockPixels lock(bitmap); 232 SkAutoLockPixels lock(bitmap);
233 for (int y = 0; y < bitmap.height(); y++) { 233 for (int y = 0; y < bitmap.height(); y++) {
234 for (int x = 0; x < bitmap.width(); x++) { 234 for (int x = 0; x < bitmap.width(); x++) {
235 *bitmap.getAddr32(x, y) |= (SK_A32_MASK << SK_A32_SHIFT); 235 *bitmap.getAddr32(x, y) |= (SK_A32_MASK << SK_A32_SHIFT);
236 } 236 }
237 } 237 }
(...skipping 26 matching lines...) Expand all
264 FailRec& rec = fFailedTests.push_back(make_name( 264 FailRec& rec = fFailedTests.push_back(make_name(
265 name.c_str(), renderModeDescriptor)); 265 name.c_str(), renderModeDescriptor));
266 rec.fIsPixelError = 266 rec.fIsPixelError =
267 (kEmptyErrorBitfield != (errorType & kImageMismatch_ErrorBitmask)); 267 (kEmptyErrorBitfield != (errorType & kImageMismatch_ErrorBitmask));
268 } 268 }
269 269
270 // List contents of fFailedTests via SkDebug. 270 // List contents of fFailedTests via SkDebug.
271 void ListErrors() { 271 void ListErrors() {
272 for (int i = 0; i < fFailedTests.count(); ++i) { 272 for (int i = 0; i < fFailedTests.count(); ++i) {
273 if (fFailedTests[i].fIsPixelError) { 273 if (fFailedTests[i].fIsPixelError) {
274 SkDebugf("\t\t%s pixel_error\n", fFailedTests[i].fName.c_str()); 274 gm_fprintf(stderr, "\t\t%s pixel_error\n", fFailedTests[i].fName .c_str());
borenet 2013/03/13 11:58:41 Thanks for directing these to stderr.
275 } else { 275 } else {
276 SkDebugf("\t\t%s\n", fFailedTests[i].fName.c_str()); 276 gm_fprintf(stderr, "\t\t%s\n", fFailedTests[i].fName.c_str());
277 } 277 }
278 } 278 }
279 } 279 }
280 280
281 static bool write_document(const SkString& path, 281 static bool write_document(const SkString& path,
282 const SkDynamicMemoryWStream& document) { 282 const SkDynamicMemoryWStream& document) {
283 SkFILEWStream stream(path.c_str()); 283 SkFILEWStream stream(path.c_str());
284 SkAutoDataUnref data(document.copyToData()); 284 SkAutoDataUnref data(document.copyToData());
285 return stream.writeData(data.get()); 285 return stream.writeData(data.get());
286 } 286 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 success = write_document(path, *document); 511 success = write_document(path, *document);
512 } 512 }
513 if (kXPS_Backend == gRec.fBackend) { 513 if (kXPS_Backend == gRec.fBackend) {
514 path = make_filename(writePath, renderModeDescriptor, name.c_str(), 514 path = make_filename(writePath, renderModeDescriptor, name.c_str(),
515 "xps"); 515 "xps");
516 success = write_document(path, *document); 516 success = write_document(path, *document);
517 } 517 }
518 if (success) { 518 if (success) {
519 return kEmptyErrorBitfield; 519 return kEmptyErrorBitfield;
520 } else { 520 } else {
521 fprintf(stderr, "FAILED to write %s\n", path.c_str()); 521 gm_fprintf(stderr, "FAILED to write %s\n", path.c_str());
522 RecordError(kWritingReferenceImage_ErrorBitmask, name, 522 RecordError(kWritingReferenceImage_ErrorBitmask, name,
523 renderModeDescriptor); 523 renderModeDescriptor);
524 return kWritingReferenceImage_ErrorBitmask; 524 return kWritingReferenceImage_ErrorBitmask;
525 } 525 }
526 } 526 }
527 527
528 /** 528 /**
529 * Log more detail about the mistmatch between expectedBitmap and 529 * Log more detail about the mistmatch between expectedBitmap and
530 * actualBitmap. 530 * actualBitmap.
531 */ 531 */
532 void report_bitmap_diffs(const SkBitmap& expectedBitmap, const SkBitmap& act ualBitmap, 532 void report_bitmap_diffs(const SkBitmap& expectedBitmap, const SkBitmap& act ualBitmap,
533 const char *testName) { 533 const char *testName) {
534 const int expectedWidth = expectedBitmap.width(); 534 const int expectedWidth = expectedBitmap.width();
535 const int expectedHeight = expectedBitmap.height(); 535 const int expectedHeight = expectedBitmap.height();
536 const int width = actualBitmap.width(); 536 const int width = actualBitmap.width();
537 const int height = actualBitmap.height(); 537 const int height = actualBitmap.height();
538 if ((expectedWidth != width) || (expectedHeight != height)) { 538 if ((expectedWidth != width) || (expectedHeight != height)) {
539 SkDebugf("---- %s: dimension mismatch -- expected [%d %d], actual [% d %d]\n", 539 gm_fprintf(stderr, "---- %s: dimension mismatch --"
540 testName, expectedWidth, expectedHeight, width, height); 540 " expected [%d %d], actual [%d %d]\n",
541 testName, expectedWidth, expectedHeight, width, height);
541 return; 542 return;
542 } 543 }
543 544
544 if ((SkBitmap::kARGB_8888_Config != expectedBitmap.config()) || 545 if ((SkBitmap::kARGB_8888_Config != expectedBitmap.config()) ||
545 (SkBitmap::kARGB_8888_Config != actualBitmap.config())) { 546 (SkBitmap::kARGB_8888_Config != actualBitmap.config())) {
546 SkDebugf("---- %s: not computing max per-channel pixel mismatch beca use non-8888\n", 547 gm_fprintf(stderr, "---- %s: not computing max per-channel"
547 testName); 548 " pixel mismatch because non-8888\n", testName);
548 return; 549 return;
549 } 550 }
550 551
551 SkAutoLockPixels alp0(expectedBitmap); 552 SkAutoLockPixels alp0(expectedBitmap);
552 SkAutoLockPixels alp1(actualBitmap); 553 SkAutoLockPixels alp1(actualBitmap);
553 int errR = 0; 554 int errR = 0;
554 int errG = 0; 555 int errG = 0;
555 int errB = 0; 556 int errB = 0;
556 int errA = 0; 557 int errA = 0;
557 int differingPixels = 0; 558 int differingPixels = 0;
(...skipping 10 matching lines...) Expand all
568 (int)SkGetPackedR32(actualPixel ))); 569 (int)SkGetPackedR32(actualPixel )));
569 errG = SkMax32(errG, SkAbs32((int)SkGetPackedG32(expectedPix el) - 570 errG = SkMax32(errG, SkAbs32((int)SkGetPackedG32(expectedPix el) -
570 (int)SkGetPackedG32(actualPixel ))); 571 (int)SkGetPackedG32(actualPixel )));
571 errB = SkMax32(errB, SkAbs32((int)SkGetPackedB32(expectedPix el) - 572 errB = SkMax32(errB, SkAbs32((int)SkGetPackedB32(expectedPix el) -
572 (int)SkGetPackedB32(actualPixel ))); 573 (int)SkGetPackedB32(actualPixel )));
573 errA = SkMax32(errA, SkAbs32((int)SkGetPackedA32(expectedPix el) - 574 errA = SkMax32(errA, SkAbs32((int)SkGetPackedA32(expectedPix el) -
574 (int)SkGetPackedA32(actualPixel ))); 575 (int)SkGetPackedA32(actualPixel )));
575 } 576 }
576 } 577 }
577 } 578 }
578 SkDebugf("---- %s: %d (of %d) differing pixels, max per-channel mismatch " 579 gm_fprintf(stderr, "---- %s: %d (of %d) differing pixels,"
579 " R=%d G=%d B=%d A=%d\n", 580 " max per-channel mismatch R=%d G=%d B=%d A=%d\n",
580 testName, differingPixels, width*height, errR, errG, errB, errA ); 581 testName, differingPixels, width*height, errR, errG, errB, er rA);
581 } 582 }
582 583
583 /** 584 /**
584 * Compares actual checksum to expectations. Returns 585 * Compares actual checksum to expectations. Returns
585 * kEmptyErrorBitfield if they match, or some combination of 586 * kEmptyErrorBitfield if they match, or some combination of
586 * _ErrorBitmask values otherwise. 587 * _ErrorBitmask values otherwise.
587 * 588 *
588 * If fMismatchPath has been set, and there are pixel diffs, then the 589 * If fMismatchPath has been set, and there are pixel diffs, then the
589 * actual bitmap will be written out to a file within fMismatchPath. 590 * actual bitmap will be written out to a file within fMismatchPath.
590 * 591 *
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 #ifdef SK_SUPPORT_XPS 1006 #ifdef SK_SUPPORT_XPS
1006 /* At present we have no way of comparing XPS files (either natively or by c onverting to PNG). */ 1007 /* At present we have no way of comparing XPS files (either natively or by c onverting to PNG). */
1007 { SkBitmap::kARGB_8888_Config, kXPS_Backend, kDontCare_GLContextType, 0, kWrite_ConfigFlag, "xps" }, 1008 { SkBitmap::kARGB_8888_Config, kXPS_Backend, kDontCare_GLContextType, 0, kWrite_ConfigFlag, "xps" },
1008 #endif // SK_SUPPORT_XPS 1009 #endif // SK_SUPPORT_XPS
1009 #ifdef SK_SUPPORT_PDF 1010 #ifdef SK_SUPPORT_PDF
1010 { SkBitmap::kARGB_8888_Config, kPDF_Backend, kDontCare_GLContextType, 0, kPDFConfigFlags, "pdf" }, 1011 { SkBitmap::kARGB_8888_Config, kPDF_Backend, kDontCare_GLContextType, 0, kPDFConfigFlags, "pdf" },
1011 #endif // SK_SUPPORT_PDF 1012 #endif // SK_SUPPORT_PDF
1012 }; 1013 };
1013 1014
1014 static void usage(const char * argv0) { 1015 static void usage(const char * argv0) {
1015 SkDebugf("%s\n", argv0); 1016 fprintf(stderr, "%s\n", argv0);
1016 SkDebugf(" [--config "); 1017 fprintf(stderr, " [--config ");
1017 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { 1018 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
1018 if (i > 0) { 1019 if (i > 0) {
1019 SkDebugf("|"); 1020 fprintf(stderr, "|");
1020 } 1021 }
1021 SkDebugf(gRec[i].fName); 1022 fprintf(stderr, "%s", gRec[i].fName);
1022 } 1023 }
1023 SkDebugf("]:\n run these configurations\n"); 1024 fprintf(stderr, "]:\n run these configurations\n");
1024 SkDebugf( 1025 fprintf(stderr,
1025 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). 1026 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath").
1026 // It would probably be better if we allowed both yes-and-no settings for each 1027 // It would probably be better if we allowed both yes-and-no settings for each
1027 // one, e.g.: 1028 // one, e.g.:
1028 // [--replay|--noreplay]: whether to exercise SkPicture replay; default is yes 1029 // [--replay|--noreplay]: whether to exercise SkPicture replay; default is yes
1029 " [--nodeferred]: skip the deferred rendering test pass\n" 1030 " [--nodeferred]: skip the deferred rendering test pass\n"
1030 " [--disable-missing-warning]: don't print a message to stderr if\n" 1031 " [--disable-missing-warning]: don't print a message to stderr if\n"
1031 " unable to read a reference image for any tests (NOT default behavior)\n " 1032 " unable to read a reference image for any tests (NOT default behavior)\n "
1032 " [--enable-missing-warning]: print message to stderr (but don't fail) if\n" 1033 " [--enable-missing-warning]: print message to stderr (but don't fail) if\n"
1033 " unable to read a reference image for any tests (default behavior)\n" 1034 " unable to read a reference image for any tests (default behavior)\n"
1034 " [--exclude-config]: disable this config (may be used multiple times)\n" 1035 " [--exclude-config]: disable this config (may be used multiple times)\n"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 char* const* stop = argv + argc; 1191 char* const* stop = argv + argc;
1191 for (++argv; argv < stop; ++argv) { 1192 for (++argv; argv < stop; ++argv) {
1192 if (strcmp(*argv, "--config") == 0) { 1193 if (strcmp(*argv, "--config") == 0) {
1193 argv++; 1194 argv++;
1194 if (argv < stop) { 1195 if (argv < stop) {
1195 int index = findConfig(*argv); 1196 int index = findConfig(*argv);
1196 if (index >= 0) { 1197 if (index >= 0) {
1197 appendUnique<size_t>(&configs, index); 1198 appendUnique<size_t>(&configs, index);
1198 userConfig = true; 1199 userConfig = true;
1199 } else { 1200 } else {
1200 SkString str; 1201 gm_fprintf(stderr, "unrecognized config %s\n", *argv);
1201 str.printf("unrecognized config %s\n", *argv);
1202 SkDebugf(str.c_str());
1203 usage(commandName); 1202 usage(commandName);
1204 return -1; 1203 return -1;
1205 } 1204 }
1206 } else { 1205 } else {
1207 SkDebugf("missing arg for --config\n"); 1206 gm_fprintf(stderr, "missing arg for --config\n");
1208 usage(commandName); 1207 usage(commandName);
1209 return -1; 1208 return -1;
1210 } 1209 }
1211 } else if (strcmp(*argv, "--exclude-config") == 0) { 1210 } else if (strcmp(*argv, "--exclude-config") == 0) {
1212 argv++; 1211 argv++;
1213 if (argv < stop) { 1212 if (argv < stop) {
1214 int index = findConfig(*argv); 1213 int index = findConfig(*argv);
1215 if (index >= 0) { 1214 if (index >= 0) {
1216 *excludeConfigs.append() = index; 1215 *excludeConfigs.append() = index;
1217 } else { 1216 } else {
1218 SkString str; 1217 gm_fprintf(stderr, "unrecognized exclude-config %s\n", *argv );
1219 str.printf("unrecognized exclude-config %s\n", *argv);
1220 SkDebugf(str.c_str());
1221 usage(commandName); 1218 usage(commandName);
1222 return -1; 1219 return -1;
1223 } 1220 }
1224 } else { 1221 } else {
1225 SkDebugf("missing arg for --exclude-config\n"); 1222 gm_fprintf(stderr, "missing arg for --exclude-config\n");
1226 usage(commandName); 1223 usage(commandName);
1227 return -1; 1224 return -1;
1228 } 1225 }
1229 } else if (strcmp(*argv, "--nodeferred") == 0) { 1226 } else if (strcmp(*argv, "--nodeferred") == 0) {
1230 doDeferred = false; 1227 doDeferred = false;
1231 } else if (strcmp(*argv, "--disable-missing-warning") == 0) { 1228 } else if (strcmp(*argv, "--disable-missing-warning") == 0) {
1232 notifyMissingReadReference = false; 1229 notifyMissingReadReference = false;
1233 } else if (strcmp(*argv, "--mismatchPath") == 0) { 1230 } else if (strcmp(*argv, "--mismatchPath") == 0) {
1234 argv++; 1231 argv++;
1235 if (argv < stop && **argv) { 1232 if (argv < stop && **argv) {
(...skipping 24 matching lines...) Expand all
1260 } else if (strcmp(*argv, "--enable-missing-warning") == 0) { 1257 } else if (strcmp(*argv, "--enable-missing-warning") == 0) {
1261 notifyMissingReadReference = true; 1258 notifyMissingReadReference = true;
1262 } else if (strcmp(*argv, "--forceBWtext") == 0) { 1259 } else if (strcmp(*argv, "--forceBWtext") == 0) {
1263 gForceBWtext = true; 1260 gForceBWtext = true;
1264 #if SK_SUPPORT_GPU 1261 #if SK_SUPPORT_GPU
1265 } else if (strcmp(*argv, "--gpuCacheSize") == 0) { 1262 } else if (strcmp(*argv, "--gpuCacheSize") == 0) {
1266 if (stop - argv > 2) { 1263 if (stop - argv > 2) {
1267 gpuCacheSize.fBytes = atoi(*++argv); 1264 gpuCacheSize.fBytes = atoi(*++argv);
1268 gpuCacheSize.fCount = atoi(*++argv); 1265 gpuCacheSize.fCount = atoi(*++argv);
1269 } else { 1266 } else {
1270 SkDebugf("missing arg for --gpuCacheSize\n"); 1267 gm_fprintf(stderr, "missing arg for --gpuCacheSize\n");
1271 usage(commandName); 1268 usage(commandName);
1272 return -1; 1269 return -1;
1273 } 1270 }
1274 #endif 1271 #endif
1275 } else if (strcmp(*argv, "--help") == 0 || strcmp(*argv, "-h") == 0) { 1272 } else if (strcmp(*argv, "--help") == 0 || strcmp(*argv, "-h") == 0) {
1276 usage(commandName); 1273 usage(commandName);
1277 return -1; 1274 return -1;
1278 } else if (strcmp(*argv, "--hierarchy") == 0) { 1275 } else if (strcmp(*argv, "--hierarchy") == 0) {
1279 gmmain.fUseFileHierarchy = true; 1276 gmmain.fUseFileHierarchy = true;
1280 } else if (strcmp(*argv, "--nohierarchy") == 0) { 1277 } else if (strcmp(*argv, "--nohierarchy") == 0) {
(...skipping 10 matching lines...) Expand all
1291 continue; 1288 continue;
1292 } 1289 }
1293 moduloRemainder = atoi(*argv); 1290 moduloRemainder = atoi(*argv);
1294 1291
1295 ++argv; 1292 ++argv;
1296 if (argv >= stop) { 1293 if (argv >= stop) {
1297 continue; 1294 continue;
1298 } 1295 }
1299 moduloDivisor = atoi(*argv); 1296 moduloDivisor = atoi(*argv);
1300 if (moduloRemainder < 0 || moduloDivisor <= 0 || moduloRemainder >= moduloDivisor) { 1297 if (moduloRemainder < 0 || moduloDivisor <= 0 || moduloRemainder >= moduloDivisor) {
1301 SkDebugf("invalid modulo values."); 1298 gm_fprintf(stderr, "invalid modulo values.");
1302 return -1; 1299 return -1;
1303 } 1300 }
1304 } else if (strcmp(*argv, "--nopdf") == 0) { 1301 } else if (strcmp(*argv, "--nopdf") == 0) {
1305 doPDF = false; 1302 doPDF = false;
1306 } else if (strcmp(*argv, "--nopipe") == 0) { 1303 } else if (strcmp(*argv, "--nopipe") == 0) {
1307 doPipe = false; 1304 doPipe = false;
1308 } else if ((0 == strcmp(*argv, "--readPath")) || 1305 } else if ((0 == strcmp(*argv, "--readPath")) ||
1309 (0 == strcmp(*argv, "-r"))) { 1306 (0 == strcmp(*argv, "-r"))) {
1310 argv++; 1307 argv++;
1311 if (argv < stop && **argv) { 1308 if (argv < stop && **argv) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 int index = configs.find(excludeConfigs[i]); 1362 int index = configs.find(excludeConfigs[i]);
1366 if (index >= 0) { 1363 if (index >= 0) {
1367 configs.remove(index); 1364 configs.remove(index);
1368 // now assert that there was only one copy in configs[] 1365 // now assert that there was only one copy in configs[]
1369 SkASSERT(configs.find(excludeConfigs[i]) < 0); 1366 SkASSERT(configs.find(excludeConfigs[i]) < 0);
1370 } 1367 }
1371 } 1368 }
1372 1369
1373 if (doVerbose) { 1370 if (doVerbose) {
1374 SkString str; 1371 SkString str;
1375 str.printf("gm: %d configs:", configs.count()); 1372 str.printf("%d configs:", configs.count());
1376 for (int i = 0; i < configs.count(); ++i) { 1373 for (int i = 0; i < configs.count(); ++i) {
1377 str.appendf(" %s", gRec[configs[i]].fName); 1374 str.appendf(" %s", gRec[configs[i]].fName);
1378 } 1375 }
1379 SkDebugf("%s\n", str.c_str()); 1376 gm_fprintf(stderr, "%s\n", str.c_str());
1380 } 1377 }
1381 1378
1382 GM::SetResourcePath(resourcePath); 1379 GM::SetResourcePath(resourcePath);
1383 1380
1384 if (readPath) { 1381 if (readPath) {
1385 if (!sk_exists(readPath)) { 1382 if (!sk_exists(readPath)) {
1386 fprintf(stderr, "readPath %s does not exist!\n", readPath); 1383 gm_fprintf(stderr, "readPath %s does not exist!\n", readPath);
1387 return -1; 1384 return -1;
1388 } 1385 }
1389 if (sk_isdir(readPath)) { 1386 if (sk_isdir(readPath)) {
1390 fprintf(stderr, "reading from %s\n", readPath); 1387 gm_fprintf(stdout, "reading from %s\n", readPath);
1391 gmmain.fExpectationsSource.reset(SkNEW_ARGS( 1388 gmmain.fExpectationsSource.reset(SkNEW_ARGS(
1392 IndividualImageExpectationsSource, 1389 IndividualImageExpectationsSource,
1393 (readPath, notifyMissingReadReference))); 1390 (readPath, notifyMissingReadReference)));
1394 } else { 1391 } else {
1395 fprintf(stderr, "reading expectations from JSON summary file %s\n", 1392 gm_fprintf(stdout, "reading expectations from JSON summary file %s\n ", readPath);
1396 readPath);
1397 gmmain.fExpectationsSource.reset(SkNEW_ARGS( 1393 gmmain.fExpectationsSource.reset(SkNEW_ARGS(
1398 JsonExpectationsSource, (readPath))); 1394 JsonExpectationsSource, (readPath)));
1399 } 1395 }
1400 } 1396 }
1401 if (writePath) { 1397 if (writePath) {
1402 fprintf(stderr, "writing to %s\n", writePath); 1398 gm_fprintf(stdout, "writing to %s\n", writePath);
1403 } 1399 }
1404 if (writePicturePath) { 1400 if (writePicturePath) {
1405 fprintf(stderr, "writing pictures to %s\n", writePicturePath); 1401 gm_fprintf(stdout, "writing pictures to %s\n", writePicturePath);
1406 } 1402 }
1407 if (resourcePath) { 1403 if (resourcePath) {
1408 fprintf(stderr, "reading resources from %s\n", resourcePath); 1404 gm_fprintf(stdout, "reading resources from %s\n", resourcePath);
1409 } 1405 }
1410 1406
1411 if (moduloDivisor <= 0) { 1407 if (moduloDivisor <= 0) {
1412 moduloRemainder = -1; 1408 moduloRemainder = -1;
1413 } 1409 }
1414 if (moduloRemainder < 0 || moduloRemainder >= moduloDivisor) { 1410 if (moduloRemainder < 0 || moduloRemainder >= moduloDivisor) {
1415 moduloRemainder = -1; 1411 moduloRemainder = -1;
1416 } 1412 }
1417 1413
1418 // Accumulate success of all tests. 1414 // Accumulate success of all tests.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); 1454 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor);
1459 } 1455 }
1460 1456
1461 const char* shortName = gm->shortName(); 1457 const char* shortName = gm->shortName();
1462 if (skip_name(fMatches, shortName)) { 1458 if (skip_name(fMatches, shortName)) {
1463 SkDELETE(gm); 1459 SkDELETE(gm);
1464 continue; 1460 continue;
1465 } 1461 }
1466 1462
1467 SkISize size = gm->getISize(); 1463 SkISize size = gm->getISize();
1468 SkDebugf("%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName, 1464 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short Name,
1469 size.width(), size.height()); 1465 size.width(), size.height());
1470 1466
1471 ErrorBitfield testErrors = kEmptyErrorBitfield; 1467 ErrorBitfield testErrors = kEmptyErrorBitfield;
1472 uint32_t gmFlags = gm->getFlags(); 1468 uint32_t gmFlags = gm->getFlags();
1473 1469
1474 for (int i = 0; i < configs.count(); i++) { 1470 for (int i = 0; i < configs.count(); i++) {
1475 ConfigData config = gRec[configs[i]]; 1471 ConfigData config = gRec[configs[i]];
1476 1472
1477 // Skip any tests that we don't even need to try. 1473 // Skip any tests that we don't even need to try.
1478 if ((kPDF_Backend == config.fBackend) && 1474 if ((kPDF_Backend == config.fBackend) &&
1479 (!doPDF || (gmFlags & GM::kSkipPDF_Flag))) 1475 (!doPDF || (gmFlags & GM::kSkipPDF_Flag)))
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 testsMissingReferenceImages++; 1671 testsMissingReferenceImages++;
1676 } 1672 }
1677 if (testErrors == (testErrors & kIgnorable_ErrorBitmask)) { 1673 if (testErrors == (testErrors & kIgnorable_ErrorBitmask)) {
1678 testsPassed++; 1674 testsPassed++;
1679 } else { 1675 } else {
1680 testsFailed++; 1676 testsFailed++;
1681 } 1677 }
1682 1678
1683 SkDELETE(gm); 1679 SkDELETE(gm);
1684 } 1680 }
1685 SkDebugf("Ran %d tests: %d passed, %d failed, %d missing reference images\n" , 1681 gm_fprintf(stdout, "Ran %d tests: %d passed, %d failed, %d missing reference images\n",
1686 testsRun, testsPassed, testsFailed, testsMissingReferenceImages); 1682 testsRun, testsPassed, testsFailed, testsMissingReferenceImages);
1687 gmmain.ListErrors(); 1683 gmmain.ListErrors();
1688 1684
1689 if (NULL != writeJsonSummaryPath) { 1685 if (NULL != writeJsonSummaryPath) {
1690 Json::Value actualResults; 1686 Json::Value actualResults;
1691 actualResults[kJsonKey_ActualResults_Failed] = 1687 actualResults[kJsonKey_ActualResults_Failed] =
1692 gmmain.fJsonActualResults_Failed; 1688 gmmain.fJsonActualResults_Failed;
1693 actualResults[kJsonKey_ActualResults_FailureIgnored] = 1689 actualResults[kJsonKey_ActualResults_FailureIgnored] =
1694 gmmain.fJsonActualResults_FailureIgnored; 1690 gmmain.fJsonActualResults_FailureIgnored;
1695 actualResults[kJsonKey_ActualResults_NoComparison] = 1691 actualResults[kJsonKey_ActualResults_NoComparison] =
1696 gmmain.fJsonActualResults_NoComparison; 1692 gmmain.fJsonActualResults_NoComparison;
1697 actualResults[kJsonKey_ActualResults_Succeeded] = 1693 actualResults[kJsonKey_ActualResults_Succeeded] =
1698 gmmain.fJsonActualResults_Succeeded; 1694 gmmain.fJsonActualResults_Succeeded;
1699 Json::Value root; 1695 Json::Value root;
1700 root[kJsonKey_ActualResults] = actualResults; 1696 root[kJsonKey_ActualResults] = actualResults;
1701 root[kJsonKey_ExpectedResults] = gmmain.fJsonExpectedResults; 1697 root[kJsonKey_ExpectedResults] = gmmain.fJsonExpectedResults;
1702 std::string jsonStdString = root.toStyledString(); 1698 std::string jsonStdString = root.toStyledString();
1703 SkFILEWStream stream(writeJsonSummaryPath); 1699 SkFILEWStream stream(writeJsonSummaryPath);
1704 stream.write(jsonStdString.c_str(), jsonStdString.length()); 1700 stream.write(jsonStdString.c_str(), jsonStdString.length());
1705 } 1701 }
1706 1702
1707 #if SK_SUPPORT_GPU 1703 #if SK_SUPPORT_GPU
1708 1704
1709 #if GR_CACHE_STATS 1705 #if GR_CACHE_STATS
1710 for (int i = 0; i < configs.count(); i++) { 1706 for (int i = 0; i < configs.count(); i++) {
1711 ConfigData config = gRec[configs[i]]; 1707 ConfigData config = gRec[configs[i]];
1712 1708
1713 if (kGPU_Backend == config.fBackend) { 1709 if (kGPU_Backend == config.fBackend) {
1714 GrContext* gr = grFactory->get(config.fGLContextType); 1710 GrContext* gr = grFactory->get(config.fGLContextType);
1715 1711
1716 SkDebugf("config: %s %x\n", config.fName, gr); 1712 gm_fprintf(stdout, "config: %s %x\n", config.fName, gr);
1717 gr->printCacheStats(); 1713 gr->printCacheStats();
1718 } 1714 }
1719 } 1715 }
1720 #endif 1716 #endif
1721 1717
1722 delete grFactory; 1718 delete grFactory;
1723 #endif 1719 #endif
1724 SkGraphics::Term(); 1720 SkGraphics::Term();
1725 1721
1726 return (0 == testsFailed) ? 0 : -1; 1722 return (0 == testsFailed) ? 0 : -1;
1727 } 1723 }
1728 1724
1729 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 1725 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
1730 int main(int argc, char * const argv[]) { 1726 int main(int argc, char * const argv[]) {
1731 return tool_main(argc, (char**) argv); 1727 return tool_main(argc, (char**) argv);
1732 } 1728 }
1733 #endif 1729 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698