Commit eec95121 authored by qyearsley's avatar qyearsley Committed by Commit bot

Refactor WPTExpectationsUpdater.get_tests_to_rebaseline.

The purpose of this CL is just to try to make this method a bit easier
to understand; this shouldn't change behavior.

Review-Url: https://codereview.chromium.org/2755033002
Cr-Commit-Position: refs/heads/master@{#457832}
parent 8ffd86e6
...@@ -419,20 +419,27 @@ class WPTExpectationsUpdater(object): ...@@ -419,20 +419,27 @@ class WPTExpectationsUpdater(object):
the test results dictionary. The tests to be rebaselined should the test results dictionary. The tests to be rebaselined should
include testharness.js tests that failed due to a baseline mismatch. include testharness.js tests that failed due to a baseline mismatch.
""" """
test_results = copy.deepcopy(test_results) new_test_results = copy.deepcopy(test_results)
tests_to_rebaseline = set() tests_to_rebaseline = set()
for test_path in test_results: for test_path in test_results:
if not (self.is_js_test(test_path) and test_results.get(test_path)): for platform, result in test_results[test_path].iteritems():
continue if self.can_rebaseline(test_path, result):
for platform in test_results[test_path].keys(): del new_test_results[test_path][platform]
if test_results[test_path][platform]['actual'] not in ['CRASH', 'TIMEOUT']:
del test_results[test_path][platform]
tests_to_rebaseline.add(test_path) tests_to_rebaseline.add(test_path)
return sorted(tests_to_rebaseline), test_results return sorted(tests_to_rebaseline), new_test_results
def can_rebaseline(self, test_path, result):
return (self.is_js_test(test_path) and
result['actual'] not in ('CRASH', 'TIMEOUT'))
def is_js_test(self, test_path): def is_js_test(self, test_path):
"""Checks whether a given file is a testharness.js test. """Checks whether a given file is a testharness.js test.
TODO(qyearsley): This may not behave how we want it to for virtual tests.
TODO(qyearsley): Avoid using TestParser; maybe this should use
Port.test_type, or Port.reference_files to see whether it's not
a reference test?
Args: Args:
test_path: A file path relative to the layout tests directory. test_path: A file path relative to the layout tests directory.
This might correspond to a deleted file or a non-test. This might correspond to a deleted file or a non-test.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment