Title: [110585] trunk/Tools
Revision
110585
Author
[email protected]
Date
2012-03-13 11:34:06 -0700 (Tue, 13 Mar 2012)

Log Message

Rebaselining for a new port doesn't work right with multiple fallback ports
https://bugs.webkit.org/show_bug.cgi?id=80932

Reviewed by Adam Barth.

Since chromium-leopard also falls back to mac-leopard, we need to
copy the existing result for both chromium-leopard and chromium-snowleopard
before doing lion rebaselines.

* Scripts/webkitpy/layout_tests/port/builders.py:
(fallback_port_names_for_new_port):
* Scripts/webkitpy/tool/commands/rebaseline.py:
(RebaselineTest):
(RebaselineTest._copy_existing_baseline):
(RebaselineTest._rebaseline_test):
(RebaselineTest.execute):
* Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
* Scripts/webkitpy/tool/servers/gardeningserver.py:
(GardeningHTTPRequestHandler.rebaseline):
* Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:
(GardeningServerTest.test_rebaseline_new_port):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (110584 => 110585)


--- trunk/Tools/ChangeLog	2012-03-13 18:21:14 UTC (rev 110584)
+++ trunk/Tools/ChangeLog	2012-03-13 18:34:06 UTC (rev 110585)
@@ -1,3 +1,27 @@
+2012-03-13  Ojan Vafai  <[email protected]>
+
+        Rebaselining for a new port doesn't work right with multiple fallback ports
+        https://bugs.webkit.org/show_bug.cgi?id=80932
+
+        Reviewed by Adam Barth.
+
+        Since chromium-leopard also falls back to mac-leopard, we need to
+        copy the existing result for both chromium-leopard and chromium-snowleopard
+        before doing lion rebaselines.
+
+        * Scripts/webkitpy/layout_tests/port/builders.py:
+        (fallback_port_names_for_new_port):
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (RebaselineTest):
+        (RebaselineTest._copy_existing_baseline):
+        (RebaselineTest._rebaseline_test):
+        (RebaselineTest.execute):
+        * Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
+        * Scripts/webkitpy/tool/servers/gardeningserver.py:
+        (GardeningHTTPRequestHandler.rebaseline):
+        * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:
+        (GardeningServerTest.test_rebaseline_new_port):
+
 2012-03-13  Tor Arne Vestbø  <[email protected]>
 
         [Qt] Tweak minibrowser UI

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/builders.py (110584 => 110585)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/builders.py	2012-03-13 18:21:14 UTC (rev 110584)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/builders.py	2012-03-13 18:34:06 UTC (rev 110585)
@@ -50,7 +50,7 @@
     "Webkit Mac10.5 (dbg)(2)": {"port_name": "chromium-mac-leopard", "specifiers": set(["leopard", "debug"])},
     "Webkit Mac10.6": {"port_name": "chromium-mac-snowleopard", "specifiers": set(["snowleopard"])},
     "Webkit Mac10.6 (dbg)": {"port_name": "chromium-mac-snowleopard", "specifiers": set(["snowleopard", "debug"])},
-    "Webkit Mac10.7": {"port_name": "chromium-mac-lion", "specifiers": set(["lion"]), "move_overwritten_baselines_to": "chromium-mac-snowleopard"},
+    "Webkit Mac10.7": {"port_name": "chromium-mac-lion", "specifiers": set(["lion"]), "move_overwritten_baselines_to": ["chromium-mac-snowleopard", "chromium-mac-leopard"]},
 
     # These builders are on build.webkit.org.
     "GTK Linux 32-bit Debug": {"port_name": "gtk", "specifiers": set(["gtk"])},
@@ -123,5 +123,5 @@
     builder_path_from_name(builder_name_for_port_name(port_name))
 
 
-def fallback_port_name_for_new_port(builder_name):
-    return _exact_matches[builder_name].get("move_overwritten_baselines_to")
+def fallback_port_names_for_new_port(builder_name):
+    return _exact_matches[builder_name].get("move_overwritten_baselines_to", [])

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-03-13 18:21:14 UTC (rev 110584)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-03-13 18:34:06 UTC (rev 110585)
@@ -57,7 +57,7 @@
 class RebaselineTest(AbstractDeclarativeCommand):
     name = "rebaseline-test"
     help_text = "Rebaseline a single test from a buildbot.  (Currently works only with build.chromium.org buildbots.)"
-    argument_names = "BUILDER_NAME TEST_NAME [PLATFORM_TO_MOVE_EXISTING_BASELINES_TO]"
+    argument_names = "BUILDER_NAME TEST_NAME [PLATFORMS_TO_MOVE_EXISTING_BASELINES_TO]"
 
     def _results_url(self, builder_name):
         # FIXME: Generalize this command to work with non-build.chromium.org builders.
@@ -68,17 +68,31 @@
         port = self._tool.port_factory.get_from_builder_name(builder_name)
         return port.baseline_path()
 
-    def _copy_existing_baseline(self, platform_to_move_existing_baselines_to, test_name, suffix):
-        port = self._tool.port_factory.get(platform_to_move_existing_baselines_to)
-        old_baseline = port.expected_filename(test_name, "." + suffix)
-        if not self._tool.filesystem.exists(old_baseline):
-            print("No existing baseline for %s." % test_name)
-            return
+    def _copy_existing_baseline(self, platforms_to_move_existing_baselines_to, test_name, suffix):
+        old_baselines = []
+        new_baselines = []
 
-        new_baseline = self._tool.filesystem.join(port.baseline_path(), self._file_name_for_expected_result(test_name, suffix))
-        if self._tool.filesystem.exists(new_baseline):
-            print("Existing baseline at %s, not copying over it." % new_baseline)
-        else:
+        # Need to gather all the baseline paths before modifying the filesystem since
+        # the modifications can affect the results of port.expected_filename.
+        for platform in platforms_to_move_existing_baselines_to:
+            port = self._tool.port_factory.get(platform)
+            old_baseline = port.expected_filename(test_name, "." + suffix)
+            if not self._tool.filesystem.exists(old_baseline):
+                print("No existing baseline for %s." % test_name)
+                continue
+
+            new_baseline = self._tool.filesystem.join(port.baseline_path(), self._file_name_for_expected_result(test_name, suffix))
+            if self._tool.filesystem.exists(new_baseline):
+                print("Existing baseline at %s, not copying over it." % new_baseline)
+                continue
+
+            old_baselines.append(old_baseline)
+            new_baselines.append(new_baseline)
+
+        for i in range(len(old_baselines)):
+            old_baseline = old_baselines[i]
+            new_baseline = new_baselines[i]
+
             print("Copying baseline from %s to %s." % (old_baseline, new_baseline))
             self._tool.filesystem.maybe_make_directory(self._tool.filesystem.dirname(new_baseline))
             self._tool.filesystem.copyfile(old_baseline, new_baseline)
@@ -103,15 +117,15 @@
     def _file_name_for_expected_result(self, test_name, suffix):
         return "%s-expected.%s" % (self._test_root(test_name), suffix)
 
-    def _rebaseline_test(self, builder_name, test_name, platform_to_move_existing_baselines_to, suffix):
+    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 platform_to_move_existing_baselines_to:
-            self._copy_existing_baseline(platform_to_move_existing_baselines_to, test_name, suffix)
+        if platforms_to_move_existing_baselines_to:
+            self._copy_existing_baseline(platforms_to_move_existing_baselines_to, test_name, suffix)
 
         print "Retrieving %s." % source_baseline
         self._save_baseline(self._tool.web.get_binary(source_baseline, convert_404_to_None=True), target_baseline)
@@ -119,13 +133,12 @@
     def execute(self, options, args, tool):
         for suffix in _baseline_suffix_list:
             if len(args) > 2:
-                platform_to_move_existing_baselines_to = args[2]
+                platforms_to_move_existing_baselines_to = args[2:]
             else:
-                platform_to_move_existing_baselines_to = None
+                platforms_to_move_existing_baselines_to = None
+            self._rebaseline_test(args[0], args[1], platforms_to_move_existing_baselines_to, suffix)
 
-            self._rebaseline_test(args[0], args[1], platform_to_move_existing_baselines_to, suffix)
 
-
 class OptimizeBaselines(AbstractDeclarativeCommand):
     name = "optimize-baselines"
     help_text = "Reshuffles the baselines for the given tests to use as litte space on disk as possible."

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-03-13 18:21:14 UTC (rev 110584)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-03-13 18:34:06 UTC (rev 110585)
@@ -59,7 +59,7 @@
         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/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)
+        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 = RebaselineTest()
@@ -69,7 +69,7 @@
         expected_stdout = """No existing baseline for userscripts/another-test.html.
 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)
+        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 = RebaselineTest()
@@ -80,9 +80,10 @@
         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/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)
+        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 = RebaselineTest()
@@ -98,7 +99,7 @@
         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/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)
+        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_expectations(self):
         command = RebaselineExpectations()

Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py (110584 => 110585)


--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py	2012-03-13 18:21:14 UTC (rev 110584)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py	2012-03-13 18:34:06 UTC (rev 110585)
@@ -142,9 +142,7 @@
             builder,
             self.query['test'][0],
         ]
-        fallback_port = builders.fallback_port_name_for_new_port(builder)
-        if fallback_port:
-            command.append(fallback_port)
+        command.extend(builders.fallback_port_names_for_new_port(builder))
         self._run_webkit_patch(command)
         self._serve_text('success')
 

Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py (110584 => 110585)


--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py	2012-03-13 18:21:14 UTC (rev 110584)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py	2012-03-13 18:34:06 UTC (rev 110585)
@@ -188,8 +188,8 @@
         self._post_to_path("/rebaseline?builder=MOCK+builder&test=user-scripts/another-test.html", expected_stderr=expected_stderr, expected_stdout=expected_stdout)
 
     def test_rebaseline_new_port(self):
-        builders._exact_matches = {"MOCK builder": {"port_name": "mock-port-name", "specifiers": set(["mock-specifier"]), "move_overwritten_baselines_to": "mock-port-fallback"}}
-        expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', 'MOCK builder', 'user-scripts/another-test.html', 'mock-port-fallback'], cwd=/mock-checkout\n"
+        builders._exact_matches = {"MOCK builder": {"port_name": "mock-port-name", "specifiers": set(["mock-specifier"]), "move_overwritten_baselines_to": ["mock-port-fallback", "mock-port-fallback2"]}}
+        expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', 'MOCK builder', 'user-scripts/another-test.html', 'mock-port-fallback', 'mock-port-fallback2'], cwd=/mock-checkout\n"
         expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n"
         self._post_to_path("/rebaseline?builder=MOCK+builder&test=user-scripts/another-test.html", expected_stderr=expected_stderr, expected_stdout=expected_stdout)
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to