| 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 | 12 |
| 13 If this script is given the argument --auto-update, it will also attempt to | 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 | 14 upload a CL, trigger try jobs, and make any changes that are required for |
| 15 new failing tests before committing. | 15 new failing tests before committing. |
| 16 """ | 16 """ |
| 17 | 17 |
| 18 import argparse | 18 import argparse |
| 19 import json | |
| 20 import logging | 19 import logging |
| 21 import re | |
| 22 | 20 |
| 23 from webkitpy.common.net.git_cl import GitCL | 21 from webkitpy.common.net.git_cl import GitCL |
| 24 from webkitpy.common.webkit_finder import WebKitFinder | 22 from webkitpy.common.webkit_finder import WebKitFinder |
| 23 from webkitpy.common.net.buildbot import current_build_link |
| 25 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes
tExpectationParser | 24 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes
tExpectationParser |
| 26 from webkitpy.w3c.common import WPT_REPO_URL, CSS_REPO_URL, WPT_DEST_NAME, CSS_D
EST_NAME, exportable_commits_since | 25 from webkitpy.w3c.common import WPT_REPO_URL, CSS_REPO_URL, WPT_DEST_NAME, CSS_D
EST_NAME, exportable_commits_since |
| 27 from webkitpy.w3c.directory_owners_extractor import DirectoryOwnersExtractor | 26 from webkitpy.w3c.directory_owners_extractor import DirectoryOwnersExtractor |
| 28 from webkitpy.w3c.local_wpt import LocalWPT | 27 from webkitpy.w3c.local_wpt import LocalWPT |
| 29 from webkitpy.w3c.test_copier import TestCopier | 28 from webkitpy.w3c.test_copier import TestCopier |
| 30 from webkitpy.w3c.wpt_expectations_updater import WPTExpectationsUpdater | 29 from webkitpy.w3c.wpt_expectations_updater import WPTExpectationsUpdater |
| 31 | 30 |
| 32 # Settings for how often to check try job results and how long to wait. | 31 # Settings for how often to check try job results and how long to wait. |
| 33 POLL_DELAY_SECONDS = 2 * 60 | 32 POLL_DELAY_SECONDS = 2 * 60 |
| 34 TIMEOUT_SECONDS = 180 * 60 | 33 TIMEOUT_SECONDS = 180 * 60 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 def get_directory_owners(self): | 367 def get_directory_owners(self): |
| 369 """Returns a list of email addresses of owners of changed tests.""" | 368 """Returns a list of email addresses of owners of changed tests.""" |
| 370 _log.info('Gathering directory owners emails to CC.') | 369 _log.info('Gathering directory owners emails to CC.') |
| 371 changed_files = self.host.cwd().changed_files() | 370 changed_files = self.host.cwd().changed_files() |
| 372 extractor = DirectoryOwnersExtractor(self.fs) | 371 extractor = DirectoryOwnersExtractor(self.fs) |
| 373 extractor.read_owner_map() | 372 extractor.read_owner_map() |
| 374 return extractor.list_owners(changed_files) | 373 return extractor.list_owners(changed_files) |
| 375 | 374 |
| 376 def _cl_description(self): | 375 def _cl_description(self): |
| 377 description = self.check_run(['git', 'log', '-1', '--format=%B']) | 376 description = self.check_run(['git', 'log', '-1', '--format=%B']) |
| 378 build_link = self._build_link() | 377 build_link = current_build_link(self.host) |
| 379 if build_link: | 378 if build_link: |
| 380 description += 'Build: %s\n\n' % build_link | 379 description += 'Build: %s\n\n' % build_link |
| 381 description += 'TBR=qyearsley@chromium.org\n' | 380 description += 'TBR=qyearsley@chromium.org\n' |
| 382 # Move any NOEXPORT tag to the end of the description. | 381 # Move any NOEXPORT tag to the end of the description. |
| 383 description = description.replace('NOEXPORT=true', '') | 382 description = description.replace('NOEXPORT=true', '') |
| 384 description = description.replace('\n\n\n\n', '\n\n') | 383 description = description.replace('\n\n\n\n', '\n\n') |
| 385 description += 'NOEXPORT=true' | 384 description += 'NOEXPORT=true' |
| 386 return description | 385 return description |
| 387 | 386 |
| 388 def _build_link(self): | |
| 389 """Returns a link to a job, if running on buildbot.""" | |
| 390 master_name = self.host.environ.get('BUILDBOT_MASTERNAME') | |
| 391 builder_name = self.host.environ.get('BUILDBOT_BUILDERNAME') | |
| 392 build_number = self.host.environ.get('BUILDBOT_BUILDNUMBER') | |
| 393 if not (master_name and builder_name and build_number): | |
| 394 return None | |
| 395 return 'https://build.chromium.org/p/%s/builders/%s/builds/%s' % (master
_name, builder_name, build_number) | |
| 396 | |
| 397 def fetch_new_expectations_and_baselines(self): | 387 def fetch_new_expectations_and_baselines(self): |
| 398 """Adds new expectations and downloads baselines based on try job result
s, then commits and uploads the change.""" | 388 """Adds new expectations and downloads baselines based on try job result
s, then commits and uploads the change.""" |
| 399 _log.info('Adding test expectations lines to LayoutTests/TestExpectation
s.') | 389 _log.info('Adding test expectations lines to LayoutTests/TestExpectation
s.') |
| 400 line_adder = WPTExpectationsUpdater(self.host) | 390 line_adder = WPTExpectationsUpdater(self.host) |
| 401 line_adder.run() | 391 line_adder.run() |
| 402 message = 'Update test expectations and baselines.' | 392 message = 'Update test expectations and baselines.' |
| 403 self.check_run(['git', 'commit', '-a', '-m', message]) | 393 self.check_run(['git', 'commit', '-a', '-m', message]) |
| 404 self.git_cl.run(['upload', '-m', message, '--rietveld']) | 394 self.git_cl.run(['upload', '-m', message, '--rietveld']) |
| 405 | 395 |
| 406 def update_all_test_expectations_files(self, deleted_tests, renamed_tests): | 396 def update_all_test_expectations_files(self, deleted_tests, renamed_tests): |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" | 436 """Returns a dict mapping source to dest name for layout tests that have
been renamed.""" |
| 447 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) | 437 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff-
filter=R', '--name-status']) |
| 448 renamed_tests = {} | 438 renamed_tests = {} |
| 449 for line in out.splitlines(): | 439 for line in out.splitlines(): |
| 450 _, source_path, dest_path = line.split() | 440 _, source_path, dest_path = line.split() |
| 451 source_test = self.finder.layout_test_name(source_path) | 441 source_test = self.finder.layout_test_name(source_path) |
| 452 dest_test = self.finder.layout_test_name(dest_path) | 442 dest_test = self.finder.layout_test_name(dest_path) |
| 453 if source_test and dest_test: | 443 if source_test and dest_test: |
| 454 renamed_tests[source_test] = dest_test | 444 renamed_tests[source_test] = dest_test |
| 455 return renamed_tests | 445 return renamed_tests |
| OLD | NEW |