| 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(failure_types) | 36 return set((FailureReftestMismatch, FailureReftestMismatchDidNotOccur, Failu
reReftestNoImagesGenerated)).intersection( |
| 37 failure_types) |
| 37 | 38 |
| 38 # FIXME: This is backwards. Each TestFailure subclass should know what | 39 # FIXME: This is backwards. Each TestFailure subclass should know what |
| 39 # test_expectation type it corresponds too. Then this method just | 40 # test_expectation type it corresponds too. Then this method just |
| 40 # collects them all from the failure list and returns the worst one. | 41 # collects them all from the failure list and returns the worst one. |
| 41 | 42 |
| 42 | 43 |
| 43 def determine_result_type(failure_list): | 44 def determine_result_type(failure_list): |
| 44 """Takes a set of test_failures and returns which result type best fits | 45 """Takes a set of test_failures and returns which result type best fits |
| 45 the list of failures. "Best fits" means we use the worst type of failure. | 46 the list of failures. "Best fits" means we use the worst type of failure. |
| 46 | 47 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 elif is_image_failure: | 79 elif is_image_failure: |
| 79 return test_expectations.IMAGE | 80 return test_expectations.IMAGE |
| 80 elif is_audio_failure: | 81 elif is_audio_failure: |
| 81 return test_expectations.AUDIO | 82 return test_expectations.AUDIO |
| 82 else: | 83 else: |
| 83 raise ValueError("unclassifiable set of failures: " | 84 raise ValueError("unclassifiable set of failures: " |
| 84 + str(failure_types)) | 85 + str(failure_types)) |
| 85 | 86 |
| 86 | 87 |
| 87 class TestFailure(object): | 88 class TestFailure(object): |
| 89 |
| 88 """Abstract base class that defines the failure interface.""" | 90 """Abstract base class that defines the failure interface.""" |
| 89 | 91 |
| 90 @staticmethod | 92 @staticmethod |
| 91 def loads(s): | 93 def loads(s): |
| 92 """Creates a TestFailure object from the specified string.""" | 94 """Creates a TestFailure object from the specified string.""" |
| 93 return cPickle.loads(s) | 95 return cPickle.loads(s) |
| 94 | 96 |
| 95 def message(self): | 97 def message(self): |
| 96 """Returns a string describing the failure in more detail.""" | 98 """Returns a string describing the failure in more detail.""" |
| 97 raise NotImplementedError | 99 raise NotImplementedError |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 # Convenient collection of all failure classes for anything that might | 251 # Convenient collection of all failure classes for anything that might |
| 250 # need to enumerate over them all. | 252 # need to enumerate over them all. |
| 251 ALL_FAILURE_CLASSES = (FailureTimeout, FailureCrash, FailureMissingResult, | 253 ALL_FAILURE_CLASSES = (FailureTimeout, FailureCrash, FailureMissingResult, |
| 252 FailureTestHarnessAssertion, | 254 FailureTestHarnessAssertion, |
| 253 FailureTextMismatch, FailureMissingImageHash, | 255 FailureTextMismatch, FailureMissingImageHash, |
| 254 FailureMissingImage, FailureImageHashMismatch, | 256 FailureMissingImage, FailureImageHashMismatch, |
| 255 FailureImageHashIncorrect, FailureReftestMismatch, | 257 FailureImageHashIncorrect, FailureReftestMismatch, |
| 256 FailureReftestMismatchDidNotOccur, FailureReftestNoImages
Generated, | 258 FailureReftestMismatchDidNotOccur, FailureReftestNoImages
Generated, |
| 257 FailureMissingAudio, FailureAudioMismatch, | 259 FailureMissingAudio, FailureAudioMismatch, |
| 258 FailureEarlyExit) | 260 FailureEarlyExit) |
| OLD | NEW |