add --dryRun flag to dm
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
diff --git a/dm/DM.cpp b/dm/DM.cpp
index f71a614..9ddba24 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -51,6 +51,7 @@
"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(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) {
SkAutoGraphics ag;
SkCommandLineFlags::Parse(argc, argv);
+
+ if (FLAGS_dryRun) {
+ FLAGS_verbose = true;
+ }
#if SK_ENABLE_INST_COUNT
gPrintInstCount = FLAGS_leaks;
#endif
diff --git a/dm/DMTask.cpp b/dm/DMTask.cpp
index e32249d..54e7df3 100644
--- a/dm/DMTask.cpp
+++ b/dm/DMTask.cpp
@@ -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 @@
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 @@
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);