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. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 for crashed_test in crashed_tests: | 245 for crashed_test in crashed_tests: |
246 print ' '*self._KEYVAL_INDENT + crashed_test | 246 print ' '*self._KEYVAL_INDENT + crashed_test |
247 | 247 |
248 print line | 248 print line |
249 print 'Total unique crashes: ' + self._color.Color(Color.BOLD, | 249 print 'Total unique crashes: ' + self._color.Color(Color.BOLD, |
250 str(len(crashes))) | 250 str(len(crashes))) |
251 else: | 251 else: |
252 print self._color.Color(Color.GREEN, | 252 print self._color.Color(Color.GREEN, |
253 'No crashes detected during testing.') | 253 'No crashes detected during testing.') |
254 | 254 |
255 # Print out the client debug information for failed tests. | 255 # Print out error log for failed tests. |
256 if self._options.print_debug: | 256 if self._options.print_debug: |
257 for test in tests_with_errors: | 257 for test in tests_with_errors: |
258 debug_file_regex = os.path.join(self._options.strip, test, 'debug', | 258 debug_file_regex = os.path.join(self._options.strip, test, 'debug', |
259 '%s*.DEBUG' % os.path.basename(test)) | 259 '%s*.ERROR' % os.path.basename(test)) |
260 for path in glob.glob(debug_file_regex): | 260 for path in glob.glob(debug_file_regex): |
261 try: | 261 try: |
262 fh = open(path) | 262 fh = open(path) |
263 print >> sys.stderr, ( | 263 print >> sys.stderr, ( |
264 '\n========== DEBUG FILE %s FOR TEST %s ==============\n' % ( | 264 '\n========== ERROR FILE %s FOR TEST %s ==============\n' % ( |
265 path, test)) | 265 path, test)) |
266 out = fh.read() | 266 out = fh.read() |
267 while out: | 267 while out: |
268 print >> sys.stderr, out | 268 print >> sys.stderr, out |
269 out = fh.read() | 269 out = fh.read() |
270 print >> sys.stderr, ( | 270 print >> sys.stderr, ( |
271 '\n=========== END DEBUG %s FOR TEST %s ===============\n' % ( | 271 '\n=========== END ERROR FILE %s FOR TEST %s ===========\n' % ( |
272 path, test)) | 272 path, test)) |
273 fh.close() | 273 fh.close() |
274 except: | 274 except: |
275 print 'Could not open %s' % path | 275 print 'Could not open %s' % path |
276 | 276 |
277 # Sometimes the builders exit before these buffers are flushed. | 277 # Sometimes the builders exit before these buffers are flushed. |
278 sys.stderr.flush() | 278 sys.stderr.flush() |
279 sys.stdout.flush() | 279 sys.stdout.flush() |
280 | 280 |
281 def Run(self): | 281 def Run(self): |
(...skipping 23 matching lines...) Expand all Loading... |
305 parser.add_option('--no-perf', dest='perf', action='store_false', | 305 parser.add_option('--no-perf', dest='perf', action='store_false', |
306 help='Don\'t include perf keyvals in the report') | 306 help='Don\'t include perf keyvals in the report') |
307 parser.add_option('--strip', dest='strip', type='string', action='store', | 307 parser.add_option('--strip', dest='strip', type='string', action='store', |
308 default='results.', | 308 default='results.', |
309 help='Strip a prefix from test directory names' | 309 help='Strip a prefix from test directory names' |
310 ' [default: \'%default\']') | 310 ' [default: \'%default\']') |
311 parser.add_option('--no-strip', dest='strip', const='', action='store_const', | 311 parser.add_option('--no-strip', dest='strip', const='', action='store_const', |
312 help='Don\'t strip a prefix from test directory names') | 312 help='Don\'t strip a prefix from test directory names') |
313 parser.add_option('--no-debug', dest='print_debug', action='store_false', | 313 parser.add_option('--no-debug', dest='print_debug', action='store_false', |
314 default=True, | 314 default=True, |
315 help='Don\'t print out the debug log when a test fails.') | 315 help='Don\'t print out logs when tests fail.') |
316 (options, args) = parser.parse_args() | 316 (options, args) = parser.parse_args() |
317 | 317 |
318 if not args: | 318 if not args: |
319 parser.print_help() | 319 parser.print_help() |
320 Die('no result directories provided') | 320 Die('no result directories provided') |
321 | 321 |
322 generator = ReportGenerator(options, args) | 322 generator = ReportGenerator(options, args) |
323 generator.Run() | 323 generator.Run() |
324 | 324 |
325 | 325 |
326 if __name__ == '__main__': | 326 if __name__ == '__main__': |
327 main() | 327 main() |
OLD | NEW |