| 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 time | 8 import time |
| 9 | 9 |
| 10 from webkitpy.common.webkit_finder import WebKitFinder | 10 from webkitpy.common.webkit_finder import WebKitFinder |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 self.run(['git', 'add', destination]) | 56 self.run(['git', 'add', destination]) |
| 57 | 57 |
| 58 elif self.target == 'css': | 58 elif self.target == 'css': |
| 59 import_commitish = self.update( | 59 import_commitish = self.update( |
| 60 CSS_DEST_NAME, | 60 CSS_DEST_NAME, |
| 61 'https://chromium.googlesource.com/external/w3c/csswg-test.git') | 61 'https://chromium.googlesource.com/external/w3c/csswg-test.git') |
| 62 else: | 62 else: |
| 63 raise AssertionError("Unsupported target %s" % self.target) | 63 raise AssertionError("Unsupported target %s" % self.target) |
| 64 | 64 |
| 65 self.commit_changes_if_needed(chromium_commitish, import_commitish) | 65 self.commit_changes_if_needed(chromium_commitish, import_commitish) |
| 66 | |
| 67 if self.auto_update: | 66 if self.auto_update: |
| 68 self.check_run(['git', 'cl', 'upload', '-f']) | 67 try_bots = self.host.builders.all_try_builder_names() |
| 69 self.run(['git', 'cl', 'set-commit', '--dry-run']) | 68 self.print_('## Uploading change list.') |
| 69 self.check_run(['git', 'cl', 'upload', '-f', '-m', 'W3C auto test im
porter']) |
| 70 self.print_('## Triggering try jobs.') |
| 71 for try_bot in try_bots: |
| 72 self.run(['git', 'cl', 'try', '-b', try_bot]) |
| 73 self.print_('## Waiting for Try Job Results') |
| 74 has_failing_results = False |
| 70 while True: | 75 while True: |
| 71 time.sleep(POLL_DELAY_SECONDS) | 76 time.sleep(POLL_DELAY_SECONDS) |
| 72 _, out = self.run(['git', 'cl', 'try-results']) | 77 _, out = self.run(['git', 'cl', 'try-results']) |
| 73 results = self.parse_try_job_results(out) | 78 results = self.parse_try_job_results(out) |
| 74 if results['Started'] or results['Scheduled']: | 79 if results.get('Started') or results.get('Scheduled'): |
| 75 continue | 80 continue |
| 76 if results['Failures']: | 81 if results.get('Failures'): |
| 77 return 1 | 82 has_failing_results = True |
| 78 break | 83 break |
| 84 if has_failing_results: |
| 85 self.print_('## Adding test expectations lines to LayoutTests/Te
stExpectations') |
| 86 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'up
date-w3c-test-expectations') |
| 87 self.run([self.host.executable, script_path]) |
| 88 self.check_run(['git', 'commit', '-a', '-m', '\'Modified Test Ex
pectations from W3C Test Auto-roller\'']) |
| 89 self.check_run(['git', 'cl', 'upload', '-m', '\'Wrote lines to T
estExpectations\'']) |
| 90 else: |
| 91 self.print_('No Failures, committing patch.') |
| 92 quit() |
| 79 self.run(['git', 'cl', 'land', '-f']) | 93 self.run(['git', 'cl', 'land', '-f']) |
| 80 return 0 | 94 return 0 |
| 81 | 95 |
| 82 def parse_args(self, argv): | 96 def parse_args(self, argv): |
| 83 parser = argparse.ArgumentParser() | 97 parser = argparse.ArgumentParser() |
| 84 parser.description = __doc__ | 98 parser.description = __doc__ |
| 85 parser.add_argument('-v', '--verbose', action='store_true', | 99 parser.add_argument('-v', '--verbose', action='store_true', |
| 86 help='log what we are doing') | 100 help='log what we are doing') |
| 87 parser.add_argument('--allow-local-commits', action='store_true', | 101 parser.add_argument('--allow-local-commits', action='store_true', |
| 88 help='allow script to run even if we have local comm
its') | 102 help='allow script to run even if we have local comm
its') |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 sets = {} | 288 sets = {} |
| 275 for line in results.splitlines(): | 289 for line in results.splitlines(): |
| 276 line = line.strip() | 290 line = line.strip() |
| 277 if line[-1] == ':': | 291 if line[-1] == ':': |
| 278 result_type = line[:-1] | 292 result_type = line[:-1] |
| 279 sets[result_type] = set() | 293 sets[result_type] = set() |
| 280 elif line.split()[0] == 'Total:': | 294 elif line.split()[0] == 'Total:': |
| 281 break | 295 break |
| 282 else: | 296 else: |
| 283 sets[result_type].add(line.split()[0]) | 297 sets[result_type].add(line.split()[0]) |
| 284 sets['Failures'] -= sets['Successes'] | |
| 285 sets['Started'] -= sets['Successes'] | |
| 286 sets['Started'] -= sets['Failures'] | |
| 287 return sets | 298 return sets |
| 288 | 299 |
| 289 def check_run(self, command): | 300 def check_run(self, command): |
| 290 return_code, out = self.run(command) | 301 return_code, out = self.run(command) |
| 291 if return_code: | 302 if return_code: |
| 292 raise Exception('%s failed with exit code %d.' % ' '.join(command),
return_code) | 303 raise Exception('%s failed with exit code %d.' % ' '.join(command),
return_code) |
| 293 return out | 304 return out |
| OLD | NEW |