Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (92635 => 92636)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2011-08-08 21:28:53 UTC (rev 92635)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2011-08-08 21:35:08 UTC (rev 92636)
@@ -166,11 +166,20 @@
return result
@classmethod
- def list_to_string(cls, expectation_lines, test_configuration_converter):
+ def list_to_string(cls, expectation_lines, test_configuration_converter, reconstitute_only_these=None):
serializer = cls(test_configuration_converter)
- return "\n".join([line for line in [serializer.to_string(expectation_line) for expectation_line in expectation_lines] if line is not None])
+ def serialize(expectation_line):
+ if not reconstitute_only_these or expectation_line in reconstitute_only_these:
+ return serializer.to_string(expectation_line)
+ return expectation_line.original_string
+ def nones_out(expectation_line):
+ return expectation_line is not None
+
+ return "\n".join(filter(nones_out, map(serialize, expectation_lines)))
+
+
class TestExpectationParser(object):
"""Provides parsing facilities for lines in the test_expectation.txt file."""
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py (92635 => 92636)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py 2011-08-08 21:28:53 UTC (rev 92635)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py 2011-08-08 21:35:08 UTC (rev 92636)
@@ -464,7 +464,8 @@
class TestExpectationSerializerTests(unittest.TestCase):
def __init__(self, testFunc):
test_port = port.get('test-win-xp', None)
- self._serializer = TestExpectationSerializer(TestConfigurationConverter(test_port.all_test_configurations(), test_port.configuration_specifier_macros()))
+ self._converter = TestConfigurationConverter(test_port.all_test_configurations(), test_port.configuration_specifier_macros())
+ self._serializer = TestExpectationSerializer(self._converter)
unittest.TestCase.__init__(self, testFunc)
def assert_round_trip(self, in_string, expected_string=None):
@@ -477,7 +478,7 @@
expectations = TestExpectationParser.tokenize_list(in_string)
if expected_string is None:
expected_string = in_string
- self.assertEqual(expected_string, TestExpectationSerializer.list_to_string(expectations, SpecifierSorter()))
+ self.assertEqual(expected_string, TestExpectationSerializer.list_to_string(expectations, self._converter))
def test_unparsed_to_string(self):
expectation = TestExpectationLine()
@@ -540,7 +541,6 @@
expectation_line.parsed_modifiers = ['garden-o-matic', 'total', 'is']
self.assertEqual(self._serializer._parsed_modifier_string(expectation_line, ['win']), 'garden-o-matic is total win')
-
def test_format_result(self):
self.assertEqual(TestExpectationSerializer._format_result('modifiers', 'name', 'expectations', 'comment'), 'MODIFIERS : name = EXPECTATIONS //comment')
self.assertEqual(TestExpectationSerializer._format_result('modifiers', 'name', 'expectations', None), 'MODIFIERS : name = EXPECTATIONS')
@@ -577,6 +577,29 @@
self.assert_list_round_trip('bar\n//Qux.')
self.assert_list_round_trip('bar\n//Qux.\n')
+ def test_reconstitute_only_these(self):
+ lines = []
+ reconstitute_only_these = []
+
+ def add_line(matching_configurations, reconstitute):
+ expectation_line = TestExpectationLine()
+ expectation_line.original_string = "Nay"
+ expectation_line.parsed_bug_modifiers = ['BUGX']
+ expectation_line.name = 'Yay'
+ expectation_line.parsed_expectations = set([IMAGE])
+ expectation_line.matching_configurations = matching_configurations
+ lines.append(expectation_line)
+ if reconstitute:
+ reconstitute_only_these.append(expectation_line)
+
+ add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')]), False)
+ add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'release', 'gpu')]), True)
+ add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu')]), False)
+ serialized = TestExpectationSerializer.list_to_string(lines, self._converter)
+ 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")
+ serialized = TestExpectationSerializer.list_to_string(lines, self._converter, reconstitute_only_these=reconstitute_only_these)
+ self.assertEquals(serialized, "Nay\nBUGX XP RELEASE : Yay = IMAGE\nNay")
+
def test_string_whitespace_stripping(self):
self.assert_round_trip('\n', '')
self.assert_round_trip(' FOO : bar = BAZ', 'FOO : bar = BAZ')
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py (92635 => 92636)
--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py 2011-08-08 21:28:53 UTC (rev 92635)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py 2011-08-08 21:35:08 UTC (rev 92636)
@@ -55,13 +55,14 @@
for expectation_line in expectation_lines:
self._parser.parse(expectation_line)
editor = TestExpectationsEditor(expectation_lines, self)
+ updated_expectation_lines = []
for failure_info in failure_info_list:
expectation_set = set(filter(None, map(TestExpectations.expectation_from_string, failure_info['failureTypeList'])))
assert(expectation_set)
test_name = failure_info['testName']
assert(test_name)
- editor.update_expectation(test_name, set([self._builder_to_test_config(failure_info['builderName'])]), expectation_set)
- self._tool.filesystem.write_text_file(self._path_to_test_expectations_file, TestExpectationSerializer.list_to_string(expectation_lines, self._converter))
+ updated_expectation_lines.extend(editor.update_expectation(test_name, set([self._builder_to_test_config(failure_info['builderName'])]), expectation_set))
+ 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))
class GardeningHTTPServer(BaseHTTPServer.HTTPServer):
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py (92635 => 92636)
--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py 2011-08-08 21:28:53 UTC (rev 92635)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py 2011-08-08 21:35:08 UTC (rev 92636)
@@ -141,7 +141,13 @@
expectations_after = "BUG_OLD XP RELEASE GPU : failures/expected/image.html = TEXT\nBUG_NEW XP RELEASE CPU : failures/expected/image.html = IMAGE"
self.assert_update(failure_info_list, expectations_before=expectations_before, expectations_after=expectations_after)
+ def test_spurious_updates(self):
+ failure_info_list = [{"testName": "failures/expected/image.html", "builderName": "Webkit Win", "failureTypeList": ["IMAGE"]}]
+ expectations_before = "BUG_OLDER MAC LINUX : failures/expected/image.html = IMAGE+TEXT\nBUG_OLD XP RELEASE CPU : failures/expected/image.html = TEXT"
+ expectations_after = "BUG_OLDER MAC LINUX : failures/expected/image.html = IMAGE+TEXT\nBUG_NEW XP RELEASE CPU : failures/expected/image.html = IMAGE"
+ self.assert_update(failure_info_list, expectations_before=expectations_before, expectations_after=expectations_after)
+
class GardeningServerTest(unittest.TestCase):
def _post_to_path(self, path, body=None, expected_stderr=None, expected_stdout=None):
handler = TestGardeningHTTPRequestHandler(MockServer())