Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 _log.warning('WebKit/%s exists; aborting.', WPT_DEST_NAME) | 109 _log.warning('WebKit/%s exists; aborting.', WPT_DEST_NAME) |
| 110 return False | 110 return False |
| 111 | 111 |
| 112 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): | 112 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): |
| 113 _log.warning('WebKit/%s repo exists; aborting.', CSS_DEST_NAME) | 113 _log.warning('WebKit/%s repo exists; aborting.', CSS_DEST_NAME) |
| 114 return False | 114 return False |
| 115 | 115 |
| 116 return True | 116 return True |
| 117 | 117 |
| 118 def _copy_resources(self): | 118 def _copy_resources(self): |
| 119 """Copies resources from LayoutTests/resources to wpt and vice versa. | 119 """Copies resources from wpt to LayoutTests/resources. |
| 120 | 120 |
| 121 There are resources from our repository that we use instead of the | 121 We copy idlharness.js and testharness.js in wpt to LayoutTests/resources |
| 122 upstream versions. Conversely, there are also some resources that | 122 in order to use them in non-imported tests. |
| 123 are copied in the other direction. | |
| 124 | |
| 125 Specifically: | |
| 126 - testharnessreport.js contains code needed to integrate our testing | |
| 127 with testharness.js; we also want our code to be used for tests | |
| 128 in wpt. | |
| 129 - TODO(qyearsley, jsbell): Document why other other files are copied, | |
| 130 or stop copying them if it's unnecessary. | |
| 131 | 123 |
| 132 If this method is changed, the lists of files expected to be identical | 124 If this method is changed, the lists of files expected to be identical |
| 133 in LayoutTests/PRESUBMIT.py should also be changed. | 125 in LayoutTests/PRESUBMIT.py should also be changed. |
| 134 """ | 126 """ |
| 135 # TODO(tkent): resources_to_copy_to_wpt is unnecessary after enabling | |
| 136 # WPTServe. | |
|
qyearsley
2017/01/19 18:00:33
Excellent :-D
| |
| 137 resources_to_copy_to_wpt = [ | |
| 138 ('testharnessreport.js', 'resources'), | |
| 139 ('WebIDLParser.js', 'resources'), | |
| 140 ('vendor-prefix.js', 'common'), | |
| 141 ] | |
| 142 resources_to_copy_from_wpt = [ | 127 resources_to_copy_from_wpt = [ |
| 143 ('idlharness.js', 'resources'), | 128 ('idlharness.js', 'resources'), |
| 144 ('testharness.js', 'resources'), | 129 ('testharness.js', 'resources'), |
| 145 ] | 130 ] |
| 146 for filename, wpt_subdir in resources_to_copy_to_wpt: | |
| 147 source = self.path_from_webkit_base('LayoutTests', 'resources', file name) | |
| 148 destination = self.path_from_webkit_base('LayoutTests', 'external', WPT_DEST_NAME, wpt_subdir, filename) | |
| 149 self.copyfile(source, destination) | |
| 150 self.run(['git', 'add', destination]) | |
| 151 for filename, wpt_subdir in resources_to_copy_from_wpt: | 131 for filename, wpt_subdir in resources_to_copy_from_wpt: |
| 152 source = self.path_from_webkit_base('LayoutTests', 'external', WPT_D EST_NAME, wpt_subdir, filename) | 132 source = self.path_from_webkit_base('LayoutTests', 'external', WPT_D EST_NAME, wpt_subdir, filename) |
| 153 destination = self.path_from_webkit_base('LayoutTests', 'resources', filename) | 133 destination = self.path_from_webkit_base('LayoutTests', 'resources', filename) |
| 154 self.copyfile(source, destination) | 134 self.copyfile(source, destination) |
| 155 self.run(['git', 'add', destination]) | 135 self.run(['git', 'add', destination]) |
| 156 | 136 |
| 157 def _generate_manifest(self, dest_path): | 137 def _generate_manifest(self, dest_path): |
| 158 """Generates MANIFEST.json for imported tests. | 138 """Generates MANIFEST.json for imported tests. |
| 159 | 139 |
| 160 Args: | 140 Args: |
| (...skipping 301 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 |