| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return 1 | 44 return 1 |
| 45 | 45 |
| 46 self.git_cl = GitCL(self.executive, auth_refresh_token_json=options.auth
_refresh_token_json) | 46 self.git_cl = GitCL(self.executive, auth_refresh_token_json=options.auth
_refresh_token_json) |
| 47 | 47 |
| 48 self.print_('## Noting the current Chromium commit.') | 48 self.print_('## Noting the current Chromium commit.') |
| 49 _, show_ref_output = self.run(['git', 'show-ref', 'HEAD']) | 49 _, show_ref_output = self.run(['git', 'show-ref', 'HEAD']) |
| 50 chromium_commitish = show_ref_output.split()[0] | 50 chromium_commitish = show_ref_output.split()[0] |
| 51 | 51 |
| 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() |
| 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() | 62 commit_successful = self.do_auto_update() |
| 63 if not commit_successful: | 63 if not commit_successful: |
| 64 return 1 | 64 return 1 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 95 if self.fs.exists(self.path_from_webkit_base(WPT_DEST_NAME)): | 95 if self.fs.exists(self.path_from_webkit_base(WPT_DEST_NAME)): |
| 96 self.print_('## WebKit/%s exists; aborting.' % WPT_DEST_NAME) | 96 self.print_('## WebKit/%s exists; aborting.' % WPT_DEST_NAME) |
| 97 return False | 97 return False |
| 98 | 98 |
| 99 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): | 99 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): |
| 100 self.print_('## WebKit/%s repo exists; aborting.' % CSS_DEST_NAME) | 100 self.print_('## WebKit/%s repo exists; aborting.' % CSS_DEST_NAME) |
| 101 return False | 101 return False |
| 102 | 102 |
| 103 return True | 103 return True |
| 104 | 104 |
| 105 def _copy_resources_to_wpt(self): | 105 def _copy_resources(self): |
| 106 """Copies some files over to a newly-updated wpt directory. | 106 """Copies resources from LayoutTests/resources to wpt and vice versa. |
| 107 | 107 |
| 108 There are some resources in our repository that we use instead of the | 108 There are resources from our repository that we use instead of the |
| 109 upstream versions. | 109 upstream versions. Conversely, there are also some resources that |
| 110 are copied in the other direction. |
| 111 |
| 112 Specifically: |
| 113 - testharnessreport.js contains code needed to integrate our testing |
| 114 with testharness.js; we also want our code to be used for tests |
| 115 in wpt. |
| 116 - TODO(qyearsley, jsbell): Document why other other files are copied, |
| 117 or stop copying them if it's unnecessary. |
| 118 |
| 119 If this method is changed, the lists of files expected to be identical |
| 120 in LayoutTests/PRESUBMIT.py should also be changed. |
| 110 """ | 121 """ |
| 111 resources_to_copy = [ | 122 resources_to_copy_to_wpt = [ |
| 112 ('testharnessreport.js', 'resources'), | 123 ('testharnessreport.js', 'resources'), |
| 113 ('WebIDLParser.js', 'resources'), | 124 ('WebIDLParser.js', 'resources'), |
| 114 ('vendor-prefix.js', 'common'), | 125 ('vendor-prefix.js', 'common'), |
| 115 ] | 126 ] |
| 116 for filename, wpt_subdir in resources_to_copy: | 127 resources_to_copy_from_wpt = [ |
| 128 ('idlharness.js', 'resources'), |
| 129 ('testharness.js', 'resources'), |
| 130 ] |
| 131 for filename, wpt_subdir in resources_to_copy_to_wpt: |
| 117 source = self.path_from_webkit_base('LayoutTests', 'resources', file
name) | 132 source = self.path_from_webkit_base('LayoutTests', 'resources', file
name) |
| 118 destination = self.path_from_webkit_base('LayoutTests', 'imported',
WPT_DEST_NAME, wpt_subdir, filename) | 133 destination = self.path_from_webkit_base('LayoutTests', 'imported',
WPT_DEST_NAME, wpt_subdir, filename) |
| 119 self.copyfile(source, destination) | 134 self.copyfile(source, destination) |
| 120 self.run(['git', 'add', destination]) | 135 self.run(['git', 'add', destination]) |
| 136 for filename, wpt_subdir in resources_to_copy_from_wpt: |
| 137 source = self.path_from_webkit_base('LayoutTests', 'imported', WPT_D
EST_NAME, wpt_subdir, filename) |
| 138 destination = self.path_from_webkit_base('LayoutTests', 'resources',
filename) |
| 139 self.copyfile(source, destination) |
| 140 self.run(['git', 'add', destination]) |
| 121 | 141 |
| 122 def update(self, dest_dir_name, url, keep_w3c_repos_around): | 142 def update(self, dest_dir_name, url, keep_w3c_repos_around): |
| 123 """Updates an imported repository. | 143 """Updates an imported repository. |
| 124 | 144 |
| 125 Args: | 145 Args: |
| 126 dest_dir_name: The destination directory name. | 146 dest_dir_name: The destination directory name. |
| 127 url: URL of the git repository. | 147 url: URL of the git repository. |
| 128 | 148 |
| 129 Returns: | 149 Returns: |
| 130 A string for the commit description "<destination>@<commitish>". | 150 A string for the commit description "<destination>@<commitish>". |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 email_addresses.add(directory_to_owner[test_dir]) | 352 email_addresses.add(directory_to_owner[test_dir]) |
| 333 return sorted(email_addresses) | 353 return sorted(email_addresses) |
| 334 | 354 |
| 335 def write_test_expectations(self): | 355 def write_test_expectations(self): |
| 336 self.print_('## Adding test expectations lines to LayoutTests/TestExpect
ations.') | 356 self.print_('## Adding test expectations lines to LayoutTests/TestExpect
ations.') |
| 337 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c
-test-expectations') | 357 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c
-test-expectations') |
| 338 self.run([self.host.executable, script_path]) | 358 self.run([self.host.executable, script_path]) |
| 339 message = '\'Modifies TestExpectations and/or downloads new baselines fo
r tests\'' | 359 message = '\'Modifies TestExpectations and/or downloads new baselines fo
r tests\'' |
| 340 self.check_run(['git', 'commit', '-a', '-m', message]) | 360 self.check_run(['git', 'commit', '-a', '-m', message]) |
| 341 self.git_cl(['upload', '-m', message, '--rietveld']) | 361 self.git_cl(['upload', '-m', message, '--rietveld']) |
| OLD | NEW |