--dryRun flag for gm
Causes gm to not actually run any tests / create any directories, just print its normal output. Useful for showing what tests would be run without actually taking the time to run them.
BUG=skia:2294
R=reed@google.com
Author: humper@google.com
Review URL: https://codereview.chromium.org/199093002
git-svn-id: http://skia.googlecode.com/svn/trunk@13785 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index de9e1a1..52e7332 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1421,6 +1421,7 @@
DEFINE_string(config, "", configUsage().c_str());
DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str());
DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass.");
+DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done.");
DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip.");
DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing.");
#if SK_SUPPORT_GPU
@@ -2237,6 +2238,10 @@
GrContextFactory* grFactory = NULL;
#endif
+ if (FLAGS_dryRun) {
+ SkDebugf( "Doing a dry run; no tests will actually be executed.\n");
+ }
+
if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) ||
!parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) ||
!parse_flags_ignore_tests(gmmain.fIgnorableTestNames) ||
@@ -2275,26 +2280,27 @@
int gmIndex = -1;
SkString moduloStr;
- // If we will be writing out files, prepare subdirectories.
- if (FLAGS_writePath.count() == 1) {
- if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHierarchy,
- configs, pdfRasterizers)) {
- return -1;
+ if (!FLAGS_dryRun) {
+ // If we will be writing out files, prepare subdirectories.
+ if (FLAGS_writePath.count() == 1) {
+ if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHierarchy,
+ configs, pdfRasterizers)) {
+ return -1;
+ }
+ }
+ if (NULL != gmmain.fMismatchPath) {
+ if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHierarchy,
+ configs, pdfRasterizers)) {
+ return -1;
+ }
+ }
+ if (NULL != gmmain.fMissingExpectationsPath) {
+ if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.fUseFileHierarchy,
+ configs, pdfRasterizers)) {
+ return -1;
+ }
}
}
- if (NULL != gmmain.fMismatchPath) {
- if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHierarchy,
- configs, pdfRasterizers)) {
- return -1;
- }
- }
- if (NULL != gmmain.fMissingExpectationsPath) {
- if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.fUseFileHierarchy,
- configs, pdfRasterizers)) {
- return -1;
- }
- }
-
Iter iter;
GM* gm;
while ((gm = iter.next()) != NULL) {
@@ -2326,10 +2332,13 @@
SkISize size = gm->getISize();
SkDebugf("%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName,
size.width(), size.height());
-
- run_multiple_configs(gmmain, gm, configs, pdfRasterizers, tileGridReplayScales, grFactory);
+ if (!FLAGS_dryRun)
+ run_multiple_configs(gmmain, gm, configs, pdfRasterizers, tileGridReplayScales, grFactory);
}
+ if (FLAGS_dryRun)
+ return 0;
+
SkTArray<SkString> modes;
gmmain.GetRenderModesEncountered(modes);
int modeCount = modes.count();