| Index: Tools/Scripts/webkitpy/tool/commands/flakytests.py
|
| diff --git a/Tools/Scripts/webkitpy/tool/commands/flakytests.py b/Tools/Scripts/webkitpy/tool/commands/flakytests.py
|
| index 67baf85b1b5c8a74bc44ef881f2ed2f6acd17285..07e34935d9142cc8d5e8892f624726fd3ec78e4f 100644
|
| --- a/Tools/Scripts/webkitpy/tool/commands/flakytests.py
|
| +++ b/Tools/Scripts/webkitpy/tool/commands/flakytests.py
|
| @@ -26,10 +26,12 @@
|
| # (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 os
|
| import optparse
|
| from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
|
| from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestExpectationsFactory
|
| from webkitpy.layout_tests.models.test_expectations import TestExpectationParser, TestExpectationsModel, TestExpectations
|
| +from webkitpy.common.net import sheriff_calendar
|
|
|
|
|
| class FlakyTests(AbstractDeclarativeCommand):
|
| @@ -37,10 +39,18 @@ class FlakyTests(AbstractDeclarativeCommand):
|
| help_text = "Update FlakyTests file from the flakiness dashboard"
|
| show_in_main_help = True
|
|
|
| + ALWAYS_CC = [
|
| + 'ojan@chromium.org',
|
| + 'dpranke@chromium.org',
|
| + 'eseidel@chromium.org',
|
| + ]
|
| +
|
| def __init__(self):
|
| options = [
|
| optparse.make_option('--upload', action='store_true',
|
| help='upload the changed FlakyTest file for review'),
|
| + optparse.make_option('--reviewers', action='store',
|
| + help='comma-separated list of reviewers, defaults to blink gardeners'),
|
| ]
|
| AbstractDeclarativeCommand.__init__(self, options=options)
|
|
|
| @@ -63,6 +73,7 @@ class FlakyTests(AbstractDeclarativeCommand):
|
| # and filter accordingly, or update existing TestExpectations instead of FlakyTests.
|
| with open(flaky_tests_path, 'w') as flake_file:
|
| flake_file.write(TestExpectations.list_to_string(lines))
|
| + print "Updated %s" % flaky_tests_path
|
|
|
| if not options.upload:
|
| return 0
|
| @@ -73,10 +84,32 @@ class FlakyTests(AbstractDeclarativeCommand):
|
| print "%s is not changed, not uploading." % flaky_tests_path
|
| return 0
|
|
|
| - commit_message = "Update FlakyTests"
|
| - git_cmd = ['git', 'commit', '-m', commit_message, flaky_tests_path]
|
| - tool.executive.run_command(git_cmd)
|
| + if options.reviewers:
|
| + # FIXME: Could validate these as emails. sheriff_calendar has some code for that.
|
| + reviewer_emails = options.reviewers.split(',')
|
| + else:
|
| + reviewer_emails = sheriff_calendar.current_gardener_emails()
|
| + if not reviewer_emails:
|
| + print "No gardener, and --reviewers not specified, not bothering."
|
| + return 1
|
| +
|
| + commit_message = """Update FlakyTests to match current flakiness dashboard results
|
| +
|
| +Automatically generated using:
|
| +webkit-patch update-flaky-tests
|
| +
|
| +R=%s
|
| +""" % ','.join(reviewer_emails)
|
| +
|
| + git_cmd = ['git', 'commit', '-m', commit_message,
|
| + fs.join(tool.scm().checkout_root, flaky_tests_path)]
|
| + tool.executive.run_and_throw_if_fail(git_cmd)
|
| +
|
| + # FIXME: There must be a cleaner way to avoid the editor!
|
| + # Silence the editor.
|
| + os.environ['EDITOR'] = 'true'
|
|
|
| - git_cmd = ['git', 'cl', 'upload', '--use-commit-queue', '--send-mail']
|
| - tool.executive.run_command(git_cmd)
|
| + git_cmd = ['git', 'cl', 'upload', '--send-mail',
|
| + '--cc', ','.join(self.ALWAYS_CC)]
|
| + tool.executive.run_and_throw_if_fail(git_cmd)
|
| # If there are changes to git, upload.
|
|
|