Title: [93562] trunk/Tools
Revision
93562
Author
[email protected]
Date
2011-08-22 16:53:19 -0700 (Mon, 22 Aug 2011)

Log Message

webkit-patch rebaseline-expectations command should not rearrange the entire test_expectations.txt file.
https://bugs.webkit.org/show_bug.cgi?id=66727

Reviewed by Adam Barth.

* Scripts/webkitpy/layout_tests/models/test_expectations.py: Made it possible to run TestExpectationSerializer without a TestConfigurationConverter,
    in which case the serializer treats all expectations as unparsed.
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Added unit tests.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (93561 => 93562)


--- trunk/Tools/ChangeLog	2011-08-22 23:52:37 UTC (rev 93561)
+++ trunk/Tools/ChangeLog	2011-08-22 23:53:19 UTC (rev 93562)
@@ -1,5 +1,16 @@
 2011-08-22  Dimitri Glazkov  <[email protected]>
 
+        webkit-patch rebaseline-expectations command should not rearrange the entire test_expectations.txt file.
+        https://bugs.webkit.org/show_bug.cgi?id=66727
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py: Made it possible to run TestExpectationSerializer without a TestConfigurationConverter,
+            in which case the serializer treats all expectations as unparsed.
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Added unit tests.
+
+2011-08-22  Dimitri Glazkov  <[email protected]>
+
         Update unit test expectations after r93530.
 
         * Scripts/webkitpy/layout_tests/port/factory_unittest.py: Updated.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (93561 => 93562)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2011-08-22 23:52:37 UTC (rev 93561)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2011-08-22 23:53:19 UTC (rev 93562)
@@ -121,7 +121,7 @@
 
 class TestExpectationSerializer(object):
     """Provides means of serializing TestExpectationLine instances."""
-    def __init__(self, test_configuration_converter):
+    def __init__(self, test_configuration_converter=None):
         self._test_configuration_converter = test_configuration_converter
         self._parsed_expectation_to_string = dict([[parsed_expectation, expectation_string] for expectation_string, parsed_expectation in TestExpectations.EXPECTATIONS.items()])
 
@@ -132,7 +132,7 @@
         if expectation_line.name is None:
             return '' if expectation_line.comment is None else "//%s" % expectation_line.comment
 
-        if expectation_line.parsed_bug_modifiers:
+        if self._test_configuration_converter and expectation_line.parsed_bug_modifiers:
             specifiers_list = self._test_configuration_converter.to_specifiers_list(expectation_line.matching_configurations)
             result = []
             for specifiers in specifiers_list:
@@ -151,6 +151,7 @@
         return ' '.join(result)
 
     def _parsed_modifier_string(self, expectation_line, specifiers):
+        assert(self._test_configuration_converter)
         result = []
         if expectation_line.parsed_bug_modifiers:
             result.extend(sorted(expectation_line.parsed_bug_modifiers))
@@ -166,7 +167,7 @@
         return result
 
     @classmethod
-    def list_to_string(cls, expectation_lines, test_configuration_converter, reconstitute_only_these=None):
+    def list_to_string(cls, expectation_lines, test_configuration_converter=None, reconstitute_only_these=None):
         serializer = cls(test_configuration_converter)
 
         def serialize(expectation_line):
@@ -930,12 +931,12 @@
     def has_warnings(self):
         return self._has_warnings
 
-    def remove_rebaselined_tests(self, tests):
+    def remove_rebaselined_tests(self, except_these_tests):
         """Returns a copy of the expectations with the tests removed."""
         def without_rebaseline_modifier(expectation):
-            return not (not expectation.is_malformed() and expectation.name in tests and "rebaseline" in expectation.modifiers)
+            return not (not expectation.is_malformed() and expectation.name in except_these_tests and "rebaseline" in expectation.modifiers)
 
-        return TestExpectationSerializer.list_to_string(filter(without_rebaseline_modifier, self._expectations), self._test_configuration_converter)
+        return TestExpectationSerializer.list_to_string(filter(without_rebaseline_modifier, self._expectations))
 
     def _add_expectations(self, expectation_list, overrides_allowed):
         for expectation_line in expectation_list:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py (93561 => 93562)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2011-08-22 23:52:37 UTC (rev 93561)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2011-08-22 23:53:19 UTC (rev 93562)
@@ -482,25 +482,34 @@
 
     def test_unparsed_to_string(self):
         expectation = TestExpectationLine()
+        serializer = TestExpectationSerializer()
 
-        self.assertEqual(self._serializer.to_string(expectation), '')
+        self.assertEqual(serializer.to_string(expectation), '')
         expectation.comment = 'Qux.'
-        self.assertEqual(self._serializer.to_string(expectation), '//Qux.')
+        self.assertEqual(serializer.to_string(expectation), '//Qux.')
         expectation.name = 'bar'
-        self.assertEqual(self._serializer.to_string(expectation), ' : bar =  //Qux.')
+        self.assertEqual(serializer.to_string(expectation), ' : bar =  //Qux.')
         expectation.modifiers = ['foo']
-        self.assertEqual(self._serializer.to_string(expectation), 'FOO : bar =  //Qux.')
+        self.assertEqual(serializer.to_string(expectation), 'FOO : bar =  //Qux.')
         expectation.expectations = ['bAz']
-        self.assertEqual(self._serializer.to_string(expectation), 'FOO : bar = BAZ //Qux.')
+        self.assertEqual(serializer.to_string(expectation), 'FOO : bar = BAZ //Qux.')
         expectation.expectations = ['bAz1', 'baZ2']
-        self.assertEqual(self._serializer.to_string(expectation), 'FOO : bar = BAZ1 BAZ2 //Qux.')
+        self.assertEqual(serializer.to_string(expectation), 'FOO : bar = BAZ1 BAZ2 //Qux.')
         expectation.modifiers = ['foo1', 'foO2']
-        self.assertEqual(self._serializer.to_string(expectation), 'FOO1 FOO2 : bar = BAZ1 BAZ2 //Qux.')
+        self.assertEqual(serializer.to_string(expectation), 'FOO1 FOO2 : bar = BAZ1 BAZ2 //Qux.')
         expectation.errors.append('Oh the horror.')
-        self.assertEqual(self._serializer.to_string(expectation), '')
+        self.assertEqual(serializer.to_string(expectation), '')
         expectation.original_string = 'Yes it is!'
-        self.assertEqual(self._serializer.to_string(expectation), 'Yes it is!')
+        self.assertEqual(serializer.to_string(expectation), 'Yes it is!')
 
+    def test_unparsed_list_to_string(self):
+        expectation = TestExpectationLine()
+        expectation.comment = 'Qux.'
+        expectation.name = 'bar'
+        expectation.modifiers = ['foo']
+        expectation.expectations = ['bAz1', 'baZ2']
+        self.assertEqual(TestExpectationSerializer.list_to_string([expectation]), 'FOO : bar = BAZ1 BAZ2 //Qux.')
+
     def test_parsed_to_string(self):
         expectation_line = TestExpectationLine()
         expectation_line.parsed_bug_modifiers = ['BUGX']
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to