| 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 14 matching lines...) Expand all Loading... |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 input_failure_types = {type(f) for f in failure_list} |
| 36 return set((FailureReftestMismatch, FailureReftestMismatchDidNotOccur, Failu
reReftestNoImagesGenerated)).intersection( | 36 reftest_failure_types = { |
| 37 failure_types) | 37 FailureReftestMismatch, |
| 38 FailureReftestMismatchDidNotOccur, |
| 39 FailureReftestNoImageGenerated, |
| 40 FailureReftestNoReferenceImageGenerated |
| 41 } |
| 42 return bool(input_failure_types & reftest_failure_types) |
| 38 | 43 |
| 39 # FIXME: This is backwards. Each TestFailure subclass should know what | 44 # FIXME: This is backwards. Each TestFailure subclass should know what |
| 40 # test_expectation type it corresponds too. Then this method just | 45 # test_expectation type it corresponds too. Then this method just |
| 41 # collects them all from the failure list and returns the worst one. | 46 # collects them all from the failure list and returns the worst one. |
| 42 | 47 |
| 43 | 48 |
| 44 def determine_result_type(failure_list): | 49 def determine_result_type(failure_list): |
| 45 """Takes a set of test_failures and returns which result type best fits | 50 """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. | 51 the list of failures. "Best fits" means we use the worst type of failure. |
| 47 | 52 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 class FailureReftestMismatchDidNotOccur(TestFailure): | 218 class FailureReftestMismatchDidNotOccur(TestFailure): |
| 214 | 219 |
| 215 def __init__(self, reference_filename=None): | 220 def __init__(self, reference_filename=None): |
| 216 super(FailureReftestMismatchDidNotOccur, self).__init__() | 221 super(FailureReftestMismatchDidNotOccur, self).__init__() |
| 217 self.reference_filename = reference_filename | 222 self.reference_filename = reference_filename |
| 218 | 223 |
| 219 def message(self): | 224 def message(self): |
| 220 return "reference mismatch didn't happen" | 225 return "reference mismatch didn't happen" |
| 221 | 226 |
| 222 | 227 |
| 223 class FailureReftestNoImagesGenerated(TestFailure): | 228 class FailureReftestNoImageGenerated(TestFailure): |
| 224 | 229 |
| 225 def __init__(self, reference_filename=None): | 230 def __init__(self, reference_filename=None): |
| 226 super(FailureReftestNoImagesGenerated, self).__init__() | 231 super(FailureReftestNoImageGenerated, self).__init__() |
| 227 self.reference_filename = reference_filename | 232 self.reference_filename = reference_filename |
| 228 | 233 |
| 229 def message(self): | 234 def message(self): |
| 230 return "reference didn't generate pixel results." | 235 return "reference test didn't generate pixel results" |
| 236 |
| 237 |
| 238 class FailureReftestNoReferenceImageGenerated(TestFailure): |
| 239 |
| 240 def __init__(self, reference_filename=None): |
| 241 super(FailureReftestNoReferenceImageGenerated, self).__init__() |
| 242 self.reference_filename = reference_filename |
| 243 |
| 244 def message(self): |
| 245 return "-expected.html didn't generate pixel results" |
| 231 | 246 |
| 232 | 247 |
| 233 class FailureMissingAudio(TestFailure): | 248 class FailureMissingAudio(TestFailure): |
| 234 | 249 |
| 235 def message(self): | 250 def message(self): |
| 236 return 'expected audio result was missing' | 251 return 'expected audio result was missing' |
| 237 | 252 |
| 238 | 253 |
| 239 class FailureAudioMismatch(TestFailure): | 254 class FailureAudioMismatch(TestFailure): |
| 240 | 255 |
| 241 def message(self): | 256 def message(self): |
| 242 return 'audio mismatch' | 257 return 'audio mismatch' |
| 243 | 258 |
| 244 | 259 |
| 245 class FailureEarlyExit(TestFailure): | 260 class FailureEarlyExit(TestFailure): |
| 246 | 261 |
| 247 def message(self): | 262 def message(self): |
| 248 return 'skipped due to early exit' | 263 return 'skipped due to early exit' |
| 249 | 264 |
| 250 | 265 |
| 251 # Convenient collection of all failure classes for anything that might | 266 # Convenient collection of all failure classes for anything that might |
| 252 # need to enumerate over them all. | 267 # need to enumerate over them all. |
| 253 ALL_FAILURE_CLASSES = (FailureTimeout, FailureCrash, FailureMissingResult, | 268 ALL_FAILURE_CLASSES = (FailureTimeout, FailureCrash, FailureMissingResult, |
| 254 FailureTestHarnessAssertion, | 269 FailureTestHarnessAssertion, |
| 255 FailureTextMismatch, FailureMissingImageHash, | 270 FailureTextMismatch, FailureMissingImageHash, |
| 256 FailureMissingImage, FailureImageHashMismatch, | 271 FailureMissingImage, FailureImageHashMismatch, |
| 257 FailureImageHashIncorrect, FailureReftestMismatch, | 272 FailureImageHashIncorrect, FailureReftestMismatch, |
| 258 FailureReftestMismatchDidNotOccur, FailureReftestNoImages
Generated, | 273 FailureReftestMismatchDidNotOccur, |
| 274 FailureReftestNoImageGenerated, |
| 275 FailureReftestNoReferenceImageGenerated, |
| 259 FailureMissingAudio, FailureAudioMismatch, | 276 FailureMissingAudio, FailureAudioMismatch, |
| 260 FailureEarlyExit) | 277 FailureEarlyExit) |
| OLD | NEW |