Commit 76d0c6c9 authored by qyearsley's avatar qyearsley Committed by Commit bot

In webkitpy-patch rebaseline-cl, don't try to rebaseline non-existent tests.

BUG=649691

Review-Url: https://codereview.chromium.org/2371803003
Cr-Commit-Position: refs/heads/master@{#421325}
parent 628580f4
...@@ -73,12 +73,30 @@ class RebaselineCL(AbstractParallelRebaselineCommand): ...@@ -73,12 +73,30 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
else: else:
test_prefix_list = self._test_prefix_list( test_prefix_list = self._test_prefix_list(
issue_number, only_changed_tests=options.only_changed_tests) issue_number, only_changed_tests=options.only_changed_tests)
# TODO(qyearsley): Fix places where non-existing tests may be added:
# 1. Make sure that the tests obtained when passing --only-changed-tests include only existing tests.
# 2. Make sure that update-w3c-test-expectations doesn't specify non-existing tests (http://crbug.com/649691).
test_prefix_list = self._filter_existing(test_prefix_list)
self._log_test_prefix_list(test_prefix_list) self._log_test_prefix_list(test_prefix_list)
if options.dry_run: if options.dry_run:
return return
self._rebaseline(options, test_prefix_list) self._rebaseline(options, test_prefix_list)
def _filter_existing(self, test_prefix_list):
"""Filters out entries in |test_prefix_list| for tests that don't exist."""
new_test_prefix_list = {}
port = self._tool.port_factory.get()
for test in test_prefix_list:
path = port.abspath_for_test(test)
if self._tool.filesystem.exists(path):
new_test_prefix_list[test] = test_prefix_list[test]
else:
_log.warning('%s not found, removing from list.', path)
return new_test_prefix_list
def _get_issue_number(self, options): def _get_issue_number(self, options):
"""Gets the Rietveld CL number from either |options| or from the current local branch.""" """Gets the Rietveld CL number from either |options| or from the current local branch."""
if options.issue: if options.issue:
......
...@@ -16,6 +16,7 @@ from webkitpy.tool.commands.rebaseline_cl import RebaselineCL ...@@ -16,6 +16,7 @@ from webkitpy.tool.commands.rebaseline_cl import RebaselineCL
from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase
# TODO(qyearsley): Change this to use webkitpy.common.system.logtesting.LoggingTestCase instead of using OutputCapture.
class RebaselineCLTest(BaseTestCase): class RebaselineCLTest(BaseTestCase):
command_constructor = RebaselineCL command_constructor = RebaselineCL
...@@ -56,6 +57,17 @@ class RebaselineCLTest(BaseTestCase): ...@@ -56,6 +57,17 @@ class RebaselineCLTest(BaseTestCase):
}) })
self.command.rietveld = Rietveld(web) self.command.rietveld = Rietveld(web)
# Write to the mock filesystem so that these tests are considered to exist.
port = self.mac_port
tests = [
'fast/dom/prototype-taco.html',
'fast/dom/prototype-inheritance.html',
'svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html',
]
for test in tests:
# pylint: disable=protected-access
self._write(port._filesystem.join(port.layout_tests_dir(), test), 'contents')
@staticmethod @staticmethod
def command_options(**kwargs): def command_options(**kwargs):
options = { options = {
...@@ -134,6 +146,18 @@ class RebaselineCLTest(BaseTestCase): ...@@ -134,6 +146,18 @@ class RebaselineCLTest(BaseTestCase):
'Rebaselining fast/dom/prototype-inheritance.html\n' 'Rebaselining fast/dom/prototype-inheritance.html\n'
'Rebaselining fast/dom/prototype-taco.html\n')) 'Rebaselining fast/dom/prototype-taco.html\n'))
def test_execute_with_nonexistent_test(self):
oc = OutputCapture()
try:
oc.capture_output()
self.command.execute(self.command_options(issue=11112222), ['some/non/existent/test.html'], self.tool)
finally:
_, _, logs = oc.restore_output()
self.assertMultiLineEqual(
logs,
'/test.checkout/LayoutTests/some/non/existent/test.html not found, removing from list.\n'
'No tests to rebaseline; exiting.\n')
def test_execute_with_trigger_jobs_option(self): def test_execute_with_trigger_jobs_option(self):
oc = OutputCapture() oc = OutputCapture()
try: try:
...@@ -154,19 +178,7 @@ class RebaselineCLTest(BaseTestCase): ...@@ -154,19 +178,7 @@ class RebaselineCLTest(BaseTestCase):
'Rebaselining fast/dom/prototype-taco.html\n' 'Rebaselining fast/dom/prototype-taco.html\n'
'Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html\n')) 'Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html\n'))
# The first executive call, before the rebaseline calls, is triggering try jobs. # The first executive call, before the rebaseline calls, is triggering try jobs.
self.assertEqual( self.assertEqual(self.tool.executive.calls[0], ['git', 'cl', 'try', '-b', 'MOCK Try Linux'])
self.tool.executive.calls,
[
['git', 'cl', 'try', '-b', 'MOCK Try Linux'],
[
['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'png',
'svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html'],
['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt',
'fast/dom/prototype-inheritance.html'],
['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt',
'fast/dom/prototype-taco.html']
]
])
def test_rebaseline_calls(self): def test_rebaseline_calls(self):
"""Tests the list of commands that are invoked when rebaseline is called.""" """Tests the list of commands that are invoked when rebaseline is called."""
......
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