Diff
Modified: trunk/Tools/ChangeLog (270002 => 270003)
--- trunk/Tools/ChangeLog 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/ChangeLog 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,3 +1,41 @@
+2020-11-18 Alexey Proskuryakov <[email protected]>
+
+ Remove IRC bots from webkitpy
+ https://bugs.webkit.org/show_bug.cgi?id=219111
+
+ Reviewed by Jonathan Bedard and Aakash Jain.
+
+ We haven't been running any IRC bots for a while, this is dead code.
+
+ * Scripts/webkitpy/common/net/irc: Removed.
+ * Scripts/webkitpy/thirdparty/irc: Removed.
+ * Scripts/webkitpy/tool/bot/irc_command.py: Removed.
+ * Scripts/webkitpy/tool/bot/irc_command_unittest.py: Removed.
+ * Scripts/webkitpy/tool/bot/ircbot.py: Removed.
+ * Scripts/webkitpy/tool/bot/ircbot_unittest.py: Removed.
+ * Scripts/webkitpy/tool/bot/sheriff.py: Removed.
+ * Scripts/webkitpy/tool/bot/sheriff_unittest.py: Removed.
+ * Scripts/webkitpy/tool/commands/__init__.py:
+ * Scripts/webkitpy/tool/commands/newcommitbot.py: Removed.
+ * Scripts/webkitpy/tool/commands/newcommitbot_unittest.py: Removed.
+ * Scripts/webkitpy/tool/commands/perfalizer.py: Removed.
+ * Scripts/webkitpy/tool/commands/perfalizer_unittest.py: Removed.
+ * Scripts/webkitpy/tool/commands/sheriffbot.py: Removed.
+ * Scripts/webkitpy/tool/commands/sheriffbot_unittest.py: Removed.
+ * Scripts/webkitpy/tool/main.py:
+ (WebKitPatch):
+ (WebKitPatch.__init__):
+ (WebKitPatch.path):
+ (WebKitPatch.command_completed):
+ (WebKitPatch.handle_global_options):
+ (WebKitPatch.ensure_irc_connected): Deleted.
+ (WebKitPatch.irc): Deleted.
+ * Scripts/webkitpy/tool/mocktool.py:
+ (MockTool.__init__):
+ (MockTool.path):
+ (MockTool.ensure_irc_connected): Deleted.
+ (MockTool.irc): Deleted.
+
2020-11-18 Wenson Hsieh <[email protected]>
[Concurrent display lists] Add a way for display lists to partially replay
Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/irc_command.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,307 +0,0 @@
-# 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.
-
-import itertools
-import random
-import re
-
-from webkitcorepy import unicode
-
-from webkitpy.common.config import irc as config_irc
-from webkitpy.common.config import urls
-from webkitpy.common.config.committers import CommitterList
-from webkitpy.common.system.executive import ScriptError
-from webkitpy.tool.bot.queueengine import TerminateQueue
-from webkitpy.tool.grammar import join_with_separators
-from webkitpy.tool.grammar import pluralize
-
-
-def _post_error_and_check_for_bug_url(tool, nicks_string, exception):
- tool.irc().post("%s" % exception)
- bug_id = urls.parse_bug_id(exception.output)
- if bug_id:
- bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
- tool.irc().post("%s: Ugg... Might have created %s" % (nicks_string, bug_url))
-
-
-# FIXME: Merge with Command?
-class IRCCommand(object):
- usage_string = None
- help_string = None
-
- def execute(self, nick, args, tool, sheriff):
- raise NotImplementedError("subclasses must implement")
-
- @classmethod
- def usage(cls, nick):
- return "%s: Usage: %s" % (nick, cls.usage_string)
-
- @classmethod
- def help(cls, nick):
- return "%s: %s" % (nick, cls.help_string)
-
-
-class CreateBug(IRCCommand):
- usage_string = "create-bug BUG_TITLE"
- help_string = "Creates a Bugzilla bug with the given title."
-
- def execute(self, nick, args, tool, sheriff):
- if not args:
- return self.usage(nick)
-
- bug_title = " ".join(args)
- bug_description = "%s\nRequested by %s on %s." % (bug_title, nick, config_irc.channel)
-
- # There happens to be a committers list hung off of Bugzilla, so
- # re-using that one makes things easiest for now.
- requester = tool.bugs.committers.contributor_by_irc_nickname(nick)
- requester_email = requester.bugzilla_email() if requester else None
-
- try:
- bug_id = tool.bugs.create_bug(bug_title, bug_description, cc=requester_email, assignee=requester_email)
- bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
- return "%s: Created bug: %s" % (nick, bug_url)
- except Exception as e:
- return "%s: Failed to create bug:\n%s" % (nick, e)
-
-
-class Help(IRCCommand):
- usage_string = "help [COMMAND]"
- help_string = "Provides help on my individual commands."
-
- def execute(self, nick, args, tool, sheriff):
- if args:
- for command_name in args:
- if command_name in commands:
- self._post_command_help(nick, tool, commands[command_name])
- else:
- tool.irc().post("%s: Available commands: %s" % (nick, ", ".join(sorted(visible_commands.keys()))))
- tool.irc().post('%s: Type "%s: help COMMAND" for help on my individual commands.' % (nick, sheriff.name()))
-
- def _post_command_help(self, nick, tool, command):
- tool.irc().post(command.usage(nick))
- tool.irc().post(command.help(nick))
- aliases = " ".join(sorted(filter(lambda alias: commands[alias] == command and alias not in visible_commands, commands)))
- if aliases:
- tool.irc().post("%s: Aliases: %s" % (nick, aliases))
-
-
-class Hi(IRCCommand):
- usage_string = "hi"
- help_string = "Responds with hi."
-
- def execute(self, nick, args, tool, sheriff):
- if len(args) and re.match(sheriff.name() + r'_*\s*!\s*', ' '.join(args)):
- return "%s: hi %s!" % (nick, nick)
- bypass_quips = ['WKR', 'webkitbot']
- if sheriff.name() in bypass_quips: # For some unknown reason, WKR/webkitbot can't use tool.bugs.quips().
- return "%s: hi %s!" % (nick, nick)
- quips = tool.bugs.quips()
- quips.append('"Only you can prevent forest fires." -- Smokey the Bear')
- return random.choice(quips)
-
-
-class PingPong(IRCCommand):
- usage_string = "ping"
- help_string = "Responds with pong."
-
- def execute(self, nick, args, tool, sheriff):
- return nick + ": pong"
-
-
-class YouThere(IRCCommand):
- usage_string = "yt?"
- help_string = "Responds with yes."
-
- def execute(self, nick, args, tool, sheriff):
- return "%s: yes" % nick
-
-
-class Restart(IRCCommand):
- usage_string = "restart"
- help_string = "Restarts sherrifbot. Will update its WebKit checkout, and re-join the channel momentarily."
-
- def execute(self, nick, args, tool, sheriff):
- tool.irc().post("Restarting...")
- raise TerminateQueue()
-
-
-class Revert(IRCCommand):
- usage_string = "revert SVN_REVISION [SVN_REVISIONS] REASON"
- help_string = "Opens a bug to revert the specified revision, CCing author + reviewer, and attaching the reverse-diff of the given revisions marked as commit-queue=?."
-
- def _extract_revisions(self, arg):
- revision_list = []
- possible_revisions = arg.split(",")
- for revision in possible_revisions:
- revision = revision.strip()
- if not revision:
- continue
- revision = revision.lstrip("r")
- # If one part of the arg isn't in the correct format,
- # then none of the arg should be considered a revision.
- if not revision.isdigit():
- return None
- revision_list.append(int(revision))
- return revision_list
-
- def _parse_args(self, args):
- if not args:
- return (None, None)
-
- svn_revision_list = []
- remaining_args = args[:]
- # First process all revisions.
- while remaining_args:
- new_revisions = self._extract_revisions(remaining_args[0])
- if not new_revisions:
- break
- svn_revision_list += new_revisions
- remaining_args = remaining_args[1:]
-
- # Was there a revision number?
- if not len(svn_revision_list):
- return (None, None)
-
- # Everything left is the reason.
- revert_reason = " ".join(remaining_args)
- return svn_revision_list, revert_reason
-
- def _responsible_nicknames_from_revisions(self, tool, sheriff, svn_revision_list):
- commit_infos = map(tool.checkout().commit_info_for_revision, svn_revision_list)
- nickname_lists = map(sheriff.responsible_nicknames_from_commit_info, commit_infos)
- return sorted(set(itertools.chain(*nickname_lists)))
-
- def _nicks_string(self, tool, sheriff, requester_nick, svn_revision_list):
- # FIXME: _parse_args guarentees that our svn_revision_list is all numbers.
- # However, it's possible our checkout will not include one of the revisions,
- # so we may need to catch exceptions from commit_info_for_revision here.
- target_nicks = [requester_nick] + self._responsible_nicknames_from_revisions(tool, sheriff, svn_revision_list)
- return ", ".join(target_nicks)
-
- def _update_working_copy(self, tool):
- tool.scm().discard_local_changes()
- tool.executive.run_and_throw_if_fail(tool.deprecated_port().update_webkit_command(), quiet=True, cwd=tool.scm().checkout_root)
-
- def _check_diff_failure(self, error_log, tool):
- if not error_log:
- return None
-
- revert_failure_message_start = error_log.find("Failed to apply reverse diff for revision")
- if revert_failure_message_start == -1:
- return None
-
- lines = error_log[revert_failure_message_start:].split('\n')[1:]
- files = list(itertools.takewhile(lambda line: tool.filesystem.exists(tool.scm().absolute_path(line)), lines))
- if files:
- return "Failed to apply reverse diff for %s: %s" % (pluralize(len(files), "file", showCount=False), ", ".join(files))
- return None
-
- def execute(self, nick, args, tool, sheriff):
- svn_revision_list, revert_reason = self._parse_args(args)
-
- if (not svn_revision_list or not revert_reason):
- return self.usage(nick)
-
- revision_urls_string = join_with_separators([urls.view_revision_url(revision) for revision in svn_revision_list])
- tool.irc().post("%s: Preparing revert for %s ..." % (nick, revision_urls_string))
-
- self._update_working_copy(tool)
-
- # FIXME: IRCCommand should bind to a tool and have a self._tool like Command objects do.
- # Likewise we should probably have a self._sheriff.
- nicks_string = self._nicks_string(tool, sheriff, nick, svn_revision_list)
-
- try:
- complete_reason = "%s (Requested by %s on %s)." % (
- revert_reason, nick, config_irc.channel)
- bug_id = sheriff.post_revert_patch(svn_revision_list, complete_reason)
- bug_url = tool.bugs.bug_url_for_bug_id(bug_id)
- tool.irc().post("%s: Created a revert patch: %s" % (nicks_string, bug_url))
- except ScriptError as e:
- tool.irc().post("%s: Failed to create revert patch:" % nicks_string)
- diff_failure = self._check_diff_failure(e.output, tool)
- if diff_failure:
- return "%s: %s" % (nicks_string, diff_failure)
- _post_error_and_check_for_bug_url(tool, nicks_string, e)
-
-
-class Whois(IRCCommand):
- usage_string = "whois SEARCH_STRING"
- help_string = "Searches known contributors and returns any matches with irc, email and full name. Wild card * permitted."
-
- def _full_record_and_nick(self, contributor):
- result = ''
-
- if contributor.irc_nicknames:
- result += ' (:%s)' % ', :'.join(contributor.irc_nicknames)
-
- if contributor.can_review:
- result += ' (r)'
- elif contributor.can_commit:
- result += ' (c)'
-
- return unicode(contributor) + result
-
- def execute(self, nick, args, tool, sheriff):
- if not args:
- return self.usage(nick)
- search_string = unicode(" ".join(args))
- # FIXME: We should get the ContributorList off the tool somewhere.
- contributors = CommitterList().contributors_by_search_string(search_string)
- if not contributors:
- return unicode("%s: Sorry, I don't know any contributors matching '%s'.") % (nick, search_string)
- if len(contributors) > 5:
- return unicode("%s: More than 5 contributors match '%s', could you be more specific?") % (nick, search_string)
- if len(contributors) == 1:
- contributor = contributors[0]
- if not contributor.irc_nicknames:
- return unicode("%s: %s hasn't told me their nick. Boo hoo :-(") % (nick, contributor)
- return unicode("%s: %s is %s. Why do you ask?") % (nick, search_string, self._full_record_and_nick(contributor))
- contributor_nicks = list(map(self._full_record_and_nick, contributors))
- contributors_string = join_with_separators(contributor_nicks, _only_two_separator_=" or ", last_separator=', or ')
- return unicode("%s: I'm not sure who you mean? %s could be '%s'.") % (nick, contributors_string, search_string)
-
-
-# FIXME: Lame. We should have an auto-registering CommandCenter.
-visible_commands = {
- "create-bug": CreateBug,
- "help": Help,
- "hi": Hi,
- "ping": PingPong,
- "restart": Restart,
- "revert": Revert,
- "whois": Whois,
- "yt?": YouThere,
-}
-
-# Add "rollout" as an command alias for "revert", since it was the standard term for so many years.
-commands = visible_commands.copy()
-commands["rollout"] = Revert
-# "hello" Alias for "hi" command for the purposes of testing aliases
-commands["hello"] = Hi
Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,159 +0,0 @@
-# Copyright (c) 2010 Google Inc. All rights reserved.
-# Copyright (C) 2020 Apple 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.
-
-import logging
-import os
-import unittest
-
-from webkitpy.tool.bot.irc_command import *
-from webkitpy.tool.mocktool import MockTool
-from webkitpy.common.net.web_mock import MockWeb
-from webkitpy.common.system.executive_mock import MockExecutive
-from webkitpy.common.system.filesystem_mock import MockFileSystem
-
-from webkitcorepy import OutputCapture
-
-
-class IRCCommandTest(unittest.TestCase):
- def test_whois(self):
- whois = Whois()
- self.assertEqual("tom: Usage: whois SEARCH_STRING",
- whois.execute("tom", [], None, None))
- self.assertEqual("tom: Sorry, I don't know any contributors matching '[email protected]'.",
- whois.execute("tom", ["[email protected]"], None, None))
- self.assertEqual('tom: [email protected] is "Tony Gentilcore" <[email protected]> (:tonyg-cr). Why do you ask?',
- whois.execute("tom", ["[email protected]"], None, None))
- self.assertEqual('tom: [email protected] is "Tony Gentilcore" <[email protected]> (:tonyg-cr). Why do you ask?',
- whois.execute("tom", ["[email protected]"], None, None))
- self.assertEqual('tom: rniwa is "Ryosuke Niwa" <[email protected]> (:rniwa) (r). Why do you ask?',
- whois.execute("tom", ["rniwa"], None, None))
- self.assertEqual('tom: Xan Lopez is "Xan Lopez" <[email protected]> (:xan) (r). Why do you ask?',
- whois.execute("tom", ["Xan", "Lopez"], None, None))
- self.assertEqual(u'tom: Osztrogon\u00e1c is "Csaba Osztrogon\u00e1c" <[email protected]> (:ossy). Why do you ask?',
- whois.execute("tom", [u'Osztrogon\u00e1c'], None, None))
- self.assertEqual('tom: "Vicki Murley" <[email protected]> hasn\'t told me their nick. Boo hoo :-(',
- whois.execute("tom", ["[email protected]"], None, None))
- self.assertEqual('tom: I\'m not sure who you mean? "Gavin Barraclough" <[email protected]> (:gbarra) or "Gavin Peters" <[email protected]> (:gavinp) could be \'Gavin\'.',
- whois.execute("tom", ["Gavin"], None, None))
- self.assertEqual('tom: More than 5 contributors match \'david\', could you be more specific?',
- whois.execute("tom", ["david"], None, None))
-
- def test_create_bug(self):
- create_bug = CreateBug()
- self.assertEqual("tom: Usage: create-bug BUG_TITLE",
- create_bug.execute("tom", [], None, None))
-
- example_args = ["sherrif-bot", "should", "have", "a", "create-bug", "command"]
- tool = MockTool()
-
- # MockBugzilla has a create_bug, but it logs to stderr, this avoids any logging.
- tool.bugs.create_bug = lambda a, b, cc=None, assignee=None: 50004
- self.assertEqual("tom: Created bug: http://example.com/50004",
- create_bug.execute("tom", example_args, tool, None))
-
- def mock_create_bug(title, description, cc=None, assignee=None):
- raise Exception("Exception from bugzilla!")
- tool.bugs.create_bug = mock_create_bug
- self.assertEqual("tom: Failed to create bug:\nException from bugzilla!",
- create_bug.execute("tom", example_args, tool, None))
-
- def test_revert_updates_working_copy(self):
- revert = Revert()
- tool = MockTool()
- tool.executive = MockExecutive(should_log=True)
- with OutputCapture(level=logging.INFO) as captured:
- revert._update_working_copy(tool)
- self.assertEqual(
- captured.root.log.getvalue(),
- "MOCK run_and_throw_if_fail: ['mock-update-webkit'], cwd=/mock-checkout\n",
- )
-
- def test_revert(self):
- revert = Revert()
- self.assertEqual(([1234], "testing foo"),
- revert._parse_args(["1234", "testing", "foo"]))
-
- self.assertEqual(([554], "testing foo"),
- revert._parse_args(["r554", "testing", "foo"]))
-
- self.assertEqual(([556, 792], "testing foo"),
- revert._parse_args(["r556", "792", "testing", "foo"]))
-
- self.assertEqual(([128, 256], "testing foo"),
- revert._parse_args(["r128,r256", "testing", "foo"]))
-
- self.assertEqual(([512, 1024, 2048], "testing foo"),
- revert._parse_args(["512,", "1024,2048", "testing", "foo"]))
-
- # Test invalid argument parsing:
- self.assertEqual((None, None), revert._parse_args([]))
- self.assertEqual((None, None), revert._parse_args(["--bar", "1234"]))
-
- # Invalid arguments result in the USAGE message.
- self.assertEqual("tom: Usage: revert SVN_REVISION [SVN_REVISIONS] REASON",
- revert.execute("tom", [], None, None))
-
- tool = MockTool()
- tool.filesystem.files["/mock-checkout/test/file/one"] = ""
- tool.filesystem.files["/mock-checkout/test/file/two"] = ""
- self.assertEqual("Failed to apply reverse diff for files: test/file/one, test/file/two",
- revert._check_diff_failure("""
-Preparing revert for bug 123456.
-Updating working directory
-Failed to apply reverse diff for revision 123456 because of the following conflicts:
-test/file/one
-test/file/two
-Failed to apply reverse diff for revision 123456 because of the following conflicts:
-test/file/one
-test/file/two
-Updating OpenSource
-Current branch master is up to date.
- """, tool))
-
- self.assertEqual("Failed to apply reverse diff for file: test/file/one",
- revert._check_diff_failure("""
-Preparing revert for bug 123456.
-Updating working directory
-Failed to apply reverse diff for revision 123456 because of the following conflicts:
-test/file/one
-Updating OpenSource
-Current branch master is up to date.
- """, tool))
-
- self.assertEqual(None, revert._check_diff_failure("""
-Preparing revert for bug 123456.
-Updating working directory
-Some other error report involving file paths:
-test/file/one
-test/file/two
-Updating OpenSource
-Current branch master is up to date.
- """, tool))
-
- # FIXME: We need a better way to test IRCCommands which call tool.irc().post()
Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/ircbot.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/bot/ircbot.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/ircbot.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,98 +0,0 @@
-# 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.tool.bot.queueengine import TerminateQueue
-from webkitpy.tool.bot.irc_command import IRCCommand
-from webkitpy.common.net.irc.ircbot import IRCBotDelegate
-from webkitpy.common.thread.threadedmessagequeue import ThreadedMessageQueue
-
-
-class _IRCThreadTearoff(IRCBotDelegate):
- def __init__(self, name, password, message_queue, wakeup_event):
- self._name = name
- self._password = password
- self._message_queue = message_queue
- self._wakeup_event = wakeup_event
-
- # IRCBotDelegate methods
-
- def irc_message_received(self, nick, message):
- self._message_queue.post([nick, message])
- self._wakeup_event.set()
-
- def irc_nickname(self):
- return self._name
-
- def irc_password(self):
- return self._password
-
-
-class UnknownCommand(IRCCommand):
- def execute(self, nick, args, tool, sheriff):
- return "%s: %s" % (nick, "...")
-
-
-class IRCBot(object):
- def __init__(self, name, tool, agent, commands):
- self._name = name
- self._tool = tool
- self._agent = agent
- self._message_queue = ThreadedMessageQueue()
- self._commands = commands
-
- def irc_delegate(self):
- return _IRCThreadTearoff(self._name, self._tool.irc_password,
- self._message_queue, self._tool.wakeup_event)
-
- def _parse_command_and_args(self, request):
- tokenized_request = request.strip().split(" ")
- command = self._commands.get(tokenized_request[0])
- args = tokenized_request[1:]
- if not command:
- # Give the peoples someone to talk with.
- command = UnknownCommand
- args = tokenized_request
- return (command, args)
-
- def process_message(self, requester_nick, request):
- command, args = self._parse_command_and_args(request)
- try:
- response = command().execute(requester_nick, args, self._tool, self._agent)
- 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 as e:
- self._tool.irc().post("Exception executing command: %s" % e)
-
- def process_pending_messages(self):
- (messages, is_running) = self._message_queue.take_all()
- for message in messages:
- (nick, request) = message
- self.process_message(nick, request)
Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/ircbot_unittest.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/bot/ircbot_unittest.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/ircbot_unittest.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,228 +0,0 @@
-# Copyright (c) 2010 Google Inc. All rights reserved.
-# Copyright (C) 2020 Apple 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.
-
-import logging
-import random
-import unittest
-
-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.ircbot import IRCBot
-from webkitpy.tool.bot.ircbot import UnknownCommand
-from webkitpy.tool.bot.sheriff_unittest import MockSheriffBot
-from webkitpy.tool.mocktool import MockTool
-
-from webkitcorepy import OutputCapture
-
-
-def run(message):
- tool = MockTool()
- tool.ensure_irc_connected(None)
- bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()), irc_command.commands)
- bot._message_queue.post(["mock_nick", message])
- bot.process_pending_messages()
-
-
-class IRCBotTest(unittest.TestCase):
- def test_parse_command_and_args(self):
- tool = MockTool()
- bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()), irc_command.commands)
- self.assertEqual(bot._parse_command_and_args(""), (UnknownCommand, [""]))
- self.assertEqual(bot._parse_command_and_args(" "), (UnknownCommand, [""]))
- self.assertEqual(bot._parse_command_and_args(" hi "), (irc_command.Hi, []))
- self.assertEqual(bot._parse_command_and_args(" hi there "), (irc_command.Hi, ["there"]))
-
- def test_exception_during_command(self):
- tool = MockTool()
- tool.ensure_irc_connected(None)
- bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()), irc_command.commands)
-
- class CommandWithException(object):
- def execute(self, nick, args, tool, sheriff):
- raise Exception("mock_exception")
-
- bot._parse_command_and_args = lambda request: (CommandWithException, [])
- with OutputCapture(level=logging.INFO) as captured:
- bot.process_message('mock_nick', 'ignored message')
- self.assertEqual(captured.root.log.getvalue(), 'MOCK: irc.post: Exception executing command: mock_exception\n')
-
-
- 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.
- with self.assertRaises(KeyboardInterrupt):
- with OutputCapture(level=logging.INFO):
- bot.process_message('mock_nick', 'ignored message')
-
- def test_hi(self):
- random.seed(23324)
- with OutputCapture(level=logging.INFO) as captured:
- run('hi')
- self.assertEqual(
- captured.root.log.getvalue(),
- 'MOCK: irc.post: "Only you can prevent forest fires." -- Smokey the Bear\n',
- )
-
- def test_help(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('help')
- self.assertEqual(
- captured.root.log.getvalue(),
- '''MOCK: irc.post: mock_nick: Available commands: create-bug, help, hi, ping, restart, revert, whois, yt?
-MOCK: irc.post: mock_nick: Type "mock-sheriff-bot: help COMMAND" for help on my individual commands.
-''',
- )
-
- expected_logs = '''MOCK: irc.post: mock_nick: Usage: hi
-MOCK: irc.post: mock_nick: Responds with hi.
-MOCK: irc.post: mock_nick: Aliases: hello
-'''
- with OutputCapture(level=logging.INFO) as captured:
- run('help hi')
- self.assertEqual(captured.root.log.getvalue(), expected_logs)
-
- with OutputCapture(level=logging.INFO) as captured:
- run('help hello')
- self.assertEqual(captured.root.log.getvalue(), expected_logs)
-
- def test_restart(self):
- with OutputCapture(level=logging.INFO) as captured:
- with self.assertRaises(TerminateQueue):
- run('restart')
- self.assertEqual(captured.root.log.getvalue(), 'MOCK: irc.post: Restarting...\n')
-
- def test_rollout(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('rollout 21654 This patch broke the world')
- self.assertEqual(
- captured.root.log.getvalue(),
- '''MOCK: irc.post: mock_nick: Preparing revert for https://trac.webkit.org/changeset/21654 ...
-MOCK: irc.post: mock_nick, abarth, ap, darin: Created a revert patch: http://example.com/36936
-''',
- )
-
- def test_revert(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('revert 21654 This patch broke the world')
- self.assertEqual(
- captured.root.log.getvalue(),
- '''MOCK: irc.post: mock_nick: Preparing revert for https://trac.webkit.org/changeset/21654 ...
-MOCK: irc.post: mock_nick, abarth, ap, darin: Created a revert patch: http://example.com/36936
-''',
- )
-
- def test_multi_revert(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('revert 21654 21655 21656 This 21654 patch broke the world')
- self.assertEqual(
- captured.root.log.getvalue(),
- '''MOCK: irc.post: mock_nick: Preparing revert for https://trac.webkit.org/changeset/21654, https://trac.webkit.org/changeset/21655, and https://trac.webkit.org/changeset/21656 ...
-MOCK: irc.post: mock_nick, abarth, ap, darin: Created a revert patch: http://example.com/36936
-''',
- )
-
- def test_revert_with_r_in_svn_revision(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('revert r21654 This patch broke the world')
- self.assertEqual(
- captured.root.log.getvalue(),
- '''MOCK: irc.post: mock_nick: Preparing revert for https://trac.webkit.org/changeset/21654 ...
-MOCK: irc.post: mock_nick, abarth, ap, darin: Created a revert patch: http://example.com/36936
-''',
- )
-
- def test_multi_revert_with_r_in_svn_revision(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('revert r21654 21655 r21656 This r21654 patch broke the world')
- self.assertEqual(
- captured.root.log.getvalue(),
- '''MOCK: irc.post: mock_nick: Preparing revert for https://trac.webkit.org/changeset/21654, https://trac.webkit.org/changeset/21655, and https://trac.webkit.org/changeset/21656 ...
-MOCK: irc.post: mock_nick, abarth, ap, darin: Created a revert patch: http://example.com/36936
-''',
- )
-
- def test_revert_bananas(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('revert bananas')
- self.assertEqual(
- captured.root.log.getvalue(),
- 'MOCK: irc.post: mock_nick: Usage: revert SVN_REVISION [SVN_REVISIONS] REASON\n',
- )
-
- def test_revert_invalidate_revision(self):
- # When folks pass junk arguments, we should just spit the usage back at them.
- with OutputCapture(level=logging.INFO) as captured:
- run('revert --component=Tools 21654')
- self.assertEqual(
- captured.root.log.getvalue(),
- 'MOCK: irc.post: mock_nick: Usage: revert SVN_REVISION [SVN_REVISIONS] REASON\n',
- )
-
- def test_revert_invalidate_reason(self):
- # FIXME: I'm slightly confused as to why this doesn't return the USAGE message.
- with OutputCapture(level=logging.INFO) as captured:
- run('revert 21654 -bad')
- self.assertEqual(
- captured.root.log.getvalue(),
- '''MOCK: irc.post: mock_nick: Preparing revert for https://trac.webkit.org/changeset/21654 ...
-MOCK: irc.post: mock_nick, abarth, ap, darin: Failed to create revert patch:
-MOCK: irc.post: The revert reason may not begin with - (\"-bad (Requested by mock_nick on #webkit).\").
-''',
- )
-
- def test_multi_revert_invalidate_reason(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('revert 21654 21655 r21656 -bad')
- self.assertEqual(
- captured.root.log.getvalue(),
- '''MOCK: irc.post: mock_nick: Preparing revert for https://trac.webkit.org/changeset/21654, https://trac.webkit.org/changeset/21655, and https://trac.webkit.org/changeset/21656 ...
-MOCK: irc.post: mock_nick, abarth, ap, darin: Failed to create revert patch:
-MOCK: irc.post: The revert reason may not begin with - (\"-bad (Requested by mock_nick on #webkit).\").
-''',
- )
-
- def test_revert_no_reason(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('revert 21654')
- self.assertEqual(
- captured.root.log.getvalue(),
- 'MOCK: irc.post: mock_nick: Usage: revert SVN_REVISION [SVN_REVISIONS] REASON\n',
- )
-
- def _test_multi_revert_no_reason(self):
- with OutputCapture(level=logging.INFO) as captured:
- run('revert 21654 21655 r21656')
- self.assertEqual(
- captured.root.log.getvalue(),
- 'MOCK: irc.post: mock_nick: Usage: revert SVN_REVISION [SVN_REVISIONS] REASON\n',
- )
Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/sheriff.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/bot/sheriff.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/sheriff.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,107 +0,0 @@
-# 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.config import urls
-from webkitpy.common.system.executive import ScriptError
-from webkitpy.tool.grammar import join_with_separators
-
-from functools import reduce
-
-
-class Sheriff(object):
- def __init__(self, tool, sheriffbot):
- self._tool = tool
- self._sheriffbot = sheriffbot
-
- def name(self):
- return self._sheriffbot.name
-
- def responsible_nicknames_from_commit_info(self, commit_info):
- nestedList = [party.irc_nicknames for party in commit_info.responsible_parties() if party.irc_nicknames]
- return reduce(lambda list, childList: list + childList, nestedList)
-
- def post_irc_warning(self, commit_info, builders):
- irc_nicknames = sorted(self.responsible_nicknames_from_commit_info(commit_info))
- irc_prefix = ": " if irc_nicknames else ""
- irc_message = "%s%s%s might have broken %s" % (
- ", ".join(irc_nicknames),
- irc_prefix,
- urls.view_revision_url(commit_info.revision()),
- join_with_separators([builder.name() for builder in builders]))
-
- self._tool.irc().post(irc_message)
-
- def post_irc_summary(self, failure_map):
- failing_tests = failure_map.failing_tests()
- if not failing_tests:
- return
- test_list_limit = 5
- irc_message = "New failures: %s" % ", ".join(sorted(failing_tests)[:test_list_limit])
- failure_count = len(failing_tests)
- if failure_count > test_list_limit:
- irc_message += " (and %s more...)" % (failure_count - test_list_limit)
- self._tool.irc().post(irc_message)
-
- def post_revert_patch(self, svn_revision_list, revert_reason):
- # Ensure that svn revisions are numbers (and not options to
- # create-revert).
- try:
- svn_revisions = " ".join([str(int(revision)) for revision in svn_revision_list])
- except:
- raise ScriptError(message="Invalid svn revision number \"%s\"."
- % " ".join(svn_revision_list))
-
- if revert_reason.startswith("-"):
- raise ScriptError(message="The revert reason may not begin "
- "with - (\"%s\")." % revert_reason)
-
- output = self._sheriffbot.run_webkit_patch([
- "create-revert",
- "--force-clean",
- # In principle, we should pass --non-interactive here, but it
- # turns out that create-revert doesn't need it yet. We can't
- # pass it prophylactically because we reject unrecognized command
- # line switches.
- "--parent-command=sheriff-bot",
- svn_revisions,
- revert_reason,
- ])
- return urls.parse_bug_id(output)
-
- def post_blame_comment_on_bug(self, commit_info, builders, tests):
- if not commit_info.bug_id():
- return
- comment = "%s might have broken %s" % (
- urls.view_revision_url(commit_info.revision()),
- join_with_separators([builder.name() for builder in builders]))
- if tests:
- comment += "\nThe following tests are not passing:\n"
- comment += "\n".join(tests)
- self._tool.bugs.post_comment_to_bug(commit_info.bug_id(),
- comment,
- cc=self._sheriffbot.watchers)
Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/sheriff_unittest.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/bot/sheriff_unittest.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/sheriff_unittest.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,97 +0,0 @@
-# Copyright (C) 2010 Google Inc. All rights reserved.
-# Copyright (C) 2020 Apple 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.
-
-import logging
-import unittest
-
-from webkitpy.common.net.buildbot import Builder
-from webkitpy.thirdparty.mock import Mock
-from webkitpy.tool.bot.sheriff import Sheriff
-from webkitpy.tool.mocktool import MockTool
-
-from webkitcorepy import OutputCapture
-
-
-class MockSheriffBot(object):
- name = "mock-sheriff-bot"
- watchers = [
- "[email protected]",
- ]
-
- def run_webkit_patch(self, args):
- return "Created bug https://bugs.webkit.org/show_bug.cgi?id=36936\n"
-
-
-class SheriffTest(unittest.TestCase):
- def test_post_blame_comment_on_bug(self):
- def run():
- sheriff = Sheriff(MockTool(), MockSheriffBot())
- builders = [
- Builder("Foo", None),
- Builder("Bar", None),
- ]
- commit_info = Mock()
- commit_info.bug_id = lambda: None
- commit_info.revision = lambda: 4321
- # Should do nothing with no bug_id
- sheriff.post_blame_comment_on_bug(commit_info, builders, [])
- sheriff.post_blame_comment_on_bug(commit_info, builders, ["mock-test-1", "mock-test-2"])
- # Should try to post a comment to the bug, but MockTool.bugs does nothing.
- commit_info.bug_id = lambda: 1234
- sheriff.post_blame_comment_on_bug(commit_info, builders, [])
- sheriff.post_blame_comment_on_bug(commit_info, builders, ["mock-test-1"])
- sheriff.post_blame_comment_on_bug(commit_info, builders, ["mock-test-1", "mock-test-2"])
-
- with OutputCapture(level=logging.INFO) as captured:
- run()
-
- self.assertEqual(
- captured.root.log.getvalue(),
- u"""MOCK bug comment: bug_id=1234, cc=['[email protected]'], see_also=None
---- Begin comment ---
-https://trac.webkit.org/changeset/4321 might have broken Foo and Bar
---- End comment ---
-
-MOCK bug comment: bug_id=1234, cc=['[email protected]'], see_also=None
---- Begin comment ---
-https://trac.webkit.org/changeset/4321 might have broken Foo and Bar
-The following tests are not passing:
-mock-test-1
---- End comment ---
-
-MOCK bug comment: bug_id=1234, cc=['[email protected]'], see_also=None
---- Begin comment ---
-https://trac.webkit.org/changeset/4321 might have broken Foo and Bar
-The following tests are not passing:
-mock-test-1
-mock-test-2
---- End comment ---
-
-""",
- )
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/__init__.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/commands/__init__.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/__init__.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -9,9 +9,7 @@
from webkitpy.tool.commands.earlywarningsystem import AbstractEarlyWarningSystem
from webkitpy.tool.commands.findusers import FindUsers
from webkitpy.tool.commands.gardenomatic import GardenOMatic
-from webkitpy.tool.commands.newcommitbot import NewCommitBot
from webkitpy.tool.commands.openbugs import OpenBugs
-from webkitpy.tool.commands.perfalizer import Perfalizer
from webkitpy.tool.commands.prettydiff import PrettyDiff
from webkitpy.tool.commands.queries import *
from webkitpy.tool.commands.queues import *
@@ -18,7 +16,6 @@
from webkitpy.tool.commands.rebaseline import Rebaseline
from webkitpy.tool.commands.rebaselineserver import RebaselineServer
from webkitpy.tool.commands.setupgitclone import SetupGitClone
-from webkitpy.tool.commands.sheriffbot import *
from webkitpy.tool.commands.upload import *
from webkitpy.tool.commands.suggestnominations import *
Deleted: trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,172 +0,0 @@
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Copyright (c) 2013 Apple 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.
-
-import logging
-import re
-
-from webkitpy.common.config.committers import CommitterList
-from webkitpy.common.system.executive import ScriptError
-from webkitpy.tool.bot.irc_command import IRCCommand
-from webkitpy.tool.bot.irc_command import Help
-from webkitpy.tool.bot.irc_command import Hi
-from webkitpy.tool.bot.irc_command import PingPong
-from webkitpy.tool.bot.irc_command import Restart
-from webkitpy.tool.bot.irc_command import YouThere
-from webkitpy.tool.bot.ircbot import IRCBot
-from webkitpy.tool.commands.queues import AbstractQueue
-from webkitpy.tool.commands.stepsequence import StepSequenceErrorHandler
-
-_log = logging.getLogger(__name__)
-
-
-class Agent(object):
- def __init__(self, tool, newcommitbot):
- self._tool = tool
- self._newcommitbot = newcommitbot
-
- def name(self):
- return 'WKR'
-
-
-class NewCommitBot(AbstractQueue, StepSequenceErrorHandler):
- name = "WKR"
- watchers = AbstractQueue.watchers + ["[email protected]"]
-
- _commands = {
- "hi": Hi,
- "ping": PingPong,
- "restart": Restart,
- "yt?": YouThere,
- }
-
- _maximum_number_of_revisions_to_avoid_spamming_irc = 10
-
- # AbstractQueue methods
-
- def begin_work_queue(self):
- self._last_svn_revision = int(self._tool.scm().head_svn_revision())
- self._irc_bot = IRCBot(self.name, self._tool, Agent(self._tool, self), self._commands)
- self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
-
- def work_item_log_path(self, failure_map):
- return None
-
- def next_work_item(self):
- self._irc_bot.process_pending_messages()
-
- _log.info('Last SVN revision: %d' % self._last_svn_revision)
-
- count = 0
- while count < self._maximum_number_of_revisions_to_avoid_spamming_irc:
- new_revision = self._last_svn_revision + 1
- try:
- commit_log = self._tool.executive.run_command(['svn', 'log', 'https://svn.webkit.org/repository/webkit/trunk', '--non-interactive', '--revision',
- self._tool.scm().strip_r_from_svn_revision(new_revision)])
- except ScriptError:
- break
-
- self._last_svn_revision = new_revision
- if self._is_empty_log(commit_log):
- continue
-
- count += 1
- _log.info('Found revision %d' % new_revision)
- self._tool.irc().post(self._summarize_commit_log(commit_log).encode('utf-8'))
-
- def _is_empty_log(self, commit_log):
- return re.match(r'^\-+$', commit_log)
-
- def process_work_item(self, failure_map):
- return True
-
- _patch_by_regex = re.compile(r'^Patch\s+by\s+(?P<author>.+?)\s+on(\s+\d{4}-\d{2}-\d{2})?\n?', re.MULTILINE | re.IGNORECASE)
- _revert_regex = re.compile(r'(rolling out|reverting) (?P<revisions>r?\d+((,\s*|,?\s*and\s+)?r?\d+)*)\.?\s*', re.MULTILINE | re.IGNORECASE)
- _requested_by_regex = re.compile(r'^\"?(?P<reason>.+?)\"? \(Requested\s+by\s+(?P<author>.+?)\s+on\s+#webkit\)\.', re.MULTILINE | re.IGNORECASE)
- _bugzilla_url_regex = re.compile(r'http(s?)://bugs\.webkit\.org/show_bug\.cgi\?id=(?P<id>\d+)', re.MULTILINE)
- _trac_url_regex = re.compile(r'http(s?)://trac.webkit.org/changeset/(?P<revision>\d+)', re.MULTILINE)
-
- @classmethod
- def _summarize_commit_log(self, commit_log, committer_list=CommitterList()):
- for contributor in committer_list.contributors():
- if not contributor.irc_nicknames:
- continue
- name_with_nick = "%s (%s)" % (contributor.full_name, contributor.irc_nicknames[0])
- if contributor.full_name in commit_log:
- commit_log = commit_log.replace(contributor.full_name, name_with_nick)
- for email in contributor.emails:
- commit_log = commit_log.replace(' <' + email + '>', '')
- else:
- for email in contributor.emails:
- commit_log = commit_log.replace(' %s ' % email, ' %s ' % name_with_nick)
-
- patch_by = self._patch_by_regex.search(commit_log)
- commit_log = self._patch_by_regex.sub('', commit_log, count=1)
-
- revert = self._revert_regex.search(commit_log)
- commit_log = self._revert_regex.sub('', commit_log, count=1)
-
- requested_by = self._requested_by_regex.search(commit_log)
-
- commit_log = self._bugzilla_url_regex.sub(r'https://webkit.org/b/\g<id>', commit_log)
- commit_log = self._trac_url_regex.sub(r'https://trac.webkit.org/r\g<revision>', commit_log)
-
- lines = commit_log.split('\n')[1:-2] # Ignore lines with ----------.
-
- firstline = re.match(r'^(?P<revision>r\d+) \| (?P<email>[^\|]+) \| (?P<timestamp>[^|]+) \| [^\n]+', lines[0])
- assert firstline
-
- author = firstline.group('email')
- if patch_by:
- author = patch_by.group('author')
-
- linkified_revision = 'https://trac.webkit.org/%s' % firstline.group('revision')
- lines[0] = '%s by %s' % (linkified_revision, author)
-
- if revert:
- if requested_by:
- author = requested_by.group('author')
- contributor = committer_list.contributor_by_irc_nickname(author)
- if contributor:
- author = "%s (%s)" % (contributor.full_name, contributor.irc_nicknames[0])
- return '%s reverted %s in %s : %s' % (author, revert.group('revisions'),
- linkified_revision, requested_by.group('reason'))
- lines[0] = '%s reverted %s in %s' % (author, revert.group('revisions'), linkified_revision)
-
- return ' '.join(list(filter(lambda line: len(line), lines))[0:4])
-
- def handle_unexpected_error(self, failure_map, message):
- _log.error(message)
-
- # StepSequenceErrorHandler methods
-
- @classmethod
- def handle_script_error(cls, tool, state, script_error):
- # Ideally we would post some information to IRC about what went wrong
- # here, but we don't have the IRC password in the child process.
- pass
Deleted: trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot_unittest.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot_unittest.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot_unittest.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,167 +0,0 @@
-# Copyright (C) 2013 Apple 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.
-
-import unittest
-
-from webkitpy.tool.commands.newcommitbot import NewCommitBot
-
-
-class NewCommitBotTest(unittest.TestCase):
- def test_summarize_commit_log_basic(self):
- self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
-r143106 | [email protected] | 2013-02-16 10:27:07 -0800 (Sat, 16 Feb 2013) | 10 lines
-
-[chromium] initialize all variables of TestRunner classes
-https://bugs.webkit.org/show_bug.cgi?id=110013
-
-Reviewed by Adam Barth.
-
-* DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp:
-(WebTestRunner::TestInterfaces::TestInterfaces):
-* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
-(WebTestRunner::TestRunner::TestRunner):
-
-------------------------------------------------------------------------"""),
- "https://trac.webkit.org/r143106 by Jochen Eisinger (jochen__) [chromium] initialize all variables of TestRunner classes"
- " https://webkit.org/b/110013 Reviewed by Adam Barth (abarth).")
-
- self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
-r140066 | [email protected] | 2013-01-17 16:10:31 -0800 (Thu, 17 Jan 2013) | 10 lines
-
-Allow PaintInfo to carry all PaintBehavior flags
-https://bugs.webkit.org/show_bug.cgi?id=106980
-
-Reviewed by Beth Dakin.
-
-In r139908 I missed one instance of the PaintInfo constructor that should take PaintBehaviorNormal
-instead of "false".
-
-* rendering/RenderScrollbarPart.cpp:
-(WebCore::RenderScrollbarPart::paintIntoRect):
-------------------------------------------------------------------------"""),
- "https://trac.webkit.org/r140066 by Simon Fraser (smfr)"
- " Allow PaintInfo to carry all PaintBehavior flags https://webkit.org/b/106980 Reviewed by Beth Dakin (dethbakin).")
-
- self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
-r211085 | [email protected] | 2017-01-24 09:01:44 -0800 (Tue, 24 Jan 2017) | 9 lines
-
-Remove always true openGLMultisamplingEnabled setting
-https://bugs.webkit.org/show_bug.cgi?id=167364
-
-Patch by Joseph Pecoraro <[email protected]> on 2017-01-24
-Reviewed by Sam Weinig.
-
-* html/canvas/WebGLRenderingContextBase.cpp:
-(WebCore::WebGLRenderingContextBase::create):
-* page/Settings.in:
-------------------------------------------------------------------------"""),
- "https://trac.webkit.org/r211085 by Joseph Pecoraro (JoePeck)"
- " Remove always true openGLMultisamplingEnabled setting https://webkit.org/b/167364 Reviewed by Sam Weinig (weinig).")
-
- def test_summarize_commit_log_revert(self):
- self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
-r143104 | [email protected] | 2013-02-16 09:09:01 -0800 (Sat, 16 Feb 2013) | 27 lines
-
-Unreviewed, reverting r142734.
-https://trac.webkit.org/changeset/142734
-https://bugs.webkit.org/show_bug.cgi?id=110018
-
-"Triggered crashes on lots of websites" (Requested by ggaren
-on #webkit).
-
-Patch by Sheriff Bot <[email protected]> on 2013-02-16
-
-Source/WebCore:
-
-------------------------------------------------------------------------"""),
- "Geoffrey Garen (ggaren) reverted r142734 in https://trac.webkit.org/r143104 : Triggered crashes on lots of websites")
-
- self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
-r139884 | [email protected] | 2013-01-16 08:26:10 -0800 (Wed, 16 Jan 2013) | 23 lines
-
-[GStreamer][Soup] Let GStreamer provide the buffer data is downloaded to, to avoid copying
-https://bugs.webkit.org/show_bug.cgi?id=105552
-
-Reverting 139877. It made a couple of API tests fail.
-
-* platform/graphics/gstreamer/GStreamerVersioning.cpp:
-* platform/graphics/gstreamer/GStreamerVersioning.h:
-* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
-(StreamingClient):
-(_WebKitWebSrcPrivate):
-
-------------------------------------------------------------------------"""),
- "Gustavo Noronha Silva (kov) reverted 139877 in https://trac.webkit.org/r139884"
- " [GStreamer][Soup] Let GStreamer provide the buffer data is downloaded to, to avoid copying"
- " https://webkit.org/b/105552 It made a couple of API tests fail.")
-
- self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
-r135487 | [email protected] | 2012-11-22 00:09:25 -0800 (Thu, 22 Nov 2012) | 52 lines
-
-Unreviewed, reverting r134927 and r134944.
-https://trac.webkit.org/changeset/134927
-https://trac.webkit.org/changeset/134944
-https://bugs.webkit.org/show_bug.cgi?id=103028
-
-Reverting the reverts after merging. (Requested by vsevik on
-#webkit).
-
-Patch by Sheriff Bot <[email protected]> on 2012-11-22
-
-* English.lproj/localizedStrings.js:
-* WebCore.gypi:
-* WebCore.vcproj/WebCore.vcproj:
-* inspector/compile-front-end.py:
-* inspector/front-end/AdvancedSearchController.js:
-* inspector/front-end/CallStackSidebarPane.js:
-
-------------------------------------------------------------------------"""),
- "Vsevolod Vlasov (vsevik) reverted r134927 and r134944 in https://trac.webkit.org/r135487 :"
- " Reverting the reverts after merging.")
-
- # Miguel <[email protected]> is not to be confused with Andres <[email protected]>.
- def test_email_substring_problem(self):
- self.assertEqual(NewCommitBot._summarize_commit_log("""------------------------------------------------------------------------
-r211084 | [email protected] | 2017-01-24 10:25:31 -0600 (Tue, 24 Jan 2017) | 13 lines
-
-[GTK] Do not paint non composited content into the window when using the threaded compositor
-https://bugs.webkit.org/show_bug.cgi?id=167367
-
-Reviewed by Carlos Garcia Campos.
-
-When using the threaded compositor we need to send the non composited content for compositing as well,
-not painting it directly into the window.
-
-No new tests.
-
-* rendering/RenderLayerBacking.cpp:
-(WebCore::RenderLayerBacking::paintsIntoWindow):
-
-------------------------------------------------------------------------"""),
- "https://trac.webkit.org/r211084 by Miguel Gomez (magomez) [GTK] Do not paint non composited content into the window when using the threaded compositor"
- " https://webkit.org/b/167367 Reviewed by Carlos Garcia Campos (KaL).")
Deleted: trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,211 +0,0 @@
-# Copyright (c) 2012 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.
-
-import logging
-
-from webkitpy.tool.bot.irc_command import IRCCommand
-from webkitpy.tool.bot.irc_command import Help
-from webkitpy.tool.bot.irc_command import Hi
-from webkitpy.tool.bot.irc_command import Restart
-from webkitpy.tool.bot.ircbot import IRCBot
-from webkitpy.tool.bot.patchanalysistask import PatchAnalysisTask, PatchAnalysisTaskDelegate, UnableToApplyPatch
-from webkitpy.tool.bot.sheriff import Sheriff
-from webkitpy.tool.commands.queues import AbstractQueue
-from webkitpy.tool.commands.stepsequence import StepSequenceErrorHandler
-
-_log = logging.getLogger(__name__)
-
-
-class PerfalizerTask(PatchAnalysisTask):
- def __init__(self, tool, patch, logger):
- PatchAnalysisTask.__init__(self, self, patch)
- self._port = tool.port_factory.get()
- self._tool = tool
- self._logger = logger
-
- def _copy_build_product_without_patch(self):
- filesystem = self._tool.filesystem
- configuration = filesystem.basename(self._port._build_path())
- self._build_directory = filesystem.dirname(self._port._build_path())
- self._build_directory_without_patch = self._build_directory + 'WithoutPatch'
-
- try:
- filesystem.rmtree(self._build_directory_without_patch)
- filesystem.copytree(filesystem.join(self._build_directory, configuration),
- filesystem.join(self._build_directory_without_patch, configuration))
- return True
- except:
- return False
-
- def validate(self):
- return True
-
- def run(self):
- if not self._patch.committer() and not self._patch.attacher().can_commit:
- self._logger('The patch %d is not authorized by a commmitter' % self._patch.id())
- return False
-
- self._logger('Preparing to run performance tests for the attachment %d...' % self._patch.id())
- if not self._clean() or not self._update():
- return False
-
- head_revision = self._tool.scm().head_svn_revision()
-
- self._logger('Building WebKit at r%s without the patch' % head_revision)
- if not self._build_without_patch():
- return False
-
- if not self._port.check_build():
- self._logger('Failed to build DumpRenderTree.')
- return False
-
- if not self._copy_build_product_without_patch():
- self._logger('Failed to copy the build product from %s to %s' % (self._build_directory, self._build_directory_without_patch))
- return False
-
- self._logger('Building WebKit at r%s with the patch' % head_revision)
- if not self._apply() or not self._build():
- return False
-
- if not self._port.check_build():
- self._logger('Failed to build DumpRenderTree.')
- return False
-
- filesystem = self._tool.filesystem
- if filesystem.exists(self._json_path()):
- filesystem.remove(self._json_path())
-
- self._logger("Running performance tests...")
- if self._run_perf_test(self._build_directory_without_patch, 'without %d' % self._patch.id()) < 0:
- self._logger('Failed to run performance tests without the patch.')
- return False
-
- if self._run_perf_test(self._build_directory, 'with %d' % self._patch.id()) < 0:
- self._logger('Failed to run performance tests with the patch.')
- return False
-
- if not filesystem.exists(self._results_page_path()):
- self._logger('Failed to generate the results page.')
- return False
-
- results_page = filesystem.read_text_file(self._results_page_path())
- self._tool.bugs.add_attachment_to_bug(self._patch.bug_id(), results_page,
- description="Performance tests results for %d" % self._patch.id(), mimetype='text/html')
-
- self._logger("Uploaded the results on the bug %d" % self._patch.bug_id())
- return True
-
- def parent_command(self):
- return "perfalizer"
-
- def run_webkit_patch(self, args):
- webkit_patch_args = [self._tool.path()]
- webkit_patch_args.extend(args)
- return self._tool.executive.run_and_throw_if_fail(webkit_patch_args, cwd=self._tool.scm().checkout_root)
-
- def _json_path(self):
- return self._tool.filesystem.join(self._build_directory, 'PerformanceTestResults.json')
-
- def _results_page_path(self):
- return self._tool.filesystem.join(self._build_directory, 'PerformanceTestResults.html')
-
- def _run_perf_test(self, build_path, description):
- filesystem = self._tool.filesystem
- script_path = filesystem.join(filesystem.dirname(self._tool.path()), 'run-perf-tests')
- perf_test_runner_args = [script_path, '--no-build', '--no-show-results', '--build-directory', build_path,
- '--output-json-path', self._json_path(), '--description', description]
- return self._tool.executive.run_and_throw_if_fail(perf_test_runner_args, cwd=self._tool.scm().checkout_root)
-
- def run_command(self, command):
- self.run_webkit_patch(command)
-
- def refetch_patch(self, patch):
- return self._tool.bugs.fetch_attachment(patch.id())
-
- def build_style(self):
- return "release"
-
-
-class PerfTest(IRCCommand):
- def execute(self, nick, args, tool, sheriff):
- if not args:
- tool.irc().post(nick + ": Please specify an attachment/patch id")
- return
-
- patch_id = args[0]
- patch = tool.bugs.fetch_attachment(patch_id)
- if not patch:
- tool.irc().post(nick + ": Could not fetch the patch")
- return
-
- task = PerfalizerTask(tool, patch, lambda message: tool.irc().post('%s: %s' % (nick, message)))
- task.run()
-
-
-class Perfalizer(AbstractQueue, StepSequenceErrorHandler):
- name = "perfalizer"
- watchers = AbstractQueue.watchers + ["[email protected]"]
-
- _commands = {
- "help": Help,
- "hi": Hi,
- "restart": Restart,
- "test": PerfTest,
- }
-
- # AbstractQueue methods
-
- def begin_work_queue(self):
- AbstractQueue.begin_work_queue(self)
- self._sheriff = Sheriff(self._tool, self)
- self._irc_bot = IRCBot("perfalizer", self._tool, self._sheriff, self._commands)
- self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
-
- def work_item_log_path(self, failure_map):
- return None
-
- def _is_old_failure(self, revision):
- return False
-
- def next_work_item(self):
- self._irc_bot.process_pending_messages()
- return
-
- def process_work_item(self, failure_map):
- return True
-
- def handle_unexpected_error(self, failure_map, message):
- _log.error(message)
-
- # StepSequenceErrorHandler methods
-
- @classmethod
- def handle_script_error(cls, tool, state, script_error):
- # Ideally we would post some information to IRC about what went wrong
- # here, but we don't have the IRC password in the child process.
- pass
Deleted: trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer_unittest.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer_unittest.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer_unittest.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,109 +0,0 @@
-# Copyright (C) 2012 Google Inc. All rights reserved.
-# Copyright (C) 2020 Apple 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.
-
-import unittest
-
-from webkitpy.common.net.buildbot import Builder
-from webkitpy.common.system.executive import ScriptError
-from webkitpy.port.test import TestPort
-from webkitpy.tool.commands.perfalizer import PerfalizerTask
-from webkitpy.tool.mocktool import MockTool
-
-from webkitcorepy import OutputCapture
-
-
-class PerfalizerTaskTest(unittest.TestCase):
- def _create_and_run_perfalizer(self, commands_to_fail=[]):
- tool = MockTool()
- patch = tool.bugs.fetch_attachment(10000)
-
- logs = []
-
- def logger(message):
- logs.append(message)
-
- def run_webkit_patch(args):
- if args[0] in commands_to_fail:
- raise ScriptError
-
- def run_perf_test(build_path, description):
- self.assertTrue(description == 'without 10000' or description == 'with 10000')
- if 'run-perf-tests' in commands_to_fail:
- return -1
- if 'results-page' not in commands_to_fail:
- tool.filesystem.write_text_file(tool.filesystem.join(build_path, 'PerformanceTestResults.html'), 'results page')
- return 0
-
- perfalizer = PerfalizerTask(tool, patch, logger)
- perfalizer._port = TestPort(tool)
- perfalizer.run_webkit_patch = run_webkit_patch
- perfalizer._run_perf_test = run_perf_test
-
- with OutputCapture():
- if commands_to_fail:
- self.assertFalse(perfalizer.run())
- else:
- self.assertTrue(perfalizer.run())
-
- return logs
-
- def test_run(self):
- self.assertEqual(self._create_and_run_perfalizer(), [
- 'Preparing to run performance tests for the attachment 10000...',
- 'Building WebKit at r1234 without the patch',
- 'Building WebKit at r1234 with the patch',
- 'Running performance tests...',
- 'Uploaded the results on the bug 50000'])
-
- def test_run_with_clean_fails(self):
- self.assertEqual(self._create_and_run_perfalizer(['clean']), [
- 'Preparing to run performance tests for the attachment 10000...'])
-
- def test_run_with_update_fails(self):
- logs = self._create_and_run_perfalizer(['update'])
- self.assertEqual(len(logs), 1)
- self.assertEqual(logs[0], 'Preparing to run performance tests for the attachment 10000...')
-
- def test_run_with_build_fails(self):
- logs = self._create_and_run_perfalizer(['build'])
- self.assertEqual(len(logs), 3)
-
- def test_run_with_build_fails(self):
- logs = self._create_and_run_perfalizer(['apply-attachment'])
- self.assertEqual(len(logs), 3)
-
- def test_run_with_perf_test_fails(self):
- logs = self._create_and_run_perfalizer(['run-perf-tests'])
- self.assertEqual(len(logs), 5)
- self.assertEqual(logs[-1], 'Failed to run performance tests without the patch.')
-
- def test_run_without_results_page(self):
- logs = self._create_and_run_perfalizer(['results-page'])
- self.assertEqual(len(logs), 5)
- self.assertEqual(logs[-1], 'Failed to generate the results page.')
Deleted: trunk/Tools/Scripts/webkitpy/tool/commands/sheriffbot.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/commands/sheriffbot.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/sheriffbot.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,76 +0,0 @@
-# Copyright (c) 2009 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.
-
-import logging
-
-from webkitpy.tool.bot.sheriff import Sheriff
-from webkitpy.tool.bot.irc_command import commands as irc_commands
-from webkitpy.tool.bot.ircbot import IRCBot
-from webkitpy.tool.commands.queues import AbstractQueue
-from webkitpy.tool.commands.stepsequence import StepSequenceErrorHandler
-
-_log = logging.getLogger(__name__)
-
-
-class SheriffBot(AbstractQueue, StepSequenceErrorHandler):
- name = "webkitbot"
- watchers = AbstractQueue.watchers + [
- "[email protected]",
- "[email protected]",
- ]
-
- # AbstractQueue methods
-
- def begin_work_queue(self):
- self._sheriff = Sheriff(self._tool, self)
- self._irc_bot = IRCBot(self.name, self._tool, self._sheriff, irc_commands)
- self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
-
- def work_item_log_path(self, failure_map):
- return None
-
- def _is_old_failure(self, revision):
- return False
-
- def next_work_item(self):
- self._irc_bot.process_pending_messages()
- return
-
- def process_work_item(self, failure_map):
- return True
-
- def handle_unexpected_error(self, failure_map, message):
- _log.error(message)
-
- # StepSequenceErrorHandler methods
-
- @classmethod
- def handle_script_error(cls, tool, state, script_error):
- # Ideally we would post some information to IRC about what went wrong
- # here, but we don't have the IRC password in the child process.
- pass
Deleted: trunk/Tools/Scripts/webkitpy/tool/commands/sheriffbot_unittest.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/commands/sheriffbot_unittest.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/sheriffbot_unittest.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -1,47 +0,0 @@
-# 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.tool.commands.queuestest import QueuesTest, MockQueueEngine
-from webkitpy.tool.commands import SheriffBot
-from webkitpy.tool.mocktool import MockTool, MockOptions
-from webkitpy.tool.bot.irc_command import Revert
-
-
-class SheriffBotTest(QueuesTest):
- def test_command_aliases(self):
- tool = MockTool()
- options = MockOptions()
- options.ensure_value("confirm", False)
- options.ensure_value("seconds_to_sleep", 120)
- sheriffbot = SheriffBot()
- sheriffbot.execute(options, [], tool, MockQueueEngine)
- sheriffbot.begin_work_queue()
- irc_bot = sheriffbot._irc_bot
- # Test Revert command aliases
- rollout_command, args = irc_bot._parse_command_and_args("rollout")
- self.assertEqual(rollout_command, Revert)
Modified: trunk/Tools/Scripts/webkitpy/tool/main.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/main.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/main.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -35,7 +35,6 @@
from webkitpy.common.config.ports import DeprecatedPort
from webkitpy.common.host import Host
-from webkitpy.common.net.irc import ircproxy
from webkitpy.common.net.ewsserver import EWSServer
from webkitpy.tool.multicommandtool import MultiCommandTool
from webkitpy.tool import commands
@@ -45,7 +44,6 @@
global_options = [
make_option("-v", "--verbose", action="" dest="verbose", default=False, help="enable all logging"),
make_option("-d", "--directory", action="" dest="patch_directories", default=[], help="Directory to look at for changed files"),
- make_option("--irc-password", action="" dest="irc_password", type="string", help="Password to use when communicating via IRC."),
make_option("--seconds-to-sleep", action="" default=120, type="int", help="Number of seconds to sleep in the task queue."),
make_option("--port", action="" dest="port", default=None, help="Specify a port (e.g., mac, gtk, ...)."),
]
@@ -57,7 +55,6 @@
self.ews_server = EWSServer()
self.wakeup_event = threading.Event()
- self._irc = None
self._deprecated_port = None
def deprecated_port(self):
@@ -66,19 +63,8 @@
def path(self):
return self._path
- def ensure_irc_connected(self, irc_delegate):
- if not self._irc:
- self._irc = ircproxy.IRCProxy(irc_delegate)
-
- def irc(self):
- # We don't automatically construct IRCProxy here because constructing
- # IRCProxy actually connects to IRC. We want clients to explicitly
- # connect to IRC.
- return self._irc
-
def command_completed(self):
- if self._irc:
- self._irc.disconnect()
+ pass
def should_show_in_main_help(self, command):
if not command.show_in_main_help:
@@ -90,8 +76,6 @@
# FIXME: This may be unnecessary since we pass global options to all commands during execute() as well.
def handle_global_options(self, options):
self.initialize_scm(options.patch_directories)
- if options.irc_password:
- self.irc_password = options.irc_password
# If options.port is None, we'll get the default port for this platform.
self._deprecated_port = DeprecatedPort.port(options.port)
Modified: trunk/Tools/Scripts/webkitpy/tool/mocktool.py (270002 => 270003)
--- trunk/Tools/Scripts/webkitpy/tool/mocktool.py 2020-11-19 01:20:48 UTC (rev 270002)
+++ trunk/Tools/Scripts/webkitpy/tool/mocktool.py 2020-11-19 01:37:37 UTC (rev 270003)
@@ -32,7 +32,6 @@
from webkitpy.common.host_mock import MockHost
from webkitpy.common.net.buildbot.buildbot_mock import MockBuildBot
from webkitpy.common.net.ewsserver_mock import MockEWSServer
-from webkitpy.common.net.irc.irc_mock import MockIRC
# FIXME: Old-style "Ports" need to die and be replaced by modern layout_tests.port which needs to move to common.
from webkitpy.common.config.ports_mock import MockPort
@@ -68,8 +67,6 @@
self._deprecated_port = MockPort()
self.ews_server = MockEWSServer()
- self._irc = None
- self.irc_password = "MOCK irc password"
self.wakeup_event = threading.Event()
def deprecated_port(self):
@@ -77,10 +74,3 @@
def path(self):
return "echo"
-
- def ensure_irc_connected(self, delegate):
- if not self._irc:
- self._irc = MockIRC()
-
- def irc(self):
- return self._irc