| 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 """Updates expectations and baselines when updating web-platform-tests. | 5 """Updates expectations and baselines when updating web-platform-tests. |
| 6 | 6 |
| 7 Specifically, this class fetches results from try bots for the current CL, then | 7 Specifically, this class fetches results from try bots for the current CL, then |
| 8 (1) downloads new baseline files for any tests that can be rebaselined, and | 8 (1) downloads new baseline files for any tests that can be rebaselined, and |
| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 expectations.add(actual.capitalize()) | 229 expectations.add(actual.capitalize()) |
| 230 return expectations | 230 return expectations |
| 231 | 231 |
| 232 def create_line_list(self, merged_results): | 232 def create_line_list(self, merged_results): |
| 233 """Creates list of test expectations lines. | 233 """Creates list of test expectations lines. |
| 234 | 234 |
| 235 Traverses through the given |merged_results| dictionary and parses the | 235 Traverses through the given |merged_results| dictionary and parses the |
| 236 value to create one test expectations line per key. | 236 value to create one test expectations line per key. |
| 237 | 237 |
| 238 Args: | 238 Args: |
| 239 merged_results: A merged_results with the format: | 239 merged_results: A dictionary with the format: |
| 240 { | 240 { |
| 241 'test_name': { | 241 'test_name': { |
| 242 'platform': { | 242 'platform': { |
| 243 'expected: 'PASS', | 243 'expected: 'PASS', |
| 244 'actual': 'FAIL', | 244 'actual': 'FAIL', |
| 245 'bug': 'crbug.com/11111' | 245 'bug': 'crbug.com/11111' |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 Returns: | 250 Returns: |
| 251 A list of test expectations lines with the format: | 251 A list of test expectations lines with the format: |
| 252 ['BUG_URL [PLATFORM(S)] TEST_NAME [EXPECTATION(S)]'] | 252 ['BUG_URL [PLATFORM(S)] TEST_NAME [EXPECTATION(S)]'] |
| 253 """ | 253 """ |
| 254 line_list = [] | 254 line_list = [] |
| 255 for test_name, port_results in sorted(merged_results.iteritems()): | 255 for test_name, port_results in sorted(merged_results.iteritems()): |
| 256 for port_names in sorted(port_results): | 256 if not test_name.startswith('external'): |
| 257 if test_name.startswith('external'): | 257 continue |
| 258 line_parts = [port_results[port_names]['bug']] | 258 for port_names, results in sorted(port_results.iteritems()): |
| 259 specifier_part = self.specifier_part(self.to_list(port_names
), test_name) | 259 line_list.append(self._create_line(test_name, port_names, result
s)) |
| 260 if specifier_part: | |
| 261 line_parts.append(specifier_part) | |
| 262 line_parts.append(test_name) | |
| 263 line_parts.append('[ %s ]' % ' '.join(self.get_expectations(
port_results[port_names]))) | |
| 264 line_list.append(' '.join(line_parts)) | |
| 265 return line_list | 260 return line_list |
| 266 | 261 |
| 262 def _create_line(self, test_name, port_names, results): |
| 263 """Constructs one test expectations line string.""" |
| 264 line_parts = [results['bug']] |
| 265 specifier_part = self.specifier_part(self.to_list(port_names), test_name
) |
| 266 if specifier_part: |
| 267 line_parts.append(specifier_part) |
| 268 line_parts.append(test_name) |
| 269 |
| 270 # Skip new manual tests; see crbug.com/708241 for context. |
| 271 if '-manual.' in test_name and results['actual'] in ('MISSING', 'TIMEOUT
'): |
| 272 line_parts.append('[ Skip ]') |
| 273 else: |
| 274 line_parts.append('[ %s ]' % ' '.join(self.get_expectations(results)
)) |
| 275 return ' '.join(line_parts) |
| 276 |
| 267 def specifier_part(self, port_names, test_name): | 277 def specifier_part(self, port_names, test_name): |
| 268 """Returns the specifier part for a new test expectations line. | 278 """Returns the specifier part for a new test expectations line. |
| 269 | 279 |
| 270 Args: | 280 Args: |
| 271 port_names: A list of full port names that the line should apply to. | 281 port_names: A list of full port names that the line should apply to. |
| 272 test_name: The test name for the expectation line. | 282 test_name: The test name for the expectation line. |
| 273 | 283 |
| 274 Returns: | 284 Returns: |
| 275 The specifier part of the new expectation line, e.g. "[ Mac ]". | 285 The specifier part of the new expectation line, e.g. "[ Mac ]". |
| 276 This will be an empty string if the line should apply to all platfor
ms. | 286 This will be an empty string if the line should apply to all platfor
ms. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 This might correspond to a deleted file or a non-test. | 455 This might correspond to a deleted file or a non-test. |
| 446 """ | 456 """ |
| 447 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir()
, test_path) | 457 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir()
, test_path) |
| 448 test_parser = TestParser(absolute_path, self.host) | 458 test_parser = TestParser(absolute_path, self.host) |
| 449 if not test_parser.test_doc: | 459 if not test_parser.test_doc: |
| 450 return False | 460 return False |
| 451 return test_parser.is_jstest() | 461 return test_parser.is_jstest() |
| 452 | 462 |
| 453 def _get_try_bots(self): | 463 def _get_try_bots(self): |
| 454 return self.host.builders.all_try_builder_names() | 464 return self.host.builders.all_try_builder_names() |
| OLD | NEW |