Commit 456acc90 authored by qyearsley's avatar qyearsley Committed by Commit bot

When auto-importing, don't limit rebaselining to directly modified tests.

BUG=676196

Review-Url: https://codereview.chromium.org/2604213002
Cr-Commit-Position: refs/heads/master@{#443417}
parent 3ec92ab7
......@@ -329,8 +329,7 @@ class W3CExpectationsLineAdder(object):
testharness.js tests that required new baselines to be downloaded
from `webkit-patch rebaseline-cl`.
"""
modified_tests = self.get_modified_existing_tests()
tests_to_rebaseline, tests_results = self.get_tests_to_rebaseline(modified_tests, tests_results)
tests_to_rebaseline, tests_results = self.get_tests_to_rebaseline(tests_results)
_log.debug('Tests to rebaseline: %r', tests_to_rebaseline)
if tests_to_rebaseline:
webkit_patch = self.host.filesystem.join(
......@@ -344,23 +343,7 @@ class W3CExpectationsLineAdder(object):
] + tests_to_rebaseline)
return tests_results
def get_modified_existing_tests(self):
"""Returns a list of layout test names for layout tests that have been modified."""
diff_output = self.host.executive.run_command(
['git', 'diff', 'origin/master', '--name-only', '--diff-filter=AMR']) # Added, modified, and renamed files.
paths_from_chromium_root = diff_output.splitlines()
modified_tests = []
for path in paths_from_chromium_root:
absolute_path = self.host.filesystem.join(self.finder.chromium_base(), path)
if not self.host.filesystem.exists(absolute_path):
_log.warning('File does not exist: %s', absolute_path)
continue
test_path = self.finder.layout_test_name(path)
if test_path:
modified_tests.append(test_path)
return modified_tests
def get_tests_to_rebaseline(self, modified_tests, test_results):
def get_tests_to_rebaseline(self, test_results):
"""Returns a list of tests to download new baselines for.
Creates a list of tests to rebaseline depending on the tests' platform-
......@@ -368,10 +351,8 @@ class W3CExpectationsLineAdder(object):
due to a baseline mismatch (rather than crash or timeout).
Args:
modified_tests: A list of paths to modified files (which should
be added, removed or modified files in the imported w3c
directory), relative to the LayoutTests directory.
test_results: A dictionary of failing tests results.
test_results: A dictionary of failing test results, mapping tests
to platforms to result dicts.
Returns:
A pair: A set of tests to be rebaselined, and a modified copy of
......@@ -380,7 +361,7 @@ class W3CExpectationsLineAdder(object):
"""
test_results = copy.deepcopy(test_results)
tests_to_rebaseline = set()
for test_path in modified_tests:
for test_path in test_results:
if not (self.is_js_test(test_path) and test_results.get(test_path)):
continue
for platform in test_results[test_path].keys():
......
......@@ -251,7 +251,7 @@ class UpdateW3CTestExpectationsTest(LoggingTestCase):
'<script src="/resources/testharness.js"></script>')
line_adder = W3CExpectationsLineAdder(self.host)
tests_to_rebaseline, _ = line_adder.get_tests_to_rebaseline(
['imported/fake/test/path.html', 'imported/other/test/path.html'], self.mock_dict_two)
self.mock_dict_two)
# The other test doesn't have an entry in the test results dict, so it is not listed as a test to rebaseline.
self.assertEqual(tests_to_rebaseline, ['imported/fake/test/path.html'])
......@@ -260,7 +260,7 @@ class UpdateW3CTestExpectationsTest(LoggingTestCase):
'this file does not look like a testharness JS test.')
line_adder = W3CExpectationsLineAdder(self.host)
tests_to_rebaseline, _ = line_adder.get_tests_to_rebaseline(
['imported/fake/test/path.html'], self.mock_dict_two)
self.mock_dict_two)
self.assertEqual(tests_to_rebaseline, [])
def test_get_tests_to_rebaseline_returns_updated_dict(self):
......@@ -275,7 +275,7 @@ class UpdateW3CTestExpectationsTest(LoggingTestCase):
'<script src="/resources/testharness.js"></script>')
line_adder = W3CExpectationsLineAdder(self.host)
tests_to_rebaseline, modified_test_results = line_adder.get_tests_to_rebaseline(
['imported/fake/test/path.html'], test_results_dict)
test_results_dict)
self.assertEqual(tests_to_rebaseline, ['imported/fake/test/path.html'])
# The record for the builder with a timeout is kept, but not with a text mismatch,
# since that should be covered by downloading a new baseline.
......@@ -299,7 +299,7 @@ class UpdateW3CTestExpectationsTest(LoggingTestCase):
'<script src="/resources/testharness.js"></script>')
line_adder = W3CExpectationsLineAdder(self.host)
tests_to_rebaseline, modified_test_results = line_adder.get_tests_to_rebaseline(
['imported/fake/test/path.html'], test_results_dict)
test_results_dict)
self.assertEqual(tests_to_rebaseline, ['imported/fake/test/path.html'])
# The record for the builder with a timeout is kept, but not with a text mismatch,
# since that should be covered by downloading a new baseline.
......@@ -337,17 +337,3 @@ class UpdateW3CTestExpectationsTest(LoggingTestCase):
'https://codereview.chromium.org/api/11112222/1'
])
self.assertLog(['ERROR: No try job information was collected.\n'])
def test_get_modified_existing_tests(self):
line_adder = W3CExpectationsLineAdder(self.host)
modified_files = [
'third_party/WebKit/LayoutTests/a/b.html',
'third_party/WebKit/LayoutTests/a/c.html',
'x/y/z.cc',
]
self.host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/a/b.html'] = ''
self.host.filesystem.files['/mock-checkout/x/y/z.cc'] = ''
self.host.executive = MockExecutive(output='\n'.join(modified_files))
tests = line_adder.get_modified_existing_tests()
self.assertEqual(tests, ['a/b.html'])
self.assertEqual(self.host.executive.calls, [['git', 'diff', 'origin/master', '--name-only', '--diff-filter=AMR']])
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