Chromium Code Reviews| 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..31b7eaa633f602e3f19300bc25b4a9076845854d 100644 |
| --- a/Tools/Scripts/webkitpy/tool/commands/flakytests.py |
| +++ b/Tools/Scripts/webkitpy/tool/commands/flakytests.py |
| @@ -32,12 +32,29 @@ from webkitpy.layout_tests.models.test_expectations import TestExpectationParser |
| class FlakyTests(AbstractDeclarativeCommand): |
| - name = "flaky-tests" |
| - help_text = "Generate FlakyTests file from the flakiness dashboard" |
| + name = "update-flaky-tests" |
| + help_text = "Update FlakyTests file from the flakiness dashboard" |
| show_in_main_help = True |
| def execute(self, options, args, tool): |
| 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, include_overrides=False, model_all_expectations=True) |
| + model = TestExpectationsModel() |
| + for port_name in tool.port_factory.all_port_names(): |
| + expectations = BotTestExpectationsFactory().expectations_for_port(port_name) |
| + for line in expectations.expectation_lines(only_ignore_very_flaky=True): |
| + 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=lambda line: line.path) |
| + # 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. |
| + # lines = filter(lambda line: not current_expectations.model().has_test(line.name), lines) |
|
ojan
2014/05/29 21:53:03
Why leave in this comment + the commented out code
|
| + # Skip any tests which are mentioned in the dashboard but not in our checkout: |
| + fs = tool.filesystem |
| + lines = filter(lambda line: fs.exists(fs.join(port.layout_tests_dir(), line.path)), lines) |
| + flaky_tests_path = fs.join(port.layout_tests_dir(), 'FlakyTests') |
| + with open(flaky_tests_path, 'w') as flake_file: |
| + flake_file.write(TestExpectations.list_to_string(lines)) |