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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 | 239 |
| 240 def _commit_changes(self, commit_message): | 240 def _commit_changes(self, commit_message): |
| 241 _log.info('Committing changes.') | 241 _log.info('Committing changes.') |
| 242 self.run(['git', 'commit', '--all', '-F', '-'], stdin=commit_message) | 242 self.run(['git', 'commit', '--all', '-F', '-'], stdin=commit_message) |
| 243 | 243 |
| 244 def _has_changes(self): | 244 def _has_changes(self): |
| 245 return_code, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_fa ilure=False) | 245 return_code, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_fa ilure=False) |
| 246 return return_code == 1 | 246 return return_code == 1 |
| 247 | 247 |
| 248 def _commit_message(self, chromium_commit, import_commit): | 248 def _commit_message(self, chromium_commit, import_commit): |
| 249 return ('Import %s\n\nUsing update-w3c-deps in Chromium %s.\n\n' % | 249 return ('Import %s\n\n' |
| 250 'Using update-w3c-deps in Chromium %s.\n\n' | |
| 251 'NOEXPORT=true' % | |
| 250 (import_commit, chromium_commit)) | 252 (import_commit, chromium_commit)) |
| 251 | 253 |
| 252 @staticmethod | 254 @staticmethod |
| 253 def is_baseline(basename): | 255 def is_baseline(basename): |
| 254 return basename.endswith('-expected.txt') | 256 return basename.endswith('-expected.txt') |
| 255 | 257 |
| 256 def run(self, cmd, exit_on_failure=True, cwd=None, stdin=''): | 258 def run(self, cmd, exit_on_failure=True, cwd=None, stdin=''): |
| 257 _log.debug('Running command: %s', ' '.join(cmd)) | 259 _log.debug('Running command: %s', ' '.join(cmd)) |
| 258 | 260 |
| 259 cwd = cwd or self.finder.webkit_base() | 261 cwd = cwd or self.finder.webkit_base() |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 '-m', | 352 '-m', |
| 351 description, | 353 description, |
| 352 ] + ['--cc=' + email for email in cc_list]) | 354 ] + ['--cc=' + email for email in cc_list]) |
| 353 | 355 |
| 354 def _cl_description(self): | 356 def _cl_description(self): |
| 355 description = self.check_run(['git', 'log', '-1', '--format=%B']) | 357 description = self.check_run(['git', 'log', '-1', '--format=%B']) |
| 356 build_link = self._build_link() | 358 build_link = self._build_link() |
| 357 if build_link: | 359 if build_link: |
| 358 description += 'Build: %s\n\n' % build_link | 360 description += 'Build: %s\n\n' % build_link |
| 359 description += 'TBR=qyearsley@chromium.org\n' | 361 description += 'TBR=qyearsley@chromium.org\n' |
| 362 # Move any NOEXPORT tag to the end of the description. | |
| 363 description = description.replace('NOEXPORT=true', '') | |
|
jeffcarp
2017/01/20 22:12:52
Can you add a unit test for this functionality?
qyearsley
2017/01/20 22:32:44
Of course, good point. Now added one, does it look
| |
| 360 description += 'NOEXPORT=true' | 364 description += 'NOEXPORT=true' |
| 361 return description | 365 return description |
| 362 | 366 |
| 363 def _build_link(self): | 367 def _build_link(self): |
| 364 """Returns a link to a job, if running on buildbot.""" | 368 """Returns a link to a job, if running on buildbot.""" |
| 365 master_name = self.host.environ.get('BUILDBOT_MASTERNAME') | 369 master_name = self.host.environ.get('BUILDBOT_MASTERNAME') |
| 366 builder_name = self.host.environ.get('BUILDBOT_BUILDERNAME') | 370 builder_name = self.host.environ.get('BUILDBOT_BUILDERNAME') |
| 367 build_number = self.host.environ.get('BUILDBOT_BUILDNUMBER') | 371 build_number = self.host.environ.get('BUILDBOT_BUILDNUMBER') |
| 368 if not (master_name and builder_name and build_number): | 372 if not (master_name and builder_name and build_number): |
| 369 return None | 373 return None |
| (...skipping 92 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.""" | 466 """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']) | 467 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff- filter=R', '--name-status']) |
| 464 renamed_tests = {} | 468 renamed_tests = {} |
| 465 for line in out.splitlines(): | 469 for line in out.splitlines(): |
| 466 _, source_path, dest_path = line.split() | 470 _, source_path, dest_path = line.split() |
| 467 source_test = self.finder.layout_test_name(source_path) | 471 source_test = self.finder.layout_test_name(source_path) |
| 468 dest_test = self.finder.layout_test_name(dest_path) | 472 dest_test = self.finder.layout_test_name(dest_path) |
| 469 if source_test and dest_test: | 473 if source_test and dest_test: |
| 470 renamed_tests[source_test] = dest_test | 474 renamed_tests[source_test] = dest_test |
| 471 return renamed_tests | 475 return renamed_tests |
| OLD | NEW |