Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 import cPickle | 29 import cPickle |
| 30 | 30 |
| 31 from webkitpy.layout_tests.models import test_expectations | 31 from webkitpy.layout_tests.models import test_expectations |
| 32 | 32 |
| 33 | 33 |
| 34 def is_reftest_failure(failure_list): | 34 def is_reftest_failure(failure_list): |
| 35 failure_types = [type(f) for f in failure_list] | 35 failure_types = [type(f) for f in failure_list] |
| 36 return set((FailureReftestMismatch, FailureReftestMismatchDidNotOccur, Failu reReftestNoImagesGenerated)).intersection( | 36 return set(( |
| 37 failure_types) | 37 FailureReftestMismatch, |
| 38 FailureReftestMismatchDidNotOccur, | |
| 39 FailureReftestNoImageGenerated, | |
| 40 FailureReftestNoReferenceImageGenerated | |
| 41 )).intersection(failure_types) | |
|
qyearsley
2017/03/27 23:15:09
It doesn't make a big difference, but this could a
skobes
2017/03/27 23:30:17
Done.
| |
| 38 | 42 |
| 39 # FIXME: This is backwards. Each TestFailure subclass should know what | 43 # FIXME: This is backwards. Each TestFailure subclass should know what |
| 40 # test_expectation type it corresponds too. Then this method just | 44 # test_expectation type it corresponds too. Then this method just |
| 41 # collects them all from the failure list and returns the worst one. | 45 # collects them all from the failure list and returns the worst one. |
| 42 | 46 |
| 43 | 47 |
| 44 def determine_result_type(failure_list): | 48 def determine_result_type(failure_list): |
| 45 """Takes a set of test_failures and returns which result type best fits | 49 """Takes a set of test_failures and returns which result type best fits |
| 46 the list of failures. "Best fits" means we use the worst type of failure. | 50 the list of failures. "Best fits" means we use the worst type of failure. |
| 47 | 51 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 class FailureReftestMismatchDidNotOccur(TestFailure): | 217 class FailureReftestMismatchDidNotOccur(TestFailure): |
| 214 | 218 |
| 215 def __init__(self, reference_filename=None): | 219 def __init__(self, reference_filename=None): |
| 216 super(FailureReftestMismatchDidNotOccur, self).__init__() | 220 super(FailureReftestMismatchDidNotOccur, self).__init__() |
| 217 self.reference_filename = reference_filename | 221 self.reference_filename = reference_filename |
| 218 | 222 |
| 219 def message(self): | 223 def message(self): |
| 220 return "reference mismatch didn't happen" | 224 return "reference mismatch didn't happen" |
| 221 | 225 |
| 222 | 226 |
| 223 class FailureReftestNoImagesGenerated(TestFailure): | 227 class FailureReftestNoImageGenerated(TestFailure): |
| 224 | 228 |
| 225 def __init__(self, reference_filename=None): | 229 def __init__(self, reference_filename=None): |
| 226 super(FailureReftestNoImagesGenerated, self).__init__() | 230 super(FailureReftestNoImageGenerated, self).__init__() |
| 227 self.reference_filename = reference_filename | 231 self.reference_filename = reference_filename |
| 228 | 232 |
| 229 def message(self): | 233 def message(self): |
| 230 return "reference didn't generate pixel results." | 234 return "reference test didn't generate pixel results" |
| 235 | |
| 236 | |
| 237 class FailureReftestNoReferenceImageGenerated(TestFailure): | |
| 238 | |
| 239 def __init__(self, reference_filename=None): | |
| 240 super(FailureReftestNoReferenceImageGenerated, self).__init__() | |
| 241 self.reference_filename = reference_filename | |
| 242 | |
| 243 def message(self): | |
| 244 return "-expected.html didn't generate pixel results" | |
| 231 | 245 |
| 232 | 246 |
| 233 class FailureMissingAudio(TestFailure): | 247 class FailureMissingAudio(TestFailure): |
| 234 | 248 |
| 235 def message(self): | 249 def message(self): |
| 236 return 'expected audio result was missing' | 250 return 'expected audio result was missing' |
| 237 | 251 |
| 238 | 252 |
| 239 class FailureAudioMismatch(TestFailure): | 253 class FailureAudioMismatch(TestFailure): |
| 240 | 254 |
| 241 def message(self): | 255 def message(self): |
| 242 return 'audio mismatch' | 256 return 'audio mismatch' |
| 243 | 257 |
| 244 | 258 |
| 245 class FailureEarlyExit(TestFailure): | 259 class FailureEarlyExit(TestFailure): |
| 246 | 260 |
| 247 def message(self): | 261 def message(self): |
| 248 return 'skipped due to early exit' | 262 return 'skipped due to early exit' |
| 249 | 263 |
| 250 | 264 |
| 251 # Convenient collection of all failure classes for anything that might | 265 # Convenient collection of all failure classes for anything that might |
| 252 # need to enumerate over them all. | 266 # need to enumerate over them all. |
| 253 ALL_FAILURE_CLASSES = (FailureTimeout, FailureCrash, FailureMissingResult, | 267 ALL_FAILURE_CLASSES = (FailureTimeout, FailureCrash, FailureMissingResult, |
| 254 FailureTestHarnessAssertion, | 268 FailureTestHarnessAssertion, |
| 255 FailureTextMismatch, FailureMissingImageHash, | 269 FailureTextMismatch, FailureMissingImageHash, |
| 256 FailureMissingImage, FailureImageHashMismatch, | 270 FailureMissingImage, FailureImageHashMismatch, |
| 257 FailureImageHashIncorrect, FailureReftestMismatch, | 271 FailureImageHashIncorrect, FailureReftestMismatch, |
| 258 FailureReftestMismatchDidNotOccur, FailureReftestNoImages Generated, | 272 FailureReftestMismatchDidNotOccur, |
| 273 FailureReftestNoImageGenerated, | |
| 274 FailureReftestNoReferenceImageGenerated, | |
| 259 FailureMissingAudio, FailureAudioMismatch, | 275 FailureMissingAudio, FailureAudioMismatch, |
| 260 FailureEarlyExit) | 276 FailureEarlyExit) |
| OLD | NEW |