[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 13:35:44 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1cd6d200aaec9534666deafe2ccc3e413b6d066d
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 21 02:45:56 2010 +0000

    2010-09-20  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            Add a feeder queue that polls bugs.webkit.org for the commit-cluster
            https://bugs.webkit.org/show_bug.cgi?id=46141
    
            The feeder-queue polls bugs.webkit.org every 30 seconds and updates the
            list of work items on the status server.  The individual commit-cluster
            nodes then grab the patches from the server and process them.
    
            * Scripts/webkitpy/tool/bot/feeders.py: Added.
            * Scripts/webkitpy/tool/bot/feeders_unittest.py: Added.
            * Scripts/webkitpy/tool/commands/queues.py:
            * Scripts/webkitpy/tool/commands/queues_unittest.py:
            * Scripts/webkitpy/tool/commands/queuestest.py:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67913 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 946f7fe..93899f8 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-20  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Add a feeder queue that polls bugs.webkit.org for the commit-cluster
+        https://bugs.webkit.org/show_bug.cgi?id=46141
+
+        The feeder-queue polls bugs.webkit.org every 30 seconds and updates the
+        list of work items on the status server.  The individual commit-cluster
+        nodes then grab the patches from the server and process them.
+
+        * Scripts/webkitpy/tool/bot/feeders.py: Added.
+        * Scripts/webkitpy/tool/bot/feeders_unittest.py: Added.
+        * Scripts/webkitpy/tool/commands/queues.py:
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        * Scripts/webkitpy/tool/commands/queuestest.py:
+
 2010-09-20  Leandro Pereira  <leandro at profusion.mobi>
 
         Reviewed by Darin Adler.
diff --git a/WebKitTools/Scripts/webkitpy/tool/bot/feeders.py b/WebKitTools/Scripts/webkitpy/tool/bot/feeders.py
new file mode 100644
index 0000000..15eaaf3
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/tool/bot/feeders.py
@@ -0,0 +1,73 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from webkitpy.common.system.deprecated_logging import log
+from webkitpy.common.net.bugzilla import CommitterValidator
+
+
+class AbstractFeeder(object):
+    def __init__(self, tool):
+        self._tool = tool
+
+    def feed(tool):
+        raise NotImplementedError, "subclasses must implement"
+
+    def update_work_items(self, item_ids):
+        self._tool.status_server.update_work_items(self.queue_name, item_ids)
+        log("Feeding %s items %s" % (self.queue_name, item_ids))
+
+
+class CommitQueueFeeder(AbstractFeeder):
+    queue_name = "commit-queue"
+
+    def __init__(self, tool):
+        AbstractFeeder.__init__(self, tool)
+        self.committer_validator = CommitterValidator(self._tool.bugs)
+
+    def feed(self):
+        patches = self._validate_patches()
+        patches = sorted(patches, self._patch_cmp)
+        patch_ids = [patch.id() for patch in patches]
+        self.update_work_items(patch_ids)
+
+    def _patches_for_bug(self, bug_id):
+        return self._tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True)
+
+    def _validate_patches(self):
+        # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers.
+        bug_ids = self._tool.bugs.queries.fetch_bug_ids_from_commit_queue()
+        all_patches = sum([self._patches_for_bug(bug_id) for bug_id in bug_ids], [])
+        return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(all_patches)
+
+    def _patch_cmp(self, a, b):
+        # Sort first by is_rollout, then by attach_date.
+        # Reversing the order so that is_rollout is first.
+        rollout_cmp = cmp(b.is_rollout(), a.is_rollout())
+        if rollout_cmp != 0:
+            return rollout_cmp
+        return cmp(a.attach_date(), b.attach_date())
diff --git a/WebKitTools/Scripts/webkitpy/tool/bot/feeders_unittest.py b/WebKitTools/Scripts/webkitpy/tool/bot/feeders_unittest.py
new file mode 100644
index 0000000..5ce00b4
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/tool/bot/feeders_unittest.py
@@ -0,0 +1,70 @@
+# Copyright (c) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from datetime import datetime
+import unittest
+
+from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.thirdparty.mock import Mock
+from webkitpy.tool.bot.feeders import *
+from webkitpy.tool.mocktool import MockTool
+
+
+class FeedersTest(unittest.TestCase):
+    def test_commit_queue_feeder(self):
+        feeder = CommitQueueFeeder(MockTool())
+        expected_stderr = u"""Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
+Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
+MOCK setting flag 'commit-queue' to '-' on attachment '128' with comment 'Rejecting patch 128 from commit-queue.' and additional comment 'non-committer at example.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py.
+
+- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.
+
+- If you have committer rights please correct the error in WebKitTools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.'
+MOCK: update_work_items: commit-queue [106, 197]
+Feeding commit-queue items [106, 197]
+"""
+        OutputCapture().assert_outputs(self, feeder.feed, expected_stderr=expected_stderr)
+
+    def _mock_attachment(self, is_rollout, attach_date):
+        attachment = Mock()
+        attachment.is_rollout = lambda: is_rollout
+        attachment.attach_date = lambda: attach_date
+        return attachment
+
+    def test_patch_cmp(self):
+        long_ago_date = datetime(1900, 1, 21)
+        recent_date = datetime(2010, 1, 21)
+        attachment1 = self._mock_attachment(is_rollout=False, attach_date=recent_date)
+        attachment2 = self._mock_attachment(is_rollout=False, attach_date=long_ago_date)
+        attachment3 = self._mock_attachment(is_rollout=True, attach_date=recent_date)
+        attachment4 = self._mock_attachment(is_rollout=True, attach_date=long_ago_date)
+        attachments = [attachment1, attachment2, attachment3, attachment4]
+        expected_sort = [attachment4, attachment3, attachment2, attachment1]
+        queue = CommitQueueFeeder(MockTool())
+        attachments.sort(queue._patch_cmp)
+        self.assertEqual(attachments, expected_sort)
diff --git a/WebKitTools/Scripts/webkitpy/tool/bot/queueengine.py b/WebKitTools/Scripts/webkitpy/tool/bot/queueengine.py
index 289dc4a..8118653 100644
--- a/WebKitTools/Scripts/webkitpy/tool/bot/queueengine.py
+++ b/WebKitTools/Scripts/webkitpy/tool/bot/queueengine.py
@@ -141,6 +141,8 @@ class QueueEngine:
 
     def _open_work_log(self, work_item):
         work_item_log_path = self._delegate.work_item_log_path(work_item)
+        if not work_item_log_path:
+            return
         self._work_log = self._output_tee.add_log(work_item_log_path)
 
     def _ensure_work_log_closed(self):
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
index bc9ee42..b91ca89 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
@@ -27,6 +27,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import time
 import traceback
 import os
 
@@ -39,6 +40,7 @@ from webkitpy.common.net.statusserver import StatusServer
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.common.system.deprecated_logging import error, log
 from webkitpy.tool.commands.stepsequence import StepSequenceErrorHandler
+from webkitpy.tool.bot.feeders import CommitQueueFeeder
 from webkitpy.tool.bot.patchcollection import PersistentPatchCollection, PersistentPatchCollectionDelegate
 from webkitpy.tool.bot.queueengine import QueueEngine, QueueEngineDelegate
 from webkitpy.tool.grammar import pluralize
@@ -144,18 +146,53 @@ class AbstractQueue(Command, QueueEngineDelegate):
         return tool.status_server.update_status(cls.name, message, state["patch"], failure_log)
 
 
+class FeederQueue(AbstractQueue):
+    name = "feeder-queue"
+
+    _sleep_duration = 30  # seconds
+
+    # AbstractPatchQueue methods
+
+    def begin_work_queue(self):
+        AbstractQueue.begin_work_queue(self)
+        self.feeders = [
+            CommitQueueFeeder(self.tool),
+        ]
+
+    def next_work_item(self):
+        # This really show inherit from some more basic class that doesn't
+        # understand work items, but the base class in the heirarchy currently
+        # understands work items.
+        return "synthetic-work-item"
+
+    def should_proceed_with_work_item(self, work_item):
+        return True
+
+    def process_work_item(self, work_item):
+        self._update_checkout()
+        for feeder in self.feeders:
+            feeder.feed()
+        time.sleep(self._sleep_duration)
+        return True
+
+    def work_item_log_path(self, work_item):
+        return None
+
+    def handle_unexpected_error(self, work_item, message):
+        log(message)
+
+    def _checkout_update(self):
+        self.run_webkit_patch([
+            "update",
+            "--force-clean",
+            "--quiet",
+        ])
+
+
 class AbstractPatchQueue(AbstractQueue):
     def _update_status(self, message, patch=None, results_file=None):
         self.tool.status_server.update_status(self.name, message, patch, results_file)
 
-    # Note, eventually this will be done by a separate "feeder" queue
-    # whose job it is to poll bugzilla and feed work items into the
-    # status server for other queues to munch on.
-    def _update_work_items(self, patch_ids):
-        self.tool.status_server.update_work_items(self.name, patch_ids)
-        if patch_ids:
-            self.log_progress(patch_ids)
-
     def _fetch_next_work_item(self):
         return self.tool.status_server.next_work_item(self.name)
 
@@ -172,14 +209,9 @@ class AbstractPatchQueue(AbstractQueue):
     def work_item_log_path(self, patch):
         return os.path.join(self._log_directory(), "%s.log" % patch.bug_id())
 
-    def log_progress(self, patch_ids):
-        log("%s in %s [%s]" % (pluralize("patch", len(patch_ids)), self.name, ", ".join(map(str, patch_ids))))
-
 
 class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler):
     name = "commit-queue"
-    def __init__(self):
-        AbstractPatchQueue.__init__(self)
 
     # AbstractPatchQueue methods
 
@@ -187,30 +219,7 @@ class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler):
         AbstractPatchQueue.begin_work_queue(self)
         self.committer_validator = CommitterValidator(self.tool.bugs)
 
-    def _validate_patches_in_commit_queue(self):
-        # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers.
-        bug_ids = self.tool.bugs.queries.fetch_bug_ids_from_commit_queue()
-        all_patches = sum([self.tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True) for bug_id in bug_ids], [])
-        return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(all_patches)
-
-    def _patch_cmp(self, a, b):
-        # Sort first by is_rollout, then by attach_date.
-        # Reversing the order so that is_rollout is first.
-        rollout_cmp = cmp(b.is_rollout(), a.is_rollout())
-        if (rollout_cmp != 0):
-            return rollout_cmp
-        return cmp(a.attach_date(), b.attach_date())
-
-    def _feed_work_items_to_server(self):
-        # Grab the set of patches from bugzilla, sort them, and update the status server.
-        # Eventually this will all be done by a separate feeder queue.
-        patches = self._validate_patches_in_commit_queue()
-        patches = sorted(patches, self._patch_cmp)
-        self._update_work_items([patch.id() for patch in patches])
-
     def next_work_item(self):
-        self._feed_work_items_to_server()
-        # The grab the next patch to work on back from the status server.
         patch_id = self._fetch_next_work_item()
         if not patch_id:
             return None
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
index 2deee76..359706f 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
@@ -47,20 +47,16 @@ class TestReviewQueue(AbstractReviewQueue):
     name = "test-review-queue"
 
 
+class TestFeederQueue(FeederQueue):
+    _sleep_duration = 0
+
+
 class MockRolloutPatch(MockPatch):
     def is_rollout(self):
         return True
 
 
 class AbstractQueueTest(CommandsTest):
-    def _assert_log_progress_output(self, patch_ids, progress_output):
-        OutputCapture().assert_outputs(self, TestQueue().log_progress, [patch_ids], expected_stderr=progress_output)
-
-    def test_log_progress(self):
-        self._assert_log_progress_output([1,2,3], "3 patches in test-queue [1, 2, 3]\n")
-        self._assert_log_progress_output(["1","2","3"], "3 patches in test-queue [1, 2, 3]\n")
-        self._assert_log_progress_output([1], "1 patch in test-queue [1]\n")
-
     def test_log_directory(self):
         self.assertEquals(TestQueue()._log_directory(), "test-queue-logs")
 
@@ -115,6 +111,30 @@ class AbstractQueueTest(CommandsTest):
         self._assert_log_message(script_error, expected_output)
 
 
+class FeederQueueTest(QueuesTest):
+    def test_feeder_queue(self):
+        queue = TestFeederQueue()
+        tool = MockTool(log_executive=True)
+        expected_stderr = {
+            "begin_work_queue": self._default_begin_work_queue_stderr("feeder-queue", MockSCM.fake_checkout_root),
+            "should_proceed_with_work_item": "",
+            "next_work_item": "",
+            "process_work_item": """MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update', '--force-clean', '--quiet']
+Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
+Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
+MOCK setting flag 'commit-queue' to '-' on attachment '128' with comment 'Rejecting patch 128 from commit-queue.' and additional comment 'non-committer at example.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py.
+
+- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.
+
+- If you have committer rights please correct the error in WebKitTools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.'
+MOCK: update_work_items: commit-queue [106, 197]
+Feeding commit-queue items [106, 197]
+""",
+            "handle_unexpected_error": "Mock error message\n",
+        }
+        self.assert_queue_outputs(queue, tool=tool, expected_stderr=expected_stderr)
+
+
 class AbstractPatchQueueTest(CommandsTest):
     def test_fetch_next_work_item(self):
         queue = AbstractPatchQueue()
@@ -177,12 +197,7 @@ class CommitQueueTest(QueuesTest):
             "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue", MockSCM.fake_checkout_root),
             "should_proceed_with_work_item": "MOCK: update_status: commit-queue Landing patch\n",
             # FIXME: The commit-queue warns about bad committers twice.  This is due to the fact that we access Attachment.reviewer() twice and it logs each time.
-            "next_work_item": """Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
-Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
-MOCK setting flag 'commit-queue' to '-' on attachment '128' with comment 'Rejecting patch 128 from commit-queue.' and additional comment 'non-committer at example.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py.\n\n- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.\n\n- If you have committer rights please correct the error in WebKitTools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.'
-MOCK: update_work_items: commit-queue [106, 197]
-2 patches in commit-queue [106, 197]
-""",
+            "next_work_item": "",
             "process_work_item": "MOCK: update_status: commit-queue Pass\n",
             "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '197' with comment 'Rejecting patch 197 from commit-queue.' and additional comment 'Mock error message'\n",
             "handle_script_error": "MOCK: update_status: commit-queue ScriptError error message\nMOCK setting flag 'commit-queue' to '-' on attachment '197' with comment 'Rejecting patch 197 from commit-queue.' and additional comment 'ScriptError error message'\n",
@@ -196,16 +211,7 @@ MOCK: update_work_items: commit-queue [106, 197]
             "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue", MockSCM.fake_checkout_root),
             "should_proceed_with_work_item": "MOCK: update_status: commit-queue Landing patch\n",
             # FIXME: The commit-queue warns about bad committers twice.  This is due to the fact that we access Attachment.reviewer() twice and it logs each time.
-            "next_work_item": """Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
-Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
-MOCK setting flag 'commit-queue' to '-' on attachment '128' with comment 'Rejecting patch 128 from commit-queue.' and additional comment 'non-committer at example.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py.
-
-- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.
-
-- If you have committer rights please correct the error in WebKitTools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.'
-MOCK: update_work_items: commit-queue [106, 197]
-2 patches in commit-queue [106, 197]
-""",
+            "next_work_item": "",
             "process_work_item": "MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build-and-test-attachment', '--force-clean', '--build', '--non-interactive', '--build-style=both', '--quiet', 197, '--test']\nMOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--non-interactive', '--ignore-builders', '--quiet', '--parent-command=commit-queue', 197]\nMOCK: update_status: commit-queue Pass\n",
             "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '197' with comment 'Rejecting patch 197 from commit-queue.' and additional comment 'Mock error message'\n",
             "handle_script_error": "MOCK: update_status: commit-queue ScriptError error message\nMOCK setting flag 'commit-queue' to '-' on attachment '197' with comment 'Rejecting patch 197 from commit-queue.' and additional comment 'ScriptError error message'\n",
@@ -220,16 +226,7 @@ MOCK: update_work_items: commit-queue [106, 197]
             "begin_work_queue": self._default_begin_work_queue_stderr("commit-queue", MockSCM.fake_checkout_root),
             "should_proceed_with_work_item": "MOCK: update_status: commit-queue Landing rollout patch\n",
             # FIXME: The commit-queue warns about bad committers twice.  This is due to the fact that we access Attachment.reviewer() twice and it logs each time.
-            "next_work_item": """Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
-Warning, attachment 128 on bug 42 has invalid committer (non-committer at example.com)
-MOCK setting flag 'commit-queue' to '-' on attachment '128' with comment 'Rejecting patch 128 from commit-queue.' and additional comment 'non-committer at example.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/config/committers.py.
-
-- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.
-
-- If you have committer rights please correct the error in WebKitTools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.'
-MOCK: update_work_items: commit-queue [106, 197]
-2 patches in commit-queue [106, 197]
-""",
+            "next_work_item": "",
             "process_work_item": "MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build-and-test-attachment', '--force-clean', '--build', '--non-interactive', '--build-style=both', '--quiet', 197]\nMOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--non-interactive', '--ignore-builders', '--quiet', '--parent-command=commit-queue', 197]\nMOCK: update_status: commit-queue Pass\n",
             "handle_unexpected_error": "MOCK setting flag 'commit-queue' to '-' on attachment '197' with comment 'Rejecting patch 197 from commit-queue.' and additional comment 'Mock error message'\n",
             "handle_script_error": "MOCK: update_status: commit-queue ScriptError error message\nMOCK setting flag 'commit-queue' to '-' on attachment '197' with comment 'Rejecting patch 197 from commit-queue.' and additional comment 'ScriptError error message'\n",
@@ -245,25 +242,6 @@ MOCK: update_work_items: commit-queue [106, 197]
         expected_run_args = ["echo", "--status-host=example.com", "build-and-test", "--force-clean", "--build", "--test", "--non-interactive", "--no-update", "--build-style=both", "--quiet"]
         tool.executive.run_and_throw_if_fail.assert_called_with(expected_run_args)
 
-    def _mock_attachment(self, is_rollout, attach_date):
-        attachment = Mock()
-        attachment.is_rollout = lambda: is_rollout
-        attachment.attach_date = lambda: attach_date
-        return attachment
-
-    def test_patch_cmp(self):
-        long_ago_date = datetime(1900, 1, 21)
-        recent_date = datetime(2010, 1, 21)
-        attachment1 = self._mock_attachment(is_rollout=False, attach_date=recent_date)
-        attachment2 = self._mock_attachment(is_rollout=False, attach_date=long_ago_date)
-        attachment3 = self._mock_attachment(is_rollout=True, attach_date=recent_date)
-        attachment4 = self._mock_attachment(is_rollout=True, attach_date=long_ago_date)
-        attachments = [attachment1, attachment2, attachment3, attachment4]
-        expected_sort = [attachment4, attachment3, attachment2, attachment1]
-        queue = CommitQueue()
-        attachments.sort(queue._patch_cmp)
-        self.assertEqual(attachments, expected_sort)
-
     def test_auto_retry(self):
         queue = CommitQueue()
         options = Mock()
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queuestest.py b/WebKitTools/Scripts/webkitpy/tool/commands/queuestest.py
index aa3cef4..9f3583d 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queuestest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queuestest.py
@@ -32,6 +32,7 @@ from webkitpy.common.net.bugzilla import Attachment
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.thirdparty.mock import Mock
+from webkitpy.tool.commands.stepsequence import StepSequenceErrorHandler
 from webkitpy.tool.mocktool import MockTool
 
 
@@ -100,4 +101,6 @@ class QueuesTest(unittest.TestCase):
         self.assert_outputs(queue.should_proceed_with_work_item, "should_proceed_with_work_item", [work_item], expected_stdout, expected_stderr, expected_exceptions)
         self.assert_outputs(queue.process_work_item, "process_work_item", [work_item], expected_stdout, expected_stderr, expected_exceptions)
         self.assert_outputs(queue.handle_unexpected_error, "handle_unexpected_error", [work_item, "Mock error message"], expected_stdout, expected_stderr, expected_exceptions)
-        self.assert_outputs(queue.handle_script_error, "handle_script_error", [tool, {"patch": MockPatch()}, ScriptError(message="ScriptError error message", script_args="MockErrorCommand")], expected_stdout, expected_stderr, expected_exceptions)
+        # Should we have a different function for testing StepSequenceErrorHandlers?
+        if isinstance(queue, StepSequenceErrorHandler):
+            self.assert_outputs(queue.handle_script_error, "handle_script_error", [tool, {"patch": MockPatch()}, ScriptError(message="ScriptError error message", script_args="MockErrorCommand")], expected_stdout, expected_stderr, expected_exceptions)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list