Changeset 85871 in webkit
- Timestamp:
- May 5, 2011 1:18:40 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r85867 r85871 1 2011-05-05 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 commit-queue should reject patches which fail ewses 6 https://bugs.webkit.org/show_bug.cgi?id=47534 7 8 * Scripts/webkitpy/common/net/bugzilla/bugzilla.py: 9 * Scripts/webkitpy/tool/commands/earlywarningsystem.py: 10 * Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py: 11 1 12 2011-05-05 Chang Shu <cshu@webkit.org> 2 13 -
trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
r85727 r85871 617 617 self.authenticate() 618 618 619 # FIXME: additional_comment_text seems useless and should be merged into comment-text. 619 620 if additional_comment_text: 620 621 comment_text += "\n\n%s" % additional_comment_text … … 660 661 self.authenticate() 661 662 662 log("Adding %s to the CC list for bug %s" % (email_address_list, 663 bug_id)) 663 log("Adding %s to the CC list for bug %s" % (email_address_list, bug_id)) 664 664 if self.dryrun: 665 665 return -
trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
r85821 r85871 100 100 101 101 @classmethod 102 def _post_reject_message_on_bug(cls, tool, patch, status_id, extra_message_text=None): 103 results_link = tool.status_server.results_url_for_status(status_id) 104 message = "Attachment %s did not pass %s (%s):\nOutput: %s" % (patch.id(), cls.name, cls.port_name, results_link) 105 # FIXME: We might want to add some text about rejecting from the commit-queue in 106 # the case where patch.commit_queue() isn't already set to '-'. 107 if cls.watchers: 108 tool.bugs.add_cc_to_bug(patch.bug_id(), cls.watchers) 109 tool.bugs.set_flag_on_attachment(patch.bug_id(), "commit-queue", "-", message, extra_message_text) 110 111 @classmethod 102 112 def handle_script_error(cls, tool, state, script_error): 103 113 is_svn_apply = script_error.command_name() == "svn-apply" … … 105 115 if is_svn_apply: 106 116 QueueEngine.exit_after_handled_error(script_error) 107 results_link = tool.status_server.results_url_for_status(status_id) 108 message = "Attachment %s did not build on %s:\nBuild output: %s" % (state["patch"].id(), cls.port_name, results_link) 109 tool.bugs.post_comment_to_bug(state["patch"].bug_id(), message, cc=cls.watchers) 117 cls._post_reject_message_on_bug(tool, state['patch'], status_id) 110 118 exit(1) 119 111 120 112 121 # FIXME: This should merge with AbstractEarlyWarningSystem once all the EWS … … 120 129 self._layout_test_results_reader = LayoutTestResultsReader(self._tool, self._log_directory()) 121 130 122 def _post_reject_message_on_bug(self, task, patch): 123 results_link = self._tool.status_server.results_url_for_status(task.failure_status_id) 124 message = "Attachment %s did not pass %s:\nOutput: %s" % (patch.id(), self.name, results_link) 131 def _failing_tests_message(self, task, patch): 125 132 results = task.results_from_patch_test_run(patch) 126 133 unexpected_failures = self._expected_failures.unexpected_failures(results) 127 if unexpected_failures:128 message += "\nNew failing tests:\n%s" % "\n".join(unexpected_failures)129 self._tool.bugs.post_comment_to_bug(patch.bug_id(), message, cc=self.watchers)134 if not unexpected_failures: 135 return None 136 return "New failing tests:\n%s" % "\n".join(unexpected_failures) 130 137 131 138 def review_patch(self, patch): … … 140 147 return False 141 148 except ScriptError, e: 142 # FIXME: This should just use CommitterValidator.reject_patch_from_commit_queue 143 self._post_reject_message_on_bug(task, patch) 149 self._post_reject_message_on_bug(self._tool, patch, task.failure_status_id, self._failing_tests_message(task, patch)) 144 150 results_archive = task.results_archive_from_patch_test_run(patch) 145 151 if results_archive: -
trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py
r85802 r85871 38 38 39 39 class AbstractEarlyWarningSystemTest(QueuesTest): 40 # Needed to define port_name, used in AbstractEarlyWarningSystem.__init__ 41 class TestEWS(AbstractEarlyWarningSystem): 42 name = "mock-ews" 43 port_name = "win" # Needs to be a port which port/factory understands. 44 40 45 def test_can_build(self): 41 # Needed to define port_name, used in AbstractEarlyWarningSystem.__init__ 42 class TestEWS(AbstractEarlyWarningSystem): 43 port_name = "win" # Needs to be a port which port/factory understands. 44 45 queue = TestEWS() 46 queue = self.TestEWS() 46 47 queue.bind_to_tool(MockTool(log_executive=True)) 47 48 queue._options = MockOptions(port=None) … … 53 54 54 55 queue.run_webkit_patch = mock_run_webkit_patch 55 expected_stderr = "MOCK: update_status: NoneUnable to perform a build\n"56 expected_stderr = "MOCK: update_status: mock-ews Unable to perform a build\n" 56 57 OutputCapture().assert_outputs(self, queue._can_build, [], expected_stderr=expected_stderr) 57 58 … … 68 69 expected_stderr = "MOCK: release_work_item: None 197\n" 69 70 OutputCapture().assert_outputs(self, queue.process_work_item, [mock_patch], expected_stderr=expected_stderr, expected_exception=ScriptError) 71 72 def test_post_reject_message_on_bug(self): 73 tool = MockTool() 74 patch = tool.bugs.fetch_attachment(197) 75 expected_stderr = """MOCK setting flag 'commit-queue' to '-' on attachment '42' with comment 'Attachment 197 did not pass mock-ews (win): 76 Output: http://dummy_url' and additional comment 'EXTRA' 77 """ 78 OutputCapture().assert_outputs(self, 79 self.TestEWS._post_reject_message_on_bug, 80 kwargs={'tool': tool, 'patch': patch, 'status_id': 1, 'extra_message_text': "EXTRA"}, 81 expected_stderr=expected_stderr) 82 83 84 class AbstractTestingEWSTest(QueuesTest): 85 def test_failing_tests_message(self): 86 # Needed to define port_name, used in AbstractEarlyWarningSystem.__init__ 87 class TestEWS(AbstractTestingEWS): 88 port_name = "win" # Needs to be a port which port/factory understands. 89 90 ews = TestEWS() 91 ews.bind_to_tool(MockTool()) 92 ews._options = MockOptions(port=None, confirm=False) 93 OutputCapture().assert_outputs(self, ews.begin_work_queue, expected_stderr=self._default_begin_work_queue_stderr(ews.name, ews._tool.scm().checkout_root)) 94 ews._expected_failures.unexpected_failures = lambda results: set(["foo.html", "bar.html"]) 95 task = Mock() 96 patch = ews._tool.bugs.fetch_attachment(197) 97 self.assertEqual(ews._failing_tests_message(task, patch), "New failing tests:\nbar.html\nfoo.html") 70 98 71 99 … … 90 118 "next_work_item": "", 91 119 "process_work_item": "MOCK: update_status: %(name)s Pass\nMOCK: release_work_item: %(name)s 197\n" % string_replacemnts, 92 "handle_script_error": "MOCK: update_status: %(name)s ScriptError error message\nMOCK bug comment: bug_id=42, cc=%(watchers)s\n--- Begin comment ---\nAttachment 197 did not build on %(port)s:\nBuild output: http://dummy_url\n--- End comment ---\n\n" % string_replacemnts, 120 "handle_script_error": """MOCK: update_status: %(name)s ScriptError error message 121 MOCK setting flag 'commit-queue' to '-' on attachment '42' with comment 'Attachment 197 did not pass %(name)s (%(port)s): 122 Output: http://dummy_url' and additional comment 'None' 123 """ % string_replacemnts, 93 124 } 94 125 return expected_stderr
Note: See TracChangeset
for help on using the changeset viewer.