| 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. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 _log.warning('WebKit/%s exists; aborting.', WPT_DEST_NAME) | 117 _log.warning('WebKit/%s exists; aborting.', WPT_DEST_NAME) |
| 118 return False | 118 return False |
| 119 | 119 |
| 120 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): | 120 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): |
| 121 _log.warning('WebKit/%s repo exists; aborting.', CSS_DEST_NAME) | 121 _log.warning('WebKit/%s repo exists; aborting.', CSS_DEST_NAME) |
| 122 return False | 122 return False |
| 123 | 123 |
| 124 return True | 124 return True |
| 125 | 125 |
| 126 def _copy_resources(self): | 126 def _copy_resources(self): |
| 127 """Copies resources from LayoutTests/resources to wpt and vice versa. | 127 """Copies resources from wpt to LayoutTests/resources. |
| 128 | 128 |
| 129 There are resources from our repository that we use instead of the | 129 We copy idlharness.js and testharness.js in wpt to LayoutTests/resources |
| 130 upstream versions. Conversely, there are also some resources that | 130 in order to use them in non-imported tests. |
| 131 are copied in the other direction. | |
| 132 | |
| 133 Specifically: | |
| 134 - testharnessreport.js contains code needed to integrate our testing | |
| 135 with testharness.js; we also want our code to be used for tests | |
| 136 in wpt. | |
| 137 - TODO(qyearsley, jsbell): Document why other other files are copied, | |
| 138 or stop copying them if it's unnecessary. | |
| 139 | 131 |
| 140 If this method is changed, the lists of files expected to be identical | 132 If this method is changed, the lists of files expected to be identical |
| 141 in LayoutTests/PRESUBMIT.py should also be changed. | 133 in LayoutTests/PRESUBMIT.py should also be changed. |
| 142 """ | 134 """ |
| 143 # TODO(tkent): resources_to_copy_to_wpt is unnecessary after enabling | |
| 144 # WPTServe. | |
| 145 resources_to_copy_to_wpt = [ | |
| 146 ('testharnessreport.js', 'resources'), | |
| 147 ('WebIDLParser.js', 'resources'), | |
| 148 ('vendor-prefix.js', 'common'), | |
| 149 ] | |
| 150 resources_to_copy_from_wpt = [ | 135 resources_to_copy_from_wpt = [ |
| 151 ('idlharness.js', 'resources'), | 136 ('idlharness.js', 'resources'), |
| 152 ('testharness.js', 'resources'), | 137 ('testharness.js', 'resources'), |
| 153 ] | 138 ] |
| 154 for filename, wpt_subdir in resources_to_copy_to_wpt: | |
| 155 source = self.path_from_webkit_base('LayoutTests', 'resources', file
name) | |
| 156 destination = self.path_from_webkit_base('LayoutTests', 'external',
WPT_DEST_NAME, wpt_subdir, filename) | |
| 157 self.copyfile(source, destination) | |
| 158 self.run(['git', 'add', destination]) | |
| 159 for filename, wpt_subdir in resources_to_copy_from_wpt: | 139 for filename, wpt_subdir in resources_to_copy_from_wpt: |
| 160 source = self.path_from_webkit_base('LayoutTests', 'external', WPT_D
EST_NAME, wpt_subdir, filename) | 140 source = self.path_from_webkit_base('LayoutTests', 'external', WPT_D
EST_NAME, wpt_subdir, filename) |
| 161 destination = self.path_from_webkit_base('LayoutTests', 'resources',
filename) | 141 destination = self.path_from_webkit_base('LayoutTests', 'resources',
filename) |
| 162 self.copyfile(source, destination) | 142 self.copyfile(source, destination) |
| 163 self.run(['git', 'add', destination]) | 143 self.run(['git', 'add', destination]) |
| 164 | 144 |
| 165 def _generate_manifest(self, dest_path): | 145 def _generate_manifest(self, dest_path): |
| 166 """Generates MANIFEST.json for imported tests. | 146 """Generates MANIFEST.json for imported tests. |
| 167 | 147 |
| 168 Args: | 148 Args: |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" | 442 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" |
| 463 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) | 443 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 464 renamed_tests = {} | 444 renamed_tests = {} |
| 465 for line in out.splitlines(): | 445 for line in out.splitlines(): |
| 466 _, source_path, dest_path = line.split() | 446 _, source_path, dest_path = line.split() |
| 467 source_test = self.finder.layout_test_name(source_path) | 447 source_test = self.finder.layout_test_name(source_path) |
| 468 dest_test = self.finder.layout_test_name(dest_path) | 448 dest_test = self.finder.layout_test_name(dest_path) |
| 469 if source_test and dest_test: | 449 if source_test and dest_test: |
| 470 renamed_tests[source_test] = dest_test | 450 renamed_tests[source_test] = dest_test |
| 471 return renamed_tests | 451 return renamed_tests |
| OLD | NEW |