Title: [89618] trunk/Tools
Revision
89618
Author
e...@webkit.org
Date
2011-06-23 14:43:33 -0700 (Thu, 23 Jun 2011)

Log Message

2011-06-23  Eric Seidel  <e...@webkit.org>

        Reviewed by Adam Barth.

        sheriffbot can no longer restart
        https://bugs.webkit.org/show_bug.cgi?id=63221

        Fixed and unit tested.

        * Scripts/webkitpy/tool/bot/queueengine.py:
        * Scripts/webkitpy/tool/bot/sheriffircbot.py:
        * Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (89617 => 89618)


--- trunk/Tools/ChangeLog	2011-06-23 21:42:52 UTC (rev 89617)
+++ trunk/Tools/ChangeLog	2011-06-23 21:43:33 UTC (rev 89618)
@@ -1,3 +1,16 @@
+2011-06-23  Eric Seidel  <e...@webkit.org>
+
+        Reviewed by Adam Barth.
+
+        sheriffbot can no longer restart
+        https://bugs.webkit.org/show_bug.cgi?id=63221
+
+        Fixed and unit tested.
+
+        * Scripts/webkitpy/tool/bot/queueengine.py:
+        * Scripts/webkitpy/tool/bot/sheriffircbot.py:
+        * Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py:
+
 2011-06-23  Martin Robinson  <mrobin...@igalia.com>
 
         Reviewed by Xan Lopez.

Modified: trunk/Tools/Scripts/webkitpy/tool/bot/queueengine.py (89617 => 89618)


--- trunk/Tools/Scripts/webkitpy/tool/bot/queueengine.py	2011-06-23 21:42:52 UTC (rev 89617)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/queueengine.py	2011-06-23 21:43:33 UTC (rev 89618)
@@ -37,6 +37,8 @@
 from webkitpy.common.system.deprecated_logging import log, OutputTee
 
 
+# FIXME: This will be caught by "except Exception:" blocks, we should consider
+# making this inherit from SystemExit instead (or BaseException, except that's not recommended).
 class TerminateQueue(Exception):
     pass
 

Modified: trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot.py (89617 => 89618)


--- trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot.py	2011-06-23 21:42:52 UTC (rev 89617)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot.py	2011-06-23 21:43:33 UTC (rev 89618)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 from webkitpy.tool.bot import irc_command
-
+from webkitpy.tool.bot.queueengine import TerminateQueue
 from webkitpy.common.net.irc.ircbot import IRCBotDelegate
 from webkitpy.common.thread.threadedmessagequeue import ThreadedMessageQueue
 
@@ -78,6 +78,9 @@
             response = command().execute(requester_nick, args, self._tool, self._sheriff)
             if response:
                 self._tool.irc().post(response)
+        except TerminateQueue:
+            raise
+        # This will catch everything else. SystemExit and KeyboardInterrupt are not subclasses of Exception, so we won't catch those.
         except Exception, e:
             self._tool.irc().post("Exception executing command: %s" % e)
 

Modified: trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py (89617 => 89618)


--- trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py	2011-06-23 21:42:52 UTC (rev 89617)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py	2011-06-23 21:43:33 UTC (rev 89618)
@@ -31,6 +31,7 @@
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.tool.bot import irc_command
+from webkitpy.tool.bot.queueengine import TerminateQueue
 from webkitpy.tool.bot.sheriff import Sheriff
 from webkitpy.tool.bot.sheriffircbot import SheriffIRCBot
 from webkitpy.tool.bot.sheriff_unittest import MockSheriffBot
@@ -67,6 +68,14 @@
         expected_stderr = 'MOCK: irc.post: Exception executing command: mock_exception\n'
         OutputCapture().assert_outputs(self, bot.process_message, args=["mock_nick", "ignored message"], expected_stderr=expected_stderr)
 
+        class CommandWithException(object):
+            def execute(self, nick, args, tool, sheriff):
+                raise KeyboardInterrupt()
+
+        bot._parse_command_and_args = lambda request: (CommandWithException, [])
+        # KeyboardInterrupt and SystemExit are not subclasses of Exception and thus correctly will not be caught.
+        OutputCapture().assert_outputs(self, bot.process_message, args=["mock_nick", "ignored message"], expected_exception=KeyboardInterrupt)
+
     def test_hi(self):
         random.seed(23324)
         expected_stderr = 'MOCK: irc.post: "Only you can prevent forest fires." -- Smokey the Bear\n'
@@ -80,6 +89,10 @@
         expected_stderr = "MOCK: irc.post: mock_nick: http://trac.webkit.org/changeset/9479\n"
         OutputCapture().assert_outputs(self, run, args=["last-green-revision"], expected_stderr=expected_stderr)
 
+    def test_restart(self):
+        expected_stderr = "MOCK: irc.post: Restarting...\n"
+        OutputCapture().assert_outputs(self, run, args=["restart"], expected_stderr=expected_stderr, expected_exception=TerminateQueue)
+
     def test_rollout(self):
         expected_stderr = "MOCK: irc.post: mock_nick, abarth, darin, eseidel: Preparing rollout for http://trac.webkit.org/changeset/21654...\nMOCK: irc.post: mock_nick, abarth, darin, eseidel: Created rollout: http://example.com/36936\n"
         OutputCapture().assert_outputs(self, run, args=["rollout 21654 This patch broke the world"], expected_stderr=expected_stderr)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to