| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 logging | 6 import logging |
| 7 | 7 |
| 8 | 8 |
| 9 # Language values match constants in Sponge protocol buffer (sponge.proto). | 9 # Language values match constants in Sponge protocol buffer (sponge.proto). |
| 10 JAVA = 5 | 10 JAVA = 5 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 """Results of a test run.""" | 51 """Results of a test run.""" |
| 52 | 52 |
| 53 def __init__(self): | 53 def __init__(self): |
| 54 self.ok = [] | 54 self.ok = [] |
| 55 self.failed = [] | 55 self.failed = [] |
| 56 self.crashed = [] | 56 self.crashed = [] |
| 57 self.unknown = [] | 57 self.unknown = [] |
| 58 self.disabled = [] | 58 self.disabled = [] |
| 59 self.unexpected_pass = [] | 59 self.unexpected_pass = [] |
| 60 self.timed_out = False | 60 self.timed_out = False |
| 61 self.overall_fail = False |
| 61 | 62 |
| 62 @staticmethod | 63 @staticmethod |
| 63 def FromOkAndFailed(ok, failed, timed_out=False): | 64 def FromOkAndFailed(ok, failed, timed_out, overall_fail): |
| 64 ret = TestResults() | 65 ret = TestResults() |
| 65 ret.ok = ok | 66 ret.ok = ok |
| 66 ret.failed = failed | 67 ret.failed = failed |
| 67 ret.timed_out = timed_out | 68 ret.timed_out = timed_out |
| 69 ret.overall_fail = overall_fail |
| 68 return ret | 70 return ret |
| 69 | 71 |
| 70 @staticmethod | 72 @staticmethod |
| 71 def FromTestResults(results): | 73 def FromTestResults(results): |
| 72 """Combines a list of results in a single TestResults object.""" | 74 """Combines a list of results in a single TestResults object.""" |
| 73 ret = TestResults() | 75 ret = TestResults() |
| 74 for t in results: | 76 for t in results: |
| 75 ret.ok += t.ok | 77 ret.ok += t.ok |
| 76 ret.failed += t.failed | 78 ret.failed += t.failed |
| 77 ret.crashed += t.crashed | 79 ret.crashed += t.crashed |
| 78 ret.unknown += t.unknown | 80 ret.unknown += t.unknown |
| 79 ret.disabled += t.disabled | 81 ret.disabled += t.disabled |
| 80 ret.unexpected_pass += t.unexpected_pass | 82 ret.unexpected_pass += t.unexpected_pass |
| 81 if t.timed_out: | 83 if t.timed_out: |
| 82 ret.timed_out = True | 84 ret.timed_out = True |
| 85 if t.overall_fail: |
| 86 ret.overall_fail = True |
| 83 return ret | 87 return ret |
| 84 | 88 |
| 85 def _Log(self, sorted_list): | 89 def _Log(self, sorted_list): |
| 86 for t in sorted_list: | 90 for t in sorted_list: |
| 87 logging.critical(t.name) | 91 logging.critical(t.name) |
| 88 if t.log: | 92 if t.log: |
| 89 logging.critical(t.log) | 93 logging.critical(t.log) |
| 90 | 94 |
| 91 def GetAllBroken(self): | 95 def GetAllBroken(self): |
| 92 """Returns the all broken tests including failed, crashed, unknown.""" | 96 """Returns the all broken tests including failed, crashed, unknown.""" |
| 93 return self.failed + self.crashed + self.unknown | 97 return self.failed + self.crashed + self.unknown |
| 94 | 98 |
| 95 def LogFull(self): | 99 def LogFull(self): |
| 96 """Output all broken tests or 'passed' if none broken""" | 100 """Output all broken tests or 'passed' if none broken""" |
| 97 logging.critical('*' * 80) | 101 logging.critical('*' * 80) |
| 98 logging.critical('Final result') | 102 logging.critical('Final result') |
| 99 if self.failed: | 103 if self.failed: |
| 100 logging.critical('Failed:') | 104 logging.critical('Failed:') |
| 101 self._Log(sorted(self.failed)) | 105 self._Log(sorted(self.failed)) |
| 102 if self.crashed: | 106 if self.crashed: |
| 103 logging.critical('Crashed:') | 107 logging.critical('Crashed:') |
| 104 self._Log(sorted(self.crashed)) | 108 self._Log(sorted(self.crashed)) |
| 105 if self.unknown: | 109 if self.unknown: |
| 106 logging.critical('Unknown:') | 110 logging.critical('Unknown:') |
| 107 self._Log(sorted(self.unknown)) | 111 self._Log(sorted(self.unknown)) |
| 108 if not self.GetAllBroken(): | 112 if not self.GetAllBroken(): |
| 109 logging.critical('Passed') | 113 logging.critical('Passed') |
| 110 logging.critical('*' * 80) | 114 logging.critical('*' * 80) |
| OLD | NEW |