Chromium Code Reviews| 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 TestExpectations based on results in builder bots. | 5 """Updates TestExpectations based on results in builder bots. |
| 6 | 6 |
| 7 Scans the TestExpectations file and uses results from actual builder bots runs | 7 Scans the TestExpectations file and uses results from actual builder bots runs |
| 8 to remove tests that are marked as flaky but don't fail in the specified way. | 8 to remove tests that are marked as flaky but don't fail in the specified way. |
| 9 | 9 |
| 10 E.g. If a test has this expectation: | 10 E.g. If a test has this expectation: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 return False | 97 return False |
| 98 | 98 |
| 99 # Don't check lines that have expectations like NeedsRebaseline or Skip. | 99 # Don't check lines that have expectations like NeedsRebaseline or Skip. |
| 100 if self._has_unstrippable_expectations(expectations): | 100 if self._has_unstrippable_expectations(expectations): |
| 101 return False | 101 return False |
| 102 | 102 |
| 103 # Don't check lines unless they're flaky. i.e. At least one expectation is a PASS. | 103 # Don't check lines unless they're flaky. i.e. At least one expectation is a PASS. |
| 104 if not self._has_pass_expectation(expectations): | 104 if not self._has_pass_expectation(expectations): |
| 105 return False | 105 return False |
| 106 | 106 |
| 107 # Don't check lines that have expectations for directories, since | |
| 108 # the flakiness of all sub-tests isn't as easy to check. | |
| 109 if self._is_directory(test_expectation_line.name): | |
| 110 return False | |
| 111 | |
| 107 # The line can be deleted if the only expectation on the line that appea rs in the actual | 112 # The line can be deleted if the only expectation on the line that appea rs in the actual |
| 108 # results is the PASS expectation. | 113 # results is the PASS expectation. |
| 109 builders_checked = [] | 114 builders_checked = [] |
| 110 for config in test_expectation_line.matching_configurations: | 115 for config in test_expectation_line.matching_configurations: |
| 111 builder_name = self._host.builders.builder_name_for_specifiers(confi g.version, config.build_type) | 116 builder_name = self._host.builders.builder_name_for_specifiers(confi g.version, config.build_type) |
| 112 | 117 |
| 113 if not builder_name: | 118 if not builder_name: |
| 114 _log.debug('No builder with config %s', config) | 119 _log.debug('No builder with config %s', config) |
| 115 # For many configurations, there is no matching builder in | 120 # For many configurations, there is no matching builder in |
| 116 # webkitpy/common/config/builders.py. We ignore these | 121 # webkitpy/common/config/builders.py. We ignore these |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 | 189 |
| 185 Returns: | 190 Returns: |
| 186 True if at least one of the expectations is unstrippable. False | 191 True if at least one of the expectations is unstrippable. False |
| 187 otherwise. | 192 otherwise. |
| 188 """ | 193 """ |
| 189 unstrippable_expectations = ('REBASELINE', 'NEEDSREBASELINE', | 194 unstrippable_expectations = ('REBASELINE', 'NEEDSREBASELINE', |
| 190 'NEEDSMANUALREBASELINE', 'SLOW', | 195 'NEEDSMANUALREBASELINE', 'SLOW', |
| 191 'SKIP') | 196 'SKIP') |
| 192 return any(s in expectations for s in unstrippable_expectations) | 197 return any(s in expectations for s in unstrippable_expectations) |
| 193 | 198 |
| 199 def _is_directory(self, name): | |
| 200 return [name] != self._port.tests([name]) | |
|
bokan
2017/02/07 20:06:28
This will return true for tests files that don't e
qyearsley
2017/02/07 21:22:42
That sounds reasonable. In the latest patch I've n
| |
| 201 | |
| 194 def _get_builder_results_by_path(self): | 202 def _get_builder_results_by_path(self): |
| 195 """Returns a dictionary of results for each builder. | 203 """Returns a dictionary of results for each builder. |
| 196 | 204 |
| 197 Returns a dictionary where each key is a builder and value is a dictiona ry containing | 205 Returns a dictionary where each key is a builder and value is a dictiona ry containing |
| 198 the distinct results for each test. E.g. | 206 the distinct results for each test. E.g. |
| 199 | 207 |
| 200 { | 208 { |
| 201 'WebKit Linux Precise': { | 209 'WebKit Linux Precise': { |
| 202 'test1.html': ['PASS', 'IMAGE'], | 210 'test1.html': ['PASS', 'IMAGE'], |
| 203 'test2.html': ['PASS'], | 211 'test2.html': ['PASS'], |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 """Writes the given TestExpectations object to the filesystem. | 338 """Writes the given TestExpectations object to the filesystem. |
| 331 | 339 |
| 332 Args: | 340 Args: |
| 333 test_expectations: The TestExpectations object to write. | 341 test_expectations: The TestExpectations object to write. |
| 334 test_expectations_file: The full file path of the Blink | 342 test_expectations_file: The full file path of the Blink |
| 335 TestExpectations file. This file will be overwritten. | 343 TestExpectations file. This file will be overwritten. |
| 336 """ | 344 """ |
| 337 self._host.filesystem.write_text_file( | 345 self._host.filesystem.write_text_file( |
| 338 test_expectations_file, | 346 test_expectations_file, |
| 339 TestExpectations.list_to_string(test_expectations, reconstitute_only _these=[])) | 347 TestExpectations.list_to_string(test_expectations, reconstitute_only _these=[])) |
| OLD | NEW |