diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-18 21:30:57 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-18 21:30:57 +0000 |
commit | ae7b8f3e7ba88baf5f64fdd2f6a70a55367a7ee1 (patch) | |
tree | e913311af53f5f423a48324979274ec502ef3735 /gm | |
parent | db14f8bb35056ac80820b6f605c84cf0165eae26 (diff) |
add --modulo A B option to gm, so we can only execute 1/B of the tests in a
given instance.
Review URL: https://codereview.appspot.com/6739044
git-svn-id: http://skia.googlecode.com/svn/trunk@6007 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/gmmain.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp index 3cac1e4649..9a9ccb16e0 100644 --- a/gm/gmmain.cpp +++ b/gm/gmmain.cpp @@ -893,6 +893,9 @@ int tool_main(int argc, char** argv) { SkTDArray<size_t> configs; bool userConfig = false; + int moduloIndex = -1; + int moduloCount = -1; + gNotifyMissingReadReference = true; const char* const commandName = argv[0]; @@ -935,6 +938,18 @@ int tool_main(int argc, char** argv) { doPDF = false; } else if (strcmp(*argv, "--nodeferred") == 0) { doDeferred = false; + } else if (strcmp(*argv, "--modulo") == 0) { + ++argv; + if (argv >= stop) { + continue; + } + moduloIndex = atoi(*argv); + + ++argv; + if (argv >= stop) { + continue; + } + moduloCount = atoi(*argv); } else if (strcmp(*argv, "--disable-missing-warning") == 0) { gNotifyMissingReadReference = false; } else if (strcmp(*argv, "--enable-missing-warning") == 0) { @@ -1007,6 +1022,13 @@ int tool_main(int argc, char** argv) { fprintf(stderr, "reading resources from %s\n", resourcePath); } + if (moduloCount <= 0) { + moduloIndex = -1; + } + if (moduloIndex < 0 || moduloIndex >= moduloCount) { + moduloIndex = -1; + } + // Accumulate success of all tests. int testsRun = 0; int testsPassed = 0; @@ -1022,9 +1044,21 @@ int tool_main(int argc, char** argv) { SkTArray<SkString> failedTests; + int gmIndex = -1; + SkString moduloStr; + Iter iter; GM* gm; while ((gm = iter.next()) != NULL) { + + ++gmIndex; + if (moduloIndex >= 0) { + if ((gmIndex % moduloCount) != moduloIndex) { + continue; + } + moduloStr.printf("[%d % %d] ", gmIndex, moduloCount); + } + const char* shortName = gm->shortName(); if (skip_name(fMatches, shortName)) { SkDELETE(gm); @@ -1032,7 +1066,7 @@ int tool_main(int argc, char** argv) { } SkISize size = gm->getISize(); - SkDebugf("drawing... %s [%d %d]\n", shortName, + SkDebugf("%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName, size.width(), size.height()); SkBitmap forwardRenderedBitmap; |