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

Side by Side Diff: gm/gmmain.cpp

Issue 14746017: add wildcard test name matching to gm (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « bench/benchmain.cpp ('k') | no next file » | 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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 #if SK_SUPPORT_GPU 1233 #if SK_SUPPORT_GPU
1234 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si ze or " 1234 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si ze or "
1235 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means " 1235 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means "
1236 "use the default. 0 for either disables the cache."); 1236 "use the default. 0 for either disables the cache.");
1237 #endif 1237 #endif
1238 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " 1238 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure "
1239 "when reading/writing files."); 1239 "when reading/writing files.");
1240 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str( ), 1240 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str( ),
1241 "Space-separated list of ErrorTypes that should be ignored. If any *other* error " 1241 "Space-separated list of ErrorTypes that should be ignored. If any *other* error "
1242 "types are encountered, the tool will exit with a nonzero return v alue."); 1242 "types are encountered, the tool will exit with a nonzero return v alue.");
1243 DEFINE_string(match, "", "Only run tests whose name includes this substring/the se substrings " 1243 DEFINE_string(match, "", "[~][^]substring[$] [...] of test name to run.\n"
1244 "(more than one can be supplied, separated by spaces)."); 1244 "Multiple matches may be separated by spaces.\n"
1245 "~ causes a matching test to always be skipped\n"
1246 "^ requires the start of the test to match\n"
1247 "$ requires the end of the test to match\n"
1248 "^ and $ requires an exact match\n"
1249 "If a test does not match any list entry,\n"
1250 "it is skipped unless some list entry starts with ~");
1245 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to " 1251 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to "
1246 "pixel mismatches into this directory."); 1252 "pixel mismatches into this directory.");
1247 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for which " 1253 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for which "
1248 "testIndex %% divisor == remainder."); 1254 "testIndex %% divisor == remainder.");
1249 DEFINE_bool(pdf, true, "Exercise the pdf rendering test pass."); 1255 DEFINE_bool(pdf, true, "Exercise the pdf rendering test pass.");
1250 DEFINE_bool(pipe, true, "Exercise the SkGPipe replay test pass."); 1256 DEFINE_bool(pipe, true, "Exercise the SkGPipe replay test pass.");
1251 DEFINE_string2(readPath, r, "", "Read reference images from this dir, and report " 1257 DEFINE_string2(readPath, r, "", "Read reference images from this dir, and report "
1252 "any differences between those and the newly generated ones."); 1258 "any differences between those and the newly generated ones.");
1253 DEFINE_bool(replay, true, "Exercise the SkPicture replay test pass."); 1259 DEFINE_bool(replay, true, "Exercise the SkPicture replay test pass.");
1254 DEFINE_string2(resourcePath, i, "", "Directory that stores image resources."); 1260 DEFINE_string2(resourcePath, i, "", "Directory that stores image resources.");
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 static int findConfig(const char config[]) { 1305 static int findConfig(const char config[]) {
1300 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { 1306 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
1301 if (!strcmp(config, gRec[i].fName)) { 1307 if (!strcmp(config, gRec[i].fName)) {
1302 return (int) i; 1308 return (int) i;
1303 } 1309 }
1304 } 1310 }
1305 return -1; 1311 return -1;
1306 } 1312 }
1307 1313
1308 static bool skip_name(SkCommandLineFlags::StringArray array, const char name[]) { 1314 static bool skip_name(SkCommandLineFlags::StringArray array, const char name[]) {
1309 if (0 == array.count()) { 1315 // FIXME: this duplicates the logic in test/skia_test.cpp -- consolidate
1310 // no names, so don't skip anything 1316 int count = array.count();
1311 return false; 1317 size_t testLen = strlen(name);
1312 } 1318 bool anyExclude = count == 0;
1313 for (int i = 0; i < array.count(); ++i) { 1319 for (int i = 0; i < array.count(); ++i) {
1314 if (strstr(name, array[i])) { 1320 const char* matchName = array[i];
1315 // found the name, so don't skip 1321 size_t matchLen = strlen(matchName);
1316 return false; 1322 bool matchExclude, matchStart, matchEnd;
1323 if ((matchExclude = matchName[0] == '~')) {
1324 anyExclude = true;
1325 matchName++;
1326 matchLen--;
1327 }
1328 if ((matchStart = matchName[0] == '^')) {
1329 matchName++;
1330 matchLen--;
1331 }
1332 if ((matchEnd = matchName[matchLen - 1] == '$')) {
1333 matchLen--;
1334 }
1335 if (matchStart ? (!matchEnd || matchLen == testLen)
1336 && strncmp(name, matchName, matchLen) == 0
1337 : matchEnd ? matchLen <= testLen
1338 && strncmp(name + testLen - matchLen, matchName, matchLen) == 0
1339 : strstr(name, matchName) != 0) {
1340 return matchExclude;
1317 } 1341 }
1318 } 1342 }
1319 return true; 1343 return !anyExclude;
1320 } 1344 }
1321 1345
1322 namespace skiagm { 1346 namespace skiagm {
1323 #if SK_SUPPORT_GPU 1347 #if SK_SUPPORT_GPU
1324 SkAutoTUnref<GrContext> gGrContext; 1348 SkAutoTUnref<GrContext> gGrContext;
1325 /** 1349 /**
1326 * Sets the global GrContext, accessible by individual GMs 1350 * Sets the global GrContext, accessible by individual GMs
1327 */ 1351 */
1328 static void SetGr(GrContext* grContext) { 1352 static void SetGr(GrContext* grContext) {
1329 SkSafeRef(grContext); 1353 SkSafeRef(grContext);
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 if (FLAGS_forceBWtext) { 2032 if (FLAGS_forceBWtext) {
2009 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2033 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2010 } 2034 }
2011 } 2035 }
2012 2036
2013 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2037 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2014 int main(int argc, char * const argv[]) { 2038 int main(int argc, char * const argv[]) {
2015 return tool_main(argc, (char**) argv); 2039 return tool_main(argc, (char**) argv);
2016 } 2040 }
2017 #endif 2041 #endif
OLDNEW
« no previous file with comments | « bench/benchmain.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698