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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/optimize_baselines.py

Issue 2776543003: Change rebaseline-test-internal to take port name option. (Closed)
Patch Set: Add example port name and builder in help strings Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 6
7 from webkitpy.common.checkout.baseline_optimizer import BaselineOptimizer 7 from webkitpy.common.checkout.baseline_optimizer import BaselineOptimizer
8 from webkitpy.layout_tests.controllers.test_result_writer import baseline_name 8 from webkitpy.layout_tests.controllers.test_result_writer import baseline_name
9 from webkitpy.tool.commands.rebaseline import AbstractRebaseliningCommand 9 from webkitpy.tool.commands.rebaseline import AbstractRebaseliningCommand
10 10
11 11
12 _log = logging.getLogger(__name__) 12 _log = logging.getLogger(__name__)
13 13
14 14
15 class OptimizeBaselines(AbstractRebaseliningCommand): 15 class OptimizeBaselines(AbstractRebaseliningCommand):
16 name = 'optimize-baselines' 16 name = 'optimize-baselines'
17 help_text = 'Reshuffles the baselines for the given tests to use as litte sp ace on disk as possible.' 17 help_text = 'Reshuffles the baselines for the given tests to use as little s pace on disk as possible.'
18 show_in_main_help = True 18 show_in_main_help = True
19 argument_names = 'TEST_NAMES' 19 argument_names = 'TEST_NAMES'
20 20
21 def __init__(self): 21 def __init__(self):
22 super(OptimizeBaselines, self).__init__(options=[ 22 super(OptimizeBaselines, self).__init__(options=[
23 self.suffixes_option, 23 self.suffixes_option,
24 self.port_name_option,
24 ] + self.platform_options) 25 ] + self.platform_options)
25 26
26 def _optimize_baseline(self, optimizer, test_name): 27 def _optimize_baseline(self, optimizer, test_name):
27 files_to_delete = [] 28 files_to_delete = []
28 files_to_add = [] 29 files_to_add = []
29 for suffix in self._baseline_suffix_list: 30 for suffix in self._baseline_suffix_list:
30 name = baseline_name(self._tool.filesystem, test_name, suffix) 31 name = baseline_name(self._tool.filesystem, test_name, suffix)
31 succeeded = optimizer.optimize(name) 32 succeeded = optimizer.optimize(name)
32 if not succeeded: 33 if not succeeded:
33 _log.error('Heuristics failed to optimize %s', name) 34 _log.error('Heuristics failed to optimize %s', name)
34 return files_to_delete, files_to_add 35 return files_to_delete, files_to_add
35 36
36 def execute(self, options, args, tool): 37 def execute(self, options, args, tool):
37 self._tool = tool 38 self._tool = tool
38 self._baseline_suffix_list = options.suffixes.split(',') 39 self._baseline_suffix_list = options.suffixes.split(',')
39 port_names = tool.port_factory.all_port_names(options.platform) 40 port_names = tool.port_factory.all_port_names(options.platform)
40 if not port_names: 41 if not port_names:
41 _log.error("No port names match '%s'", options.platform) 42 _log.error("No port names match '%s'", options.platform)
42 return 43 return
43 port = tool.port_factory.get(port_names[0]) 44 port = tool.port_factory.get(port_names[0])
44 optimizer = BaselineOptimizer(tool, port, port_names) 45 optimizer = BaselineOptimizer(tool, port, port_names)
45 tests = port.tests(args) 46 tests = port.tests(args)
46 for test_name in tests: 47 for test_name in tests:
47 self._optimize_baseline(optimizer, test_name) 48 self._optimize_baseline(optimizer, test_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698