| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 return {build: self._tests_to_rebaseline(build) for build in builds} | 183 return {build: self._tests_to_rebaseline(build) for build in builds} |
| 184 | 184 |
| 185 def _try_bots(self): | 185 def _try_bots(self): |
| 186 """Returns a collection of try bot builders to fetch results for.""" | 186 """Returns a collection of try bot builders to fetch results for.""" |
| 187 return self._tool.builders.all_try_builder_names() | 187 return self._tool.builders.all_try_builder_names() |
| 188 | 188 |
| 189 def _tests_to_rebaseline(self, build): | 189 def _tests_to_rebaseline(self, build): |
| 190 """Fetches a list of tests that should be rebaselined.""" | 190 """Fetches a list of tests that should be rebaselined.""" |
| 191 buildbot = self._tool.buildbot | 191 buildbot = self._tool.buildbot |
| 192 results_url = buildbot.results_url(build.builder_name, build.build_numbe
r) | 192 results_url = buildbot.results_url(build.builder_name, build.build_numbe
r) |
| 193 |
| 193 layout_test_results = buildbot.fetch_layout_test_results(results_url) | 194 layout_test_results = buildbot.fetch_layout_test_results(results_url) |
| 194 if layout_test_results is None: | 195 if layout_test_results is None: |
| 195 _log.warning('Failed to request layout test results from "%s".', res
ults_url) | 196 _log.warning('Failed to request layout test results from "%s".', res
ults_url) |
| 196 return [] | 197 return [] |
| 197 failure_results = layout_test_results.unexpected_mismatch_results() | 198 |
| 198 missing_results = layout_test_results.missing_results() | 199 unexpected_results = layout_test_results.didnt_run_as_expected_results() |
| 199 tests = sorted(r.test_name() for r in failure_results + missing_results) | 200 tests = sorted(r.test_name() for r in unexpected_results |
| 201 if r.is_missing_baseline() or r.has_mismatch_result()) |
| 200 | 202 |
| 201 new_failures = self._fetch_tests_with_new_failures(build) | 203 new_failures = self._fetch_tests_with_new_failures(build) |
| 202 if new_failures is None: | 204 if new_failures is None: |
| 203 _log.warning('No retry summary available for build %s.', build) | 205 _log.warning('No retry summary available for build %s.', build) |
| 204 else: | 206 else: |
| 205 tests = [t for t in tests if t in new_failures] | 207 tests = [t for t in tests if t in new_failures] |
| 206 return tests | 208 return tests |
| 207 | 209 |
| 208 def _fetch_tests_with_new_failures(self, build): | 210 def _fetch_tests_with_new_failures(self, build): |
| 209 """Fetches a list of tests that failed with a patch in a given try job b
ut not without.""" | 211 """Fetches a list of tests that failed with a patch in a given try job b
ut not without.""" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 222 def _log_test_prefix_list(test_prefix_list): | 224 def _log_test_prefix_list(test_prefix_list): |
| 223 """Logs the tests to download new baselines for.""" | 225 """Logs the tests to download new baselines for.""" |
| 224 if not test_prefix_list: | 226 if not test_prefix_list: |
| 225 _log.info('No tests to rebaseline; exiting.') | 227 _log.info('No tests to rebaseline; exiting.') |
| 226 return | 228 return |
| 227 _log.debug('Tests to rebaseline:') | 229 _log.debug('Tests to rebaseline:') |
| 228 for test, builds in test_prefix_list.iteritems(): | 230 for test, builds in test_prefix_list.iteritems(): |
| 229 _log.debug(' %s:', test) | 231 _log.debug(' %s:', test) |
| 230 for build in sorted(builds): | 232 for build in sorted(builds): |
| 231 _log.debug(' %s', build) | 233 _log.debug(' %s', build) |
| OLD | NEW |