| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 | 5 |
| 6 import json | 6 import json |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import time | 9 import time |
| 10 import traceback | 10 import traceback |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 def _Log(self, sorted_list): | 123 def _Log(self, sorted_list): |
| 124 for t in sorted_list: | 124 for t in sorted_list: |
| 125 logging.critical(t.name) | 125 logging.critical(t.name) |
| 126 if t.log: | 126 if t.log: |
| 127 logging.critical(t.log) | 127 logging.critical(t.log) |
| 128 | 128 |
| 129 def GetAllBroken(self): | 129 def GetAllBroken(self): |
| 130 """Returns the all broken tests including failed, crashed, unknown.""" | 130 """Returns the all broken tests including failed, crashed, unknown.""" |
| 131 return self.failed + self.crashed + self.unknown | 131 return self.failed + self.crashed + self.unknown |
| 132 | 132 |
| 133 def LogFull(self, test_group, test_suite): | 133 def LogFull(self, test_group, test_suite, build_type): |
| 134 """Output broken test logs, summarize in a log file and the test output.""" | 134 """Output broken test logs, summarize in a log file and the test output.""" |
| 135 # Output all broken tests or 'passed' if none broken. | 135 # Output all broken tests or 'passed' if none broken. |
| 136 logging.critical('*' * 80) | 136 logging.critical('*' * 80) |
| 137 logging.critical('Final result') | 137 logging.critical('Final result') |
| 138 if self.failed: | 138 if self.failed: |
| 139 logging.critical('Failed:') | 139 logging.critical('Failed:') |
| 140 self._Log(sorted(self.failed)) | 140 self._Log(sorted(self.failed)) |
| 141 if self.crashed: | 141 if self.crashed: |
| 142 logging.critical('Crashed:') | 142 logging.critical('Crashed:') |
| 143 self._Log(sorted(self.crashed)) | 143 self._Log(sorted(self.crashed)) |
| 144 if self.unknown: | 144 if self.unknown: |
| 145 logging.critical('Unknown:') | 145 logging.critical('Unknown:') |
| 146 self._Log(sorted(self.unknown)) | 146 self._Log(sorted(self.unknown)) |
| 147 if not self.GetAllBroken(): | 147 if not self.GetAllBroken(): |
| 148 logging.critical('Passed') | 148 logging.critical('Passed') |
| 149 logging.critical('*' * 80) | 149 logging.critical('*' * 80) |
| 150 | 150 |
| 151 # Summarize in a log file, if tests are running on bots. | 151 # Summarize in a log file, if tests are running on bots. |
| 152 if test_group and test_suite and os.environ.get('BUILDBOT_BUILDERNAME'): | 152 if test_group and test_suite and os.environ.get('BUILDBOT_BUILDERNAME'): |
| 153 log_file_path = os.path.join(constants.CHROME_DIR, 'out', | 153 log_file_path = os.path.join(constants.CHROME_DIR, 'out', |
| 154 'Release', 'test_logs') | 154 build_type, 'test_logs') |
| 155 if not os.path.exists(log_file_path): | 155 if not os.path.exists(log_file_path): |
| 156 os.mkdir(log_file_path) | 156 os.mkdir(log_file_path) |
| 157 full_file_name = os.path.join(log_file_path, test_group) | 157 full_file_name = os.path.join(log_file_path, test_group) |
| 158 if not os.path.exists(full_file_name): | 158 if not os.path.exists(full_file_name): |
| 159 with open(full_file_name, 'w') as log_file: | 159 with open(full_file_name, 'w') as log_file: |
| 160 print >> log_file, '\n%s results for %s build %s:' % ( | 160 print >> log_file, '\n%s results for %s build %s:' % ( |
| 161 test_group, os.environ.get('BUILDBOT_BUILDERNAME'), | 161 test_group, os.environ.get('BUILDBOT_BUILDERNAME'), |
| 162 os.environ.get('BUILDBOT_BUILDNUMBER')) | 162 os.environ.get('BUILDBOT_BUILDNUMBER')) |
| 163 log_contents = [' %s result : %d tests ran' % (test_suite, | 163 log_contents = [' %s result : %d tests ran' % (test_suite, |
| 164 len(self.ok) + | 164 len(self.ok) + |
| (...skipping 21 matching lines...) Expand all Loading... |
| 186 len(self.crashed) + len(self.unknown)) | 186 len(self.crashed) + len(self.unknown)) |
| 187 summary_string += 'PASSED=%d\n' % (len(self.ok)) | 187 summary_string += 'PASSED=%d\n' % (len(self.ok)) |
| 188 summary_string += 'FAILED=%d %s\n' % (len(self.failed), | 188 summary_string += 'FAILED=%d %s\n' % (len(self.failed), |
| 189 [t.name for t in self.failed]) | 189 [t.name for t in self.failed]) |
| 190 summary_string += 'CRASHED=%d %s\n' % (len(self.crashed), | 190 summary_string += 'CRASHED=%d %s\n' % (len(self.crashed), |
| 191 [t.name for t in self.crashed]) | 191 [t.name for t in self.crashed]) |
| 192 summary_string += 'UNKNOWN=%d %s\n' % (len(self.unknown), | 192 summary_string += 'UNKNOWN=%d %s\n' % (len(self.unknown), |
| 193 [t.name for t in self.unknown]) | 193 [t.name for t in self.unknown]) |
| 194 logging.critical(summary_string) | 194 logging.critical(summary_string) |
| 195 return summary_string | 195 return summary_string |
| OLD | NEW |