| 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 """A command to fetch new baselines from try jobs for a Rietveld issue. | 5 """A command to fetch new baselines from try jobs for a Rietveld issue. |
| 6 | 6 |
| 7 This command interacts with the Rietveld API to get information about try jobs | 7 This command interacts with the Rietveld API to get information about try jobs |
| 8 with layout test results. | 8 with layout test results. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 if args: | 69 if args: |
| 70 test_prefix_list = {} | 70 test_prefix_list = {} |
| 71 for test in args: | 71 for test in args: |
| 72 test_prefix_list[test] = {b: BASELINE_SUFFIX_LIST for b in build
s} | 72 test_prefix_list[test] = {b: BASELINE_SUFFIX_LIST for b in build
s} |
| 73 else: | 73 else: |
| 74 test_prefix_list = self._test_prefix_list( | 74 test_prefix_list = self._test_prefix_list( |
| 75 issue_number, only_changed_tests=options.only_changed_tests) | 75 issue_number, only_changed_tests=options.only_changed_tests) |
| 76 | 76 |
| 77 # TODO(qyearsley): Fix places where non-existing tests may be added: | 77 # TODO(qyearsley): Fix places where non-existing tests may be added: |
| 78 # 1. Make sure that the tests obtained when passing --only-changed-test
s include only existing tests. | 78 # 1. Make sure that the tests obtained when passing --only-changed-test
s include only existing tests. |
| 79 # 2. Make sure that update-w3c-test-expectations doesn't specify non-ex
isting tests (http://crbug.com/649691). | |
| 80 test_prefix_list = self._filter_existing(test_prefix_list) | 79 test_prefix_list = self._filter_existing(test_prefix_list) |
| 81 | 80 |
| 82 self._log_test_prefix_list(test_prefix_list) | 81 self._log_test_prefix_list(test_prefix_list) |
| 83 | 82 |
| 84 if options.dry_run: | 83 if options.dry_run: |
| 85 return | 84 return |
| 86 # NOTE(qyearsley): If this is changed to stage all new files with git, | 85 self.rebaseline(options, test_prefix_list) |
| 87 # e.g. if update_scm is not False, then update_w3c_test_expectations.py | |
| 88 # should be changed to not call git add --all. | |
| 89 self.rebaseline(options, test_prefix_list, update_scm=False) | |
| 90 | 86 |
| 91 def _filter_existing(self, test_prefix_list): | 87 def _filter_existing(self, test_prefix_list): |
| 92 """Filters out entries in |test_prefix_list| for tests that don't exist.
""" | 88 """Filters out entries in |test_prefix_list| for tests that don't exist.
""" |
| 93 new_test_prefix_list = {} | 89 new_test_prefix_list = {} |
| 94 port = self._tool.port_factory.get() | 90 port = self._tool.port_factory.get() |
| 95 for test in test_prefix_list: | 91 for test in test_prefix_list: |
| 96 path = port.abspath_for_test(test) | 92 path = port.abspath_for_test(test) |
| 97 if self._tool.filesystem.exists(path): | 93 if self._tool.filesystem.exists(path): |
| 98 new_test_prefix_list[test] = test_prefix_list[test] | 94 new_test_prefix_list[test] = test_prefix_list[test] |
| 99 else: | 95 else: |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 @staticmethod | 187 @staticmethod |
| 192 def _log_test_prefix_list(test_prefix_list): | 188 def _log_test_prefix_list(test_prefix_list): |
| 193 """Logs the tests to download new baselines for.""" | 189 """Logs the tests to download new baselines for.""" |
| 194 if not test_prefix_list: | 190 if not test_prefix_list: |
| 195 _log.info('No tests to rebaseline; exiting.') | 191 _log.info('No tests to rebaseline; exiting.') |
| 196 return | 192 return |
| 197 _log.info('Tests to rebaseline:') | 193 _log.info('Tests to rebaseline:') |
| 198 for test, builds in test_prefix_list.iteritems(): | 194 for test, builds in test_prefix_list.iteritems(): |
| 199 builds_str = ', '.join(sorted('%s (%s)' % (b.builder_name, b.build_n
umber) for b in builds)) | 195 builds_str = ', '.join(sorted('%s (%s)' % (b.builder_name, b.build_n
umber) for b in builds)) |
| 200 _log.info(' %s: %s', test, builds_str) | 196 _log.info(' %s: %s', test, builds_str) |
| OLD | NEW |