Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py

Issue 2627213003: Rename LayoutTests/imported/ -> LayoutTests/external/. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 """
11 11
12 import logging 12 import logging
13 import argparse 13 import argparse
14 import json 14 import json
15 15
16 from webkitpy.common.net.git_cl import GitCL 16 from webkitpy.common.net.git_cl import GitCL
17 from webkitpy.common.webkit_finder import WebKitFinder 17 from webkitpy.common.webkit_finder import WebKitFinder
18 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes tExpectationParser 18 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes tExpectationParser
19 19
20 # Import destination directories (under LayoutTests/imported/). 20 # Import destination directories (under LayoutTests/external/).
21 WPT_DEST_NAME = 'wpt' 21 WPT_DEST_NAME = 'wpt'
22 CSS_DEST_NAME = 'csswg-test' 22 CSS_DEST_NAME = 'csswg-test'
23 23
24 # Our mirrors of the official w3c repos, which we pull from. 24 # Our mirrors of the official w3c repos, which we pull from.
25 WPT_REPO_URL = 'https://chromium.googlesource.com/external/w3c/web-platform-test s.git' 25 WPT_REPO_URL = 'https://chromium.googlesource.com/external/w3c/web-platform-test s.git'
26 CSS_REPO_URL = 'https://chromium.googlesource.com/external/w3c/csswg-test.git' 26 CSS_REPO_URL = 'https://chromium.googlesource.com/external/w3c/csswg-test.git'
27 27
28 28
29 _log = logging.getLogger(__file__) 29 _log = logging.getLogger(__file__)
30 30
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ('testharnessreport.js', 'resources'), 132 ('testharnessreport.js', 'resources'),
133 ('WebIDLParser.js', 'resources'), 133 ('WebIDLParser.js', 'resources'),
134 ('vendor-prefix.js', 'common'), 134 ('vendor-prefix.js', 'common'),
135 ] 135 ]
136 resources_to_copy_from_wpt = [ 136 resources_to_copy_from_wpt = [
137 ('idlharness.js', 'resources'), 137 ('idlharness.js', 'resources'),
138 ('testharness.js', 'resources'), 138 ('testharness.js', 'resources'),
139 ] 139 ]
140 for filename, wpt_subdir in resources_to_copy_to_wpt: 140 for filename, wpt_subdir in resources_to_copy_to_wpt:
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', 'imported', 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', 'imported', 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, original_repo_path, 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. 155 original_repo_path: Path to the temporary source WPT repo directory.
156 dest_path: Path to the destination WPT directory. 156 dest_path: Path to the destination WPT directory.
(...skipping 26 matching lines...) Expand all
183 183
184 if revision is not None: 184 if revision is not None:
185 _log.info('Checking out %s', revision) 185 _log.info('Checking out %s', revision)
186 self.run(['git', 'checkout', revision], cwd=temp_repo_path) 186 self.run(['git', 'checkout', revision], cwd=temp_repo_path)
187 self.run(['git', 'submodule', 'update', '--init', '--recursive'], cwd=te mp_repo_path) 187 self.run(['git', 'submodule', 'update', '--init', '--recursive'], cwd=te mp_repo_path)
188 188
189 _log.info('Noting the revision we are importing.') 189 _log.info('Noting the revision we are importing.')
190 _, show_ref_output = self.run(['git', 'show-ref', 'origin/master'], cwd= temp_repo_path) 190 _, show_ref_output = self.run(['git', 'show-ref', 'origin/master'], cwd= temp_repo_path)
191 master_commitish = show_ref_output.split()[0] 191 master_commitish = show_ref_output.split()[0]
192 192
193 _log.info('Cleaning out tests from LayoutTests/imported/%s.', dest_dir_n ame) 193 _log.info('Cleaning out tests from LayoutTests/external/%s.', dest_dir_n ame)
194 dest_path = self.path_from_webkit_base('LayoutTests', 'imported', dest_d ir_name) 194 dest_path = self.path_from_webkit_base('LayoutTests', 'external', dest_d ir_name)
195 is_not_baseline_filter = lambda fs, dirname, basename: not self.is_basel ine(basename) 195 is_not_baseline_filter = lambda fs, dirname, basename: not self.is_basel ine(basename)
196 files_to_delete = self.fs.files_under(dest_path, file_filter=is_not_base line_filter) 196 files_to_delete = self.fs.files_under(dest_path, file_filter=is_not_base line_filter)
197 for subpath in files_to_delete: 197 for subpath in files_to_delete:
198 self.remove('LayoutTests', 'imported', subpath) 198 self.remove('LayoutTests', 'external', subpath)
199 199
200 _log.info('Importing the tests.') 200 _log.info('Importing the tests.')
201 src_repo = self.path_from_webkit_base(dest_dir_name) 201 src_repo = self.path_from_webkit_base(dest_dir_name)
202 import_path = self.path_from_webkit_base('Tools', 'Scripts', 'import-w3c -tests') 202 import_path = self.path_from_webkit_base('Tools', 'Scripts', 'import-w3c -tests')
203 self.run([self.host.executable, import_path, '-d', 'imported', src_repo] ) 203 self.run([self.host.executable, import_path, '-d', 'external', src_repo] )
204 204
205 self.run(['git', 'add', '--all', 'LayoutTests/imported/%s' % dest_dir_na me]) 205 self.run(['git', 'add', '--all', 'LayoutTests/external/%s' % dest_dir_na me])
206 206
207 _log.info('Deleting any orphaned baselines.') 207 _log.info('Deleting any orphaned baselines.')
208 208
209 is_baseline_filter = lambda fs, dirname, basename: self.is_baseline(base name) 209 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) 210 previous_baselines = self.fs.files_under(dest_path, file_filter=is_basel ine_filter)
211 211
212 for subpath in previous_baselines: 212 for subpath in previous_baselines:
213 full_path = self.fs.join(dest_path, subpath) 213 full_path = self.fs.join(dest_path, subpath)
214 if self.fs.glob(full_path.replace('-expected.txt', '*')) == [full_pa th]: 214 if self.fs.glob(full_path.replace('-expected.txt', '*')) == [full_pa th]:
215 self.fs.remove(full_path) 215 self.fs.remove(full_path)
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 """Returns a dict mapping source to dest name for layout tests that have been renamed.""" 452 """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']) 453 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff- filter=R', '--name-status'])
454 renamed_tests = {} 454 renamed_tests = {}
455 for line in out.splitlines(): 455 for line in out.splitlines():
456 _, source_path, dest_path = line.split() 456 _, source_path, dest_path = line.split()
457 source_test = self.finder.layout_test_name(source_path) 457 source_test = self.finder.layout_test_name(source_path)
458 dest_test = self.finder.layout_test_name(dest_path) 458 dest_test = self.finder.layout_test_name(dest_path)
459 if source_test and dest_test: 459 if source_test and dest_test:
460 renamed_tests[source_test] = dest_test 460 renamed_tests[source_test] = dest_test
461 return renamed_tests 461 return renamed_tests
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698