Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 2128233003: Split out optimize-baselines command from rebaseline.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
index 77424eec001d20a2fb320cde0bfeca53be876046..91cd4b4650bd953b7dcef7731bea026e10a78035 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -26,7 +26,6 @@
# (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 __future__ import print_function
import json
import logging
@@ -37,10 +36,8 @@ import time
import traceback
import urllib2
-from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
from webkitpy.common.memoized import memoized
from webkitpy.common.system.executive import ScriptError
-from webkitpy.layout_tests.controllers.test_result_writer import baseline_name
from webkitpy.layout_tests.models.test_expectations import TestExpectations, BASELINE_SUFFIX_LIST, SKIP
from webkitpy.layout_tests.port import factory
from webkitpy.tool.commands.command import Command
@@ -236,49 +233,6 @@ class RebaselineTest(BaseInternalRebaselineCommand):
self._print_scm_changes()
-class OptimizeBaselines(AbstractRebaseliningCommand):
- name = "optimize-baselines"
- help_text = "Reshuffles the baselines for the given tests to use as litte space on disk as possible."
- show_in_main_help = True
- argument_names = "TEST_NAMES"
-
- def __init__(self):
- super(OptimizeBaselines, self).__init__(options=[
- self.suffixes_option,
- optparse.make_option('--no-modify-scm', action='store_true', default=False,
- help='Dump SCM commands as JSON instead of actually committing changes.'),
- ] + self.platform_options)
-
- def _optimize_baseline(self, optimizer, test_name):
- files_to_delete = []
- files_to_add = []
- for suffix in self._baseline_suffix_list:
- name = baseline_name(self._tool.filesystem, test_name, suffix)
- succeeded, more_files_to_delete, more_files_to_add = optimizer.optimize(name)
- if not succeeded:
- _log.error("Heuristics failed to optimize %s", name)
- files_to_delete.extend(more_files_to_delete)
- files_to_add.extend(more_files_to_add)
- return files_to_delete, files_to_add
-
- def execute(self, options, args, tool):
- self._baseline_suffix_list = options.suffixes.split(',')
- port_names = tool.port_factory.all_port_names(options.platform)
- if not port_names:
- _log.error("No port names match '%s'", options.platform)
- return
- port = tool.port_factory.get(port_names[0])
- optimizer = BaselineOptimizer(tool, port, port_names, skip_scm_commands=options.no_modify_scm)
- tests = port.tests(args)
- for test_name in tests:
- files_to_delete, files_to_add = self._optimize_baseline(optimizer, test_name)
- for path in files_to_delete:
- self._delete_from_scm_later(path)
- for path in files_to_add:
- self._add_to_scm_later(path)
- self._print_scm_changes()
-
-
class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
"""Base class for rebaseline commands that do some tasks in parallel."""
# Not overriding execute() - pylint: disable=abstract-method

Powered by Google App Engine
This is Rietveld 408576698