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

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

Issue 2507613002: In rebaseline-cl, don't check for local file existence. (Closed)
Patch Set: Created 4 years, 1 month 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
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 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
11 import json 11 import json
12 import logging 12 import logging
13 import optparse 13 import optparse
14 14
15 from webkitpy.common.net.rietveld import Rietveld 15 from webkitpy.common.net.rietveld import Rietveld
16 from webkitpy.common.net.web import Web 16 from webkitpy.common.net.web import Web
17 from webkitpy.common.net.git_cl import GitCL 17 from webkitpy.common.net.git_cl import GitCL
18 from webkitpy.common.webkit_finder import WebKitFinder
19 from webkitpy.layout_tests.models.test_expectations import BASELINE_SUFFIX_LIST 18 from webkitpy.layout_tests.models.test_expectations import BASELINE_SUFFIX_LIST
20 from webkitpy.tool.commands.rebaseline import AbstractParallelRebaselineCommand 19 from webkitpy.tool.commands.rebaseline import AbstractParallelRebaselineCommand
21 20
22 _log = logging.getLogger(__name__) 21 _log = logging.getLogger(__name__)
23 22
24 23
25 class RebaselineCL(AbstractParallelRebaselineCommand): 24 class RebaselineCL(AbstractParallelRebaselineCommand):
26 name = "rebaseline-cl" 25 name = "rebaseline-cl"
27 help_text = "Fetches new baselines for a CL from test runs on try bots." 26 help_text = "Fetches new baselines for a CL from test runs on try bots."
28 long_help = ("By default, this command will check the latest try job results " 27 long_help = ("By default, this command will check the latest try job results "
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 _log.info('No builds to download baselines from.') 65 _log.info('No builds to download baselines from.')
67 66
68 if args: 67 if args:
69 test_prefix_list = {} 68 test_prefix_list = {}
70 for test in args: 69 for test in args:
71 test_prefix_list[test] = {b: BASELINE_SUFFIX_LIST for b in build s} 70 test_prefix_list[test] = {b: BASELINE_SUFFIX_LIST for b in build s}
72 else: 71 else:
73 test_prefix_list = self._test_prefix_list( 72 test_prefix_list = self._test_prefix_list(
74 issue_number, only_changed_tests=options.only_changed_tests) 73 issue_number, only_changed_tests=options.only_changed_tests)
75 74
76 # TODO(qyearsley): Fix places where non-existing tests may be added:
77 # 1. Make sure that the tests obtained when passing --only-changed-test s include only existing tests.
78 test_prefix_list = self._filter_existing(test_prefix_list)
79
80 self._log_test_prefix_list(test_prefix_list) 75 self._log_test_prefix_list(test_prefix_list)
81 76
82 if options.dry_run: 77 if options.dry_run:
83 return 78 return
84 self.rebaseline(options, test_prefix_list) 79 self.rebaseline(options, test_prefix_list)
85 80
86 def _filter_existing(self, test_prefix_list):
87 """Filters out entries in |test_prefix_list| for tests that don't exist. """
88 new_test_prefix_list = {}
89 port = self._tool.port_factory.get()
90 for test in test_prefix_list:
91 path = port.abspath_for_test(test)
92 if self._tool.filesystem.exists(path):
93 new_test_prefix_list[test] = test_prefix_list[test]
94 else:
95 _log.warning('%s not found, removing from list.', path)
96 return new_test_prefix_list
97
98 def _get_issue_number(self, options): 81 def _get_issue_number(self, options):
99 """Gets the Rietveld CL number from either |options| or from the current local branch.""" 82 """Gets the Rietveld CL number from either |options| or from the current local branch."""
100 if options.issue: 83 if options.issue:
101 return options.issue 84 return options.issue
102 issue_number = self.git_cl().get_issue_number() 85 issue_number = self.git_cl().get_issue_number()
103 _log.debug('Issue number for current branch: %s', issue_number) 86 _log.debug('Issue number for current branch: %s', issue_number)
104 if not issue_number.isdigit(): 87 if not issue_number.isdigit():
105 _log.error('No issue number given and no issue for current branch. T his tool requires a CL\n' 88 _log.error('No issue number given and no issue for current branch. T his tool requires a CL\n'
106 'to operate on; please run `git cl upload` on this branch first, or use the --issue\n' 89 'to operate on; please run `git cl upload` on this branch first, or use the --issue\n'
107 'option to download baselines for another existing CL.') 90 'option to download baselines for another existing CL.')
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 def _log_test_prefix_list(test_prefix_list): 204 def _log_test_prefix_list(test_prefix_list):
222 """Logs the tests to download new baselines for.""" 205 """Logs the tests to download new baselines for."""
223 if not test_prefix_list: 206 if not test_prefix_list:
224 _log.info('No tests to rebaseline; exiting.') 207 _log.info('No tests to rebaseline; exiting.')
225 return 208 return
226 _log.debug('Tests to rebaseline:') 209 _log.debug('Tests to rebaseline:')
227 for test, builds in test_prefix_list.iteritems(): 210 for test, builds in test_prefix_list.iteritems():
228 _log.debug(' %s:', test) 211 _log.debug(' %s:', test)
229 for build in sorted(builds): 212 for build in sorted(builds):
230 _log.debug(' %s', build) 213 _log.debug(' %s', build)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698