| 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 """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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 if options.target == 'wpt': | 52 if options.target == 'wpt': |
| 53 import_commitish = self.update(WPT_DEST_NAME, WPT_REPO_URL, options.
keep_w3c_repos_around) | 53 import_commitish = self.update(WPT_DEST_NAME, WPT_REPO_URL, options.
keep_w3c_repos_around) |
| 54 self._copy_resources_to_wpt() | 54 self._copy_resources_to_wpt() |
| 55 elif options.target == 'css': | 55 elif options.target == 'css': |
| 56 import_commitish = self.update(CSS_DEST_NAME, CSS_REPO_URL, options.
keep_w3c_repos_around) | 56 import_commitish = self.update(CSS_DEST_NAME, CSS_REPO_URL, options.
keep_w3c_repos_around) |
| 57 else: | 57 else: |
| 58 raise AssertionError("Unsupported target %s" % options.target) | 58 raise AssertionError("Unsupported target %s" % options.target) |
| 59 | 59 |
| 60 has_changes = self.commit_changes_if_needed(chromium_commitish, import_c
ommitish) | 60 has_changes = self.commit_changes_if_needed(chromium_commitish, import_c
ommitish) |
| 61 if options.auto_update and has_changes: | 61 if options.auto_update and has_changes: |
| 62 commit_successful = self.do_auto_update(options.auth_refresh_token_j
son) | 62 commit_successful = self.do_auto_update() |
| 63 if not commit_successful: | 63 if not commit_successful: |
| 64 return 1 | 64 return 1 |
| 65 return 0 | 65 return 0 |
| 66 | 66 |
| 67 def parse_args(self, argv): | 67 def parse_args(self, argv): |
| 68 parser = argparse.ArgumentParser() | 68 parser = argparse.ArgumentParser() |
| 69 parser.description = __doc__ | 69 parser.description = __doc__ |
| 70 parser.add_argument('-v', '--verbose', action='store_true', | 70 parser.add_argument('-v', '--verbose', action='store_true', |
| 71 help='log what we are doing') | 71 help='log what we are doing') |
| 72 parser.add_argument('--allow-local-commits', action='store_true', | 72 parser.add_argument('--allow-local-commits', action='store_true', |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 if self.verbose: | 253 if self.verbose: |
| 254 self.print_('rm -fr %s' % dest) | 254 self.print_('rm -fr %s' % dest) |
| 255 self.fs.rmtree(dest) | 255 self.fs.rmtree(dest) |
| 256 | 256 |
| 257 def path_from_webkit_base(self, *comps): | 257 def path_from_webkit_base(self, *comps): |
| 258 return self.finder.path_from_webkit_base(*comps) | 258 return self.finder.path_from_webkit_base(*comps) |
| 259 | 259 |
| 260 def print_(self, msg): | 260 def print_(self, msg): |
| 261 self.host.print_(msg) | 261 self.host.print_(msg) |
| 262 | 262 |
| 263 def do_auto_update(self, auth_refresh_token_json): | 263 def do_auto_update(self): |
| 264 """Attempts to upload a CL, make any required adjustments, and commit. | 264 """Attempts to upload a CL, make any required adjustments, and commit. |
| 265 | 265 |
| 266 This function assumes that the imported repo has already been updated, | 266 This function assumes that the imported repo has already been updated, |
| 267 and that change has been committed. There may be newly-failing tests, | 267 and that change has been committed. There may be newly-failing tests, |
| 268 so before being able to commit these new changes, we may need to update | 268 so before being able to commit these new changes, we may need to update |
| 269 TestExpectations or download new baselines. | 269 TestExpectations or download new baselines. |
| 270 | 270 |
| 271 Returns: | 271 Returns: |
| 272 True if successfully committed, False otherwise. | 272 True if successfully committed, False otherwise. |
| 273 """ | 273 """ |
| 274 self.print_('## Uploading change list.') | 274 self.print_('## Uploading change list.') |
| 275 cc_list = self.get_directory_owners_to_cc() | 275 cc_list = self.get_directory_owners_to_cc() |
| 276 self.git_cl.run([ | 276 self.git_cl.run([ |
| 277 'upload', '-f', '--rietveld' | 277 'upload', '-f', '--rietveld', |
| 278 '-m', 'W3C auto test import CL.\n\nTBR=qyearsley@chromium.org', | 278 '-m', 'W3C auto test import CL.\n\nTBR=qyearsley@chromium.org', |
| 279 ] + ['--cc=' + email for email in cc_list]) | 279 ] + ['--cc=' + email for email in cc_list]) |
| 280 | 280 |
| 281 self.print_('## Triggering try jobs.') | 281 self.print_('## Triggering try jobs.') |
| 282 for try_bot in self.host.builders.all_try_builder_names(): | 282 for try_bot in self.host.builders.all_try_builder_names(): |
| 283 self.git_cl.run(['try', '-b', try_bot]) | 283 self.git_cl.run(['try', '-b', try_bot]) |
| 284 if self.git_cl.has_failing_try_results(): | 284 if self.git_cl.has_failing_try_results(): |
| 285 self.write_test_expectations() | 285 self.write_test_expectations() |
| 286 | 286 |
| 287 self.run(['set-commit', '--rietveld']) | 287 self.run(['set-commit', '--rietveld']) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 email_addresses.add(directory_to_owner[test_dir]) | 330 email_addresses.add(directory_to_owner[test_dir]) |
| 331 return sorted(email_addresses) | 331 return sorted(email_addresses) |
| 332 | 332 |
| 333 def write_test_expectations(self): | 333 def write_test_expectations(self): |
| 334 self.print_('## Adding test expectations lines to LayoutTests/TestExpect
ations.') | 334 self.print_('## Adding test expectations lines to LayoutTests/TestExpect
ations.') |
| 335 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c
-test-expectations') | 335 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c
-test-expectations') |
| 336 self.run([self.host.executable, script_path]) | 336 self.run([self.host.executable, script_path]) |
| 337 message = '\'Modifies TestExpectations and/or downloads new baselines fo
r tests\'' | 337 message = '\'Modifies TestExpectations and/or downloads new baselines fo
r tests\'' |
| 338 self.check_run(['git', 'commit', '-a', '-m', message]) | 338 self.check_run(['git', 'commit', '-a', '-m', message]) |
| 339 self.git_cl(['upload', '-m', message, '--rietveld']) | 339 self.git_cl(['upload', '-m', message, '--rietveld']) |
| OLD | NEW |