Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Unified Diff: generate_test_report.py

Issue 3814009: Print out debug of test when it fails. (Closed) Base URL: http://git.chromium.org/git/crosutils.git
Patch Set: Nits Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: generate_test_report.py
diff --git a/generate_test_report.py b/generate_test_report.py
index f5d32dbbeae36b7c215dec7c1797f695db0c786e..3ad5e1755db0bfd3e613983ed85b1566da6eae0b 100755
--- a/generate_test_report.py
+++ b/generate_test_report.py
@@ -167,6 +167,8 @@ class ReportGenerator(object):
tests = self._results.keys()
tests.sort()
+ tests_with_errors = []
+
width = self.GetTestColumnWidth()
line = ''.ljust(width + 5, '-')
@@ -182,6 +184,8 @@ class ReportGenerator(object):
tests_pass += 1
else:
color = Color.RED
+ tests_with_errors.append(test)
+
status_entry = self._color.Color(color, status_entry)
print test_entry + status_entry
@@ -204,6 +208,23 @@ class ReportGenerator(object):
pass_str = '%d/%d (%d%%)' % (tests_pass, total_tests, percent_pass)
print 'Total PASS: ' + self._color.Color(Color.BOLD, pass_str)
+ # Print out the client debug information for failed tests.
+ if self._options.print_debug:
+ for test in tests_with_errors:
+ debug_file_regex = os.path.join(self._options.strip, test, 'debug',
+ 'client.*.DEBUG')
+ for path in glob.glob(debug_file_regex):
+ try:
+ fh = open(path)
+ print ('\n========== DEBUG FILE %s FOR TEST %s ==============\n' % (
+ path, test))
+ print fh.read()
+ print('\n=========== END DEBUG %s FOR TEST %s ===============\n' % (
+ path, test))
+ fh.close()
+ except:
+ print 'Could not open %s' % path
+
def Run(self):
"""Runs report generation."""
self._CollectResults()
@@ -232,6 +253,9 @@ def main():
' [default: \'%default\']')
parser.add_option('--no-strip', dest='strip', const='', action='store_const',
help='Don\'t strip a prefix from test directory names')
+ parser.add_option('--no-debug', dest='print_debug', action='store_false',
+ default=True,
+ help='Do not print out the debug log when a test fails.')
(options, args) = parser.parse_args()
if not args:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698