Title: [116787] trunk/Tools
Revision
116787
Author
[email protected]
Date
2012-05-11 11:10:34 -0700 (Fri, 11 May 2012)

Log Message

webkit-patch rebaseline should fetch stale expectations :)
https://bugs.webkit.org/show_bug.cgi?id=86231

Unreviewed, build fix.

This change reverts r115492 and goes back to fetching individual
baselines from the layout tests directory, rather than fetching
entire zip files. The performance hit over networks for people
far away from the bots has turned out to be severe, so we need a
better solution to this.

* Scripts/webkitpy/tool/commands/rebaseline.py:
(RebaselineTest._results_url):
(RebaselineTest._file_name_for_expected_result):
(RebaselineTest._rebaseline_test):
* Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
(TestRebaseline.test_rebaseline_updates_expectations_file_noop):
(test_rebaseline_updates_expectations_file):
(test_rebaseline_test):
(test_rebaseline_and_copy_test):
(test_rebaseline_and_copy_test_no_existing_result):
(test_rebaseline_and_copy_test_with_lion_result):
(test_rebaseline_and_copy_no_overwrite_test):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (116786 => 116787)


--- trunk/Tools/ChangeLog	2012-05-11 18:04:15 UTC (rev 116786)
+++ trunk/Tools/ChangeLog	2012-05-11 18:10:34 UTC (rev 116787)
@@ -1,3 +1,29 @@
+2012-05-11  Dirk Pranke  <[email protected]>
+
+        webkit-patch rebaseline should fetch stale expectations :)
+        https://bugs.webkit.org/show_bug.cgi?id=86231
+
+        Unreviewed, build fix.
+
+        This change reverts r115492 and goes back to fetching individual
+        baselines from the layout tests directory, rather than fetching
+        entire zip files. The performance hit over networks for people
+        far away from the bots has turned out to be severe, so we need a
+        better solution to this.
+
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (RebaselineTest._results_url):
+        (RebaselineTest._file_name_for_expected_result):
+        (RebaselineTest._rebaseline_test):
+        * Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
+        (TestRebaseline.test_rebaseline_updates_expectations_file_noop):
+        (test_rebaseline_updates_expectations_file):
+        (test_rebaseline_test):
+        (test_rebaseline_and_copy_test):
+        (test_rebaseline_and_copy_test_no_existing_result):
+        (test_rebaseline_and_copy_test_with_lion_result):
+        (test_rebaseline_and_copy_no_overwrite_test):
+
 2012-05-11  Christophe Dumez  <[email protected]>
 
         [GTK] LayoutTests/svg/batik/text/verticalText.svg fails to display Chinese characters

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-05-11 18:04:15 UTC (rev 116786)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-05-11 18:10:34 UTC (rev 116787)
@@ -38,7 +38,6 @@
 from webkitpy.common.net.layouttestresults import LayoutTestResults
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.common.system.user import User
-from webkitpy.common.system.zipfileset import ZipFileSet
 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter
 from webkitpy.layout_tests.models import test_failures
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
@@ -61,13 +60,10 @@
     help_text = "Rebaseline a single test from a buildbot.  (Currently works only with build.chromium.org buildbots.)"
     argument_names = "BUILDER_NAME TEST_NAME [PLATFORMS_TO_MOVE_EXISTING_BASELINES_TO]"
 
-    def __init__(self, options=None, **kwargs):
-        super(RebaselineTest, self).__init__(options, **kwargs)
-        self._zip_file_sets = {}
-
-    def _results_zip_url(self, builder_name):
+    def _results_url(self, builder_name):
         # FIXME: Generalize this command to work with non-build.chromium.org builders.
-        return self._tool.chromium_buildbot().builder_with_name(builder_name).accumulated_results_url().replace('results/layout-test-results', 'layout-test-results.zip')
+        builder = self._tool.chromium_buildbot().builder_with_name(builder_name)
+        return builder.accumulated_results_url()
 
     def _baseline_directory(self, builder_name):
         port = self._tool.port_factory.get_from_builder_name(builder_name)
@@ -133,35 +129,18 @@
     def _file_name_for_expected_result(self, test_name, suffix):
         return "%s-expected.%s" % (self._test_root(test_name), suffix)
 
-    def _zip_file_set(self, url):
-        return ZipFileSet(url)
-
-    def _fetch_baseline(self, builder_name, test_name, suffix):
-        # FIXME: See https://bugs.webkit.org/show_bug.cgi?id=84762 ... fetching the whole
-        # zip file and then extracting individual results is much slower than just fetching
-        # the result directly from the buildbot, but it guarantees that we are getting correct results.
-        member_name = self._file_name_for_actual_result(test_name, suffix)
-        zip_url = self._results_zip_url(builder_name)
-        if not builder_name in self._zip_file_sets:
-            print "Retrieving " + zip_url
-            self._zip_file_sets[builder_name] = self._zip_file_set(zip_url)
-
-        try:
-            data = "" + member_name)
-            print "  Found " + member_name
-            return data
-        except KeyError, e:
-            return None
-
     def _rebaseline_test(self, builder_name, test_name, platforms_to_move_existing_baselines_to, suffix):
+        results_url = self._results_url(builder_name)
         baseline_directory = self._baseline_directory(builder_name)
 
+        source_baseline = "%s/%s" % (results_url, self._file_name_for_actual_result(test_name, suffix))
         target_baseline = self._tool.filesystem.join(baseline_directory, self._file_name_for_expected_result(test_name, suffix))
 
         if platforms_to_move_existing_baselines_to:
             self._copy_existing_baseline(platforms_to_move_existing_baselines_to, test_name, suffix)
 
-        self._save_baseline(self._fetch_baseline(builder_name, test_name, suffix), target_baseline)
+        print "Retrieving %s." % source_baseline
+        self._save_baseline(self._tool.web.get_binary(source_baseline, convert_404_to_None=True), target_baseline)
 
     def _rebaseline_test_and_update_expectations(self, builder_name, test_name, platforms_to_move_existing_baselines_to):
         for suffix in _baseline_suffix_list:

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-05-11 18:04:15 UTC (rev 116786)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-05-11 18:10:34 UTC (rev 116787)
@@ -36,20 +36,6 @@
 
 
 class TestRebaseline(unittest.TestCase):
-    def stub_rebaseline_test_command_and_tool(self):
-
-        class FakeZipFileSet(object):
-            contents = {}
-
-            def read(self, member):
-                return self.contents[member]
-
-        command = RebaselineTest()
-        tool = MockTool()
-        command.bind_to_tool(tool)
-        command._zip_file_set = lambda url: FakeZipFileSet()
-        return (command, tool)
-
     def test_tests_to_update(self):
         command = Rebaseline()
         command.bind_to_tool(MockTool())
@@ -57,7 +43,10 @@
         OutputCapture().assert_outputs(self, command._tests_to_update, [build])
 
     def test_rebaseline_updates_expectations_file_noop(self):
-        command, tool = self.stub_rebaseline_test_command_and_tool()
+        command = RebaselineTest()
+        tool = MockTool()
+        command.bind_to_tool(tool)
+
         lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
         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
 BUGA DEBUG : fast/css/large-list-of-rules-crash.html = TEXT
@@ -66,7 +55,10 @@
         tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "fast/css/large-list-of-rules-crash.html"), "Dummy test contents")
         tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "userscripts/another-test.html"), "Dummy test contents")
 
-        expected_stdout = "Retrieving http://example.com/f/builders/Webkit Mac10.7/layout-test-results.zip\n"
+        expected_stdout = """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.
+"""
         OutputCapture().assert_outputs(self, command._rebaseline_test_and_update_expectations, ["Webkit Mac10.7", "userscripts/another-test.html", None], expected_stdout=expected_stdout)
 
         new_expectations = tool.filesystem.read_text_file(lion_port.path_to_test_expectations_file())
@@ -75,56 +67,70 @@
 """)
 
     def test_rebaseline_updates_expectations_file(self):
-        command, tool = self.stub_rebaseline_test_command_and_tool()
+        command = RebaselineTest()
+        tool = MockTool()
+        command.bind_to_tool(tool)
 
         lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
         tool.filesystem.write_text_file(lion_port.path_to_test_expectations_file(), "BUGX MAC : userscripts/another-test.html = IMAGE\nBUGZ LINUX : userscripts/another-test.html = IMAGE\n")
         tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "userscripts/another-test.html"), "Dummy test contents")
 
-        expected_stdout = "Retrieving http://example.com/f/builders/Webkit Mac10.7/layout-test-results.zip\n"
+        expected_stdout = """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.
+"""
         OutputCapture().assert_outputs(self, command._rebaseline_test_and_update_expectations, ["Webkit Mac10.7", "userscripts/another-test.html", None], expected_stdout=expected_stdout)
 
         new_expectations = tool.filesystem.read_text_file(lion_port.path_to_test_expectations_file())
         self.assertEqual(new_expectations, "BUGX LEOPARD SNOWLEOPARD : userscripts/another-test.html = IMAGE\nBUGZ LINUX : userscripts/another-test.html = IMAGE\n")
 
     def test_rebaseline_test(self):
-        command, _ = self.stub_rebaseline_test_command_and_tool()
-        expected_stdout = "Retrieving http://example.com/f/builders/Webkit Linux/layout-test-results.zip\n"
+        command = RebaselineTest()
+        command.bind_to_tool(MockTool())
+        expected_stdout = "Retrieving http://example.com/f/builders/Webkit Linux/results/layout-test-results/userscripts/another-test-actual.txt.\n"
         OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Linux", "userscripts/another-test.html", None, "txt"], expected_stdout=expected_stdout)
 
     def test_rebaseline_and_copy_test(self):
-        command, tool = self.stub_rebaseline_test_command_and_tool()
+        command = RebaselineTest()
+        tool = MockTool()
+        command.bind_to_tool(tool)
 
         lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
         tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "userscripts/another-test-expected.txt"), "Dummy expected result")
 
         expected_stdout = """Copying baseline from /mock-checkout/LayoutTests/userscripts/another-test-expected.txt to /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt.
-Retrieving http://example.com/f/builders/Webkit Mac10.7/layout-test-results.zip
+Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt.
 """
         OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_stdout=expected_stdout)
 
     def test_rebaseline_and_copy_test_no_existing_result(self):
-        command, _ = self.stub_rebaseline_test_command_and_tool()
+        command = RebaselineTest()
+        tool = MockTool()
+        command.bind_to_tool(tool)
 
         expected_stdout = """No existing baseline for userscripts/another-test.html.
-Retrieving http://example.com/f/builders/Webkit Mac10.7/layout-test-results.zip
+Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt.
 """
         OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_stdout=expected_stdout)
 
     def test_rebaseline_and_copy_test_with_lion_result(self):
-        command, tool = self.stub_rebaseline_test_command_and_tool()
+        command = RebaselineTest()
+        tool = MockTool()
+        command.bind_to_tool(tool)
 
         lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
         tool.filesystem.write_text_file(os.path.join(lion_port.baseline_path(), "userscripts/another-test-expected.txt"), "Dummy expected result")
 
         expected_stdout = """Copying baseline from /mock-checkout/LayoutTests/platform/chromium-mac/userscripts/another-test-expected.txt to /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt.
 Copying baseline from /mock-checkout/LayoutTests/platform/chromium-mac/userscripts/another-test-expected.txt to /mock-checkout/LayoutTests/platform/chromium-mac-leopard/userscripts/another-test-expected.txt.
-Retrieving http://example.com/f/builders/Webkit Mac10.7/layout-test-results.zip
+Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt.
 """
         OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard", "chromium-mac-leopard"], "txt"], expected_stdout=expected_stdout)
 
     def test_rebaseline_and_copy_no_overwrite_test(self):
-        command, tool = self.stub_rebaseline_test_command_and_tool()
+        command = RebaselineTest()
+        tool = MockTool()
+        command.bind_to_tool(tool)
 
         lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
         tool.filesystem.write_text_file(os.path.join(lion_port.baseline_path(), "userscripts/another-test-expected.txt"), "Dummy expected result")
@@ -133,7 +139,7 @@
         tool.filesystem.write_text_file(os.path.join(snowleopard_port.baseline_path(), "userscripts/another-test-expected.txt"), "Dummy expected result")
 
         expected_stdout = """Existing baseline at /mock-checkout/LayoutTests/platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt, not copying over it.
-Retrieving http://example.com/f/builders/Webkit Mac10.7/layout-test-results.zip
+Retrieving http://example.com/f/builders/Webkit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt.
 """
         OutputCapture().assert_outputs(self, command._rebaseline_test, ["Webkit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt"], expected_stdout=expected_stdout)
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to