| 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 the current CL.""" | 5 """A command to fetch new baselines from try jobs for the current CL.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import optparse | 9 import optparse |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 for builder in sorted(builders_with_pending_builds): | 70 for builder in sorted(builders_with_pending_builds): |
| 71 _log.info(' %s', builder) | 71 _log.info(' %s', builder) |
| 72 builders_with_no_results = self.builders_with_no_results(builds) | 72 builders_with_no_results = self.builders_with_no_results(builds) |
| 73 | 73 |
| 74 if options.trigger_jobs and builders_with_no_results: | 74 if options.trigger_jobs and builders_with_no_results: |
| 75 self.trigger_builds(builders_with_no_results) | 75 self.trigger_builds(builders_with_no_results) |
| 76 _log.info('Please re-run webkit-patch rebaseline-cl once all pending
try jobs have finished.') | 76 _log.info('Please re-run webkit-patch rebaseline-cl once all pending
try jobs have finished.') |
| 77 return 1 | 77 return 1 |
| 78 | 78 |
| 79 if builders_with_no_results and not options.fill_missing: | 79 if builders_with_no_results and not options.fill_missing: |
| 80 # TODO(qyearsley): Support trying to continue as long as there are | |
| 81 # some results from some builder; see http://crbug.com/673966. | |
| 82 _log.error('The following builders have no results:') | 80 _log.error('The following builders have no results:') |
| 83 for builder in builders_with_no_results: | 81 for builder in builders_with_no_results: |
| 84 _log.error(' %s', builder) | 82 _log.error(' %s', builder) |
| 85 return 1 | 83 return 1 |
| 86 | 84 |
| 87 _log.debug('Getting results for issue %d.', issue_number) | 85 _log.debug('Getting results for issue %d.', issue_number) |
| 88 builds_to_results = self._fetch_results(builds) | 86 builds_to_results = self._fetch_results(builds) |
| 89 if builds_to_results is None: | 87 if not options.fill_missing and len(builds_to_results) < len(builds): |
| 90 return 1 | 88 return 1 |
| 91 | 89 |
| 92 test_baseline_set = TestBaselineSet(tool) | 90 test_baseline_set = TestBaselineSet(tool) |
| 93 if args: | 91 if args: |
| 94 for test in args: | 92 for test in args: |
| 95 for build in builds: | 93 for build in builds: |
| 94 if not builds_to_results.get(build): |
| 95 continue |
| 96 test_baseline_set.add(test, build) | 96 test_baseline_set.add(test, build) |
| 97 else: | 97 else: |
| 98 test_baseline_set = self._make_test_baseline_set( | 98 test_baseline_set = self._make_test_baseline_set( |
| 99 builds_to_results, | 99 builds_to_results, |
| 100 only_changed_tests=options.only_changed_tests) | 100 only_changed_tests=options.only_changed_tests) |
| 101 | 101 |
| 102 if options.fill_missing: | 102 if options.fill_missing: |
| 103 self.fill_in_missing_results(test_baseline_set) | 103 self.fill_in_missing_results(test_baseline_set) |
| 104 | 104 |
| 105 _log.debug('Rebaselining: %s', test_baseline_set) | 105 _log.debug('Rebaselining: %s', test_baseline_set) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 Returns: | 153 Returns: |
| 154 A dict mapping Build to LayoutTestResults, or None if any results | 154 A dict mapping Build to LayoutTestResults, or None if any results |
| 155 were not available. | 155 were not available. |
| 156 """ | 156 """ |
| 157 buildbot = self._tool.buildbot | 157 buildbot = self._tool.buildbot |
| 158 results = {} | 158 results = {} |
| 159 for build in builds: | 159 for build in builds: |
| 160 results_url = buildbot.results_url(build.builder_name, build.build_n
umber) | 160 results_url = buildbot.results_url(build.builder_name, build.build_n
umber) |
| 161 layout_test_results = buildbot.fetch_results(build) | 161 layout_test_results = buildbot.fetch_results(build) |
| 162 if layout_test_results is None: | 162 if layout_test_results is None: |
| 163 _log.error('Failed to fetch results for: %s', build) | 163 _log.info('Failed to fetch results for %s', build) |
| 164 _log.error('Results were expected to exist at:\n%s/results.html'
, results_url) | 164 _log.info('Results URL: %s/results.html', results_url) |
| 165 _log.error('If the job failed, you could retry by running:\ngit
cl try -b %s', build.builder_name) | 165 _log.info('Retry job by running: git cl try -b %s', build.builde
r_name) |
| 166 return None | 166 continue |
| 167 results[build] = layout_test_results | 167 results[build] = layout_test_results |
| 168 return results | 168 return results |
| 169 | 169 |
| 170 def _make_test_baseline_set(self, builds_to_results, only_changed_tests): | 170 def _make_test_baseline_set(self, builds_to_results, only_changed_tests): |
| 171 """Returns a dict which lists the set of baselines to fetch. | 171 """Returns a dict which lists the set of baselines to fetch. |
| 172 | 172 |
| 173 The dict that is returned is a dict of tests to Build objects | 173 The dict that is returned is a dict of tests to Build objects |
| 174 to baseline file extensions. | 174 to baseline file extensions. |
| 175 | 175 |
| 176 Args: | 176 Args: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 def _choose_fill_in_build(self, _, build_port_pairs): | 253 def _choose_fill_in_build(self, _, build_port_pairs): |
| 254 """Returns a Build to use to supply results for the given port. | 254 """Returns a Build to use to supply results for the given port. |
| 255 | 255 |
| 256 Ideally, this should return a build for a similar port so that the | 256 Ideally, this should return a build for a similar port so that the |
| 257 results from the selected build may also be correct for the target port. | 257 results from the selected build may also be correct for the target port. |
| 258 """ | 258 """ |
| 259 # TODO(qyearsley): Decide what build to use for a given port | 259 # TODO(qyearsley): Decide what build to use for a given port |
| 260 # in a more sophisticated way, such that a build with a | 260 # in a more sophisticated way, such that a build with a |
| 261 # "similar" port will be used when available. | 261 # "similar" port will be used when available. |
| 262 return build_port_pairs[0][0] | 262 return build_port_pairs[0][0] |
| OLD | NEW |