add --dryRun flag to dm
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 30 May 2014 17:23:31 +0000 (17:23 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 30 May 2014 17:23:31 +0000 (17:23 +0000)
BUG=2294
R=mtklein@google.com

Author: humper@google.com

Review URL: https://codereview.chromium.org/305963007

git-svn-id: http://skia.googlecode.com/svn/trunk@14999 2bbb7eff-a529-9590-31e7-b0007b416f81

dm/DM.cpp
dm/DMTask.cpp

index f71a614..9ddba24 100644 (file)
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -51,6 +51,7 @@ DEFINE_string(match, "",  "[~][^]substring[$] [...] of GM name to run.\n"
                           "it is skipped unless some list entry starts with ~");
 DEFINE_string(config, "565 8888 gpu nonrendering",
               "Options: 565 8888 gpu nonrendering msaa4 msaa16 nvprmsaa4 nvprmsaa16 gpunull gpudebug angle mesa");
+DEFINE_bool(dryRun, false, "Just print the tests that would be run, without actually running them.");
 DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?");
 DEFINE_string(skps, "", "Directory to read skps from.");
 
@@ -58,6 +59,8 @@ DEFINE_bool(gms, true, "Run GMs?");
 DEFINE_bool(benches, true, "Run benches?  Does not run GMs-as-benches.");
 DEFINE_bool(tests, true, "Run tests?");
 
+DECLARE_bool(verbose);
+
 __SK_FORCE_IMAGE_DECODER_LINKING;
 
 // "FooBar" -> "foobar".  Obviously, ASCII only.
@@ -208,6 +211,10 @@ int tool_main(int argc, char** argv);
 int tool_main(int argc, char** argv) {
     SkAutoGraphics ag;
     SkCommandLineFlags::Parse(argc, argv);
+
+    if (FLAGS_dryRun) {
+        FLAGS_verbose = true;
+    }
 #if SK_ENABLE_INST_COUNT
     gPrintInstCount = FLAGS_leaks;
 #endif
index e32249d..54e7df3 100644 (file)
@@ -5,6 +5,8 @@
 DEFINE_bool(cpu, true, "Master switch for running CPU-bound work.");
 DEFINE_bool(gpu, true, "Master switch for running GPU-bound work.");
 
+DECLARE_bool(dryRun);
+
 namespace DM {
 
 Task::Task(Reporter* reporter, TaskRunner* taskRunner)
@@ -51,7 +53,7 @@ CpuTask::CpuTask(const Task& parent) : Task(parent) {}
 void CpuTask::run() {
     if (FLAGS_cpu && !this->shouldSkip()) {
         this->start();
-        this->draw();
+        if (!FLAGS_dryRun) this->draw();
         this->finish();
     }
     SkDELETE(this);
@@ -69,7 +71,7 @@ GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, ta
 void GpuTask::run(GrContextFactory& factory) {
     if (FLAGS_gpu && !this->shouldSkip()) {
         this->start();
-        this->draw(&factory);
+        if (!FLAGS_dryRun) this->draw(&factory);
         this->finish();
     }
     SkDELETE(this);