| 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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 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': |
| 43 _log.error('No issue on current branch.') | 43 _log.error('No issue on current branch.') |
| 44 return 1 | 44 return 1 |
| 45 | 45 |
| 46 try_bots = self.get_try_bots() | |
| 47 rietveld = Rietveld(self.host.web) | 46 rietveld = Rietveld(self.host.web) |
| 48 try_jobs = rietveld.latest_try_jobs(issue_number, try_bots) | 47 builds = rietveld.latest_try_job_results(issue_number, self.get_try_bots
()) |
| 49 _log.debug('Latest try jobs: %r', try_jobs) | 48 _log.debug('Latest try jobs: %r', builds) |
| 50 | 49 |
| 51 if not try_jobs: | 50 if not builds: |
| 52 _log.error('No try job information was collected.') | 51 _log.error('No try job information was collected.') |
| 53 return 1 | 52 return 1 |
| 54 | 53 |
| 55 test_expectations = {} | 54 test_expectations = {} |
| 56 for job in try_jobs: | 55 for build in builds: |
| 57 platform_results = self.get_failing_results_dict(job) | 56 platform_results = self.get_failing_results_dict(build) |
| 58 test_expectations = self.merge_dicts(test_expectations, platform_res
ults) | 57 test_expectations = self.merge_dicts(test_expectations, platform_res
ults) |
| 59 | 58 |
| 60 for test_name, platform_result in test_expectations.iteritems(): | 59 for test_name, platform_result in test_expectations.iteritems(): |
| 61 test_expectations[test_name] = self.merge_same_valued_keys(platform_
result) | 60 test_expectations[test_name] = self.merge_same_valued_keys(platform_
result) |
| 62 | 61 |
| 63 test_expectations = self.get_expected_txt_files(test_expectations) | 62 test_expectations = self.get_expected_txt_files(test_expectations) |
| 64 test_expectation_lines = self.create_line_list(test_expectations) | 63 test_expectation_lines = self.create_line_list(test_expectations) |
| 65 self.write_to_test_expectations(test_expectation_lines) | 64 self.write_to_test_expectations(test_expectation_lines) |
| 66 return 0 | 65 return 0 |
| 67 | 66 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 367 |
| 369 Args: | 368 Args: |
| 370 test_path: A file path relative to the layout tests directory. | 369 test_path: A file path relative to the layout tests directory. |
| 371 This might correspond to a deleted file or a non-test. | 370 This might correspond to a deleted file or a non-test. |
| 372 """ | 371 """ |
| 373 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir()
, test_path) | 372 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir()
, test_path) |
| 374 test_parser = TestParser(absolute_path, self.host) | 373 test_parser = TestParser(absolute_path, self.host) |
| 375 if not test_parser.test_doc: | 374 if not test_parser.test_doc: |
| 376 return False | 375 return False |
| 377 return test_parser.is_jstest() | 376 return test_parser.is_jstest() |
| OLD | NEW |