| OLD | NEW |
| 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 import optparse | 6 import optparse |
| 7 | 7 |
| 8 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer | 8 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer |
| 9 from webkitpy.layout_tests.controllers.test_result_writer import baseline_name | 9 from webkitpy.layout_tests.controllers.test_result_writer import baseline_name |
| 10 from webkitpy.tool.commands.rebaseline import AbstractRebaseliningCommand | 10 from webkitpy.tool.commands.rebaseline import AbstractRebaseliningCommand |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 for suffix in self._baseline_suffix_list: | 32 for suffix in self._baseline_suffix_list: |
| 33 name = baseline_name(self._tool.filesystem, test_name, suffix) | 33 name = baseline_name(self._tool.filesystem, test_name, suffix) |
| 34 succeeded, more_files_to_delete, more_files_to_add = optimizer.optim
ize(name) | 34 succeeded, more_files_to_delete, more_files_to_add = optimizer.optim
ize(name) |
| 35 if not succeeded: | 35 if not succeeded: |
| 36 _log.error("Heuristics failed to optimize %s", name) | 36 _log.error("Heuristics failed to optimize %s", name) |
| 37 files_to_delete.extend(more_files_to_delete) | 37 files_to_delete.extend(more_files_to_delete) |
| 38 files_to_add.extend(more_files_to_add) | 38 files_to_add.extend(more_files_to_add) |
| 39 return files_to_delete, files_to_add | 39 return files_to_delete, files_to_add |
| 40 | 40 |
| 41 def execute(self, options, args, tool): | 41 def execute(self, options, args, tool): |
| 42 self._tool = tool |
| 42 self._baseline_suffix_list = options.suffixes.split(',') | 43 self._baseline_suffix_list = options.suffixes.split(',') |
| 43 port_names = tool.port_factory.all_port_names(options.platform) | 44 port_names = tool.port_factory.all_port_names(options.platform) |
| 44 if not port_names: | 45 if not port_names: |
| 45 _log.error("No port names match '%s'", options.platform) | 46 _log.error("No port names match '%s'", options.platform) |
| 46 return | 47 return |
| 47 port = tool.port_factory.get(port_names[0]) | 48 port = tool.port_factory.get(port_names[0]) |
| 48 optimizer = BaselineOptimizer(tool, port, port_names, skip_scm_commands=
options.no_modify_scm) | 49 optimizer = BaselineOptimizer(tool, port, port_names, skip_scm_commands=
options.no_modify_scm) |
| 49 tests = port.tests(args) | 50 tests = port.tests(args) |
| 50 for test_name in tests: | 51 for test_name in tests: |
| 51 files_to_delete, files_to_add = self._optimize_baseline(optimizer, t
est_name) | 52 files_to_delete, files_to_add = self._optimize_baseline(optimizer, t
est_name) |
| 52 for path in files_to_delete: | 53 for path in files_to_delete: |
| 53 self._delete_from_scm_later(path) | 54 self._delete_from_scm_later(path) |
| 54 for path in files_to_add: | 55 for path in files_to_add: |
| 55 self._add_to_scm_later(path) | 56 self._add_to_scm_later(path) |
| 56 self._print_scm_changes() | 57 self._print_scm_changes() |
| OLD | NEW |