| 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: |
| 8 upload a CL, triggery try jobs, and make any changes that are required for | 8 1. Upload a CL. |
| 9 new failing tests before committing. | 9 2. Trigger try jobs and wait for them to complete. |
| 10 3. Make any changes that are required for new failing tests. |
| 11 4. Commit the CL. |
| 10 """ | 12 """ |
| 11 | 13 |
| 12 import logging | 14 import logging |
| 13 import argparse | 15 import argparse |
| 14 import json | 16 import json |
| 15 | 17 |
| 16 from webkitpy.common.net.git_cl import GitCL | 18 from webkitpy.common.net.git_cl import GitCL |
| 17 from webkitpy.common.webkit_finder import WebKitFinder | 19 from webkitpy.common.webkit_finder import WebKitFinder |
| 18 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes
tExpectationParser | 20 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes
tExpectationParser |
| 21 from webkitpy.w3c.test_importer import TestImporter |
| 19 | 22 |
| 20 # Import destination directories (under LayoutTests/external/). | 23 # Import destination directories (under LayoutTests/external/). |
| 21 WPT_DEST_NAME = 'wpt' | 24 WPT_DEST_NAME = 'wpt' |
| 22 CSS_DEST_NAME = 'csswg-test' | 25 CSS_DEST_NAME = 'csswg-test' |
| 23 | 26 |
| 24 # Our mirrors of the official w3c repos, which we pull from. | 27 # 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' | 28 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' | 29 CSS_REPO_URL = 'https://chromium.googlesource.com/external/w3c/csswg-test.git' |
| 27 | 30 |
| 28 | 31 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 master_commitish = show_ref_output.split()[0] | 193 master_commitish = show_ref_output.split()[0] |
| 191 | 194 |
| 192 _log.info('Cleaning out tests from LayoutTests/external/%s.', dest_dir_n
ame) | 195 _log.info('Cleaning out tests from LayoutTests/external/%s.', dest_dir_n
ame) |
| 193 dest_path = self.path_from_webkit_base('LayoutTests', 'external', dest_d
ir_name) | 196 dest_path = self.path_from_webkit_base('LayoutTests', 'external', dest_d
ir_name) |
| 194 is_not_baseline_filter = lambda fs, dirname, basename: not self.is_basel
ine(basename) | 197 is_not_baseline_filter = lambda fs, dirname, basename: not self.is_basel
ine(basename) |
| 195 files_to_delete = self.fs.files_under(dest_path, file_filter=is_not_base
line_filter) | 198 files_to_delete = self.fs.files_under(dest_path, file_filter=is_not_base
line_filter) |
| 196 for subpath in files_to_delete: | 199 for subpath in files_to_delete: |
| 197 self.remove('LayoutTests', 'external', subpath) | 200 self.remove('LayoutTests', 'external', subpath) |
| 198 | 201 |
| 199 _log.info('Importing the tests.') | 202 _log.info('Importing the tests.') |
| 200 src_repo = self.path_from_webkit_base(dest_dir_name) | 203 test_importer = TestImporter(self.host, temp_repo_path) |
| 201 import_path = self.path_from_webkit_base('Tools', 'Scripts', 'import-w3c
-tests') | 204 test_importer.do_import() |
| 202 self.run([self.host.executable, import_path, '-d', 'external', src_repo]
) | |
| 203 | 205 |
| 204 self.run(['git', 'add', '--all', 'LayoutTests/external/%s' % dest_dir_na
me]) | 206 self.run(['git', 'add', '--all', 'LayoutTests/external/%s' % dest_dir_na
me]) |
| 205 | 207 |
| 206 _log.info('Deleting any orphaned baselines.') | 208 _log.info('Deleting any orphaned baselines.') |
| 207 | 209 |
| 208 is_baseline_filter = lambda fs, dirname, basename: self.is_baseline(base
name) | 210 is_baseline_filter = lambda fs, dirname, basename: self.is_baseline(base
name) |
| 209 previous_baselines = self.fs.files_under(dest_path, file_filter=is_basel
ine_filter) | 211 previous_baselines = self.fs.files_under(dest_path, file_filter=is_basel
ine_filter) |
| 210 | 212 |
| 211 for subpath in previous_baselines: | 213 for subpath in previous_baselines: |
| 212 full_path = self.fs.join(dest_path, subpath) | 214 full_path = self.fs.join(dest_path, subpath) |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" | 453 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" |
| 452 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) | 454 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 453 renamed_tests = {} | 455 renamed_tests = {} |
| 454 for line in out.splitlines(): | 456 for line in out.splitlines(): |
| 455 _, source_path, dest_path = line.split() | 457 _, source_path, dest_path = line.split() |
| 456 source_test = self.finder.layout_test_name(source_path) | 458 source_test = self.finder.layout_test_name(source_path) |
| 457 dest_test = self.finder.layout_test_name(dest_path) | 459 dest_test = self.finder.layout_test_name(dest_path) |
| 458 if source_test and dest_test: | 460 if source_test and dest_test: |
| 459 renamed_tests[source_test] = dest_test | 461 renamed_tests[source_test] = dest_test |
| 460 return renamed_tests | 462 return renamed_tests |
| OLD | NEW |