| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 """A class for updating layout test expectations when updating w3c tests. | 5 """A class for updating layout test expectations when updating w3c tests. |
| 6 | 6 |
| 7 Specifically, this class fetches results from try bots for the current CL, and: | 7 Specifically, this class fetches results from try bots for the current CL, and: |
| 8 1. Downloads new baseline files for any tests that can be rebaselined. | 8 1. Downloads new baseline files for any tests that can be rebaselined. |
| 9 2. Updates the generic TestExpectations file for any other failing tests. | 9 2. Updates the generic TestExpectations file for any other failing tests. |
| 10 | 10 |
| 11 This is used as part of the w3c test auto-import process. | 11 This is used as part of the w3c test auto-import process. |
| 12 """ | 12 """ |
| 13 | 13 |
| 14 import argparse | 14 import argparse |
| 15 import copy | 15 import copy |
| 16 import logging | 16 import logging |
| 17 | 17 |
| 18 from webkitpy.common.net.git_cl import GitCL | 18 from webkitpy.common.net.git_cl import GitCL |
| 19 from webkitpy.common.net.rietveld import Rietveld | 19 from webkitpy.common.net.rietveld import Rietveld |
| 20 from webkitpy.common.webkit_finder import WebKitFinder | 20 from webkitpy.common.blink_finder import BlinkFinder |
| 21 from webkitpy.layout_tests.models.test_expectations import TestExpectationLine | 21 from webkitpy.layout_tests.models.test_expectations import TestExpectationLine |
| 22 from webkitpy.w3c.test_parser import TestParser | 22 from webkitpy.w3c.test_parser import TestParser |
| 23 | 23 |
| 24 _log = logging.getLogger(__name__) | 24 _log = logging.getLogger(__name__) |
| 25 | 25 |
| 26 | 26 |
| 27 class W3CExpectationsLineAdder(object): | 27 class W3CExpectationsLineAdder(object): |
| 28 | 28 |
| 29 def __init__(self, host): | 29 def __init__(self, host): |
| 30 self.host = host | 30 self.host = host |
| 31 self.host.initialize_scm() | 31 self.host.initialize_scm() |
| 32 self.finder = WebKitFinder(self.host.filesystem) | 32 self.finder = BlinkFinder(self.host.filesystem) |
| 33 | 33 |
| 34 def run(self, args=None): | 34 def run(self, args=None): |
| 35 parser = argparse.ArgumentParser(description=__doc__) | 35 parser = argparse.ArgumentParser(description=__doc__) |
| 36 parser.add_argument('-v', '--verbose', action='store_true', help='More v
erbose logging.') | 36 parser.add_argument('-v', '--verbose', action='store_true', help='More v
erbose logging.') |
| 37 args = parser.parse_args(args) | 37 args = parser.parse_args(args) |
| 38 log_level = logging.DEBUG if args.verbose else logging.INFO | 38 log_level = logging.DEBUG if args.verbose else logging.INFO |
| 39 logging.basicConfig(level=log_level, format='%(message)s') | 39 logging.basicConfig(level=log_level, format='%(message)s') |
| 40 | 40 |
| 41 issue_number = self.get_issue_number() | 41 issue_number = self.get_issue_number() |
| 42 if issue_number == 'None': | 42 if issue_number == 'None': |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 Returns: | 299 Returns: |
| 300 An updated tests_results dictionary without the platform-specific | 300 An updated tests_results dictionary without the platform-specific |
| 301 testharness.js tests that required new baselines to be downloaded | 301 testharness.js tests that required new baselines to be downloaded |
| 302 from `webkit-patch rebaseline-from-try-jobs`. | 302 from `webkit-patch rebaseline-from-try-jobs`. |
| 303 """ | 303 """ |
| 304 modified_tests = self.get_modified_existing_tests() | 304 modified_tests = self.get_modified_existing_tests() |
| 305 tests_to_rebaseline, tests_results = self.get_tests_to_rebaseline(modifi
ed_tests, tests_results) | 305 tests_to_rebaseline, tests_results = self.get_tests_to_rebaseline(modifi
ed_tests, tests_results) |
| 306 _log.debug('Tests to rebaseline: %r', tests_to_rebaseline) | 306 _log.debug('Tests to rebaseline: %r', tests_to_rebaseline) |
| 307 if tests_to_rebaseline: | 307 if tests_to_rebaseline: |
| 308 webkit_patch = self.host.filesystem.join( | 308 webkit_patch = self.host.filesystem.join( |
| 309 self.finder.chromium_base(), self.finder.webkit_base(), self.fin
der.path_to_script('webkit-patch')) | 309 self.finder.chromium_base(), self.finder.blink_base(), self.find
er.path_to_script('webkit-patch')) |
| 310 self.host.executive.run_command([ | 310 self.host.executive.run_command([ |
| 311 'python', | 311 'python', |
| 312 webkit_patch, | 312 webkit_patch, |
| 313 'rebaseline-cl', | 313 'rebaseline-cl', |
| 314 '--verbose', | 314 '--verbose', |
| 315 '--no-trigger-jobs', | 315 '--no-trigger-jobs', |
| 316 ] + tests_to_rebaseline) | 316 ] + tests_to_rebaseline) |
| 317 return tests_results | 317 return tests_results |
| 318 | 318 |
| 319 def get_modified_existing_tests(self): | 319 def get_modified_existing_tests(self): |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 Args: | 367 Args: |
| 368 test_path: A file path relative to the layout tests directory. | 368 test_path: A file path relative to the layout tests directory. |
| 369 This might correspond to a deleted file or a non-test. | 369 This might correspond to a deleted file or a non-test. |
| 370 """ | 370 """ |
| 371 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir()
, test_path) | 371 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir()
, test_path) |
| 372 test_parser = TestParser(absolute_path, self.host) | 372 test_parser = TestParser(absolute_path, self.host) |
| 373 if not test_parser.test_doc: | 373 if not test_parser.test_doc: |
| 374 return False | 374 return False |
| 375 return test_parser.is_jstest() | 375 return test_parser.is_jstest() |
| OLD | NEW |