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

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

Issue 2779053002: Ignore OWNERS files during external/wpt import and export (Closed)
Patch Set: Addressed comments Created 3 years, 8 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: 7 If this script is given the argument --auto-update, it will also:
8 1. Upload a CL. 8 1. Upload a CL.
9 2. Trigger try jobs and wait for them to complete. 9 2. Trigger try jobs and wait for them to complete.
10 3. Make any changes that are required for new failing tests. 10 3. Make any changes that are required for new failing tests.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 if revision is not None: 226 if revision is not None:
227 _log.info('Checking out %s', revision) 227 _log.info('Checking out %s', revision)
228 self.run(['git', 'checkout', revision], cwd=temp_repo_path) 228 self.run(['git', 'checkout', revision], cwd=temp_repo_path)
229 229
230 self.run(['git', 'submodule', 'update', '--init', '--recursive'], cwd=te mp_repo_path) 230 self.run(['git', 'submodule', 'update', '--init', '--recursive'], cwd=te mp_repo_path)
231 231
232 _log.info('Noting the revision we are importing.') 232 _log.info('Noting the revision we are importing.')
233 _, show_ref_output = self.run(['git', 'show-ref', 'origin/master'], cwd= temp_repo_path) 233 _, show_ref_output = self.run(['git', 'show-ref', 'origin/master'], cwd= temp_repo_path)
234 master_commitish = show_ref_output.split()[0] 234 master_commitish = show_ref_output.split()[0]
235 235
236 _log.info('Cleaning out tests from LayoutTests/external/%s.', dest_dir_n ame)
237 dest_path = self.path_from_webkit_base('LayoutTests', 'external', dest_d ir_name) 236 dest_path = self.path_from_webkit_base('LayoutTests', 'external', dest_d ir_name)
238 is_not_baseline_filter = lambda fs, dirname, basename: not self.is_basel ine(basename) 237 self._clear_out_dest_path(dest_path)
239 files_to_delete = self.fs.files_under(dest_path, file_filter=is_not_base line_filter)
240 for subpath in files_to_delete:
241 self.remove('LayoutTests', 'external', subpath)
242 238
243 _log.info('Importing the tests.') 239 _log.info('Importing the tests.')
244 test_copier = TestCopier(self.host, temp_repo_path) 240 test_copier = TestCopier(self.host, temp_repo_path)
245 test_copier.do_import() 241 test_copier.do_import()
246 242
247 self.run(['git', 'add', '--all', 'LayoutTests/external/%s' % dest_dir_na me]) 243 self.run(['git', 'add', '--all', 'LayoutTests/external/%s' % dest_dir_na me])
248 244
249 self._delete_orphaned_baselines(dest_path) 245 self._delete_orphaned_baselines(dest_path)
250 246
251 self._generate_manifest(dest_path) 247 self._generate_manifest(dest_path)
252 248
253 _log.info('Updating TestExpectations for any removed or renamed tests.') 249 _log.info('Updating TestExpectations for any removed or renamed tests.')
254 self.update_all_test_expectations_files(self._list_deleted_tests(), self ._list_renamed_tests()) 250 self.update_all_test_expectations_files(self._list_deleted_tests(), self ._list_renamed_tests())
255 251
256 return '%s@%s' % (dest_dir_name, master_commitish) 252 return '%s@%s' % (dest_dir_name, master_commitish)
257 253
254 def _clear_out_dest_path(self, dest_path):
255 _log.info('Cleaning out tests from %s.', dest_path)
256 should_remove = lambda fs, dirname, basename: (
257 not self.is_baseline(basename) and
258 # See http://crbug.com/702283 for context.
259 basename != 'OWNERS')
260 files_to_delete = self.fs.files_under(dest_path, file_filter=should_remo ve)
261 for subpath in files_to_delete:
262 self.remove('LayoutTests', 'external', subpath)
263
258 def _commit_changes(self, commit_message): 264 def _commit_changes(self, commit_message):
259 _log.info('Committing changes.') 265 _log.info('Committing changes.')
260 self.run(['git', 'commit', '--all', '-F', '-'], stdin=commit_message) 266 self.run(['git', 'commit', '--all', '-F', '-'], stdin=commit_message)
261 267
262 def _has_changes(self): 268 def _has_changes(self):
263 return_code, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_fa ilure=False) 269 return_code, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_fa ilure=False)
264 return return_code == 1 270 return return_code == 1
265 271
266 def _commit_message(self, chromium_commit, import_commit): 272 def _commit_message(self, chromium_commit, import_commit):
267 return ('Import %s\n\n' 273 return ('Import %s\n\n'
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 """Returns a dict mapping source to dest name for layout tests that have been renamed.""" 493 """Returns a dict mapping source to dest name for layout tests that have been renamed."""
488 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff- filter=R', '--name-status']) 494 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff- filter=R', '--name-status'])
489 renamed_tests = {} 495 renamed_tests = {}
490 for line in out.splitlines(): 496 for line in out.splitlines():
491 _, source_path, dest_path = line.split() 497 _, source_path, dest_path = line.split()
492 source_test = self.finder.layout_test_name(source_path) 498 source_test = self.finder.layout_test_name(source_path)
493 dest_test = self.finder.layout_test_name(dest_path) 499 dest_test = self.finder.layout_test_name(dest_path)
494 if source_test and dest_test: 500 if source_test and dest_test:
495 renamed_tests[source_test] = dest_test 501 renamed_tests[source_test] = dest_test
496 return renamed_tests 502 return renamed_tests
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698