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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 content = {'test_group': test_group, | 170 content = {'test_group': test_group, |
171 'ok': [t.name for t in self.ok], | 171 'ok': [t.name for t in self.ok], |
172 'failed': [t.name for t in self.failed], | 172 'failed': [t.name for t in self.failed], |
173 'crashed': [t.name for t in self.failed], | 173 'crashed': [t.name for t in self.failed], |
174 'unknown': [t.name for t in self.unknown],} | 174 'unknown': [t.name for t in self.unknown],} |
175 with open(os.path.join(log_file_path, 'results.json'), 'a') as json_file: | 175 with open(os.path.join(log_file_path, 'results.json'), 'a') as json_file: |
176 print >> json_file, json.dumps(content) | 176 print >> json_file, json.dumps(content) |
177 | 177 |
178 # Summarize in the test output. | 178 # Summarize in the test output. |
179 summary = ['Summary:\n'] | 179 summary = ['Summary:\n'] |
180 summary += ['TESTS_TO_RUN=%d\n' % (len(tests_to_run))] | 180 if tests_to_run: |
Isaac (away)
2012/11/07 19:32:37
I think we can remove these checks now that we are
nilesh
2012/11/07 19:35:27
Actual list of tests is not passed from run_instru
| |
181 summary += ['TESTS_TO_RUN=%d\n' % (len(tests_to_run))] | |
181 num_tests_ran = (len(self.ok) + len(self.failed) + | 182 num_tests_ran = (len(self.ok) + len(self.failed) + |
182 len(self.crashed) + len(self.unknown)) | 183 len(self.crashed) + len(self.unknown)) |
183 tests_passed = [t.name for t in self.ok] | 184 tests_passed = [t.name for t in self.ok] |
184 tests_failed = [t.name for t in self.failed] | 185 tests_failed = [t.name for t in self.failed] |
185 tests_crashed = [t.name for t in self.crashed] | 186 tests_crashed = [t.name for t in self.crashed] |
186 tests_unknown = [t.name for t in self.unknown] | 187 tests_unknown = [t.name for t in self.unknown] |
187 summary += ['RAN=%d\n' % (num_tests_ran), | 188 summary += ['RAN=%d\n' % (num_tests_ran), |
188 'PASSED=%d\n' % len(tests_passed), | 189 'PASSED=%d\n' % len(tests_passed), |
189 'FAILED=%d %s\n' % (len(tests_failed), tests_failed), | 190 'FAILED=%d %s\n' % (len(tests_failed), tests_failed), |
190 'CRASHED=%d %s\n' % (len(tests_crashed), tests_crashed), | 191 'CRASHED=%d %s\n' % (len(tests_crashed), tests_crashed), |
191 'UNKNOWN=%d %s\n' % (len(tests_unknown), tests_unknown)] | 192 'UNKNOWN=%d %s\n' % (len(tests_unknown), tests_unknown)] |
192 if num_tests_ran != len(tests_to_run): | 193 if tests_to_run and num_tests_ran != len(tests_to_run): |
193 # Add the list of tests we failed to run. | 194 # Add the list of tests we failed to run. |
194 tests_failed_to_run = list(set(tests_to_run) - set(tests_passed) - | 195 tests_failed_to_run = list(set(tests_to_run) - set(tests_passed) - |
195 set(tests_failed) - set(tests_crashed) - | 196 set(tests_failed) - set(tests_crashed) - |
196 set(tests_unknown)) | 197 set(tests_unknown)) |
197 summary += ['FAILED_TO_RUN=%d %s\n' % (len(tests_failed_to_run), | 198 summary += ['FAILED_TO_RUN=%d %s\n' % (len(tests_failed_to_run), |
198 tests_failed_to_run)] | 199 tests_failed_to_run)] |
199 summary_string = ''.join(summary) | 200 summary_string = ''.join(summary) |
200 logging.critical(summary_string) | 201 logging.critical(summary_string) |
201 return summary_string | 202 return summary_string |
202 | 203 |
203 def PrintAnnotation(self): | 204 def PrintAnnotation(self): |
204 """Print buildbot annotations for test results.""" | 205 """Print buildbot annotations for test results.""" |
205 if self.failed or self.crashed or self.overall_fail or self.timed_out: | 206 if self.failed or self.crashed or self.overall_fail or self.timed_out: |
206 buildbot_report.PrintError() | 207 buildbot_report.PrintError() |
207 else: | 208 else: |
208 print 'Step success!' # No annotation needed | 209 print 'Step success!' # No annotation needed |
OLD | NEW |