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

Side by Side Diff: gm/gmmain.cpp

Issue 281303003: Generate gm/Android.mk, minus JSON. (Closed) Base URL: https://skia.googlesource.com/skia.git@baseline_gm
Patch Set: Created 6 years, 7 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
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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 } 862 }
863 863
864 /** 864 /**
865 * Add this result to the appropriate JSON collection of actual results (but just ONE), 865 * Add this result to the appropriate JSON collection of actual results (but just ONE),
866 * depending on errors encountered. 866 * depending on errors encountered.
867 */ 867 */
868 void add_actual_results_to_json_summary(const char testName[], 868 void add_actual_results_to_json_summary(const char testName[],
869 const GmResultDigest &actualResultDi gest, 869 const GmResultDigest &actualResultDi gest,
870 ErrorCombination errors, 870 ErrorCombination errors,
871 bool ignoreFailure) { 871 bool ignoreFailure) {
872 // FIXME (scroggo): JSON is disabled in Android framework until we solve
873 // skbug.com/2448
874 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
872 Json::Value jsonActualResults = actualResultDigest.asJsonTypeValuePair() ; 875 Json::Value jsonActualResults = actualResultDigest.asJsonTypeValuePair() ;
873 Json::Value *resultCollection = NULL; 876 Json::Value *resultCollection = NULL;
874 877
875 if (errors.isEmpty()) { 878 if (errors.isEmpty()) {
876 resultCollection = &this->fJsonActualResults_Succeeded; 879 resultCollection = &this->fJsonActualResults_Succeeded;
877 } else if (errors.includes(kRenderModeMismatch_ErrorType)) { 880 } else if (errors.includes(kRenderModeMismatch_ErrorType)) {
878 resultCollection = &this->fJsonActualResults_Failed; 881 resultCollection = &this->fJsonActualResults_Failed;
879 } else if (errors.includes(kExpectationsMismatch_ErrorType)) { 882 } else if (errors.includes(kExpectationsMismatch_ErrorType)) {
880 if (ignoreFailure) { 883 if (ignoreFailure) {
881 resultCollection = &this->fJsonActualResults_FailureIgnored; 884 resultCollection = &this->fJsonActualResults_FailureIgnored;
(...skipping 11 matching lines...) Expand all
893 // JSON file, we should fix this (and add a test case for 896 // JSON file, we should fix this (and add a test case for
894 // which an expectation is given but the test is never 897 // which an expectation is given but the test is never
895 // run). 898 // run).
896 resultCollection = &this->fJsonActualResults_NoComparison; 899 resultCollection = &this->fJsonActualResults_NoComparison;
897 } 900 }
898 901
899 // If none of the above cases match, we don't add it to ANY tally of act ual results. 902 // If none of the above cases match, we don't add it to ANY tally of act ual results.
900 if (resultCollection) { 903 if (resultCollection) {
901 (*resultCollection)[testName] = jsonActualResults; 904 (*resultCollection)[testName] = jsonActualResults;
902 } 905 }
906 #endif
903 } 907 }
904 908
905 /** 909 /**
906 * Add this test to the JSON collection of expected results. 910 * Add this test to the JSON collection of expected results.
907 */ 911 */
908 void add_expected_results_to_json_summary(const char testName[], 912 void add_expected_results_to_json_summary(const char testName[],
909 Expectations expectations) { 913 Expectations expectations) {
914 // FIXME (scroggo): JSON is disabled in Android framework until we solve
915 // skbug.com/2448
916 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
910 this->fJsonExpectedResults[testName] = expectations.asJsonValue(); 917 this->fJsonExpectedResults[testName] = expectations.asJsonValue();
918 #endif
911 } 919 }
912 920
913 /** 921 /**
914 * Compare actualBitmap to expectations stored in this->fExpectationsSource. 922 * Compare actualBitmap to expectations stored in this->fExpectationsSource.
915 * 923 *
916 * @param gm which test generated the actualBitmap 924 * @param gm which test generated the actualBitmap
917 * @param gRec 925 * @param gRec
918 * @param configName The config name to look for in the expectation file. 926 * @param configName The config name to look for in the expectation file.
919 * @param actualBitmapAndDigest ptr to bitmap generated by this run, or NULL 927 * @param actualBitmapAndDigest ptr to bitmap generated by this run, or NULL
920 * if we don't have a usable bitmap representation 928 * if we don't have a usable bitmap representation
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 // collection of tests that have failed with each ErrorType 1268 // collection of tests that have failed with each ErrorType
1261 SkTArray<SkString> fFailedTests[kLast_ErrorType+1]; 1269 SkTArray<SkString> fFailedTests[kLast_ErrorType+1];
1262 SkTArray<SkString> fTestsSkippedOnAllRenderModes; 1270 SkTArray<SkString> fTestsSkippedOnAllRenderModes;
1263 int fTestsRun; 1271 int fTestsRun;
1264 SkTDict<int> fRenderModesEncountered; 1272 SkTDict<int> fRenderModesEncountered;
1265 1273
1266 // Where to read expectations (expected image hash digests, etc.) from. 1274 // Where to read expectations (expected image hash digests, etc.) from.
1267 // If unset, we don't do comparisons. 1275 // If unset, we don't do comparisons.
1268 SkAutoTUnref<ExpectationsSource> fExpectationsSource; 1276 SkAutoTUnref<ExpectationsSource> fExpectationsSource;
1269 1277
1278 // FIXME (scroggo): JSON is disabled in Android framework until we solve
1279 // skbug.com/2448
1280 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
1270 // JSON summaries that we generate as we go (just for output). 1281 // JSON summaries that we generate as we go (just for output).
1271 Json::Value fJsonExpectedResults; 1282 Json::Value fJsonExpectedResults;
1272 Json::Value fJsonActualResults_Failed; 1283 Json::Value fJsonActualResults_Failed;
1273 Json::Value fJsonActualResults_FailureIgnored; 1284 Json::Value fJsonActualResults_FailureIgnored;
1274 Json::Value fJsonActualResults_NoComparison; 1285 Json::Value fJsonActualResults_NoComparison;
1275 Json::Value fJsonActualResults_Succeeded; 1286 Json::Value fJsonActualResults_Succeeded;
1276 1287 #endif
1277 }; // end of GMMain class definition 1288 }; // end of GMMain class definition
1278 1289
1279 #if SK_SUPPORT_GPU 1290 #if SK_SUPPORT_GPU
1280 static const GLContextType kDontCare_GLContextType = GrContextFactory::kNative_G LContextType; 1291 static const GLContextType kDontCare_GLContextType = GrContextFactory::kNative_G LContextType;
1281 #else 1292 #else
1282 static const GLContextType kDontCare_GLContextType = 0; 1293 static const GLContextType kDontCare_GLContextType = 0;
1283 #endif 1294 #endif
1284 1295
1285 static const ConfigData gRec[] = { 1296 static const ConfigData gRec[] = {
1286 { SkBitmap::kARGB_8888_Config, kRaster_Backend, kDontCare_GLContextType, 0, kRW_ConfigFlag, "8888", true }, 1297 { SkBitmap::kARGB_8888_Config, kRaster_Backend, kDontCare_GLContextType, 0, kRW_ConfigFlag, "8888", true },
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 DEFINE_bool(serialize, false, "Exercise the SkPicture serialization & deserializ ation test pass."); 1477 DEFINE_bool(serialize, false, "Exercise the SkPicture serialization & deserializ ation test pass.");
1467 DEFINE_bool(simulatePipePlaybackFailure, false, "Simulate a rendering failure in pipe mode only."); 1478 DEFINE_bool(simulatePipePlaybackFailure, false, "Simulate a rendering failure in pipe mode only.");
1468 DEFINE_bool(tiledPipe, false, "Exercise tiled SkGPipe replay."); 1479 DEFINE_bool(tiledPipe, false, "Exercise tiled SkGPipe replay.");
1469 DEFINE_bool(tileGrid, false, "Exercise the tile grid variant of SkPicture."); 1480 DEFINE_bool(tileGrid, false, "Exercise the tile grid variant of SkPicture.");
1470 DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale " 1481 DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale "
1471 "factors to be used for tileGrid playback testing. Default value: 1.0"); 1482 "factors to be used for tileGrid playback testing. Default value: 1.0");
1472 DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more i nfo about " 1483 DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more i nfo about "
1473 "each test)."); 1484 "each test).");
1474 DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-" 1485 DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-"
1475 "based filenames, as rebaseline.py will use when downloading them fr om Google Storage"); 1486 "based filenames, as rebaseline.py will use when downloading them fr om Google Storage");
1487 // FIXME (scroggo): JSON is disabled in Android framework until we solve
1488 // skbug.com/2448
1489 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
1476 DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary t o this file."); 1490 DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary t o this file.");
1491 #endif
1477 DEFINE_string2(writePath, w, "", "Write rendered images into this directory."); 1492 DEFINE_string2(writePath, w, "", "Write rendered images into this directory.");
1478 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.") ; 1493 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.") ;
1479 DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, " 1494 DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, "
1480 "which can be in range 0-100). N = -1 will disable JPEG compression . " 1495 "which can be in range 0-100). N = -1 will disable JPEG compression . "
1481 "Default is N = 100, maximum quality."); 1496 "Default is N = 100, maximum quality.");
1482 // TODO(edisonn): pass a matrix instead of forcePerspectiveMatrix 1497 // TODO(edisonn): pass a matrix instead of forcePerspectiveMatrix
1483 // Either the 9 numbers defining the matrix 1498 // Either the 9 numbers defining the matrix
1484 // or probably more readable would be to replace it with a set of a few predicat es 1499 // or probably more readable would be to replace it with a set of a few predicat es
1485 // Like --prerotate 100 200 10 --posttranslate 10, 10 1500 // Like --prerotate 100 200 10 --posttranslate 10, 10
1486 // Probably define spacial names like centerx, centery, top, bottom, left, right 1501 // Probably define spacial names like centerx, centery, top, bottom, left, right
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 SkDebugf("readPath %s does not exist!\n", readPath); 2206 SkDebugf("readPath %s does not exist!\n", readPath);
2192 return false; 2207 return false;
2193 } 2208 }
2194 if (sk_isdir(readPath)) { 2209 if (sk_isdir(readPath)) {
2195 if (FLAGS_verbose) { 2210 if (FLAGS_verbose) {
2196 SkDebugf("reading from %s\n", readPath); 2211 SkDebugf("reading from %s\n", readPath);
2197 } 2212 }
2198 gmmain->fExpectationsSource.reset(SkNEW_ARGS( 2213 gmmain->fExpectationsSource.reset(SkNEW_ARGS(
2199 IndividualImageExpectationsSource, (readPath))); 2214 IndividualImageExpectationsSource, (readPath)));
2200 } else { 2215 } else {
2216 // FIXME (scroggo): JSON is disabled in Android framework until we solve
2217 // skbug.com/2448
2218 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
2201 if (FLAGS_verbose) { 2219 if (FLAGS_verbose) {
2202 SkDebugf("reading expectations from JSON summary file %s\n", rea dPath); 2220 SkDebugf("reading expectations from JSON summary file %s\n", rea dPath);
2203 } 2221 }
2204 gmmain->fExpectationsSource.reset(SkNEW_ARGS(JsonExpectationsSource, (readPath))); 2222 gmmain->fExpectationsSource.reset(SkNEW_ARGS(JsonExpectationsSource, (readPath)));
2223 #endif
2205 } 2224 }
2206 } 2225 }
2207 return true; 2226 return true;
2208 } 2227 }
2209 2228
2210 static bool parse_flags_resource_path() { 2229 static bool parse_flags_resource_path() {
2211 if (FLAGS_resourcePath.count() == 1) { 2230 if (FLAGS_resourcePath.count() == 1) {
2212 GM::SetResourcePath(FLAGS_resourcePath[0]); 2231 GM::SetResourcePath(FLAGS_resourcePath[0]);
2213 } 2232 }
2214 return true; 2233 return true;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2401 // https://code.google.com/p/skia/issues/detail?id=1222 2420 // https://code.google.com/p/skia/issues/detail?id=1222
2402 // ('GM is unexpectedly skipping tests on Android') 2421 // ('GM is unexpectedly skipping tests on Android')
2403 #ifndef SK_BUILD_FOR_ANDROID 2422 #ifndef SK_BUILD_FOR_ANDROID
2404 if (expectedNumberOfTests != gmmain.fTestsRun) { 2423 if (expectedNumberOfTests != gmmain.fTestsRun) {
2405 SkDebugf("expected %d tests, but ran or skipped %d tests\n", 2424 SkDebugf("expected %d tests, but ran or skipped %d tests\n",
2406 expectedNumberOfTests, gmmain.fTestsRun); 2425 expectedNumberOfTests, gmmain.fTestsRun);
2407 reportError = true; 2426 reportError = true;
2408 } 2427 }
2409 #endif 2428 #endif
2410 2429
2430 // FIXME (scroggo): JSON is disabled in Android framework until we solve
2431 // skbug.com/2448
2432 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
2411 if (FLAGS_writeJsonSummaryPath.count() == 1) { 2433 if (FLAGS_writeJsonSummaryPath.count() == 1) {
2412 Json::Value root = CreateJsonTree( 2434 Json::Value root = CreateJsonTree(
2413 gmmain.fJsonExpectedResults, 2435 gmmain.fJsonExpectedResults,
2414 gmmain.fJsonActualResults_Failed, gmmain.fJsonActualResults_FailureI gnored, 2436 gmmain.fJsonActualResults_Failed, gmmain.fJsonActualResults_FailureI gnored,
2415 gmmain.fJsonActualResults_NoComparison, gmmain.fJsonActualResults_Su cceeded); 2437 gmmain.fJsonActualResults_NoComparison, gmmain.fJsonActualResults_Su cceeded);
2416 std::string jsonStdString = root.toStyledString(); 2438 std::string jsonStdString = root.toStyledString();
2417 SkFILEWStream stream(FLAGS_writeJsonSummaryPath[0]); 2439 SkFILEWStream stream(FLAGS_writeJsonSummaryPath[0]);
2418 stream.write(jsonStdString.c_str(), jsonStdString.length()); 2440 stream.write(jsonStdString.c_str(), jsonStdString.length());
2419 } 2441 }
2442 #endif
2420 2443
2421 #if SK_SUPPORT_GPU 2444 #if SK_SUPPORT_GPU
2422 2445
2423 #if GR_CACHE_STATS 2446 #if GR_CACHE_STATS
2424 for (int i = 0; i < configs.count(); i++) { 2447 for (int i = 0; i < configs.count(); i++) {
2425 ConfigData config = gRec[configs[i]]; 2448 ConfigData config = gRec[configs[i]];
2426 2449
2427 if (FLAGS_verbose && (kGPU_Backend == config.fBackend)) { 2450 if (FLAGS_verbose && (kGPU_Backend == config.fBackend)) {
2428 GrContext* gr = grFactory->get(config.fGLContextType); 2451 GrContext* gr = grFactory->get(config.fGLContextType);
2429 2452
(...skipping 26 matching lines...) Expand all
2456 if (FLAGS_forceBWtext) { 2479 if (FLAGS_forceBWtext) {
2457 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2480 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2458 } 2481 }
2459 } 2482 }
2460 2483
2461 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2484 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2462 int main(int argc, char * const argv[]) { 2485 int main(int argc, char * const argv[]) {
2463 return tool_main(argc, (char**) argv); 2486 return tool_main(argc, (char**) argv);
2464 } 2487 }
2465 #endif 2488 #endif
OLDNEW
« Android.mk ('K') | « gm/gm_expectations.cpp ('k') | gyp/gm.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698