| Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py
|
| index ab839fc630c28336e1e45505af962364696d24ab..eb72502cd108ab61d7eb80ff25522db553858d9e 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py
|
| @@ -12,11 +12,12 @@ import logging
|
| import optparse
|
|
|
| from webkitpy.common.checkout.scm.git import Git
|
| -from webkitpy.common.net.rietveld import latest_try_jobs
|
| +from webkitpy.common.net.buildbot import Build
|
| +from webkitpy.common.net.rietveld import latest_try_jobs, changed_files
|
| from webkitpy.common.net.web import Web
|
| +from webkitpy.common.webkit_finder import WebKitFinder
|
| from webkitpy.layout_tests.models.test_expectations import BASELINE_SUFFIX_LIST
|
| from webkitpy.tool.commands.rebaseline import AbstractParallelRebaselineCommand
|
| -from webkitpy.tool.commands.rebaseline import Build
|
|
|
|
|
| _log = logging.getLogger(__name__)
|
| @@ -24,7 +25,12 @@ _log = logging.getLogger(__name__)
|
|
|
| class RebaselineCL(AbstractParallelRebaselineCommand):
|
| name = "rebaseline-cl"
|
| - help_text = "Fetches new baselines for one CL, from layout test runs on try bots."
|
| + help_text = "Fetches new baselines for a CL from test runs on try bots."
|
| + long_help = ("By default, this command will check the latest try results "
|
| + "and download new baselines for any tests that have been "
|
| + "changed in the given CL that have failed and have new "
|
| + "baselines. After downloading, the baselines for different "
|
| + "platforms should be optimized (conslidated).")
|
| show_in_main_help = True
|
|
|
| def __init__(self):
|
| @@ -35,6 +41,9 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
|
| optparse.make_option(
|
| '--dry-run', action='store_true', default=False,
|
| help='Dry run mode; list actions that would be performed but do not do anything.'),
|
| + optparse.make_option(
|
| + '--only-changed-tests', action='store_true', default=False,
|
| + help='Only download new baselines for tests that are changed in the CL.'),
|
| self.no_optimize_option,
|
| self.results_directory_option,
|
| ])
|
| @@ -51,7 +60,8 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
|
| for test in args:
|
| test_prefix_list[test] = {b: BASELINE_SUFFIX_LIST for b in builds}
|
| else:
|
| - test_prefix_list = self._test_prefix_list(issue_number)
|
| + test_prefix_list = self._test_prefix_list(
|
| + issue_number, only_changed_tests=options.only_changed_tests)
|
| self._log_test_prefix_list(test_prefix_list)
|
|
|
| if options.dry_run:
|
| @@ -75,12 +85,28 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
|
| # that this command can be called from outside of the repo.
|
| return Git(cwd=self._tool.filesystem.dirname(self._tool.path()))
|
|
|
| - def _test_prefix_list(self, issue_number):
|
| - """Returns a collection of test, builder and file extensions to get new baselines for."""
|
| + def _test_prefix_list(self, issue_number, only_changed_tests):
|
| + """Returns a collection of test, builder and file extensions to get new baselines for.
|
| +
|
| + Args:
|
| + issue_number: The CL number of the change which needs new baselines.
|
| + only_changed_tests: Whether to only include baselines for tests that
|
| + are changed in this CL. If False, all new baselines for failing
|
| + tests will be downloaded, even for tests that were not modified.
|
| +
|
| + Returns:
|
| + A dict containing information about which new baselines to download.
|
| + """
|
| builds_to_tests = self._builds_to_tests(issue_number)
|
| + if only_changed_tests:
|
| + files_in_cl = changed_files(issue_number, self.web)
|
| + finder = WebKitFinder(self._tool.filesystem)
|
| + tests_in_cl = [finder.layout_test_name(f) for f in files_in_cl]
|
| result = {}
|
| for build, tests in builds_to_tests.iteritems():
|
| for test in tests:
|
| + if only_changed_tests and test not in tests_in_cl:
|
| + continue
|
| if test not in result:
|
| result[test] = {}
|
| result[test][build] = BASELINE_SUFFIX_LIST
|
| @@ -100,7 +126,7 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
|
| return builds_to_tests
|
|
|
| def _try_bots(self):
|
| - """Retuns a collection of try bot builders to fetch results for."""
|
| + """Returns a collection of try bot builders to fetch results for."""
|
| return self._tool.builders.all_try_builder_names()
|
|
|
| def _unexpected_mismatch_results(self, try_job):
|
|
|