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

Side by Side Diff: gm/gmmain.cpp

Issue 26294004: GM: Allow ignored-tests.txt to list configs as well as tests (and combinations too) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: clarify Created 7 years, 2 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
« no previous file with comments | « gm/gm.cpp ('k') | gm/tests/outputs/ignoring-one-test/output-expected/command_line » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // compare_test_results_to_reference_bitmap() historically, 322 // compare_test_results_to_reference_bitmap() historically,
323 // and changing that now may affect other parts of our code. 323 // and changing that now may affect other parts of our code.
324 if (modeAsString.startsWith("-")) { 324 if (modeAsString.startsWith("-")) {
325 modeAsString.remove(0, 1); 325 modeAsString.remove(0, 1);
326 modes.push_back(modeAsString); 326 modes.push_back(modeAsString);
327 } 327 }
328 } 328 }
329 } 329 }
330 330
331 /** 331 /**
332 * Returns true if failures on this test should be ignored.
333 */
334 bool ShouldIgnoreTest(const SkString &name) const {
335 for (int i = 0; i < fIgnorableTestSubstrings.count(); i++) {
336 if (name.contains(fIgnorableTestSubstrings[i].c_str())) {
337 return true;
338 }
339 }
340 return false;
341 }
342
343 /**
332 * Records the results of this test in fTestsRun and fFailedTests. 344 * Records the results of this test in fTestsRun and fFailedTests.
333 * 345 *
334 * We even record successes, and errors that we regard as 346 * We even record successes, and errors that we regard as
335 * "ignorable"; we can filter them out later. 347 * "ignorable"; we can filter them out later.
336 */ 348 */
337 void RecordTestResults(const ErrorCombination& errorCombination, 349 void RecordTestResults(const ErrorCombination& errorCombination,
338 const SkString& shortNamePlusConfig, 350 const SkString& shortNamePlusConfig,
339 const char renderModeDescriptor []) { 351 const char renderModeDescriptor []) {
340 // Things to do regardless of errorCombination. 352 // Things to do regardless of errorCombination.
341 fTestsRun++; 353 fTestsRun++;
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 * 910 *
899 * TODO(epoger): This relies on the fact that 911 * TODO(epoger): This relies on the fact that
900 * force_all_opaque() was called on the bitmap before it 912 * force_all_opaque() was called on the bitmap before it
901 * was written to disk as a PNG in the first place. If 913 * was written to disk as a PNG in the first place. If
902 * not, the hash digest returned here may not match the 914 * not, the hash digest returned here may not match the
903 * hash digest of actualBitmap, which *has* been run through 915 * hash digest of actualBitmap, which *has* been run through
904 * force_all_opaque(). 916 * force_all_opaque().
905 * See comments above complete_bitmap() for more detail. 917 * See comments above complete_bitmap() for more detail.
906 */ 918 */
907 Expectations expectations = expectationsSource->get(nameWithExte nsion.c_str()); 919 Expectations expectations = expectationsSource->get(nameWithExte nsion.c_str());
908 if (gm->isIgnoringFailures()) { 920 if (this->ShouldIgnoreTest(shortNamePlusConfig)) {
909 expectations.setIgnoreFailure(true); 921 expectations.setIgnoreFailure(true);
910 } 922 }
911 errors.add(compare_to_expectations(expectations, *actualBitmapAn dDigest, 923 errors.add(compare_to_expectations(expectations, *actualBitmapAn dDigest,
912 gm->shortName(), configName, "", true)); 924 gm->shortName(), configName, "", true));
913 } else { 925 } else {
914 // If we are running without expectations, we still want to 926 // If we are running without expectations, we still want to
915 // record the actual results. 927 // record the actual results.
916 add_actual_results_to_json_summary(nameWithExtension.c_str(), 928 add_actual_results_to_json_summary(nameWithExtension.c_str(),
917 actualBitmapAndDigest->fDiges t, 929 actualBitmapAndDigest->fDiges t,
918 ErrorCombination(kMissingExpe ctations_ErrorType), 930 ErrorCombination(kMissingExpe ctations_ErrorType),
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 return errors; 1217 return errors;
1206 } 1218 }
1207 1219
1208 // 1220 //
1209 // member variables. 1221 // member variables.
1210 // They are public for now, to allow easier setting by tool_main(). 1222 // They are public for now, to allow easier setting by tool_main().
1211 // 1223 //
1212 1224
1213 bool fUseFileHierarchy, fWriteChecksumBasedFilenames; 1225 bool fUseFileHierarchy, fWriteChecksumBasedFilenames;
1214 ErrorCombination fIgnorableErrorTypes; 1226 ErrorCombination fIgnorableErrorTypes;
1227 SkTArray<SkString> fIgnorableTestSubstrings;
1215 1228
1216 const char* fMismatchPath; 1229 const char* fMismatchPath;
1217 const char* fMissingExpectationsPath; 1230 const char* fMissingExpectationsPath;
1218 1231
1219 // collection of tests that have failed with each ErrorType 1232 // collection of tests that have failed with each ErrorType
1220 SkTArray<SkString> fFailedTests[kLast_ErrorType+1]; 1233 SkTArray<SkString> fFailedTests[kLast_ErrorType+1];
1221 int fTestsRun; 1234 int fTestsRun;
1222 SkTDict<int> fRenderModesEncountered; 1235 SkTDict<int> fRenderModesEncountered;
1223 1236
1224 // Where to read expectations (expected image hash digests, etc.) from. 1237 // Where to read expectations (expected image hash digests, etc.) from.
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 gm_fprintf(stderr, "cannot find ErrorType with name '%s'\n", nam e); 1985 gm_fprintf(stderr, "cannot find ErrorType with name '%s'\n", nam e);
1973 return false; 1986 return false;
1974 } else { 1987 } else {
1975 outErrorTypes->add(type); 1988 outErrorTypes->add(type);
1976 } 1989 }
1977 } 1990 }
1978 } 1991 }
1979 return true; 1992 return true;
1980 } 1993 }
1981 1994
1995 /**
1996 * Replace contents of ignoreTestSubstrings with a list of testname/config subst rings, indicating
1997 * which tests' failures should be ignored.
1998 */
1999 static bool parse_flags_ignore_tests(SkTArray<SkString> &ignoreTestSubstrings) {
2000 ignoreTestSubstrings.reset();
2001 for (int i = 0; i < FLAGS_ignoreTests.count(); i++) {
2002 ignoreTestSubstrings.push_back(SkString(FLAGS_ignoreTests[i]));
2003 }
2004 return true;
2005 }
2006
1982 static bool parse_flags_modulo(int* moduloRemainder, int* moduloDivisor) { 2007 static bool parse_flags_modulo(int* moduloRemainder, int* moduloDivisor) {
1983 if (FLAGS_modulo.count() == 2) { 2008 if (FLAGS_modulo.count() == 2) {
1984 *moduloRemainder = atoi(FLAGS_modulo[0]); 2009 *moduloRemainder = atoi(FLAGS_modulo[0]);
1985 *moduloDivisor = atoi(FLAGS_modulo[1]); 2010 *moduloDivisor = atoi(FLAGS_modulo[1]);
1986 if (*moduloRemainder < 0 || *moduloDivisor <= 0 || 2011 if (*moduloRemainder < 0 || *moduloDivisor <= 0 ||
1987 *moduloRemainder >= *moduloDivisor) { 2012 *moduloRemainder >= *moduloDivisor) {
1988 gm_fprintf(stderr, "invalid modulo values."); 2013 gm_fprintf(stderr, "invalid modulo values.");
1989 return false; 2014 return false;
1990 } 2015 }
1991 } 2016 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 SkTDArray<const PDFRasterizerData*> pdfRasterizers; 2128 SkTDArray<const PDFRasterizerData*> pdfRasterizers;
2104 SkTDArray<SkScalar> tileGridReplayScales; 2129 SkTDArray<SkScalar> tileGridReplayScales;
2105 #if SK_SUPPORT_GPU 2130 #if SK_SUPPORT_GPU
2106 GrContextFactory* grFactory = new GrContextFactory; 2131 GrContextFactory* grFactory = new GrContextFactory;
2107 #else 2132 #else
2108 GrContextFactory* grFactory = NULL; 2133 GrContextFactory* grFactory = NULL;
2109 #endif 2134 #endif
2110 2135
2111 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) || 2136 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) ||
2112 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) || 2137 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) ||
2138 !parse_flags_ignore_tests(gmmain.fIgnorableTestSubstrings) ||
2113 #if SK_SUPPORT_GPU 2139 #if SK_SUPPORT_GPU
2114 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) || 2140 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) ||
2115 #endif 2141 #endif
2116 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) || 2142 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) ||
2117 !parse_flags_resource_path() || 2143 !parse_flags_resource_path() ||
2118 !parse_flags_jpeg_quality() || 2144 !parse_flags_jpeg_quality() ||
2119 !parse_flags_configs(&configs, grFactory) || 2145 !parse_flags_configs(&configs, grFactory) ||
2120 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || 2146 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) ||
2121 !parse_flags_gmmain_paths(&gmmain)) { 2147 !parse_flags_gmmain_paths(&gmmain)) {
2122 return -1; 2148 return -1;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 continue; 2210 continue;
2185 } 2211 }
2186 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); 2212 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor);
2187 } 2213 }
2188 2214
2189 const char* shortName = gm->shortName(); 2215 const char* shortName = gm->shortName();
2190 2216
2191 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) { 2217 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) {
2192 continue; 2218 continue;
2193 } 2219 }
2194 if (FLAGS_ignoreTests.contains(shortName)) {
2195 gm->setIgnoreFailures(true);
2196 }
2197 2220
2198 gmsRun++; 2221 gmsRun++;
2199 SkISize size = gm->getISize(); 2222 SkISize size = gm->getISize();
2200 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short Name, 2223 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short Name,
2201 size.width(), size.height()); 2224 size.width(), size.height());
2202 2225
2203 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, grFactory); 2226 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, grFactory);
2204 2227
2205 SkBitmap comparisonBitmap; 2228 SkBitmap comparisonBitmap;
2206 const ConfigData compareConfig = 2229 const ConfigData compareConfig =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 if (FLAGS_forceBWtext) { 2300 if (FLAGS_forceBWtext) {
2278 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2301 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2279 } 2302 }
2280 } 2303 }
2281 2304
2282 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2305 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2283 int main(int argc, char * const argv[]) { 2306 int main(int argc, char * const argv[]) {
2284 return tool_main(argc, (char**) argv); 2307 return tool_main(argc, (char**) argv);
2285 } 2308 }
2286 #endif 2309 #endif
OLDNEW
« no previous file with comments | « gm/gm.cpp ('k') | gm/tests/outputs/ignoring-one-test/output-expected/command_line » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698