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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py

Issue 2248913003: In deps_updater.py: After updating, set commit and close on CQ failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Fetches a copy of the latest state of a W3C test repository and commits. 5 """Fetches a copy of the latest state of a W3C test repository and commits.
6 6
7 If this script is given the argument --auto-update, it will also attempt to 7 If this script is given the argument --auto-update, it will also attempt to
8 upload a CL, triggery try jobs, and make any changes that are required for 8 upload a CL, triggery try jobs, and make any changes that are required for
9 new failing tests before committing. 9 new failing tests before committing.
10 """ 10 """
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 self.run(['git', 'add', destination]) 66 self.run(['git', 'add', destination])
67 67
68 elif self.target == 'css': 68 elif self.target == 'css':
69 import_commitish = self.update(CSS_DEST_NAME, WPT_REPO_URL) 69 import_commitish = self.update(CSS_DEST_NAME, WPT_REPO_URL)
70 else: 70 else:
71 raise AssertionError("Unsupported target %s" % self.target) 71 raise AssertionError("Unsupported target %s" % self.target)
72 72
73 has_changes = self.commit_changes_if_needed(chromium_commitish, import_c ommitish) 73 has_changes = self.commit_changes_if_needed(chromium_commitish, import_c ommitish)
74 74
75 if self.auto_update and has_changes: 75 if self.auto_update and has_changes:
76 self.do_auto_update() 76 commit_successful = self.do_auto_update()
77 if not commit_successful:
78 return 1
77 return 0 79 return 0
78 80
79 def parse_args(self, argv): 81 def parse_args(self, argv):
80 parser = argparse.ArgumentParser() 82 parser = argparse.ArgumentParser()
81 parser.description = __doc__ 83 parser.description = __doc__
82 parser.add_argument('-v', '--verbose', action='store_true', 84 parser.add_argument('-v', '--verbose', action='store_true',
83 help='log what we are doing') 85 help='log what we are doing')
84 parser.add_argument('--allow-local-commits', action='store_true', 86 parser.add_argument('--allow-local-commits', action='store_true',
85 help='allow script to run even if we have local comm its') 87 help='allow script to run even if we have local comm its')
86 parser.add_argument('--keep-w3c-repos-around', action='store_true', 88 parser.add_argument('--keep-w3c-repos-around', action='store_true',
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 def print_(self, msg): 264 def print_(self, msg):
263 self.host.print_(msg) 265 self.host.print_(msg)
264 266
265 def do_auto_update(self): 267 def do_auto_update(self):
266 """Attempts to upload a CL, make any required adjustments, and commit. 268 """Attempts to upload a CL, make any required adjustments, and commit.
267 269
268 This function assumes that the imported repo has already been updated, 270 This function assumes that the imported repo has already been updated,
269 and that change has been committed. There may be newly-failing tests, 271 and that change has been committed. There may be newly-failing tests,
270 so before being able to commit these new changes, we may need to update 272 so before being able to commit these new changes, we may need to update
271 TestExpectations or download new baselines. 273 TestExpectations or download new baselines.
274
275 Returns:
276 True if successfully committed, False otherwise.
272 """ 277 """
273 email_list = self.get_directory_owners_to_cc() 278 email_list = self.get_directory_owners_to_cc()
274 self.print_('## Uploading change list.') 279 self.print_('## Uploading change list.')
275 self.check_run(self.generate_upload_command(email_list)) 280 self.check_run(self.generate_upload_command(email_list))
276 self.trigger_try_jobs() 281 self.trigger_try_jobs()
277 if self.has_failing_results(): 282 if self.has_failing_results():
278 self.write_test_expectations() 283 self.write_test_expectations()
279 # TODO(qyearsley): After writing test expectations, the CL needs 284 command = ['git', 'cl', 'set-commit', '--rietveld']
280 # to be tried again on the try bots, and closed if it fails. 285 if self.auth_refresh_token_json:
281 else: 286 command += ['--auth-refresh-token-json', self.auth_refresh_token_jso n]
282 self.print_('No Failures, committing patch.') 287 self.run(command)
283 self.run(['git', 'cl', 'land', '-f', '--auth-refresh-token-json', self.a uth_refresh_token_json]) 288 if self.has_failing_results():
284 # TODO(qyearsley): Attempting to land should trigger the CQ -- if 289 self.print_('## CL has failing results when trying to land; aborting .')
285 # the CQ fails, we should abort and close the CL. 290 command = ['git', 'cl', 'set-close']
291 if self.auth_refresh_token_json:
292 command += ['--auth-refresh-token-json', self.auth_refresh_token _json]
293 self.run(command)
294 return False
295 return True
296
286 297
287 def get_directory_owners_to_cc(self): 298 def get_directory_owners_to_cc(self):
288 """Returns a list of email addresses to CC for the current import.""" 299 """Returns a list of email addresses to CC for the current import."""
289 self.print_('## Gathering directory owners emails to CC.') 300 self.print_('## Gathering directory owners emails to CC.')
290 directory_owners_file_path = self.finder.path_from_webkit_base( 301 directory_owners_file_path = self.finder.path_from_webkit_base(
291 'Tools', 'Scripts', 'webkitpy', 'w3c', 'directory_owners.json') 302 'Tools', 'Scripts', 'webkitpy', 'w3c', 'directory_owners.json')
292 with open(directory_owners_file_path) as data_file: 303 with open(directory_owners_file_path) as data_file:
293 directory_to_owner = self.parse_directory_owners(json.load(data_file )) 304 directory_to_owner = self.parse_directory_owners(json.load(data_file ))
294 out = self.check_run(['git', 'diff', 'master', '--name-only']) 305 out = self.check_run(['git', 'diff', 'master', '--name-only'])
295 changed_files = out.splitlines() 306 changed_files = out.splitlines()
(...skipping 22 matching lines...) Expand all
318 email_addresses = set() 329 email_addresses = set()
319 for file_path in changed_files: 330 for file_path in changed_files:
320 test_path = self.finder.layout_test_name(file_path) 331 test_path = self.finder.layout_test_name(file_path)
321 test_dir = self.fs.dirname(test_path) 332 test_dir = self.fs.dirname(test_path)
322 if test_dir in directory_to_owner: 333 if test_dir in directory_to_owner:
323 email_addresses.add(directory_to_owner[test_dir]) 334 email_addresses.add(directory_to_owner[test_dir])
324 return sorted(email_addresses) 335 return sorted(email_addresses)
325 336
326 def generate_upload_command(self, email_list): 337 def generate_upload_command(self, email_list):
327 message = 'W3C auto test importer\n\nTBR=qyearsley@chromium.org' 338 message = 'W3C auto test importer\n\nTBR=qyearsley@chromium.org'
328 command = ['git', 'cl', 'upload', '-f', '-m', message] 339 command = ['git', 'cl', 'upload', '-f', '-m', message, '--rietveld']
329 command += ['--cc=' + email for email in email_list] 340 command += ['--cc=' + email for email in email_list]
330 if self.auth_refresh_token_json: 341 if self.auth_refresh_token_json:
331 command += ['--auth-refresh-token-json', self.auth_refresh_token_jso n] 342 command += ['--auth-refresh-token-json', self.auth_refresh_token_jso n]
332 return command 343 return command
333 344
334 def trigger_try_jobs(self): 345 def trigger_try_jobs(self):
335 """Triggers try jobs on all Blink layout test try bots.""" 346 """Triggers try jobs on all Blink layout test try bots."""
336 self.print_('## Triggering try jobs.') 347 self.print_('## Triggering try jobs.')
337 for try_bot in self.host.builders.all_try_builder_names(): 348 for try_bot in self.host.builders.all_try_builder_names():
338 self.run(['git', 'cl', 'try', '-b', try_bot, 349 self.run(['git', 'cl', 'try', '-b', try_bot,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 else: 389 else:
379 sets[result_type].add(line.split()[0]) 390 sets[result_type].add(line.split()[0])
380 return sets 391 return sets
381 392
382 def write_test_expectations(self): 393 def write_test_expectations(self):
383 self.print_('## Adding test expectations lines to LayoutTests/TestExpect ations.') 394 self.print_('## Adding test expectations lines to LayoutTests/TestExpect ations.')
384 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c -test-expectations') 395 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c -test-expectations')
385 self.run([self.host.executable, script_path]) 396 self.run([self.host.executable, script_path])
386 message = '\'Modifies TestExpectations and/or downloads new baselines fo r tests\'' 397 message = '\'Modifies TestExpectations and/or downloads new baselines fo r tests\''
387 self.check_run(['git', 'commit', '-a', '-m', message]) 398 self.check_run(['git', 'commit', '-a', '-m', message])
388 self.check_run(['git', 'cl', 'upload', '-m', message, 399 self.check_run(['git', 'cl', 'upload', '-m', message, '--rietveld'
389 '--auth-refresh-token-json', self.auth_refresh_token_jso n]) 400 '--auth-refresh-token-json', self.auth_refresh_token_jso n])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698