| 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 drop any pixel failures and return the remaining expectations. For examp
le, | 877 drop any pixel failures and return the remaining expectations. For examp
le, |
| 878 if we're not running pixel tests, then tests expected to fail as IMAGE | 878 if we're not running pixel tests, then tests expected to fail as IMAGE |
| 879 will PASS.""" | 879 will PASS.""" |
| 880 expected_results = expected_results.copy() | 880 expected_results = expected_results.copy() |
| 881 if IMAGE in expected_results: | 881 if IMAGE in expected_results: |
| 882 expected_results.remove(IMAGE) | 882 expected_results.remove(IMAGE) |
| 883 expected_results.add(PASS) | 883 expected_results.add(PASS) |
| 884 return expected_results | 884 return expected_results |
| 885 | 885 |
| 886 @staticmethod | 886 @staticmethod |
| 887 def remove_non_sanitizer_failures(expected_results): |
| 888 """Returns a copy of the expected results for a test, except that we |
| 889 drop any failures that the sanitizers don't care about.""" |
| 890 expected_results = expected_results.copy() |
| 891 for result in (IMAGE, FAIL, IMAGE_PLUS_TEXT): |
| 892 if result in expected_results: |
| 893 expected_results.remove(result) |
| 894 expected_results.add(PASS) |
| 895 return expected_results |
| 896 |
| 897 @staticmethod |
| 887 def has_pixel_failures(actual_results): | 898 def has_pixel_failures(actual_results): |
| 888 return IMAGE in actual_results or FAIL in actual_results | 899 return IMAGE in actual_results or FAIL in actual_results |
| 889 | 900 |
| 890 @staticmethod | 901 @staticmethod |
| 891 def suffixes_for_expectations(expectations): | 902 def suffixes_for_expectations(expectations): |
| 892 suffixes = set() | 903 suffixes = set() |
| 893 if IMAGE in expectations: | 904 if IMAGE in expectations: |
| 894 suffixes.add('png') | 905 suffixes.add('png') |
| 895 if FAIL in expectations: | 906 if FAIL in expectations: |
| 896 suffixes.add('txt') | 907 suffixes.add('txt') |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 # FIXME: Change the callsites to use TestExpectationsModel and remove. | 991 # FIXME: Change the callsites to use TestExpectationsModel and remove. |
| 981 def get_tests_with_timeline(self, timeline): | 992 def get_tests_with_timeline(self, timeline): |
| 982 return self._model.get_tests_with_timeline(timeline) | 993 return self._model.get_tests_with_timeline(timeline) |
| 983 | 994 |
| 984 def get_expectations_string(self, test): | 995 def get_expectations_string(self, test): |
| 985 return self._model.get_expectations_string(test) | 996 return self._model.get_expectations_string(test) |
| 986 | 997 |
| 987 def expectation_to_string(self, expectation): | 998 def expectation_to_string(self, expectation): |
| 988 return self._model.expectation_to_string(expectation) | 999 return self._model.expectation_to_string(expectation) |
| 989 | 1000 |
| 990 def matches_an_expected_result(self, test, result, pixel_tests_are_enabled): | 1001 def matches_an_expected_result(self, test, result, pixel_tests_are_enabled,
sanitizer_is_enabled): |
| 991 expected_results = self._model.get_expectations(test) | 1002 expected_results = self._model.get_expectations(test) |
| 992 if not pixel_tests_are_enabled: | 1003 if sanitizer_is_enabled: |
| 1004 expected_results = self.remove_non_sanitizer_failures(expected_resul
ts) |
| 1005 elif not pixel_tests_are_enabled: |
| 993 expected_results = self.remove_pixel_failures(expected_results) | 1006 expected_results = self.remove_pixel_failures(expected_results) |
| 994 return self.result_was_expected(result, expected_results, self.is_rebase
lining(test)) | 1007 return self.result_was_expected(result, expected_results, self.is_rebase
lining(test)) |
| 995 | 1008 |
| 996 def is_rebaselining(self, test): | 1009 def is_rebaselining(self, test): |
| 997 return REBASELINE in self._model.get_expectations(test) | 1010 return REBASELINE in self._model.get_expectations(test) |
| 998 | 1011 |
| 999 def _shorten_filename(self, filename): | 1012 def _shorten_filename(self, filename): |
| 1000 if filename.startswith(self._port.path_from_webkit_base()): | 1013 if filename.startswith(self._port.path_from_webkit_base()): |
| 1001 return self._port.host.filesystem.relpath(filename, self._port.path_
from_webkit_base()) | 1014 return self._port.host.filesystem.relpath(filename, self._port.path_
from_webkit_base()) |
| 1002 return filename | 1015 return filename |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 # If reconstitute_only_these is an empty list, we want to return ori
ginal_string. | 1117 # If reconstitute_only_these is an empty list, we want to return ori
ginal_string. |
| 1105 # So we need to compare reconstitute_only_these to None, not just ch
eck if it's falsey. | 1118 # So we need to compare reconstitute_only_these to None, not just ch
eck if it's falsey. |
| 1106 if reconstitute_only_these is None or expectation_line in reconstitu
te_only_these: | 1119 if reconstitute_only_these is None or expectation_line in reconstitu
te_only_these: |
| 1107 return expectation_line.to_string(test_configuration_converter) | 1120 return expectation_line.to_string(test_configuration_converter) |
| 1108 return expectation_line.original_string | 1121 return expectation_line.original_string |
| 1109 | 1122 |
| 1110 def nones_out(expectation_line): | 1123 def nones_out(expectation_line): |
| 1111 return expectation_line is not None | 1124 return expectation_line is not None |
| 1112 | 1125 |
| 1113 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) | 1126 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) |
| OLD | NEW |