| OLD | NEW | 
|---|
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be | 
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. | 
| 4 | 4 | 
| 5 """Module containing utility functions for reporting results.""" | 5 """Module containing utility functions for reporting results.""" | 
| 6 | 6 | 
| 7 import logging | 7 import logging | 
| 8 import os | 8 import os | 
| 9 import re | 9 import re | 
| 10 | 10 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 24       log_file_path, re.sub('\W', '_', test_type).lower() + '.log') | 24       log_file_path, re.sub('\W', '_', test_type).lower() + '.log') | 
| 25   if not os.path.exists(full_file_name): | 25   if not os.path.exists(full_file_name): | 
| 26     with open(full_file_name, 'w') as log_file: | 26     with open(full_file_name, 'w') as log_file: | 
| 27       print >> log_file, '\n%s results for %s build %s:' % ( | 27       print >> log_file, '\n%s results for %s build %s:' % ( | 
| 28           test_type, os.environ.get('BUILDBOT_BUILDERNAME'), | 28           test_type, os.environ.get('BUILDBOT_BUILDERNAME'), | 
| 29           os.environ.get('BUILDBOT_BUILDNUMBER')) | 29           os.environ.get('BUILDBOT_BUILDNUMBER')) | 
| 30     logging.info('Writing results to %s.' % full_file_name) | 30     logging.info('Writing results to %s.' % full_file_name) | 
| 31 | 31 | 
| 32   logging.info('Writing results to %s.' % full_file_name) | 32   logging.info('Writing results to %s.' % full_file_name) | 
| 33   with open(full_file_name, 'a') as log_file: | 33   with open(full_file_name, 'a') as log_file: | 
| 34     print >> log_file, '%s%s' % (test_suite.ljust(30), results.GetShortForm()) | 34     shortened_suite_name = test_suite[:25] + (test_suite[25:] and '...') | 
|  | 35     print >> log_file, '%s%s' % (shortened_suite_name.ljust(30), | 
|  | 36                                  results.GetShortForm()) | 
| 35 | 37 | 
| 36 | 38 | 
| 37 def _LogToFlakinessDashboard(results, test_type, test_package, | 39 def _LogToFlakinessDashboard(results, test_type, test_package, | 
| 38                              flakiness_server): | 40                              flakiness_server): | 
| 39   """Upload results to the flakiness dashboard""" | 41   """Upload results to the flakiness dashboard""" | 
| 40   logging.info('Upload results for test type "%s", test package "%s" to %s' % | 42   logging.info('Upload results for test type "%s", test package "%s" to %s' % | 
| 41                (test_type, test_package, flakiness_server)) | 43                (test_type, test_package, flakiness_server)) | 
| 42 | 44 | 
| 43   # TODO(frankf): Enable uploading for gtests. | 45   # TODO(frankf): Enable uploading for gtests. | 
| 44   if test_type != 'Instrumentation': | 46   if test_type != 'Instrumentation': | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 105       _LogToFlakinessDashboard(results, test_type, test_package, | 107       _LogToFlakinessDashboard(results, test_type, test_package, | 
| 106                                flakiness_server) | 108                                flakiness_server) | 
| 107 | 109 | 
| 108 | 110 | 
| 109 def PrintAnnotation(results): | 111 def PrintAnnotation(results): | 
| 110   """Print buildbot annotations for test results.""" | 112   """Print buildbot annotations for test results.""" | 
| 111   if not results.DidRunPass(): | 113   if not results.DidRunPass(): | 
| 112     buildbot_report.PrintError() | 114     buildbot_report.PrintError() | 
| 113   else: | 115   else: | 
| 114     print 'Step success!'  # No annotation needed | 116     print 'Step success!'  # No annotation needed | 
| OLD | NEW | 
|---|