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 """Pull latest revisions of a W3C test repo and make a local commit.""" | 5 """Pull latest revisions of a W3C test repo and make a local commit.""" |
6 | 6 |
7 import argparse | 7 import argparse |
8 import json | 8 import json |
9 import time | 9 import time |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... | |
38 return 1 | 38 return 1 |
39 | 39 |
40 self.print_('## Noting the current Chromium commit.') | 40 self.print_('## Noting the current Chromium commit.') |
41 _, show_ref_output = self.run(['git', 'show-ref', 'HEAD']) | 41 _, show_ref_output = self.run(['git', 'show-ref', 'HEAD']) |
42 chromium_commitish = show_ref_output.split()[0] | 42 chromium_commitish = show_ref_output.split()[0] |
43 | 43 |
44 if self.target == 'wpt': | 44 if self.target == 'wpt': |
45 import_commitish = self.update( | 45 import_commitish = self.update( |
46 WPT_DEST_NAME, | 46 WPT_DEST_NAME, |
47 'https://chromium.googlesource.com/external/w3c/web-platform-tes ts.git') | 47 'https://chromium.googlesource.com/external/w3c/web-platform-tes ts.git') |
48 | 48 self._copy_resources_to_wpt() |
49 for resource in ['testharnessreport.js', 'WebIDLParser.js']: | |
50 source = self.path_from_webkit_base('LayoutTests', 'resources', resource) | |
51 destination = self.path_from_webkit_base('LayoutTests', 'importe d', WPT_DEST_NAME, 'resources', resource) | |
52 self.copyfile(source, destination) | |
53 self.run(['git', 'add', destination]) | |
54 for resource in ['vendor-prefix.js']: | |
55 source = self.path_from_webkit_base('LayoutTests', 'resources', resource) | |
56 destination = self.path_from_webkit_base('LayoutTests', 'importe d', WPT_DEST_NAME, 'common', resource) | |
57 self.copyfile(source, destination) | |
58 self.run(['git', 'add', destination]) | |
59 | |
60 elif self.target == 'css': | 49 elif self.target == 'css': |
61 import_commitish = self.update( | 50 import_commitish = self.update( |
62 CSS_DEST_NAME, | 51 CSS_DEST_NAME, |
63 'https://chromium.googlesource.com/external/w3c/csswg-test.git') | 52 'https://chromium.googlesource.com/external/w3c/csswg-test.git') |
64 else: | 53 else: |
65 raise AssertionError("Unsupported target %s" % self.target) | 54 raise AssertionError("Unsupported target %s" % self.target) |
66 | 55 |
67 has_changes = self.commit_changes_if_needed(chromium_commitish, import_c ommitish) | 56 has_changes = self.commit_changes_if_needed(chromium_commitish, import_c ommitish) |
68 if self.auto_update and has_changes: | 57 if self.auto_update and has_changes: |
69 try_bots = self.host.builders.all_try_builder_names() | 58 try_bots = self.host.builders.all_try_builder_names() |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 if self.fs.exists(self.path_from_webkit_base(WPT_DEST_NAME)): | 114 if self.fs.exists(self.path_from_webkit_base(WPT_DEST_NAME)): |
126 self.print_('## WebKit/%s exists; aborting.' % WPT_DEST_NAME) | 115 self.print_('## WebKit/%s exists; aborting.' % WPT_DEST_NAME) |
127 return False | 116 return False |
128 | 117 |
129 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): | 118 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): |
130 self.print_('## WebKit/%s repo exists; aborting.' % CSS_DEST_NAME) | 119 self.print_('## WebKit/%s repo exists; aborting.' % CSS_DEST_NAME) |
131 return False | 120 return False |
132 | 121 |
133 return True | 122 return True |
134 | 123 |
124 def _copy_resources_to_wpt(self): | |
125 """Copies some files over to a newly-updated wpt directory. | |
126 | |
127 This is necessary because we want to be used when running imported tests | |
Dirk Pranke
2016/08/15 23:40:14
Nit: what is it that we want to be used? This word
| |
128 which are different than those in the upstream repo. | |
129 """ | |
130 resources_to_copy = [ | |
131 ('testharnessreport.js', 'resources'), | |
132 ('WebIDLParser.js', 'resources'), | |
133 ('vendor-prefix.js', 'common'), | |
134 ] | |
135 for filename, wpt_subdir in resources_to_copy: | |
136 source = self.path_from_webkit_base('LayoutTests', 'resources', file name) | |
137 destination = self.path_from_webkit_base('LayoutTests', 'imported', WPT_DEST_NAME, wpt_subdir, filename) | |
138 self.copyfile(source, destination) | |
139 self.run(['git', 'add', destination]) | |
140 | |
135 def update(self, dest_dir_name, url): | 141 def update(self, dest_dir_name, url): |
136 """Updates an imported repository. | 142 """Updates an imported repository. |
137 | 143 |
138 Args: | 144 Args: |
139 dest_dir_name: The destination directory name. | 145 dest_dir_name: The destination directory name. |
140 url: URL of the git repository. | 146 url: URL of the git repository. |
141 | 147 |
142 Returns: | 148 Returns: |
143 A string for the commit description "<destination>@<commitish>". | 149 A string for the commit description "<destination>@<commitish>". |
144 """ | 150 """ |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 def generate_upload_command(self, email_list): | 368 def generate_upload_command(self, email_list): |
363 message = """W3C auto test importer | 369 message = """W3C auto test importer |
364 | 370 |
365 TBR=qyearsley@chromium.org""" | 371 TBR=qyearsley@chromium.org""" |
366 | 372 |
367 command = ['git', 'cl', 'upload', '-f', '-m', message] | 373 command = ['git', 'cl', 'upload', '-f', '-m', message] |
368 command += ['--cc=' + email for email in email_list] | 374 command += ['--cc=' + email for email in email_list] |
369 if self.auth_refresh_token_json: | 375 if self.auth_refresh_token_json: |
370 command += ['--auth-refresh-token-json', self.auth_refresh_token_jso n] | 376 command += ['--auth-refresh-token-json', self.auth_refresh_token_jso n] |
371 return command | 377 return command |
OLD | NEW |