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

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: Fix variable overlap. 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..c62381663b7b6b12cc613432ce0c6e80dff464db 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 .+)')
+ for match in regex.finditer(status_raw):
+ crashes.append(match.group(1).split('\t')[0])
petkov 2011/02/16 00:53:56 what does this do? group(1) is the whole string, r
DaleCurtis 2011/02/16 00:59:00 Autotest attaches the timetamp and a couple other
petkov 2011/02/16 01:01:17 Sorry, I still don't get what this does... Can you
DaleCurtis 2011/02/16 01:03:54 Line in status.log is this: "INFO desktopui_Chr
petkov 2011/02/16 01:06:03 Thanks. It seems "Received crash notification for
DaleCurtis 2011/02/16 01:18:49 Done.
+
+ 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_detected = False
tests_pass = 0
print line
for test in tests:
@@ -205,6 +212,9 @@ class ReportGenerator(object):
perf_value_entry = self._color.Color(Color.BOLD, perf[perf_key])
print perf_key_entry + perf_value_entry
+ if result['crashes']:
+ crashes_detected = True
+
print line
total_tests = len(tests)
@@ -212,6 +222,31 @@ 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 ''
petkov 2011/02/16 00:53:56 Isn't it better to interleave the crash results in
DaleCurtis 2011/02/16 00:59:00 I thought about this, but cmasone indicated he'd l
+ if crashes_detected:
+ num_crashes = 0
+ print self._color.Color(Color.RED, 'Crashes detected during testing:')
+ print line
+
+ # Ignore top-level entry, since it's just a combination of all the
+ # individual results.
+ for test in tests[1:]:
+ crashes = self._results[test]['crashes']
+ if not crashes:
+ continue
+ print test
+ for crash in crashes:
+ num_crashes += 1
+ print ' '*self._KEYVAL_INDENT + self._color.Color(Color.RED, crash)
+
+ print line
+ print 'Total crashes: ' + self._color.Color(Color.BOLD,
+ str(num_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 +278,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 +291,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 +307,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