Title: [121447] trunk/Tools
Revision
121447
Author
[email protected]
Date
2012-06-28 12:03:06 -0700 (Thu, 28 Jun 2012)

Log Message

Make rebaseline-test and rebaseline-expectations work for non-Chromium ports
https://bugs.webkit.org/show_bug.cgi?id=90186

Reviewed by Adam Barth.

This makes rebaselining work for all ports that have a TestExpectations file
in the tree. I didn't test other ports.

This doesn't address 100% of the problem. The rebaseline code puts the expectations
in the most specific directory and relies on optimize-baselines to merge baselines
appropriately. This only works if every platform directory has an equivalent bot
that runs the tests, which is not true for most ports.

* Scripts/webkitpy/common/net/buildbot/buildbot.py:
(Builder._revision_and_build_for_filename):
Some bots have filenames that aren't revision/build number pairs
e.g. they are random junk like aQhxvx. Handle this gracefully.
(Builder._fetch_revision_to_build_map):
(Builder._file_info_list_to_revision_to_build_list):
* Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py:
(BuilderTest.test_build_and_revision_for_filename):
(BuilderTest.test_file_info_list_to_revision_to_build_list):
* Scripts/webkitpy/layout_tests/port/builders.py:
Update the list of builders. This list needs to be kept up
to date for the rebaseline tool to work.
* Scripts/webkitpy/tool/commands/rebaseline.py:
(RebaselineTest._results_url):
(RebaselineExpectations._run_webkit_patch):
(RebaselineExpectations._rebaseline_port):
* Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
Qt port uses qmake to determine the right version. Systems without qmake correctly fallback
to a specific version.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (121446 => 121447)


--- trunk/Tools/ChangeLog	2012-06-28 18:58:21 UTC (rev 121446)
+++ trunk/Tools/ChangeLog	2012-06-28 19:03:06 UTC (rev 121447)
@@ -1,3 +1,38 @@
+2012-06-28  Ojan Vafai  <[email protected]>
+
+        Make rebaseline-test and rebaseline-expectations work for non-Chromium ports
+        https://bugs.webkit.org/show_bug.cgi?id=90186
+
+        Reviewed by Adam Barth.
+
+        This makes rebaselining work for all ports that have a TestExpectations file
+        in the tree. I didn't test other ports.
+
+        This doesn't address 100% of the problem. The rebaseline code puts the expectations
+        in the most specific directory and relies on optimize-baselines to merge baselines
+        appropriately. This only works if every platform directory has an equivalent bot
+        that runs the tests, which is not true for most ports.
+
+        * Scripts/webkitpy/common/net/buildbot/buildbot.py:
+        (Builder._revision_and_build_for_filename):
+        Some bots have filenames that aren't revision/build number pairs
+        e.g. they are random junk like aQhxvx. Handle this gracefully.
+        (Builder._fetch_revision_to_build_map):
+        (Builder._file_info_list_to_revision_to_build_list):
+        * Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py:
+        (BuilderTest.test_build_and_revision_for_filename):
+        (BuilderTest.test_file_info_list_to_revision_to_build_list):
+        * Scripts/webkitpy/layout_tests/port/builders.py:
+        Update the list of builders. This list needs to be kept up
+        to date for the rebaseline tool to work.
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (RebaselineTest._results_url):
+        (RebaselineExpectations._run_webkit_patch):
+        (RebaselineExpectations._rebaseline_port):
+        * Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
+        Qt port uses qmake to determine the right version. Systems without qmake correctly fallback
+        to a specific version.
+
 2012-06-28  Csaba Osztrogonác  <[email protected]>
 
         [Qt][NRWT] Fix baseline and skipped file search path.

Modified: trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py (121446 => 121447)


--- trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py	2012-06-28 18:58:21 UTC (rev 121446)
+++ trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py	2012-06-28 19:03:06 UTC (rev 121447)
@@ -120,6 +120,8 @@
     def _revision_and_build_for_filename(self, filename):
         # Example: "r47483 (1)/" or "r47483 (1).zip"
         match = self.file_name_regexp.match(filename)
+        if not match:
+            return None
         return (int(match.group("revision")), int(match.group("build_number")))
 
     def _fetch_revision_to_build_map(self):
@@ -135,10 +137,18 @@
         except urllib2.HTTPError, error:
             if error.code != 404:
                 raise
+            _log.debug("Revision/build list failed to load.")
             result_files = []
+        return dict(self._file_info_list_to_revision_to_build_list(result_files))
 
+    def _file_info_list_to_revision_to_build_list(self, file_info_list):
         # This assumes there was only one build per revision, which is false but we don't care for now.
-        return dict([self._revision_and_build_for_filename(file_info["filename"]) for file_info in result_files])
+        revisions_and_builds = []
+        for file_info in file_info_list:
+            revision_and_build = self._revision_and_build_for_filename(file_info["filename"])
+            if revision_and_build:
+                revisions_and_builds.append(revision_and_build)
+        return revisions_and_builds
 
     def _revision_to_build_map(self):
         if not self._revision_to_build_number:

Modified: trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py (121446 => 121447)


--- trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py	2012-06-28 18:58:21 UTC (rev 121446)
+++ trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py	2012-06-28 19:03:06 UTC (rev 121447)
@@ -112,10 +112,20 @@
         expectations = {
             "r47483 (1)/" : (47483, 1),
             "r47483 (1).zip" : (47483, 1),
+            "random junk": None,
         }
         for filename, revision_and_build in expectations.items():
             self.assertEqual(self.builder._revision_and_build_for_filename(filename), revision_and_build)
 
+    def test_file_info_list_to_revision_to_build_list(self):
+        file_info_list = [
+            {"filename": "r47483 (1)/"},
+            {"filename": "r47483 (1).zip"},
+            {"filename": "random junk"},
+        ]
+        builds_and_revisions_list = [(47483, 1), (47483, 1)]
+        self.assertEqual(self.builder._file_info_list_to_revision_to_build_list(file_info_list), builds_and_revisions_list)
+
     def test_fetch_build(self):
         buildbot = BuildBot()
         builder = Builder(u"Test Builder \u2661", buildbot)

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/builders.py	2012-06-28 18:58:21 UTC (rev 121446)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/builders.py	2012-06-28 19:03:06 UTC (rev 121447)
@@ -58,11 +58,17 @@
     "Apple Lion Debug WK2 (Tests)": {"port_name": "mac-lion", "specifiers": set(["lion", "wk2", "debug"])},
 
     "Apple Win XP Debug (Tests)": {"port_name": "win-xp", "specifiers": set(["win", "debug"])},
-    "Apple Win 7 Release (Tests)": {"port_name": "win-xp", "specifiers": set(["win"])},
+    "Apple Win 7 Release (Tests)": {"port_name": "win-7sp0", "specifiers": set(["win"])},
 
-    "GTK Linux 32-bit Debug": {"port_name": "gtk", "specifiers": set(["gtk"])},
+    "GTK Linux 32-bit Release": {"port_name": "gtk", "specifiers": set(["gtk", "x86", "release"])},
+    "GTK Linux 64-bit Debug": {"port_name": "gtk", "specifiers": set(["gtk", "x86_64", "debug"])},
+    "GTK Linux 64-bit Release": {"port_name": "gtk", "specifiers": set(["gtk", "x86_64", "release"])},
+    "GTK Linux 64-bit Release WK2 (Tests)": {"port_name": "gtk", "specifiers": set(["gtk", "x86_64", "wk2", "release"])},
+
     "Qt Linux Release": {"port_name": "qt-linux", "specifiers": set(["win", "linux", "mac"])},
-    "EFL Linux Release": {"port_name": "efl", "specifiers": set(["efl"])},
+
+    "EFL Linux 64-bit Debug": {"port_name": "efl", "specifiers": set(["efl", "debug"])},
+    "EFL Linux 64-bit Release": {"port_name": "efl", "specifiers": set(["efl", "release"])},
 }
 
 

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-06-28 18:58:21 UTC (rev 121446)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-06-28 19:03:06 UTC (rev 121447)
@@ -80,9 +80,11 @@
         self._scm_changes = {}
 
     def _results_url(self, builder_name):
-        # FIXME: Generalize this command to work with non-build.chromium.org builders.
-        builder = self._tool.chromium_buildbot().builder_with_name(builder_name)
-        return builder.accumulated_results_url()
+        port = self._tool.port_factory.get_from_builder_name(builder_name)
+        # FIXME: Come up with a better way than string manipulation to see if the port is a chromium port.
+        if port.name().startswith('chromium-'):
+            return self._tool.chromium_buildbot().builder_with_name(builder_name).accumulated_results_url()
+        return self._tool.buildbot.builder_with_name(builder_name).latest_cached_build().results_url()
 
     def _baseline_directory(self, builder_name):
         port = self._tool.port_factory.get_from_builder_name(builder_name)
@@ -250,15 +252,9 @@
         try:
             self._tool.executive.run_command([self._tool.path()] + args, cwd=self._tool.scm().checkout_root)
         except ScriptError, e:
-            pass
+            _log.error(e)
 
-    def _is_supported_port(self, port_name):
-        # FIXME: Support non-Chromium ports.
-        return port_name.startswith('chromium-')
-
     def _update_expectations_file(self, port_name):
-        if not self._is_supported_port(port_name):
-            return
         port = self._tool.port_factory.get(port_name)
 
         # FIXME: This will intentionally skip over any REBASELINE expectations that were in an overrides file.
@@ -277,13 +273,13 @@
         return tests_to_rebaseline
 
     def _rebaseline_port(self, port_name):
-        if not self._is_supported_port(port_name):
-            return
         builder_name = builders.builder_name_for_port_name(port_name)
         if not builder_name:
             return
-        _log.info("Retrieving results for %s from %s." % (port_name, builder_name))
-        for test_name, suffixes in self._tests_to_rebaseline(self._tool.port_factory.get(port_name)).iteritems():
+        tests = self._tests_to_rebaseline(self._tool.port_factory.get(port_name)).items()
+        if tests:
+            _log.info("Retrieving results for %s from %s." % (port_name, builder_name))
+        for test_name, suffixes in tests:
             self._touched_tests.setdefault(test_name, set()).update(set(suffixes))
             _log.info("    %s (%s)" % (test_name, ','.join(suffixes)))
             # FIXME: we should use executive.run_in_parallel() to speed this up.

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-06-28 18:58:21 UTC (rev 121446)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-06-28 19:03:06 UTC (rev 121447)
@@ -210,6 +210,21 @@
 Retrieving results for chromium-win-xp from Webkit Win.
     userscripts/another-test.html (txt)
     userscripts/images.svg (png)
+Retrieving results for efl from EFL Linux 64-bit Release.
+    userscripts/another-test.html (txt)
+    userscripts/images.svg (png)
+Retrieving results for gtk from GTK Linux 64-bit Release.
+    userscripts/another-test.html (txt)
+    userscripts/images.svg (png)
+Retrieving results for mac-lion from Apple Lion Release WK1 (Tests).
+    userscripts/another-test.html (txt)
+    userscripts/images.svg (png)
+Retrieving results for qt-linux from Qt Linux Release.
+    userscripts/another-test.html (txt)
+    userscripts/images.svg (png)
+Retrieving results for win-7sp0 from Apple Win 7 Release (Tests).
+    userscripts/another-test.html (txt)
+    userscripts/images.svg (png)
 """
 
         expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Linux 32', 'userscripts/another-test.html'], cwd=/mock-checkout
@@ -226,6 +241,20 @@
 MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Win7', 'userscripts/images.svg'], cwd=/mock-checkout
 MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Win', 'userscripts/another-test.html'], cwd=/mock-checkout
 MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Win', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'EFL Linux 64-bit Release', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'EFL Linux 64-bit Release', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'GTK Linux 64-bit Release', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'GTK Linux 64-bit Release', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Apple Lion Release WK1 (Tests)', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Apple Lion Release WK1 (Tests)', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Qt Linux Release', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Qt Linux Release', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Apple Win 7 Release (Tests)', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Apple Win 7 Release (Tests)', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['qmake', '-v'], cwd=None
+MOCK run_command: ['qmake', '-v'], cwd=None
+MOCK run_command: ['qmake', '-v'], cwd=None
+MOCK run_command: ['qmake', '-v'], cwd=None
 """
 
         command._tests_to_rebaseline = lambda port: {'userscripts/another-test.html': set(['txt']), 'userscripts/images.svg': set(['png'])}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to