garden-o-matic should not fetch from debug bots if it also knows about the release...
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2012 00:03:14 +0000 (00:03 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2012 00:03:14 +0000 (00:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86916

Reviewed by Adam Barth.

Note that if release and debug are failing differently, debug
will be ignored ...

Note: also change the use of a fake port name from
"mock-port-name" to "test-mac-leopard" to make it more friendly
to the port factory ("mock" actually is a real port).

* Scripts/webkitpy/tool/servers/gardeningserver.py:
(GardeningHTTPRequestHandler._builders_to_fetch_from):
(GardeningHTTPRequestHandler.rebaselineall):
* Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:
(GardeningServerTest.test_rebaselineall):
(GardeningServerTest.test_rebaseline_new_port):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@118447 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/tool/servers/gardeningserver.py
Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py

index 0ac90bb..0b9d71b 100644 (file)
@@ -1,5 +1,26 @@
 2012-05-24  Dirk Pranke  <dpranke@chromium.org>
 
+        garden-o-matic should not fetch from debug bots if it also knows about the release bots
+        https://bugs.webkit.org/show_bug.cgi?id=86916
+
+        Reviewed by Adam Barth.
+
+        Note that if release and debug are failing differently, debug
+        will be ignored ...
+
+        Note: also change the use of a fake port name from
+        "mock-port-name" to "test-mac-leopard" to make it more friendly
+        to the port factory ("mock" actually is a real port).
+
+        * Scripts/webkitpy/tool/servers/gardeningserver.py:
+        (GardeningHTTPRequestHandler._builders_to_fetch_from):
+        (GardeningHTTPRequestHandler.rebaselineall):
+        * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:
+        (GardeningServerTest.test_rebaselineall):
+        (GardeningServerTest.test_rebaseline_new_port):
+
+2012-05-24  Dirk Pranke  <dpranke@chromium.org>
+
         nrwt: fix baseline search path for official chrome builders
         https://bugs.webkit.org/show_bug.cgi?id=87432
 
index 772c53a..09660f6 100644 (file)
@@ -150,13 +150,36 @@ class GardeningHTTPRequestHandler(ReflectionHandler):
         self._run_webkit_patch(command)
         self._serve_text('success')
 
+    def _builders_to_fetch_from(self, builders):
+        # This routine returns the subset of builders that will cover all of the baseline search paths
+        # used in the input list. In particular, if the input list contains both Release and Debug
+        # versions of a configuration, we *only* return the Release version (since we don't save
+        # debug versions of baselines).
+        release_builders = set()
+        debug_builders = set()
+        builders_to_fallback_paths = {}
+        for builder in builders:
+            port = self.server.tool.port_factory.get_from_builder_name(builder)
+            if port.test_configuration().build_type == 'Release':
+                release_builders.add(builder)
+            else:
+                debug_builders.add(builder)
+        for builder in list(release_builders) + list(debug_builders):
+            port = self.server.tool.port_factory.get_from_builder_name(builder)
+            fallback_path = port.baseline_search_path()
+            if fallback_path not in builders_to_fallback_paths.values():
+                builders_to_fallback_paths[builder] = fallback_path
+        return builders_to_fallback_paths.keys()
+
     def rebaselineall(self):
-        # FIXME: Optimize this to de-dup bot results, run in parallel, cache zips, etc.
+        # FIXME: Optimize this to run in parallel, cache zips, etc.
         test_list = self._read_entity_body_as_json()
         for test in test_list:
             all_suffixes = set()
-            for builder, suffixes in test_list[test].iteritems():
-                all_suffixes.update(set(suffixes))
+            builders = self._builders_to_fetch_from(test_list[test])
+            for builder in builders:
+                suffixes = test_list[test][builder]
+                all_suffixes.update(suffixes)
                 self._run_webkit_patch(['rebaseline-test', '--suffixes', ','.join(suffixes), builder, test])
             self._run_webkit_patch(['optimize-baselines', '--suffixes', ','.join(all_suffixes), test])
         self._serve_text('success')
index 0d466d2..e1798f6 100644 (file)
@@ -182,13 +182,20 @@ class GardeningServerTest(unittest.TestCase):
         self._post_to_path("/rollout?revision=2314&reason=MOCK+rollout+reason", expected_stderr=expected_stderr, expected_stdout=expected_stdout)
 
     def test_rebaselineall(self):
-        builders._exact_matches = {"MOCK builder": {"port_name": "mock-port-name", "specifiers": set(["mock-specifier"])}}
-        expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', u'txt,png', u'MOCK builder', u'user-scripts/another-test.html'], cwd=/mock-checkout\nMOCK run_command: ['echo', 'optimize-baselines', '--suffixes', u'txt,png', u'user-scripts/another-test.html'], cwd=/mock-checkout\n"
+        builders._exact_matches = {
+            "MOCK builder": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])},
+            "MOCK builder (Debug)": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier", "debug"])},
+        }
+        expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', u'%s', u'%s', u'user-scripts/another-test.html'], cwd=/mock-checkout\nMOCK run_command: ['echo', 'optimize-baselines', '--suffixes', u'%s', u'user-scripts/another-test.html'], cwd=/mock-checkout\n"
         expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n"
-        self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder": ["txt","png"]}}', expected_stderr=expected_stderr, expected_stdout=expected_stdout)
+        self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder": ["txt","png"]}}', expected_stderr=expected_stderr % ('txt,png', 'MOCK builder', 'txt,png'), expected_stdout=expected_stdout)
+
+        self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder (Debug)": ["txt","png"]}}', expected_stderr=expected_stderr % ('txt,png', 'MOCK builder (Debug)', 'txt,png'), expected_stdout=expected_stdout)
+
+        self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder (Debug)": ["txt","png"], "MOCK builder": ["txt"]}}', expected_stderr=expected_stderr % ('txt', 'MOCK builder', 'txt'), 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", "mock-port-fallback2"]}}
+        builders._exact_matches = {"MOCK builder": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"]), "move_overwritten_baselines_to": ["mock-port-fallback", "mock-port-fallback2"]}}
         expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt,png', '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&suffixes=txt,png", expected_stderr=expected_stderr, expected_stdout=expected_stdout)