GM: remove enableMissingWarning in favor of verbose flag, and trim output in nonverbose mode
Review URL: https://codereview.chromium.org/14080003

git-svn-id: http://skia.googlecode.com/svn/trunk@8600 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gm_expectations.h b/gm/gm_expectations.h
index 2efdd4b..3d3f2b5 100644
--- a/gm/gm_expectations.h
+++ b/gm/gm_expectations.h
@@ -225,12 +225,8 @@
          *
          * rootDir: directory under which to look for image files
          *          (this string will be copied to storage within this object)
-         * notifyOfMissingFiles: whether to log a message to stderr if an image
-         *                       file cannot be found
          */
-        IndividualImageExpectationsSource(const char *rootDir,
-                                          bool notifyOfMissingFiles) :
-            fRootDir(rootDir), fNotifyOfMissingFiles(notifyOfMissingFiles) {}
+        IndividualImageExpectationsSource(const char *rootDir) : fRootDir(rootDir) {}
 
         Expectations get(const char *testName) SK_OVERRIDE {
             SkString path = make_filename(fRootDir.c_str(), "", testName,
@@ -244,16 +240,12 @@
             if (decodedReferenceBitmap) {
                 return Expectations(referenceBitmap);
             } else {
-                if (fNotifyOfMissingFiles) {
-                    gm_fprintf(stderr, "FAILED to read %s\n", path.c_str());
-                }
                 return Expectations();
             }
         }
 
     private:
         const SkString fRootDir;
-        const bool fNotifyOfMissingFiles;
     };
 
     /**
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 8cb74be..bc11d4a 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1191,8 +1191,6 @@
 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath").
 DEFINE_string(config, "", configUsage().c_str());
 DEFINE_bool(deferred, true, "Exercise the deferred rendering test pass.");
-DEFINE_bool(enableMissingWarning, true, "Print message to stderr (but don't fail) if "
-            "unable to read a reference image for any tests.");
 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip.");
 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing.");
 #if SK_SUPPORT_GPU
@@ -1222,7 +1220,8 @@
 DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale "
               "factors to be used for tileGrid playback testing. Default value: 1.0");
 DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary to this file.");
-DEFINE_bool2(verbose, v, false, "Print diagnostics (e.g. list each config to be tested).");
+DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more info about "
+             "each test).");
 DEFINE_string2(writePath, w, "",  "Write rendered images into this directory.");
 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.");
 
@@ -1687,14 +1686,14 @@
         if (kGPU_Backend == gRec[index].fBackend) {
             GrContext* ctx = grFactory->get(gRec[index].fGLContextType);
             if (NULL == ctx) {
-                SkDebugf("GrContext could not be created for config %s. Config will be skipped.",
-                         gRec[index].fName);
+                gm_fprintf(stderr, "GrContext could not be created for config %s."
+                           " Config will be skipped.\n", gRec[index].fName);
                 configs.remove(i);
                 --i;
             }
             if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) {
-                SkDebugf("Sample count (%d) of config %s is not supported. Config will be skipped.",
-                         gRec[index].fSampleCnt, gRec[index].fName);
+                gm_fprintf(stderr, "Sample count (%d) of config %s is not supported."
+                           " Config will be skipped.\n", gRec[index].fSampleCnt, gRec[index].fName);
                 configs.remove(i);
                 --i;
             }
@@ -1715,24 +1714,29 @@
             return -1;
         }
         if (sk_isdir(readPath)) {
-            gm_fprintf(stdout, "reading from %s\n", readPath);
+            if (FLAGS_verbose) {
+                gm_fprintf(stdout, "reading from %s\n", readPath);
+            }
             gmmain.fExpectationsSource.reset(SkNEW_ARGS(
-                IndividualImageExpectationsSource,
-                (readPath, FLAGS_enableMissingWarning)));
+                IndividualImageExpectationsSource, (readPath)));
         } else {
-            gm_fprintf(stdout, "reading expectations from JSON summary file %s\n", readPath);
+            if (FLAGS_verbose) {
+                gm_fprintf(stdout, "reading expectations from JSON summary file %s\n", readPath);
+            }
             gmmain.fExpectationsSource.reset(SkNEW_ARGS(
                 JsonExpectationsSource, (readPath)));
         }
     }
-    if (FLAGS_writePath.count() == 1) {
-        gm_fprintf(stderr, "writing to %s\n", FLAGS_writePath[0]);
-    }
-    if (FLAGS_writePicturePath.count() == 1) {
-        gm_fprintf(stderr, "writing pictures to %s\n", FLAGS_writePicturePath[0]);
-    }
-    if (FLAGS_resourcePath.count() == 1) {
-        gm_fprintf(stderr, "reading resources from %s\n", FLAGS_resourcePath[0]);
+    if (FLAGS_verbose) {
+        if (FLAGS_writePath.count() == 1) {
+            gm_fprintf(stdout, "writing to %s\n", FLAGS_writePath[0]);
+        }
+        if (FLAGS_writePicturePath.count() == 1) {
+            gm_fprintf(stdout, "writing pictures to %s\n", FLAGS_writePicturePath[0]);
+        }
+        if (FLAGS_resourcePath.count() == 1) {
+            gm_fprintf(stdout, "reading resources from %s\n", FLAGS_resourcePath[0]);
+        }
     }
 
     if (moduloDivisor <= 0) {
@@ -1784,8 +1788,10 @@
 
         gmsRun++;
         SkISize size = gm->getISize();
-        gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName,
-                   size.width(), size.height());
+        if (FLAGS_verbose) {
+            gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName,
+                       size.width(), size.height());
+        }
 
         run_multiple_configs(gmmain, gm, configs, grFactory);
 
@@ -1852,7 +1858,7 @@
     for (int i = 0; i < configs.count(); i++) {
         ConfigData config = gRec[configs[i]];
 
-        if (kGPU_Backend == config.fBackend) {
+        if (FLAGS_verbose && (kGPU_Backend == config.fBackend)) {
             GrContext* gr = grFactory->get(config.fGLContextType);
 
             gm_fprintf(stdout, "config: %s %x\n", config.fName, gr);
diff --git a/gm/tests/outputs/compared-against-empty-dir/output-expected/stderr b/gm/tests/outputs/compared-against-empty-dir/output-expected/stderr
index 2e951cf..e69de29 100644
--- a/gm/tests/outputs/compared-against-empty-dir/output-expected/stderr
+++ b/gm/tests/outputs/compared-against-empty-dir/output-expected/stderr
@@ -1,2 +0,0 @@
-GM: FAILED to read gm/tests/inputs/images/empty-dir/8888/selftest1.png
-GM: FAILED to read gm/tests/inputs/images/empty-dir/565/selftest1.png
diff --git a/gm/tests/outputs/nonverbose/output-expected/stderr b/gm/tests/outputs/nonverbose/output-expected/stderr
index 2e951cf..e69de29 100644
--- a/gm/tests/outputs/nonverbose/output-expected/stderr
+++ b/gm/tests/outputs/nonverbose/output-expected/stderr
@@ -1,2 +0,0 @@
-GM: FAILED to read gm/tests/inputs/images/empty-dir/8888/selftest1.png
-GM: FAILED to read gm/tests/inputs/images/empty-dir/565/selftest1.png
diff --git a/gm/tests/outputs/nonverbose/output-expected/stdout b/gm/tests/outputs/nonverbose/output-expected/stdout
index 6139fdb..e666a0b 100644
--- a/gm/tests/outputs/nonverbose/output-expected/stdout
+++ b/gm/tests/outputs/nonverbose/output-expected/stdout
@@ -1,5 +1,3 @@
-GM: reading from gm/tests/inputs/images/empty-dir
-GM: drawing... selftest1 [300 200]
 GM: Ran 9 tests: NoGpuContext=0 IntentionallySkipped=0 RenderModeMismatch=0 ExpectationsMismatch=0 MissingExpectations=2 WritingReferenceImage=0
 GM: [*] 0 NoGpuContext:
 GM: [ ] 0 IntentionallySkipped