Make things generally quieter.

* Give run-test a --quiet flag that causes it to only print on errors.
* Give cpplint a --quiet flag that causes it to not print anything
  when there are no errors.
* Add a ART_TEST_QUIET flag to build/Android.common_test.mk which
  makes run-test targets much quieter when true (the default). With
  this flag only failures will be printed.
* Make build/Android.cpplint.mk pass the new cpplint --quiet flag so
  that only failures will be printed.

Before:
    [ 96% 5715/5906] build test-art-host-run-test-debug-prebuild-interpreter-relocate-ntrace-cms-checkjni-image-npictest-ndebuggable-461-get-reference-vreg32
    test-art-host-run-test-debug-prebuild-interpreter-relocate-ntrace-cms-checkjni-image-npictest-ndebuggable-448-multiple-returns32 RUNNING
    /usr/local/google/buildbot/src/googleplex-android/master-art-host/art/test/448-multiple-returns: building...
    /usr/local/google/buildbot/src/googleplex-android/master-art-host/art/test/448-multiple-returns: running...
    /usr/local/google/buildbot/src/googleplex-android/master-art-host/art/test/448-multiple-returns: succeeded!
    test-art-host-run-test-debug-prebuild-interpreter-relocate-ntrace-cms-checkjni-image-npictest-ndebuggable-448-multiple-returns32 PASSED

After:
    [ 96% 5715/5906] build test-art-host-run-test-debug-prebuild-interpreter-relocate-ntrace-cms-checkjni-image-npictest-ndebuggable-461-get-reference-vreg32

Change-Id: Idf6fce7f48a619f83254b48861dbd7f8eb4ebdbf
diff --git a/build/Android.common_test.mk b/build/Android.common_test.mk
index 2f43f5f..420db43 100644
--- a/build/Android.common_test.mk
+++ b/build/Android.common_test.mk
@@ -40,6 +40,9 @@
 # Do you want all tests, even those that are time consuming?
 ART_TEST_FULL ?= false
 
+# Do you want run-test to be quieter? run-tests will only show output if they fail.
+ART_TEST_QUIET ?= true
+
 # Do you want default compiler tests run?
 ART_TEST_DEFAULT_COMPILER ?= true
 
@@ -116,12 +119,25 @@
         || (echo -e "$(1) \e[91mFAILED\e[0m" >&2 )))
 endef
 
+ifeq ($(ART_TEST_QUIET),true)
+  ART_TEST_ANNOUNCE_PASS := ( true )
+  ART_TEST_ANNOUNCE_RUN := ( true )
+  ART_TEST_ANNOUNCE_SKIP_FAILURE := ( true )
+  ART_TEST_ANNOUNCE_SKIP_BROKEN := ( true )
+else
+  # Note the use of '=' and not ':=' is intentional since these are actually functions.
+  ART_TEST_ANNOUNCE_PASS = ( echo -e "$(1) \e[92mPASSED\e[0m" )
+  ART_TEST_ANNOUNCE_RUN = ( echo -e "$(1) \e[95mRUNNING\e[0m")
+  ART_TEST_ANNOUNCE_SKIP_FAILURE = ( echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m" )
+  ART_TEST_ANNOUNCE_SKIP_BROKEN = ( echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m" )
+endif
+
 # Define the command run on test success. $(1) is the name of the test. Executed by the shell.
 # The command checks prints "PASSED" then checks to see if this was a top-level make target (e.g.
 # "mm test-art-host-oat-HelloWorld32"), if it was then it does nothing, otherwise it creates a file
 # to be printed in the passing test summary.
 define ART_TEST_PASSED
-  ( echo -e "$(1) \e[92mPASSED\e[0m" && \
+  ( $(call ART_TEST_ANNOUNCE_PASS,$(1)) && \
     (echo $(MAKECMDGOALS) | grep -q $(1) || \
       (mkdir -p $(ART_HOST_TEST_DIR)/passed/ && touch $(ART_HOST_TEST_DIR)/passed/$(1))))
 endef
@@ -150,11 +166,11 @@
 define ART_TEST_SKIP
   ((echo $(ART_TEST_KNOWN_BROKEN) | grep -q -v $(1) \
      && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] || [ $(ART_TEST_KEEP_GOING) = true ])\
-     && echo -e "$(1) \e[95mRUNNING\e[0m") \
+     && $(call ART_TEST_ANNOUNCE_RUN,$(1)) ) \
    || ((mkdir -p $(ART_HOST_TEST_DIR)/skipped/ && touch $(ART_HOST_TEST_DIR)/skipped/$(1) \
      && ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
-       && echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m") \
-     || echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m") && false))
+       && $(call ART_TEST_ANNOUNCE_SKIP_FAILURE,$(1)) ) \
+     || $(call ART_TEST_ANNOUNCE_SKIP_BROKEN,$(1)) ) && false))
 endef
 
 # Create a build rule to create the dex file for a test.