| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 only_changed_tests: Whether to only include baselines for tests that | 151 only_changed_tests: Whether to only include baselines for tests that |
| 152 are changed in this CL. If False, all new baselines for failing | 152 are changed in this CL. If False, all new baselines for failing |
| 153 tests will be downloaded, even for tests that were not modified. | 153 tests will be downloaded, even for tests that were not modified. |
| 154 | 154 |
| 155 Returns: | 155 Returns: |
| 156 A dict containing information about which new baselines to download. | 156 A dict containing information about which new baselines to download. |
| 157 """ | 157 """ |
| 158 builds_to_tests = self._builds_to_tests(issue_number) | 158 builds_to_tests = self._builds_to_tests(issue_number) |
| 159 if only_changed_tests: | 159 if only_changed_tests: |
| 160 files_in_cl = self.rietveld.changed_files(issue_number) | 160 files_in_cl = self.rietveld.changed_files(issue_number) |
| 161 finder = WebKitFinder(self._tool.filesystem) | 161 # Note, in the changed files list from Rietveld, paths always |
| 162 tests_in_cl = [finder.layout_test_name(f) for f in files_in_cl] | 162 # use / as the separator, and they're always relative to repo root. |
| 163 # TODO(qyearsley): Do this without using a hard-coded constant. |
| 164 test_base = 'third_party/WebKit/LayoutTests/' |
| 165 tests_in_cl = [f[len(test_base):] for f in files_in_cl if f.startswi
th(test_base)] |
| 163 result = {} | 166 result = {} |
| 164 for build, tests in builds_to_tests.iteritems(): | 167 for build, tests in builds_to_tests.iteritems(): |
| 165 for test in tests: | 168 for test in tests: |
| 166 if only_changed_tests and test not in tests_in_cl: | 169 if only_changed_tests and test not in tests_in_cl: |
| 167 continue | 170 continue |
| 168 if test not in result: | 171 if test not in result: |
| 169 result[test] = {} | 172 result[test] = {} |
| 170 result[test][build] = BASELINE_SUFFIX_LIST | 173 result[test][build] = BASELINE_SUFFIX_LIST |
| 171 return result | 174 return result |
| 172 | 175 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 197 @staticmethod | 200 @staticmethod |
| 198 def _log_test_prefix_list(test_prefix_list): | 201 def _log_test_prefix_list(test_prefix_list): |
| 199 """Logs the tests to download new baselines for.""" | 202 """Logs the tests to download new baselines for.""" |
| 200 if not test_prefix_list: | 203 if not test_prefix_list: |
| 201 _log.info('No tests to rebaseline; exiting.') | 204 _log.info('No tests to rebaseline; exiting.') |
| 202 return | 205 return |
| 203 _log.info('Tests to rebaseline:') | 206 _log.info('Tests to rebaseline:') |
| 204 for test, builds in test_prefix_list.iteritems(): | 207 for test, builds in test_prefix_list.iteritems(): |
| 205 builds_str = ', '.join(sorted('%s (%s)' % (b.builder_name, b.build_n
umber) for b in builds)) | 208 builds_str = ', '.join(sorted('%s (%s)' % (b.builder_name, b.build_n
umber) for b in builds)) |
| 206 _log.info(' %s: %s', test, builds_str) | 209 _log.info(' %s: %s', test, builds_str) |
| OLD | NEW |