Changeset 92636 in webkit


Ignore:
Timestamp:
Aug 8, 2011 2:35:08 PM (13 years ago)
Author:
Dimitri Glazkov
Message:

garden-o-matic should only touch expectations that need updating.
https://bugs.webkit.org/show_bug.cgi?id=65876

Reviewed by Adam Barth.

  • Scripts/webkitpy/layout_tests/models/test_expectations.py: Added reconstitute_only_these to TestExpectationSerializer.list_to_string,

so that a caller could influence which lines to serialize from values.

  • Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Added tests.
  • Scripts/webkitpy/tool/servers/gardeningserver.py: Started using reconstitute_only_these.
  • Scripts/webkitpy/tool/servers/gardeningserver_unittest.py: Added tests.
Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r92634 r92636  
     12011-08-08  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        garden-o-matic should only touch expectations that need updating.
     4        https://bugs.webkit.org/show_bug.cgi?id=65876
     5
     6        Reviewed by Adam Barth.
     7
     8        * Scripts/webkitpy/layout_tests/models/test_expectations.py: Added reconstitute_only_these to TestExpectationSerializer.list_to_string,
     9            so that a caller could influence which lines to serialize from values.
     10        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Added tests.
     11        * Scripts/webkitpy/tool/servers/gardeningserver.py: Started using reconstitute_only_these.
     12        * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py: Added tests.
     13
    1142011-08-08  Dimitri Glazkov  <dglazkov@chromium.org>
    215
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

    r92634 r92636  
    167167
    168168    @classmethod
    169     def list_to_string(cls, expectation_lines, test_configuration_converter):
     169    def list_to_string(cls, expectation_lines, test_configuration_converter, reconstitute_only_these=None):
    170170        serializer = cls(test_configuration_converter)
    171         return "\n".join([line for line in [serializer.to_string(expectation_line) for expectation_line in expectation_lines] if line is not None])
     171
     172        def serialize(expectation_line):
     173            if not reconstitute_only_these or expectation_line in reconstitute_only_these:
     174                return serializer.to_string(expectation_line)
     175            return expectation_line.original_string
     176
     177        def nones_out(expectation_line):
     178            return expectation_line is not None
     179
     180        return "\n".join(filter(nones_out, map(serialize, expectation_lines)))
    172181
    173182
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py

    r92634 r92636  
    465465    def __init__(self, testFunc):
    466466        test_port = port.get('test-win-xp', None)
    467         self._serializer = TestExpectationSerializer(TestConfigurationConverter(test_port.all_test_configurations(), test_port.configuration_specifier_macros()))
     467        self._converter = TestConfigurationConverter(test_port.all_test_configurations(), test_port.configuration_specifier_macros())
     468        self._serializer = TestExpectationSerializer(self._converter)
    468469        unittest.TestCase.__init__(self, testFunc)
    469470
     
    478479        if expected_string is None:
    479480            expected_string = in_string
    480         self.assertEqual(expected_string, TestExpectationSerializer.list_to_string(expectations, SpecifierSorter()))
     481        self.assertEqual(expected_string, TestExpectationSerializer.list_to_string(expectations, self._converter))
    481482
    482483    def test_unparsed_to_string(self):
     
    540541        expectation_line.parsed_modifiers = ['garden-o-matic', 'total', 'is']
    541542        self.assertEqual(self._serializer._parsed_modifier_string(expectation_line, ['win']), 'garden-o-matic is total win')
    542 
    543543
    544544    def test_format_result(self):
     
    578578        self.assert_list_round_trip('bar\n//Qux.\n')
    579579
     580    def test_reconstitute_only_these(self):
     581        lines = []
     582        reconstitute_only_these = []
     583
     584        def add_line(matching_configurations, reconstitute):
     585            expectation_line = TestExpectationLine()
     586            expectation_line.original_string = "Nay"
     587            expectation_line.parsed_bug_modifiers = ['BUGX']
     588            expectation_line.name = 'Yay'
     589            expectation_line.parsed_expectations = set([IMAGE])
     590            expectation_line.matching_configurations = matching_configurations
     591            lines.append(expectation_line)
     592            if reconstitute:
     593                reconstitute_only_these.append(expectation_line)
     594
     595        add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')]), False)
     596        add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'release', 'gpu')]), True)
     597        add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu')]), False)
     598        serialized = TestExpectationSerializer.list_to_string(lines, self._converter)
     599        self.assertEquals(serialized, "BUGX XP RELEASE CPU : Yay = IMAGE\nBUGX XP RELEASE : Yay = IMAGE\nBUGX XP RELEASE CPU : Yay = IMAGE\nBUGX XP DEBUG GPU : Yay = IMAGE")
     600        serialized = TestExpectationSerializer.list_to_string(lines, self._converter, reconstitute_only_these=reconstitute_only_these)
     601        self.assertEquals(serialized, "Nay\nBUGX XP RELEASE : Yay = IMAGE\nNay")
     602
    580603    def test_string_whitespace_stripping(self):
    581604        self.assert_round_trip('\n', '')
  • trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py

    r92624 r92636  
    5656            self._parser.parse(expectation_line)
    5757        editor = TestExpectationsEditor(expectation_lines, self)
     58        updated_expectation_lines = []
    5859        for failure_info in failure_info_list:
    5960            expectation_set = set(filter(None, map(TestExpectations.expectation_from_string, failure_info['failureTypeList'])))
     
    6162            test_name = failure_info['testName']
    6263            assert(test_name)
    63             editor.update_expectation(test_name, set([self._builder_to_test_config(failure_info['builderName'])]), expectation_set)
    64         self._tool.filesystem.write_text_file(self._path_to_test_expectations_file, TestExpectationSerializer.list_to_string(expectation_lines, self._converter))
     64            updated_expectation_lines.extend(editor.update_expectation(test_name, set([self._builder_to_test_config(failure_info['builderName'])]), expectation_set))
     65        self._tool.filesystem.write_text_file(self._path_to_test_expectations_file, TestExpectationSerializer.list_to_string(expectation_lines, self._converter, reconstitute_only_these=updated_expectation_lines))
    6566
    6667
  • trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py

    r92624 r92636  
    142142        self.assert_update(failure_info_list, expectations_before=expectations_before, expectations_after=expectations_after)
    143143
     144    def test_spurious_updates(self):
     145        failure_info_list = [{"testName": "failures/expected/image.html", "builderName": "Webkit Win", "failureTypeList": ["IMAGE"]}]
     146        expectations_before = "BUG_OLDER MAC LINUX : failures/expected/image.html = IMAGE+TEXT\nBUG_OLD XP RELEASE CPU :  failures/expected/image.html = TEXT"
     147        expectations_after = "BUG_OLDER MAC LINUX : failures/expected/image.html = IMAGE+TEXT\nBUG_NEW XP RELEASE CPU : failures/expected/image.html = IMAGE"
     148        self.assert_update(failure_info_list, expectations_before=expectations_before, expectations_after=expectations_after)
     149
    144150
    145151class GardeningServerTest(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.