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 |
11 from pylib import buildbot_report | 11 from pylib import buildbot_report |
12 from pylib import constants | 12 from pylib import constants |
13 | 13 |
14 import flakiness_dashboard_results_uploader | 14 import flakiness_dashboard_results_uploader |
15 | 15 |
16 | 16 |
17 def _LogToFile(results, test_type, test_suite, build_type): | 17 def _LogToFile(results, test_type, test_suite, build_type): |
18 """Log results to local files which can be used for aggregation later.""" | 18 """Log results to local files which can be used for aggregation later.""" |
19 log_file_path = os.path.join(constants.CHROME_DIR, 'out', | 19 log_file_path = os.path.join(constants.DIR_SOURCE_ROOT, 'out', |
20 build_type, 'test_logs') | 20 build_type, 'test_logs') |
21 if not os.path.exists(log_file_path): | 21 if not os.path.exists(log_file_path): |
22 os.mkdir(log_file_path) | 22 os.mkdir(log_file_path) |
23 full_file_name = os.path.join( | 23 full_file_name = os.path.join( |
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')) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 _LogToFlakinessDashboard(results, test_type, test_package, | 111 _LogToFlakinessDashboard(results, test_type, test_package, |
112 flakiness_server) | 112 flakiness_server) |
113 | 113 |
114 | 114 |
115 def PrintAnnotation(results): | 115 def PrintAnnotation(results): |
116 """Print buildbot annotations for test results.""" | 116 """Print buildbot annotations for test results.""" |
117 if not results.DidRunPass(): | 117 if not results.DidRunPass(): |
118 buildbot_report.PrintError() | 118 buildbot_report.PrintError() |
119 else: | 119 else: |
120 print 'Step success!' # No annotation needed | 120 print 'Step success!' # No annotation needed |
OLD | NEW |