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

Side by Side Diff: generate_test_report.py

Issue 4007008: Robustify printing of test errors to stderr. (Closed) Base URL: http://git.chromium.org/git/crosutils.git
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 print 'Total PASS: ' + self._color.Color(Color.BOLD, pass_str) 209 print 'Total PASS: ' + self._color.Color(Color.BOLD, pass_str)
210 210
211 # Print out the client debug information for failed tests. 211 # Print out the client debug information for failed tests.
212 if self._options.print_debug: 212 if self._options.print_debug:
213 for test in tests_with_errors: 213 for test in tests_with_errors:
214 debug_file_regex = os.path.join(self._options.strip, test, 'debug', 214 debug_file_regex = os.path.join(self._options.strip, test, 'debug',
215 '%s*.DEBUG' % os.path.basename(test)) 215 '%s*.DEBUG' % os.path.basename(test))
216 for path in glob.glob(debug_file_regex): 216 for path in glob.glob(debug_file_regex):
217 try: 217 try:
218 fh = open(path) 218 fh = open(path)
219 print ('\n========== DEBUG FILE %s FOR TEST %s ==============\n' % ( 219 print >> sys.stderr, (
220 path, test)) 220 '\n========== DEBUG FILE %s FOR TEST %s ==============\n' % (
221 print fh.read() 221 path, test))
222 print('\n=========== END DEBUG %s FOR TEST %s ===============\n' % ( 222 out = fh.read()
223 path, test)) 223 while out:
224 print >> sys.stderr, out
225 out = fh.read()
226 print >> sys.stderr, (
227 '\n=========== END DEBUG %s FOR TEST %s ===============\n' % (
228 path, test))
224 fh.close() 229 fh.close()
225 except: 230 except:
226 print 'Could not open %s' % path 231 print 'Could not open %s' % path
227 232
228 def Run(self): 233 def Run(self):
229 """Runs report generation.""" 234 """Runs report generation."""
230 self._CollectResults() 235 self._CollectResults()
231 self._GenerateReportText() 236 self._GenerateReportText()
232 for v in self._results.itervalues(): 237 for v in self._results.itervalues():
233 if v['status'] != 'PASS': 238 if v['status'] != 'PASS':
(...skipping 27 matching lines...) Expand all
261 if not args: 266 if not args:
262 parser.print_help() 267 parser.print_help()
263 Die('no result directories provided') 268 Die('no result directories provided')
264 269
265 generator = ReportGenerator(options, args) 270 generator = ReportGenerator(options, args)
266 generator.Run() 271 generator.Run()
267 272
268 273
269 if __name__ == '__main__': 274 if __name__ == '__main__':
270 main() 275 main()
OLDNEW
« 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