| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 | 6 |
| 7 """Parses and displays the contents of one or more autoserv result directories. | 7 """Parses and displays the contents of one or more autoserv result directories. |
| 8 | 8 |
| 9 This script parses the contents of one or more autoserv results folders and | 9 This script parses the contents of one or more autoserv results folders and |
| 10 generates test reports. | 10 generates test reports. |
| 11 """ | 11 """ |
| 12 | 12 |
| 13 | 13 |
| 14 import glob | 14 import glob |
| 15 import optparse | 15 import optparse |
| 16 import os | 16 import os |
| 17 import re | 17 import re |
| 18 import sys | 18 import sys |
| 19 | 19 |
| 20 sys.path.append(os.path.join(os.path.dirname(__file__), 'lib')) | 20 sys.path.append(os.path.join(os.path.dirname(__file__), 'lib')) |
| 21 from cros_build_lib import Color, Die | 21 from cros_build_lib import Color, Die |
| 22 | 22 |
| 23 _STDOUT_IS_TTY = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() | 23 _STDOUT_IS_TTY = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() |
| 24 | 24 |
| 25 # List of crashes which are okay to ignore. This list should almost always be |
| 26 # empty. If you add an entry, mark it with a TODO(<your name>) and the issue |
| 27 # filed for the crash. |
| 28 _CRASH_WHITELIST = { |
| 29 # TODO(dalecurtis): chromium-os:12212. Remove when resolved. |
| 30 'chromeos-wm': ['sig 6'] |
| 31 } |
| 25 | 32 |
| 26 class ReportGenerator(object): | 33 class ReportGenerator(object): |
| 27 """Collects and displays data from autoserv results directories. | 34 """Collects and displays data from autoserv results directories. |
| 28 | 35 |
| 29 This class collects status and performance data from one or more autoserv | 36 This class collects status and performance data from one or more autoserv |
| 30 result directories and generates test reports. | 37 result directories and generates test reports. |
| 31 """ | 38 """ |
| 32 | 39 |
| 33 _KEYVAL_INDENT = 2 | 40 _KEYVAL_INDENT = 2 |
| 34 | 41 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 status = 'PASS' | 116 status = 'PASS' |
| 110 | 117 |
| 111 perf = self._CollectPerf(testdir) | 118 perf = self._CollectPerf(testdir) |
| 112 | 119 |
| 113 if testdir.startswith(self._options.strip): | 120 if testdir.startswith(self._options.strip): |
| 114 testdir = testdir.replace(self._options.strip, '', 1) | 121 testdir = testdir.replace(self._options.strip, '', 1) |
| 115 | 122 |
| 116 crashes = [] | 123 crashes = [] |
| 117 regex = re.compile('Received crash notification for ([-\w]+).+ (sig \d+)') | 124 regex = re.compile('Received crash notification for ([-\w]+).+ (sig \d+)') |
| 118 for match in regex.finditer(status_raw): | 125 for match in regex.finditer(status_raw): |
| 126 if (match.group(1) in _CRASH_WHITELIST and |
| 127 match.group(2) in _CRASH_WHITELIST[match.group(1)]): |
| 128 continue |
| 119 crashes.append('%s %s' % match.groups()) | 129 crashes.append('%s %s' % match.groups()) |
| 120 | 130 |
| 121 self._results[testdir] = {'crashes': crashes, | 131 self._results[testdir] = {'crashes': crashes, |
| 122 'status': status, | 132 'status': status, |
| 123 'perf': perf} | 133 'perf': perf} |
| 124 | 134 |
| 125 def _CollectResultsRec(self, resdir): | 135 def _CollectResultsRec(self, resdir): |
| 126 """Recursively collect results into the self._results dictionary. | 136 """Recursively collect results into the self._results dictionary. |
| 127 | 137 |
| 128 Args: | 138 Args: |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 if not args: | 321 if not args: |
| 312 parser.print_help() | 322 parser.print_help() |
| 313 Die('no result directories provided') | 323 Die('no result directories provided') |
| 314 | 324 |
| 315 generator = ReportGenerator(options, args) | 325 generator = ReportGenerator(options, args) |
| 316 generator.Run() | 326 generator.Run() |
| 317 | 327 |
| 318 | 328 |
| 319 if __name__ == '__main__': | 329 if __name__ == '__main__': |
| 320 main() | 330 main() |
| OLD | NEW |