Title: [125115] trunk/Tools
Revision
125115
Author
[email protected]
Date
2012-08-08 16:55:46 -0700 (Wed, 08 Aug 2012)

Log Message

webkit-patch rebaseline-expectations needs to support multiple expectations files
https://bugs.webkit.org/show_bug.cgi?id=89051

Reviewed by Adam Barth.

fixed the bug described above, added unit test in
test_expectations_unittest, and updated the tool tests
to not contain all of the "missing skia expectations" warnings.

* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectations.remove_rebaselined_tests):
(TestExpectations.remove_rebaselined_tests.without_rebaseline_modifier):
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
(RebaseliningTest.assertRemove):
(RebaseliningTest.test_remove):
* Scripts/webkitpy/tool/commands/rebaseline.py:
(RebaselineExpectations._update_expectations_files):
(RebaselineExpectations.execute):
* Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
(TestRebaseline.test_rebaseline_updates_expectations_file_noop):
(test_rebaseline_expectations):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (125114 => 125115)


--- trunk/Tools/ChangeLog	2012-08-08 23:50:35 UTC (rev 125114)
+++ trunk/Tools/ChangeLog	2012-08-08 23:55:46 UTC (rev 125115)
@@ -1,3 +1,27 @@
+2012-08-08  Dirk Pranke  <[email protected]>
+
+        webkit-patch rebaseline-expectations needs to support multiple expectations files
+        https://bugs.webkit.org/show_bug.cgi?id=89051
+
+        Reviewed by Adam Barth.
+
+        fixed the bug described above, added unit test in
+        test_expectations_unittest, and updated the tool tests
+        to not contain all of the "missing skia expectations" warnings.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectations.remove_rebaselined_tests):
+        (TestExpectations.remove_rebaselined_tests.without_rebaseline_modifier):
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+        (RebaseliningTest.assertRemove):
+        (RebaseliningTest.test_remove):
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (RebaselineExpectations._update_expectations_files):
+        (RebaselineExpectations.execute):
+        * Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
+        (TestRebaseline.test_rebaseline_updates_expectations_file_noop):
+        (test_rebaseline_expectations):
+
 2012-08-08  Alexey Proskuryakov  <[email protected]>
 
         [WK2] MiniBrowser crashes on quit if any windows were previously closed

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2012-08-08 23:50:35 UTC (rev 125114)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2012-08-08 23:55:46 UTC (rev 125115)
@@ -852,10 +852,13 @@
 
         return TestExpectationSerializer.list_to_string(self._expectations, self._parser._test_configuration_converter, modified_expectations)
 
-    def remove_rebaselined_tests(self, except_these_tests):
-        """Returns a copy of the expectations with the tests removed."""
+    def remove_rebaselined_tests(self, except_these_tests, filename):
+        """Returns a copy of the expectations in the file with the tests removed."""
         def without_rebaseline_modifier(expectation):
-            return not (not expectation.is_invalid() and expectation.name in except_these_tests and "rebaseline" in expectation.modifiers)
+            return not (not expectation.is_invalid() and
+                        expectation.name in except_these_tests and
+                        "rebaseline" in expectation.modifiers and
+                        filename == expectation.filename)
 
         return TestExpectationSerializer.list_to_string(filter(without_rebaseline_modifier, self._expectations))
 

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2012-08-08 23:50:35 UTC (rev 125114)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2012-08-08 23:55:46 UTC (rev 125115)
@@ -456,9 +456,9 @@
 
 class RebaseliningTest(Base):
     """Test rebaselining-specific functionality."""
-    def assertRemove(self, input_expectations, tests, expected_expectations):
+    def assertRemove(self, input_expectations, tests, expected_expectations, filename):
         self.parse_exp(input_expectations, is_lint_mode=False)
-        actual_expectations = self._exp.remove_rebaselined_tests(tests)
+        actual_expectations = self._exp.remove_rebaselined_tests(tests, filename)
         self.assertEqual(expected_expectations, actual_expectations)
 
     def test_remove(self):
@@ -467,8 +467,20 @@
                           'BUGZ REBASELINE : failures/expected/crash.html = CRASH\n',
                           ['failures/expected/text.html'],
                           'BUGY : failures/expected/image.html = IMAGE\n'
-                          'BUGZ REBASELINE : failures/expected/crash.html = CRASH\n')
+                          'BUGZ REBASELINE : failures/expected/crash.html = CRASH\n',
+                          'expectations')
 
+        # test that we don't remove lines from the expectations if we're asking for the overrides
+        self.assertRemove('BUGX REBASELINE : failures/expected/text.html = TEXT\n'
+                          'BUGY : failures/expected/image.html = IMAGE\n'
+                          'BUGZ REBASELINE : failures/expected/crash.html = CRASH\n',
+                          ['failures/expected/text.html'],
+                          'BUGX REBASELINE : failures/expected/text.html = TEXT\n'
+                          'BUGY : failures/expected/image.html = IMAGE\n'
+                          'BUGZ REBASELINE : failures/expected/crash.html = CRASH\n',
+                          'overrides')
+
+
     def test_no_get_rebaselining_failures(self):
         self.parse_exp(self.get_basic_expectations())
         self.assertEqual(len(self._exp.get_rebaselining_failures()), 0)

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py (125114 => 125115)


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-08-08 23:50:35 UTC (rev 125114)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-08-08 23:55:46 UTC (rev 125115)
@@ -321,16 +321,13 @@
     name = "rebaseline-expectations"
     help_text = "Rebaselines the tests indicated in TestExpectations."
 
-    def _update_expectations_file(self, port_name):
+    def _update_expectations_files(self, port_name):
         port = self._tool.port_factory.get(port_name)
 
-        # FIXME: This will intentionally skip over any REBASELINE expectations that were in an overrides file.
-        # This is not good, but avoids having the overrides getting written into the main file.
-        # See https://bugs.webkit.org/show_bug.cgi?id=88456 for context. This will no longer be needed
-        # once we properly support cascading expectations files.
         expectations = TestExpectations(port, include_overrides=False)
-        path = port.path_to_test_expectations_file()
-        self._tool.filesystem.write_text_file(path, expectations.remove_rebaselined_tests(expectations.get_rebaselining_failures()))
+        for path in port.expectations_dict():
+            if self._tool.filesystem.exists(path):
+                self._tool.filesystem.write_text_file(path, expectations.remove_rebaselined_tests(expectations.get_rebaselining_failures(), path))
 
     def _tests_to_rebaseline(self, port):
         tests_to_rebaseline = {}
@@ -361,7 +358,7 @@
         self._rebaseline(options, self._test_list)
 
         for port_name in tool.port_factory.all_port_names():
-            self._update_expectations_file(port_name)
+            self._update_expectations_files(port_name)
 
 
 class Rebaseline(AbstractParallelRebaselineCommand):

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py (125114 => 125115)


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-08-08 23:50:35 UTC (rev 125114)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-08-08 23:55:46 UTC (rev 125115)
@@ -63,6 +63,8 @@
         command.bind_to_tool(tool)
 
         lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
+        # FIXME: work around the chromium skia expectations file to avoid getting a bunch of confusing warnings.
+        tool.filesystem.write_text_file(lion_port.path_from_chromium_base('skia', 'skia_test_expectations.txt'), '')
         for path in lion_port.expectations_files():
             tool.filesystem.write_text_file(path, '')
         tool.filesystem.write_text_file(lion_port.path_to_test_expectations_file(), """BUGB MAC LINUX XP DEBUG : fast/dom/Window/window-postmessage-clone-really-deep-array.html = PASS
@@ -75,7 +77,6 @@
         expected_logs = """Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.png.
 Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.wav.
 Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt.
-Using the chromium port without having the downstream skia_test_expectations.txt file checked out. Expectations related things might be wonky.
 """
         OutputCapture().assert_outputs(self, command._rebaseline_test_and_update_expectations, ["Webkit Mac10.7", "userscripts/another-test.html", None], expected_logs=expected_logs)
 
@@ -227,6 +228,9 @@
         tool = MockTool()
         command.bind_to_tool(tool)
 
+        # FIXME: work around the chromium skia expectations file to avoid getting a bunch of confusing warnings.
+        lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
+        tool.filesystem.write_text_file(lion_port.path_from_chromium_base('skia', 'skia_test_expectations.txt'), '')
         for port_name in tool.port_factory.all_port_names():
             port = tool.port_factory.get(port_name)
             for path in port.expectations_files():
@@ -274,12 +278,6 @@
 Retrieving results for win-7sp0 from Apple Win 7 Release (Tests).
     userscripts/another-test.html (txt)
     userscripts/images.svg (png)
-Using the chromium port without having the downstream skia_test_expectations.txt file checked out. Expectations related things might be wonky.
-Using the chromium port without having the downstream skia_test_expectations.txt file checked out. Expectations related things might be wonky.
-Using the chromium port without having the downstream skia_test_expectations.txt file checked out. Expectations related things might be wonky.
-Using the chromium port without having the downstream skia_test_expectations.txt file checked out. Expectations related things might be wonky.
-Using the chromium port without having the downstream skia_test_expectations.txt file checked out. Expectations related things might be wonky.
-Using the chromium port without having the downstream skia_test_expectations.txt file checked out. Expectations related things might be wonky.
 """
 
         expected_stdout = """[(['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Linux 32', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Linux', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Mac10.6', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Mac10.7', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Win7', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Apple Win 7 Release (Tests)', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'EFL Linux 64-bit Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Webkit Win', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'GTK Linux 64-bit Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Qt Linux Release', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'Apple Lion Release WK1 (Tests)', '--test', 'userscripts/another-test.html'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Linux 32', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Linux', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Mac10.6', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Mac10.7', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Win7', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Apple Win 7 Release (Tests)', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'EFL Linux 64-bit Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Webkit Win', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'GTK Linux 64-bit Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Qt Linux Release', '--test', 'userscripts/images.svg'], '/mock-checkout'), (['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'Apple Lion Release WK1 (Tests)', '--test', 'userscripts/images.svg'], '/mock-checkout')]
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to