Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl.py

Issue 2817583004: rebaseline-cl: Enable filling in missing results if no results could be fetched. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 """Modifies test_baseline_set to guarantee that there are entries for 231 """Modifies test_baseline_set to guarantee that there are entries for
232 all ports for all tests to rebaseline. 232 all ports for all tests to rebaseline.
233 233
234 For each test prefix, if there is an entry missing for some port, 234 For each test prefix, if there is an entry missing for some port,
235 then an entry should be added for that port using a build that is 235 then an entry should be added for that port using a build that is
236 available. For example, if there's no entry for the port "win-win7", 236 available. For example, if there's no entry for the port "win-win7",
237 then an entry might be added for "win-win7" using a build on 237 then an entry might be added for "win-win7" using a build on
238 a Win10 builder which does have results. 238 a Win10 builder which does have results.
239 """ 239 """
240 all_ports = {self._tool.builders.port_name_for_builder_name(b) for b in self._try_bots()} 240 all_ports = {self._tool.builders.port_name_for_builder_name(b) for b in self._try_bots()}
241 print test_baseline_set
wkorman 2017/04/13 16:45:53 debugging?
241 for test_prefix in test_baseline_set.test_prefixes(): 242 for test_prefix in test_baseline_set.test_prefixes():
242 build_port_pairs = test_baseline_set.build_port_pairs(test_prefix) 243 build_port_pairs = test_baseline_set.build_port_pairs(test_prefix)
243 missing_ports = all_ports - {p for _, p in build_port_pairs} 244 missing_ports = all_ports - {p for _, p in build_port_pairs}
244 if not missing_ports: 245 if not missing_ports:
245 continue 246 continue
246 _log.info('For %s:', test_prefix) 247 _log.info('For %s:', test_prefix)
247 for port in missing_ports: 248 for port in missing_ports:
248 build = self._choose_fill_in_build(port, build_port_pairs) 249 build = self._choose_fill_in_build(port, build_port_pairs)
249 _log.info('Using %s to supply results for %s.', build, port) 250 _log.info('Using %s to supply results for %s.', build, port)
250 test_baseline_set.add(test_prefix, build, port) 251 test_baseline_set.add(test_prefix, build, port)
251 return test_baseline_set 252 return test_baseline_set
252 253
253 def _choose_fill_in_build(self, _, build_port_pairs): 254 def _choose_fill_in_build(self, _, build_port_pairs):
254 """Returns a Build to use to supply results for the given port. 255 """Returns a Build to use to supply results for the given port.
255 256
256 Ideally, this should return a build for a similar port so that the 257 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. 258 results from the selected build may also be correct for the target port.
258 """ 259 """
259 # TODO(qyearsley): Decide what build to use for a given port 260 # TODO(qyearsley): Decide what build to use for a given port
260 # in a more sophisticated way, such that a build with a 261 # in a more sophisticated way, such that a build with a
261 # "similar" port will be used when available. 262 # "similar" port will be used when available.
262 return build_port_pairs[0][0] 263 return build_port_pairs[0][0]
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698