OLD | NEW |
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 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 """A helper class for comparing the failures and crashes from a test run | 5 """A helper class for comparing the failures and crashes from a test run |
6 against what we expected to happen (as specified in test_expectations.txt).""" | 6 against what we expected to happen (as specified in test_expectations.txt).""" |
7 | 7 |
8 import errno | 8 import errno |
9 import os | 9 import os |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 "Expected to timeout (ignored), but passed", | 89 "Expected to timeout (ignored), but passed", |
90 output) | 90 output) |
91 # Crashes should never be deferred. | 91 # Crashes should never be deferred. |
92 PrintFilesFromSet(passes & self._expectations.GetDeferredFailures(), | 92 PrintFilesFromSet(passes & self._expectations.GetDeferredFailures(), |
93 "Expected to fail (deferred), but passed", | 93 "Expected to fail (deferred), but passed", |
94 output) | 94 output) |
95 PrintFilesFromSet(passes & self._expectations.GetDeferredTimeouts(), | 95 PrintFilesFromSet(passes & self._expectations.GetDeferredTimeouts(), |
96 "Expected to timeout (deferred), but passed", | 96 "Expected to timeout (deferred), but passed", |
97 output) | 97 output) |
98 # Print real regressions. | 98 # Print real regressions. |
99 PrintFilesFromSet(self._regressed_failures, | 99 PrintFilesFromSet(self._regressed_text_failures, |
100 "Regressions: Unexpected failures", | 100 "Regressions: Unexpected text failures", |
101 output, | 101 output, |
102 'FAIL') | 102 'TEXT') |
| 103 PrintFilesFromSet(self._regressed_image_failures, |
| 104 "Regressions: Unexpected image failures", |
| 105 output, |
| 106 'IMAGE') |
| 107 PrintFilesFromSet(self._regressed_image_plus_text_failures, |
| 108 "Regressions: Unexpected image + text failures", |
| 109 output, |
| 110 'IMAGE+TEXT') |
103 PrintFilesFromSet(self._regressed_hangs, | 111 PrintFilesFromSet(self._regressed_hangs, |
104 "Regressions: Unexpected timeouts", | 112 "Regressions: Unexpected timeouts", |
105 output, | 113 output, |
106 'TIMEOUT') | 114 'TIMEOUT') |
107 PrintFilesFromSet(self._regressed_crashes, | 115 PrintFilesFromSet(self._regressed_crashes, |
108 "Regressions: Unexpected crashes", | 116 "Regressions: Unexpected crashes", |
109 output, | 117 output, |
110 'CRASH') | 118 'CRASH') |
111 PrintFilesFromSet(self._missing, | 119 PrintFilesFromSet(self._missing, |
112 "Missing expected results", | 120 "Missing expected results", |
113 output) | 121 output) |
114 | 122 |
115 def _CalculateRegressions(self): | 123 def _CalculateRegressions(self): |
116 """Calculate regressions from this run through the layout tests.""" | 124 """Calculate regressions from this run through the layout tests.""" |
117 worklist = self._test_files.copy() | 125 worklist = self._test_files.copy() |
118 | 126 |
119 passes = set() | 127 passes = set() |
120 crashes = set() | 128 crashes = set() |
121 hangs = set() | 129 hangs = set() |
122 missing = set() | 130 missing = set() |
123 failures = set() | 131 image_failures = set() |
| 132 text_failures = set() |
| 133 image_plus_text_failures = set() |
124 | 134 |
125 for test, failure_type_instances in self._test_failures.iteritems(): | 135 for test, failure_type_instances in self._test_failures.iteritems(): |
126 # Although each test can have multiple test_failures, we only put them | 136 # Although each test can have multiple test_failures, we only put them |
127 # into one list (either the crash list or the failure list). We give | 137 # into one list (either the crash list or the failure list). We give |
128 # priority to a crash/timeout over others, and to missing results over | 138 # priority to a crash/timeout over others, and to missing results over |
129 # a text mismatch. | 139 # a text mismatch. |
130 failure_types = [type(f) for f in failure_type_instances] | 140 failure_types = [type(f) for f in failure_type_instances] |
131 is_crash = [True for f in failure_types if f in self.CRASH_TYPES] | 141 is_crash = [True for f in failure_types if f in self.CRASH_TYPES] |
132 is_hang = [True for f in failure_types if f in self.HANG_TYPES] | 142 is_hang = [True for f in failure_types if f in self.HANG_TYPES] |
133 is_missing = [True for f in failure_types if f in self.MISSING_TYPES] | 143 is_missing = [True for f in failure_types if f in self.MISSING_TYPES] |
(...skipping 10 matching lines...) Expand all Loading... |
144 if not test_expectations.TIMEOUT in expectations: hangs.add(test) | 154 if not test_expectations.TIMEOUT in expectations: hangs.add(test) |
145 # Do not add to the missing list if a test is rebaselining and missing | 155 # Do not add to the missing list if a test is rebaselining and missing |
146 # expected files. | 156 # expected files. |
147 elif (is_missing and | 157 elif (is_missing and |
148 not self._expectations.IsRebaselining(test) and | 158 not self._expectations.IsRebaselining(test) and |
149 not self._expectations.IsIgnored(test)): | 159 not self._expectations.IsIgnored(test)): |
150 missing.add(test) | 160 missing.add(test) |
151 elif is_image_failure and is_text_failure: | 161 elif is_image_failure and is_text_failure: |
152 if (not test_expectations.FAIL in expectations and | 162 if (not test_expectations.FAIL in expectations and |
153 not test_expectations.IMAGE_PLUS_TEXT in expectations): | 163 not test_expectations.IMAGE_PLUS_TEXT in expectations): |
154 failures.add(test) | 164 image_plus_text_failures.add(test) |
155 elif is_image_failure: | 165 elif is_image_failure: |
156 if (not test_expectations.FAIL in expectations and | 166 if (not test_expectations.FAIL in expectations and |
157 not test_expectations.IMAGE in expectations): | 167 not test_expectations.IMAGE in expectations): |
158 failures.add(test) | 168 image_failures.add(test) |
159 elif is_text_failure: | 169 elif is_text_failure: |
160 if (not test_expectations.FAIL in expectations and | 170 if (not test_expectations.FAIL in expectations and |
161 not test_expectations.TEXT in expectations): | 171 not test_expectations.TEXT in expectations): |
162 failures.add(test) | 172 text_failures.add(test) |
163 elif is_failure: | 173 elif is_failure: |
164 raise ValueError('unexpected failure type:' + f) | 174 raise ValueError('unexpected failure type:' + f) |
165 worklist.remove(test) | 175 worklist.remove(test) |
166 | 176 |
167 for test in worklist: | 177 for test in worklist: |
168 # Check that all passing tests are expected to pass. | 178 # Check that all passing tests are expected to pass. |
169 expectations = self._expectations.GetExpectations(test) | 179 expectations = self._expectations.GetExpectations(test) |
170 if not test_expectations.PASS in expectations: passes.add(test) | 180 if not test_expectations.PASS in expectations: passes.add(test) |
171 | 181 |
172 self._regressed_passes = passes | 182 self._regressed_passes = passes |
173 self._regressed_crashes = crashes | 183 self._regressed_crashes = crashes |
174 self._regressed_hangs = hangs | 184 self._regressed_hangs = hangs |
175 self._missing = missing | 185 self._missing = missing |
176 self._regressed_failures = failures | 186 self._regressed_image_failures = image_failures |
| 187 self._regressed_text_failures = text_failures |
| 188 self._regressed_image_plus_text_failures = image_plus_text_failures |
177 | 189 |
178 def GetRegressions(self): | 190 def GetRegressions(self): |
179 """Returns a set of regressions from the test expectations. This is | 191 """Returns a set of regressions from the test expectations. This is |
180 used to determine which tests to list in results.html and the | 192 used to determine which tests to list in results.html and the |
181 right script exit code for the build bots. The list does not | 193 right script exit code for the build bots. The list does not |
182 include the unexpected passes.""" | 194 include the unexpected passes.""" |
183 return (self._regressed_failures | self._regressed_hangs | | 195 return (self._regressed_text_failures | self._regressed_image_failures | |
| 196 self._regressed_image_plus_text_failures | self._regressed_hangs | |
184 self._regressed_crashes | self._missing) | 197 self._regressed_crashes | self._missing) |
185 | 198 |
OLD | NEW |