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

Unified Diff: generate_test_report.py

Issue 6526031: Add crash detection to test report generation. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Code review fixes. Sorted crashes. Created 9 years, 10 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 d84e6159c141824a8207715e5e30b8402bfba6bc..33ec0a6ead47abea8982e9045b1dd0d7d9d3a1af 100755
--- a/generate_test_report.py
+++ b/generate_test_report.py
@@ -113,7 +113,13 @@ class ReportGenerator(object):
if testdir.startswith(self._options.strip):
testdir = testdir.replace(self._options.strip, '', 1)
- self._results[testdir] = {'status': status,
+ crashes = []
+ regex = re.compile('Received crash notification for ([-\w]+).+ (sig \d+)')
+ for match in regex.finditer(status_raw):
+ crashes.append('%s %s' % match.groups())
+
+ self._results[testdir] = {'crashes': crashes,
+ 'status': status,
'perf': perf}
def _CollectResultsRec(self, resdir):
@@ -176,6 +182,7 @@ class ReportGenerator(object):
width = self.GetTestColumnWidth()
line = ''.ljust(width + 5, '-')
+ crashes = {}
tests_pass = 0
print line
for test in tests:
@@ -205,6 +212,14 @@ class ReportGenerator(object):
perf_value_entry = self._color.Color(Color.BOLD, perf[perf_key])
print perf_key_entry + perf_value_entry
+ # Ignore top-level entry, since it's just a combination of all the
+ # individual results.
+ if result['crashes'] and test != tests[0]:
+ for crash in result['crashes']:
+ if not crash in crashes:
+ crashes[crash] = set([])
+ crashes[crash].add(test)
+
print line
total_tests = len(tests)
@@ -212,6 +227,24 @@ class ReportGenerator(object):
pass_str = '%d/%d (%d%%)' % (tests_pass, total_tests, percent_pass)
print 'Total PASS: ' + self._color.Color(Color.BOLD, pass_str)
+ if self._options.crash_detection:
+ print ''
+ if crashes:
+ print self._color.Color(Color.RED, 'Crashes detected during testing:')
+ print line
+
+ for crash_name, crashed_tests in sorted(crashes.iteritems()):
+ print self._color.Color(Color.RED, crash_name)
+ for crashed_test in crashed_tests:
+ print ' '*self._KEYVAL_INDENT + crashed_test
+
+ print line
+ print 'Total unique crashes: ' + self._color.Color(Color.BOLD,
+ str(len(crashes)))
+ else:
+ print self._color.Color(Color.GREEN,
+ 'No crashes detected during testing.')
+
# Print out the client debug information for failed tests.
if self._options.print_debug:
for test in tests_with_errors:
@@ -243,7 +276,8 @@ class ReportGenerator(object):
self._CollectResults()
self._GenerateReportText()
for v in self._results.itervalues():
- if v['status'] != 'PASS':
+ if v['status'] != 'PASS' or (self._options.crash_detection
+ and v['crashes']):
sys.exit(1)
@@ -255,6 +289,9 @@ def main():
help='Use color for text reports [default if TTY stdout]')
parser.add_option('--no-color', dest='color', action='store_false',
help='Don\'t use color for text reports')
+ parser.add_option('--no-crash-detection', dest='crash_detection',
+ action='store_false', default=True,
+ help='Don\'t report crashes or error out when detected')
parser.add_option('--perf', dest='perf', action='store_true',
default=True,
help='Include perf keyvals in the report [default]')
@@ -268,7 +305,7 @@ def main():
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.')
+ help='Don\'t 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