Changeset 93562 in webkit
- Timestamp:
- Aug 22, 2011 4:53:19 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r93552 r93562 1 2011-08-22 Dimitri Glazkov <dglazkov@chromium.org> 2 3 webkit-patch rebaseline-expectations command should not rearrange the entire test_expectations.txt file. 4 https://bugs.webkit.org/show_bug.cgi?id=66727 5 6 Reviewed by Adam Barth. 7 8 * Scripts/webkitpy/layout_tests/models/test_expectations.py: Made it possible to run TestExpectationSerializer without a TestConfigurationConverter, 9 in which case the serializer treats all expectations as unparsed. 10 * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Added unit tests. 11 1 12 2011-08-22 Dimitri Glazkov <dglazkov@chromium.org> 2 13 -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
r92861 r93562 122 122 class TestExpectationSerializer(object): 123 123 """Provides means of serializing TestExpectationLine instances.""" 124 def __init__(self, test_configuration_converter ):124 def __init__(self, test_configuration_converter=None): 125 125 self._test_configuration_converter = test_configuration_converter 126 126 self._parsed_expectation_to_string = dict([[parsed_expectation, expectation_string] for expectation_string, parsed_expectation in TestExpectations.EXPECTATIONS.items()]) … … 133 133 return '' if expectation_line.comment is None else "//%s" % expectation_line.comment 134 134 135 if expectation_line.parsed_bug_modifiers:135 if self._test_configuration_converter and expectation_line.parsed_bug_modifiers: 136 136 specifiers_list = self._test_configuration_converter.to_specifiers_list(expectation_line.matching_configurations) 137 137 result = [] … … 152 152 153 153 def _parsed_modifier_string(self, expectation_line, specifiers): 154 assert(self._test_configuration_converter) 154 155 result = [] 155 156 if expectation_line.parsed_bug_modifiers: … … 167 168 168 169 @classmethod 169 def list_to_string(cls, expectation_lines, test_configuration_converter , reconstitute_only_these=None):170 def list_to_string(cls, expectation_lines, test_configuration_converter=None, reconstitute_only_these=None): 170 171 serializer = cls(test_configuration_converter) 171 172 … … 931 932 return self._has_warnings 932 933 933 def remove_rebaselined_tests(self, tests):934 def remove_rebaselined_tests(self, except_these_tests): 934 935 """Returns a copy of the expectations with the tests removed.""" 935 936 def without_rebaseline_modifier(expectation): 936 return not (not expectation.is_malformed() and expectation.name in tests and "rebaseline" in expectation.modifiers)937 938 return TestExpectationSerializer.list_to_string(filter(without_rebaseline_modifier, self._expectations) , self._test_configuration_converter)937 return not (not expectation.is_malformed() and expectation.name in except_these_tests and "rebaseline" in expectation.modifiers) 938 939 return TestExpectationSerializer.list_to_string(filter(without_rebaseline_modifier, self._expectations)) 939 940 940 941 def _add_expectations(self, expectation_list, overrides_allowed): -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
r92861 r93562 483 483 def test_unparsed_to_string(self): 484 484 expectation = TestExpectationLine() 485 486 self.assertEqual(self._serializer.to_string(expectation), '') 485 serializer = TestExpectationSerializer() 486 487 self.assertEqual(serializer.to_string(expectation), '') 487 488 expectation.comment = 'Qux.' 488 self.assertEqual(se lf._serializer.to_string(expectation), '//Qux.')489 self.assertEqual(serializer.to_string(expectation), '//Qux.') 489 490 expectation.name = 'bar' 490 self.assertEqual(se lf._serializer.to_string(expectation), ' : bar = //Qux.')491 self.assertEqual(serializer.to_string(expectation), ' : bar = //Qux.') 491 492 expectation.modifiers = ['foo'] 492 self.assertEqual(se lf._serializer.to_string(expectation), 'FOO : bar = //Qux.')493 self.assertEqual(serializer.to_string(expectation), 'FOO : bar = //Qux.') 493 494 expectation.expectations = ['bAz'] 494 self.assertEqual(se lf._serializer.to_string(expectation), 'FOO : bar = BAZ //Qux.')495 self.assertEqual(serializer.to_string(expectation), 'FOO : bar = BAZ //Qux.') 495 496 expectation.expectations = ['bAz1', 'baZ2'] 496 self.assertEqual(se lf._serializer.to_string(expectation), 'FOO : bar = BAZ1 BAZ2 //Qux.')497 self.assertEqual(serializer.to_string(expectation), 'FOO : bar = BAZ1 BAZ2 //Qux.') 497 498 expectation.modifiers = ['foo1', 'foO2'] 498 self.assertEqual(se lf._serializer.to_string(expectation), 'FOO1 FOO2 : bar = BAZ1 BAZ2 //Qux.')499 self.assertEqual(serializer.to_string(expectation), 'FOO1 FOO2 : bar = BAZ1 BAZ2 //Qux.') 499 500 expectation.errors.append('Oh the horror.') 500 self.assertEqual(se lf._serializer.to_string(expectation), '')501 self.assertEqual(serializer.to_string(expectation), '') 501 502 expectation.original_string = 'Yes it is!' 502 self.assertEqual(self._serializer.to_string(expectation), 'Yes it is!') 503 self.assertEqual(serializer.to_string(expectation), 'Yes it is!') 504 505 def test_unparsed_list_to_string(self): 506 expectation = TestExpectationLine() 507 expectation.comment = 'Qux.' 508 expectation.name = 'bar' 509 expectation.modifiers = ['foo'] 510 expectation.expectations = ['bAz1', 'baZ2'] 511 self.assertEqual(TestExpectationSerializer.list_to_string([expectation]), 'FOO : bar = BAZ1 BAZ2 //Qux.') 503 512 504 513 def test_parsed_to_string(self):
Note: See TracChangeset
for help on using the changeset viewer.