| 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: | 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. |
| 11 4. Commit the CL. | 11 4. Commit the CL. |
| 12 |
| 13 If this script is given the argument --auto-update, it will also attempt to |
| 14 upload a CL, trigger try jobs, and make any changes that are required for |
| 15 new failing tests before committing. |
| 12 """ | 16 """ |
| 13 | 17 |
| 14 import logging | 18 import logging |
| 15 import argparse | 19 import argparse |
| 16 import json | 20 import json |
| 17 | 21 |
| 18 from webkitpy.common.net.git_cl import GitCL | 22 from webkitpy.common.net.git_cl import GitCL |
| 19 from webkitpy.common.webkit_finder import WebKitFinder | 23 from webkitpy.common.webkit_finder import WebKitFinder |
| 20 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes
tExpectationParser | 24 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes
tExpectationParser |
| 21 from webkitpy.w3c.test_importer import TestImporter | 25 from webkitpy.w3c.test_importer import TestImporter |
| 22 | 26 from webkitpy.w3c.common import WPT_REPO_URL, CSS_REPO_URL, WPT_DEST_NAME, CSS_D
EST_NAME |
| 23 # Import destination directories (under LayoutTests/external/). | |
| 24 WPT_DEST_NAME = 'wpt' | |
| 25 CSS_DEST_NAME = 'csswg-test' | |
| 26 | |
| 27 # Our mirrors of the official w3c repos, which we pull from. | |
| 28 WPT_REPO_URL = 'https://chromium.googlesource.com/external/w3c/web-platform-test
s.git' | |
| 29 CSS_REPO_URL = 'https://chromium.googlesource.com/external/w3c/csswg-test.git' | |
| 30 | 27 |
| 31 # Settings for how often to check try job results and how long to wait. | 28 # Settings for how often to check try job results and how long to wait. |
| 32 POLL_DELAY_SECONDS = 2 * 60 | 29 POLL_DELAY_SECONDS = 2 * 60 |
| 33 TIMEOUT_SECONDS = 180 * 60 | 30 TIMEOUT_SECONDS = 180 * 60 |
| 34 | 31 |
| 35 _log = logging.getLogger(__file__) | 32 _log = logging.getLogger(__file__) |
| 36 | 33 |
| 37 | 34 |
| 38 class DepsUpdater(object): | 35 class DepsUpdater(object): |
| 39 | 36 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 def _has_changes(self): | 222 def _has_changes(self): |
| 226 return_code, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_fa
ilure=False) | 223 return_code, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_fa
ilure=False) |
| 227 return return_code == 1 | 224 return return_code == 1 |
| 228 | 225 |
| 229 def _commit_message(self, chromium_commit, import_commit): | 226 def _commit_message(self, chromium_commit, import_commit): |
| 230 return ('Import %s\n\nUsing update-w3c-deps in Chromium %s.\n\n' % | 227 return ('Import %s\n\nUsing update-w3c-deps in Chromium %s.\n\n' % |
| 231 (import_commit, chromium_commit)) | 228 (import_commit, chromium_commit)) |
| 232 | 229 |
| 233 @staticmethod | 230 @staticmethod |
| 234 def is_baseline(basename): | 231 def is_baseline(basename): |
| 232 # TODO(qyearsley): Find a better, centralized place for this. |
| 235 return basename.endswith('-expected.txt') | 233 return basename.endswith('-expected.txt') |
| 236 | 234 |
| 237 def run(self, cmd, exit_on_failure=True, cwd=None, stdin=''): | 235 def run(self, cmd, exit_on_failure=True, cwd=None, stdin=''): |
| 238 _log.debug('Running command: %s', ' '.join(cmd)) | 236 _log.debug('Running command: %s', ' '.join(cmd)) |
| 239 | 237 |
| 240 cwd = cwd or self.finder.webkit_base() | 238 cwd = cwd or self.finder.webkit_base() |
| 241 proc = self.executive.popen(cmd, stdout=self.executive.PIPE, stderr=self
.executive.PIPE, stdin=self.executive.PIPE, cwd=cwd) | 239 proc = self.executive.popen(cmd, stdout=self.executive.PIPE, stderr=self
.executive.PIPE, stdin=self.executive.PIPE, cwd=cwd) |
| 242 out, err = proc.communicate(stdin) | 240 out, err = proc.communicate(stdin) |
| 243 if proc.returncode or self.verbose: | 241 if proc.returncode or self.verbose: |
| 244 _log.info('# ret> %d', proc.returncode) | 242 _log.info('# ret> %d', proc.returncode) |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" | 441 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" |
| 444 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) | 442 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 445 renamed_tests = {} | 443 renamed_tests = {} |
| 446 for line in out.splitlines(): | 444 for line in out.splitlines(): |
| 447 _, source_path, dest_path = line.split() | 445 _, source_path, dest_path = line.split() |
| 448 source_test = self.finder.layout_test_name(source_path) | 446 source_test = self.finder.layout_test_name(source_path) |
| 449 dest_test = self.finder.layout_test_name(dest_path) | 447 dest_test = self.finder.layout_test_name(dest_path) |
| 450 if source_test and dest_test: | 448 if source_test and dest_test: |
| 451 renamed_tests[source_test] = dest_test | 449 renamed_tests[source_test] = dest_test |
| 452 return renamed_tests | 450 return renamed_tests |
| OLD | NEW |