| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 source = self.path_from_webkit_base('LayoutTests', 'resources', file
name) | 141 source = self.path_from_webkit_base('LayoutTests', 'resources', file
name) |
| 142 destination = self.path_from_webkit_base('LayoutTests', 'external',
WPT_DEST_NAME, wpt_subdir, filename) | 142 destination = self.path_from_webkit_base('LayoutTests', 'external',
WPT_DEST_NAME, wpt_subdir, filename) |
| 143 self.copyfile(source, destination) | 143 self.copyfile(source, destination) |
| 144 self.run(['git', 'add', destination]) | 144 self.run(['git', 'add', destination]) |
| 145 for filename, wpt_subdir in resources_to_copy_from_wpt: | 145 for filename, wpt_subdir in resources_to_copy_from_wpt: |
| 146 source = self.path_from_webkit_base('LayoutTests', 'external', WPT_D
EST_NAME, wpt_subdir, filename) | 146 source = self.path_from_webkit_base('LayoutTests', 'external', WPT_D
EST_NAME, wpt_subdir, filename) |
| 147 destination = self.path_from_webkit_base('LayoutTests', 'resources',
filename) | 147 destination = self.path_from_webkit_base('LayoutTests', 'resources',
filename) |
| 148 self.copyfile(source, destination) | 148 self.copyfile(source, destination) |
| 149 self.run(['git', 'add', destination]) | 149 self.run(['git', 'add', destination]) |
| 150 | 150 |
| 151 def _generate_manifest(self, original_repo_path, dest_path): | 151 def _generate_manifest(self, dest_path): |
| 152 """Generates MANIFEST.json for imported tests. | 152 """Generates MANIFEST.json for imported tests. |
| 153 | 153 |
| 154 Args: | 154 Args: |
| 155 original_repo_path: Path to the temporary source WPT repo directory. | |
| 156 dest_path: Path to the destination WPT directory. | 155 dest_path: Path to the destination WPT directory. |
| 157 | 156 |
| 158 Runs the (newly-updated) manifest command if it's found, and then | 157 Runs the (newly-updated) manifest command if it's found, and then |
| 159 stages the generated MANIFEST.json in the git index, ready to commit. | 158 stages the generated MANIFEST.json in the git index, ready to commit. |
| 160 """ | 159 """ |
| 161 manifest_command = self.finder.path_from_webkit_base('Tools', 'Scripts',
'webkitpy', 'thirdparty', 'wpt', 'wpt', 'manifest') | 160 manifest_command = self.finder.path_from_webkit_base('Tools', 'Scripts',
'webkitpy', 'thirdparty', 'wpt', 'wpt', 'manifest') |
| 162 if 'css' in dest_path: | 161 if 'css' in dest_path: |
| 163 # Do nothing for csswg-test. | 162 # Do nothing for csswg-test. |
| 164 return | 163 return |
| 165 _log.info('Generating MANIFEST.json') | 164 _log.info('Generating MANIFEST.json') |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 _log.info('Deleting any orphaned baselines.') | 206 _log.info('Deleting any orphaned baselines.') |
| 208 | 207 |
| 209 is_baseline_filter = lambda fs, dirname, basename: self.is_baseline(base
name) | 208 is_baseline_filter = lambda fs, dirname, basename: self.is_baseline(base
name) |
| 210 previous_baselines = self.fs.files_under(dest_path, file_filter=is_basel
ine_filter) | 209 previous_baselines = self.fs.files_under(dest_path, file_filter=is_basel
ine_filter) |
| 211 | 210 |
| 212 for subpath in previous_baselines: | 211 for subpath in previous_baselines: |
| 213 full_path = self.fs.join(dest_path, subpath) | 212 full_path = self.fs.join(dest_path, subpath) |
| 214 if self.fs.glob(full_path.replace('-expected.txt', '*')) == [full_pa
th]: | 213 if self.fs.glob(full_path.replace('-expected.txt', '*')) == [full_pa
th]: |
| 215 self.fs.remove(full_path) | 214 self.fs.remove(full_path) |
| 216 | 215 |
| 217 self._generate_manifest(temp_repo_path, dest_path) | 216 self._generate_manifest(dest_path) |
| 218 | 217 |
| 219 if not keep_w3c_repos_around: | 218 if not keep_w3c_repos_around: |
| 220 _log.info('Deleting temp repo directory %s.', temp_repo_path) | 219 _log.info('Deleting temp repo directory %s.', temp_repo_path) |
| 221 self.rmtree(temp_repo_path) | 220 self.rmtree(temp_repo_path) |
| 222 | 221 |
| 223 _log.info('Updating TestExpectations for any removed or renamed tests.') | 222 _log.info('Updating TestExpectations for any removed or renamed tests.') |
| 224 self.update_all_test_expectations_files(self._list_deleted_tests(), self
._list_renamed_tests()) | 223 self.update_all_test_expectations_files(self._list_deleted_tests(), self
._list_renamed_tests()) |
| 225 | 224 |
| 226 return '%s@%s' % (dest_dir_name, master_commitish) | 225 return '%s@%s' % (dest_dir_name, master_commitish) |
| 227 | 226 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" | 451 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" |
| 453 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) | 452 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 454 renamed_tests = {} | 453 renamed_tests = {} |
| 455 for line in out.splitlines(): | 454 for line in out.splitlines(): |
| 456 _, source_path, dest_path = line.split() | 455 _, source_path, dest_path = line.split() |
| 457 source_test = self.finder.layout_test_name(source_path) | 456 source_test = self.finder.layout_test_name(source_path) |
| 458 dest_test = self.finder.layout_test_name(dest_path) | 457 dest_test = self.finder.layout_test_name(dest_path) |
| 459 if source_test and dest_test: | 458 if source_test and dest_test: |
| 460 renamed_tests[source_test] = dest_test | 459 renamed_tests[source_test] = dest_test |
| 461 return renamed_tests | 460 return renamed_tests |
| OLD | NEW |