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/tools/cpplint.py b/tools/cpplint.py
index 4f063d9..308dd8c 100755
--- a/tools/cpplint.py
+++ b/tools/cpplint.py
@@ -90,6 +90,7 @@
_USAGE = """
Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
[--counting=total|toplevel|detailed]
+ [--quiet]
<file> [file] ...
The style guidelines this tries to follow are those in
@@ -115,6 +116,9 @@
verbose=#
Specify a number 0-5 to restrict errors to certain verbosity levels.
+ quiet
+ Don't print anything if no errors are found.
+
filter=-x,+y,...
Specify a comma-separated list of category-filters to apply: only
error messages whose category names pass the filters will be printed.
@@ -558,6 +562,9 @@
self.filters = _DEFAULT_FILTERS[:]
self.counting = 'total' # In what way are we counting errors?
self.errors_by_category = {} # string to int dict storing error counts
+ # BEGIN android-added
+ self.quiet = False # global setting.
+ # END android-added
# output format:
# "emacs" - format that emacs can parse (default)
@@ -568,6 +575,14 @@
"""Sets the output format for errors."""
self.output_format = output_format
+ # BEGIN android-added
+ def SetQuiet(self, level):
+ """Sets the module's quiet setting, and returns the previous setting."""
+ last_quiet = self.quiet
+ self.quiet = level
+ return last_quiet
+ # END android-added
+
def SetVerboseLevel(self, level):
"""Sets the module's verbosity, and returns the previous setting."""
last_verbose_level = self.verbose_level
@@ -638,6 +653,17 @@
_cpplint_state.SetOutputFormat(output_format)
+# BEGIN android-added
+def _Quiet():
+ """Returns the module's quiet setting."""
+ return _cpplint_state.quiet
+
+
+def _SetQuiet(level):
+ """Sets the module's quiet status, and returns the previous setting."""
+ return _cpplint_state.SetQuiet(level)
+# END android-added
+
def _VerboseLevel():
"""Returns the module's verbosity setting."""
return _cpplint_state.verbose_level
@@ -3888,6 +3914,9 @@
"""
_SetVerboseLevel(vlevel)
+# BEGIN android-added
+ old_errors = _cpplint_state.error_count
+# END android-added
try:
# Support the UNIX convention of using "-" for stdin. Note that
@@ -3938,8 +3967,11 @@
'One or more unexpected \\r (^M) found;'
'better to use only a \\n')
- sys.stderr.write('Done processing %s\n' % filename)
-
+# BEGIN android-changed
+ # sys.stderr.write('Done processing %s\n' % filename)
+ if not _cpplint_state.quiet or old_errors != _cpplint_state.error_count:
+ sys.stderr.write('Done processing %s\n' % filename)
+# END android-changed
def PrintUsage(message):
"""Prints a brief usage string and exits, optionally with an error message.
@@ -3977,6 +4009,9 @@
try:
(opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose=',
'stdout', # TODO(enh): added --stdout
+ # BEGIN android-added
+ 'quiet',
+ # END android-added
'counting=',
'filter=',
'root='])
@@ -3987,6 +4022,9 @@
output_format = _OutputFormat()
output_stream = sys.stderr # TODO(enh): added --stdout
filters = ''
+ # BEGIN android-added
+ quiet = _Quiet()
+ # END android-added
counting_style = ''
for (opt, val) in opts:
@@ -3994,6 +4032,10 @@
PrintUsage(None)
elif opt == '--stdout': # TODO(enh): added --stdout
output_stream = sys.stdout # TODO(enh): added --stdout
+ # BEGIN android-added
+ elif opt == '--quiet':
+ quiet = True
+ # END android-added
elif opt == '--output':
if not val in ('emacs', 'vs7', 'eclipse'):
PrintUsage('The only allowed output formats are emacs, vs7 and eclipse.')
@@ -4019,6 +4061,9 @@
_SetVerboseLevel(verbosity)
_SetFilters(filters)
_SetCountingStyle(counting_style)
+ # BEGIN android-added
+ _SetQuiet(quiet)
+ # END android-added
sys.stderr = output_stream # TODO(enh): added --stdout
return filenames
@@ -4037,7 +4082,11 @@
_cpplint_state.ResetErrorCounts()
for filename in filenames:
ProcessFile(filename, _cpplint_state.verbose_level)
- _cpplint_state.PrintErrorCounts()
+ # BEGIN android-changed
+ # _cpplint_state.PrintErrorCounts()
+ if not _cpplint_state.quiet or _cpplint_state.error_count > 0:
+ _cpplint_state.PrintErrorCounts()
+ # END android-changed
sys.exit(_cpplint_state.error_count > 0)