Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 """Pull latest revisions of a W3C test repo and make a local commit.""" | 5 """Pull latest revisions of a W3C test repo and make a local commit.""" |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import json | 8 import json |
| 9 import time | 9 import time |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 email_list = self.generate_email_list(out, directory_dict) | 75 email_list = self.generate_email_list(out, directory_dict) |
| 76 self.print_('## Uploading change list.') | 76 self.print_('## Uploading change list.') |
| 77 self.check_run(self.generate_upload_command(email_list)) | 77 self.check_run(self.generate_upload_command(email_list)) |
| 78 self.print_('## Triggering try jobs.') | 78 self.print_('## Triggering try jobs.') |
| 79 for try_bot in try_bots: | 79 for try_bot in try_bots: |
| 80 self.run(['git', 'cl', 'try', '-b', try_bot, | 80 self.run(['git', 'cl', 'try', '-b', try_bot, |
| 81 '--auth-refresh-token-json', self.auth_refresh_token_j son]) | 81 '--auth-refresh-token-json', self.auth_refresh_token_j son]) |
| 82 self.print_('## Waiting for Try Job Results') | 82 self.print_('## Waiting for Try Job Results') |
| 83 if self.has_failing_results(): | 83 if self.has_failing_results(): |
| 84 self.write_test_expectations() | 84 self.write_test_expectations() |
| 85 else: | 85 self.run(['git', 'cl', 'set-commit', '--rietveld', |
| 86 self.print_('No Failures, committing patch.') | 86 '--auth-refresh-token-json', self.auth_refresh_token_json] ) |
| 87 self.run(['git', 'cl', 'land', '-f', '--auth-refresh-token-json', se lf.auth_refresh_token_json]) | 87 if self.has_failing_results(): |
| 88 self.print_('## CL has failing results when trying to land; abor ting.') | |
| 89 self.run(['git', 'cl', 'set-close', '--auth-refresh-token-json', self.auth_refresh_token_json]) | |
| 90 return 1 | |
|
qyearsley
2016/08/16 22:35:59
Note, this CL should make it so that after trying
| |
| 91 self.print_('## Auto-update complete.') | |
| 88 return 0 | 92 return 0 |
| 89 | 93 |
| 90 def parse_args(self, argv): | 94 def parse_args(self, argv): |
| 91 parser = argparse.ArgumentParser() | 95 parser = argparse.ArgumentParser() |
| 92 parser.description = __doc__ | 96 parser.description = __doc__ |
| 93 parser.add_argument('-v', '--verbose', action='store_true', | 97 parser.add_argument('-v', '--verbose', action='store_true', |
| 94 help='log what we are doing') | 98 help='log what we are doing') |
| 95 parser.add_argument('--allow-local-commits', action='store_true', | 99 parser.add_argument('--allow-local-commits', action='store_true', |
| 96 help='allow script to run even if we have local comm its') | 100 help='allow script to run even if we have local comm its') |
| 97 parser.add_argument('--keep-w3c-repos-around', action='store_true', | 101 parser.add_argument('--keep-w3c-repos-around', action='store_true', |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 if dict_set['notification-email']: | 341 if dict_set['notification-email']: |
| 338 directory_dict[dict_set['directory']] = dict_set['notification-e mail'] | 342 directory_dict[dict_set['directory']] = dict_set['notification-e mail'] |
| 339 return directory_dict | 343 return directory_dict |
| 340 | 344 |
| 341 def write_test_expectations(self): | 345 def write_test_expectations(self): |
| 342 self.print_('## Adding test expectations lines to LayoutTests/TestExpect ations.') | 346 self.print_('## Adding test expectations lines to LayoutTests/TestExpect ations.') |
| 343 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c -test-expectations') | 347 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c -test-expectations') |
| 344 self.run([self.host.executable, script_path]) | 348 self.run([self.host.executable, script_path]) |
| 345 message = '\'Modifies TestExpectations and/or downloads new baselines fo r tests\'' | 349 message = '\'Modifies TestExpectations and/or downloads new baselines fo r tests\'' |
| 346 self.check_run(['git', 'commit', '-a', '-m', message]) | 350 self.check_run(['git', 'commit', '-a', '-m', message]) |
| 347 self.check_run(['git', 'cl', 'upload', '-m', message, | 351 self.check_run(['git', 'cl', 'upload', '-m', message, '--rietveld' |
| 348 '--auth-refresh-token-json', self.auth_refresh_token_jso n]) | 352 '--auth-refresh-token-json', self.auth_refresh_token_jso n]) |
| 349 | 353 |
| 350 def has_failing_results(self): | 354 def has_failing_results(self): |
| 351 while True: | 355 while True: |
| 352 time.sleep(POLL_DELAY_SECONDS) | 356 time.sleep(POLL_DELAY_SECONDS) |
| 353 self.print_('Still waiting...') | 357 self.print_('Still waiting...') |
| 354 _, out = self.run(['git', 'cl', 'try-results']) | 358 _, out = self.run(['git', 'cl', 'try-results']) |
| 355 results = self.parse_try_job_results(out) | 359 results = self.parse_try_job_results(out) |
| 356 if results.get('Started') or results.get('Scheduled'): | 360 if results.get('Started') or results.get('Scheduled'): |
| 357 continue | 361 continue |
| 358 if results.get('Failures'): | 362 if results.get('Failures'): |
| 359 return True | 363 return True |
| 360 return False | 364 return False |
| 361 | 365 |
| 362 def generate_upload_command(self, email_list): | 366 def generate_upload_command(self, email_list): |
| 363 message = """W3C auto test importer | 367 message = """W3C auto test importer |
| 364 | 368 |
| 365 TBR=qyearsley@chromium.org""" | 369 TBR=qyearsley@chromium.org""" |
| 366 | 370 |
| 367 command = ['git', 'cl', 'upload', '-f', '-m', message] | 371 command = ['git', 'cl', 'upload', '-f', '-m', message, '--rietveld'] |
| 368 command += ['--cc=' + email for email in email_list] | 372 command += ['--cc=' + email for email in email_list] |
| 369 if self.auth_refresh_token_json: | 373 if self.auth_refresh_token_json: |
| 370 command += ['--auth-refresh-token-json', self.auth_refresh_token_jso n] | 374 command += ['--auth-refresh-token-json', self.auth_refresh_token_jso n] |
| 371 return command | 375 return command |
| OLD | NEW |