Title: [110900] trunk/Tools
Revision
110900
Author
aba...@webkit.org
Date
2012-03-15 15:48:57 -0700 (Thu, 15 Mar 2012)

Log Message

The commit-queue can hang when the test_expectations.txt style check fails during commit
https://bugs.webkit.org/show_bug.cgi?id=81251

Reviewed by Eric Seidel.

We forgot to check the --non-interactive flag, so we end up prompting
the "user" who doesn't exist on the bot.  We might consider teaching
the User class about non-interactive if we have this sort of bug again.

* Scripts/webkitpy/tool/steps/commit.py:
(Commit.options):
(Commit._check_test_expectations):
(Commit.run):
* Scripts/webkitpy/tool/steps/commit_unittest.py:
(CommitTest.test_check_test_expectations):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (110899 => 110900)


--- trunk/Tools/ChangeLog	2012-03-15 22:44:02 UTC (rev 110899)
+++ trunk/Tools/ChangeLog	2012-03-15 22:48:57 UTC (rev 110900)
@@ -1,3 +1,21 @@
+2012-03-15  Adam Barth  <aba...@webkit.org>
+
+        The commit-queue can hang when the test_expectations.txt style check fails during commit
+        https://bugs.webkit.org/show_bug.cgi?id=81251
+
+        Reviewed by Eric Seidel.
+
+        We forgot to check the --non-interactive flag, so we end up prompting
+        the "user" who doesn't exist on the bot.  We might consider teaching
+        the User class about non-interactive if we have this sort of bug again.
+
+        * Scripts/webkitpy/tool/steps/commit.py:
+        (Commit.options):
+        (Commit._check_test_expectations):
+        (Commit.run):
+        * Scripts/webkitpy/tool/steps/commit_unittest.py:
+        (CommitTest.test_check_test_expectations):
+
 2012-03-15  Jessie Berlin  <jber...@apple.com>
 
         fast/dom/Window/window-properties.html and fast/dom/prototype-inheritance-2.html failing on

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/commit.py (110899 => 110900)


--- trunk/Tools/Scripts/webkitpy/tool/steps/commit.py	2012-03-15 22:44:02 UTC (rev 110899)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/commit.py	2012-03-15 22:48:57 UTC (rev 110900)
@@ -44,6 +44,7 @@
     def options(cls):
         return AbstractStep.options() + [
             Options.check_builders,
+            Options.non_interactive,
         ]
 
     def _commit_warning(self, error):
@@ -66,6 +67,8 @@
         try:
             self._tool.executive.run_and_throw_if_fail(self._tool.port().check_webkit_style_command() + args, cwd=self._tool.scm().checkout_root)
         except ScriptError, e:
+            if self._options.non_interactive:
+                raise
             if not self._tool.user.confirm("Are you sure you want to continue?", default="n"):
                 self._exit(1)
 
@@ -94,12 +97,14 @@
                 self._state["commit_text"] = commit_text
                 break;
             except AmbiguousCommitError, e:
-                if self._tool.user.confirm(self._commit_warning(e)):
+                if self._options.non_interactive or self._tool.user.confirm(self._commit_warning(e)):
                     force_squash = True
                 else:
                     # This will correctly interrupt the rest of the commit process.
                     raise ScriptError(message="Did not commit")
             except AuthenticationError, e:
+                if self._options.non_interactive:
+                    raise ScriptError(message="Authentication required")
                 username = self._tool.user.prompt("%s login: " % e.server_host, repeat=5)
                 if not username:
                     raise ScriptError("You need to specify the username on %s to perform the commit as." % e.server_host)

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/commit_unittest.py (110899 => 110900)


--- trunk/Tools/Scripts/webkitpy/tool/steps/commit_unittest.py	2012-03-15 22:44:02 UTC (rev 110899)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/commit_unittest.py	2012-03-15 22:48:57 UTC (rev 110900)
@@ -29,6 +29,7 @@
 import unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.common.system.executive import ScriptError
 from webkitpy.common.system.executive_mock import MockExecutive
 from webkitpy.tool.mocktool import MockOptions, MockTool
 from webkitpy.tool.steps.commit import Commit
@@ -39,8 +40,10 @@
         capture = OutputCapture()
         options = MockOptions()
         options.git_commit = ""
+        options.non_interactive = True
 
         tool = MockTool()
+        tool.user = None  # Will cause any access of tool.user to raise an exception.
         step = Commit(tool, options)
         state = {
             "changed_files": ["test_expectations.txtXXX"],
@@ -55,4 +58,4 @@
         capture.assert_outputs(self, step.run, [state], expected_stderr="MOCK run_and_throw_if_fail: ['mock-check-webkit-style', '--diff-files', 'platform/chromium/test_expectations.txt'], cwd=/mock-checkout\nCommitted r49824: <http://trac.webkit.org/changeset/49824>\n")
 
         tool.executive = MockExecutive(should_log=True, should_throw_when_run=set(["platform/chromium/test_expectations.txt"]))
-        self.assertRaises(SystemExit, capture.assert_outputs, self, step.run, [state])
+        self.assertRaises(ScriptError, capture.assert_outputs, self, step.run, [state])
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to