Index: Tools/Scripts/webkitpy/tool/commands/flakytests.py |
diff --git a/Tools/Scripts/webkitpy/tool/commands/flakytests.py b/Tools/Scripts/webkitpy/tool/commands/flakytests.py |
index 3a97cd61cd7bf5a9462306a076dd759d3b5dd842..b976e8edb125b572f2b883b89363e65ce9b6ebfc 100644 |
--- a/Tools/Scripts/webkitpy/tool/commands/flakytests.py |
+++ b/Tools/Scripts/webkitpy/tool/commands/flakytests.py |
@@ -26,6 +26,7 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+import operator |
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand |
from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestExpectationsFactory |
from webkitpy.layout_tests.models.test_expectations import TestExpectationParser, TestExpectationsModel, TestExpectations |
@@ -37,7 +38,26 @@ class FlakyTests(AbstractDeclarativeCommand): |
show_in_main_help = True |
def execute(self, options, args, tool): |
+ fs = tool.filesystem |
ojan
2014/05/29 18:51:20
Nit: this is only used in two places on the same l
|
port = tool.port_factory.get() |
- full_port_name = port.determine_full_port_name(tool, options, port.port_name) |
- expectations = BotTestExpectationsFactory().expectations_for_port(full_port_name) |
- print TestExpectations.list_to_string(expectations.expectation_lines()) |
+ current_expectations = TestExpectations(port, model_all_expectations=True) |
+ model = TestExpectationsModel() |
+ port_names = tool.port_factory.all_port_names() |
+ # builders.all_builder_names includes an ASAN builder but |
+ # those are in a separate TestExpectations file, so skip it. |
+ port_names = filter(lambda name: 'ASAN' not in name, port_names) |
Dirk Pranke
2014/05/29 18:25:21
Perhaps 'ASAN' shouldn't be in all_builder_names()
ojan
2014/05/29 18:51:20
+1. I should have done this before when I made reb
|
+ for port_name in port_names: |
+ expectations = BotTestExpectationsFactory().expectations_for_port(port_name) |
+ for line in expectations.expectation_lines(): |
+ model.add_expectation_line(line) |
+ # FIXME: We need an official API to get all the test names or all test lines. |
+ lines = model._test_to_expectation_line.values() |
+ lines.sort(key=operator.attrgetter('path')) |
Dirk Pranke
2014/05/29 18:25:21
Can you use key=lambda line: line.path or somethin
Dirk Pranke
2014/05/29 21:06:46
I think you missed this comment as well ...
|
+ # This is a hack, but prevents duplicates with existing TestExpectations |
+ # (which would cause lint-test-expectations to fail). A better solution |
+ # would be to update 'current_expectations' with the new data and |
+ # write out the whole TestExpectations file. |
Dirk Pranke
2014/05/29 18:25:21
I don't think we do complain about duplicates acro
ojan
2014/05/29 18:51:20
This is adding to the regular TestExpectations fil
Dirk Pranke
2014/05/29 18:59:56
Oh. Right. I suppose the better question is, why w
ojan
2014/05/29 19:37:04
Yes! This would solve almost all my concerns I bro
|
+ lines = filter(lambda line: not current_expectations.model().has_test(line.name), lines) |
+ # Skip any tests which are mentioned in the dashboard but not in our checkout: |
+ lines = filter(lambda line: fs.exists(fs.join(port.layout_tests_dir(), line.path)), lines) |
+ print TestExpectations.list_to_string(lines) |