Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py (119765 => 119766)
--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2012-06-07 23:07:48 UTC (rev 119765)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2012-06-07 23:10:23 UTC (rev 119766)
@@ -43,16 +43,12 @@
from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter
from webkitpy.layout_tests.models import test_failures
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
-from webkitpy.layout_tests.models.test_expectations import TestExpectations
+from webkitpy.layout_tests.models.test_expectations import TestExpectations, suffixes_for_expectations, BASELINE_SUFFIX_LIST
from webkitpy.layout_tests.port import builders
from webkitpy.tool.grammar import pluralize
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
-# FIXME: Pull this from Port.baseline_extensions().
-_baseline_suffix_list = ['png', 'wav', 'txt']
-
-
_log = logging.getLogger(__name__)
# FIXME: Should TestResultWriter know how to compute this string?
@@ -64,10 +60,10 @@
def __init__(self, options=None):
options = options or []
options.extend([
- optparse.make_option('--suffixes', default=','.join(_baseline_suffix_list), action='',
+ optparse.make_option('--suffixes', default=','.join(BASELINE_SUFFIX_LIST), action='',
help='file types to rebaseline')])
AbstractDeclarativeCommand.__init__(self, options=options)
- self._baseline_suffix_list = _baseline_suffix_list
+ self._baseline_suffix_list = BASELINE_SUFFIX_LIST
class RebaselineTest(AbstractRebaseliningCommand):
@@ -260,9 +256,6 @@
# FIXME: Support non-Chromium ports.
return port_name.startswith('chromium-')
- def _expectations(self, port, include_overrides):
- return TestExpectations(port, include_overrides=include_overrides)
-
def _update_expectations_file(self, port_name):
if not self._is_supported_port(port_name):
return
@@ -272,12 +265,16 @@
# This is not good, but avoids having the overrides getting written into the main file.
# See https://bugs.webkit.org/show_bug.cgi?id=88456 for context. This will no longer be needed
# once we properly support cascading expectations files.
- expectations = self._expectations(port, include_overrides=False)
+ expectations = TestExpectations(port, include_overrides=False)
path = port.path_to_test_expectations_file()
self._tool.filesystem.write_text_file(path, expectations.remove_rebaselined_tests(expectations.get_rebaselining_failures()))
def _tests_to_rebaseline(self, port):
- return self._expectations(port, include_overrides=True).get_rebaselining_failures()
+ tests_to_rebaseline = {}
+ expectations = TestExpectations(port, include_overrides=True)
+ for test in expectations.get_rebaselining_failures():
+ tests_to_rebaseline[test] = suffixes_for_expectations(expectations.get_expectations(test))
+ return tests_to_rebaseline
def _rebaseline_port(self, port_name):
if not self._is_supported_port(port_name):
@@ -286,11 +283,11 @@
if not builder_name:
return
_log.info("Retrieving results for %s from %s." % (port_name, builder_name))
- for test_name in self._tests_to_rebaseline(self._tool.port_factory.get(port_name)):
+ for test_name, suffixes in self._tests_to_rebaseline(self._tool.port_factory.get(port_name)).iteritems():
self._touched_test_names.add(test_name)
- _log.info(" %s" % test_name)
- # FIXME: need to extract the correct list of suffixes here.
- self._run_webkit_patch(['rebaseline-test', builder_name, test_name])
+ _log.info(" %s (%s)" % (test_name, ','.join(suffixes)))
+ # FIXME: we should use executive.run_in_parallel() to speed this up.
+ self._run_webkit_patch(['rebaseline-test', '--suffixes', ','.join(suffixes), builder_name, test_name])
def execute(self, options, args, tool):
self._touched_test_names = set([])
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py (119765 => 119766)
--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py 2012-06-07 23:07:48 UTC (rev 119765)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py 2012-06-07 23:10:23 UTC (rev 119766)
@@ -185,50 +185,50 @@
tool.executive = MockExecutive(should_log=True)
expected_logs = """Retrieving results for chromium-linux-x86 from Webkit Linux 32.
- userscripts/another-test.html
- userscripts/images.svg
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
Retrieving results for chromium-linux-x86_64 from Webkit Linux.
- userscripts/another-test.html
- userscripts/images.svg
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
Retrieving results for chromium-mac-leopard from Webkit Mac10.5.
- userscripts/another-test.html
- userscripts/images.svg
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
Retrieving results for chromium-mac-lion from Webkit Mac10.7.
- userscripts/another-test.html
- userscripts/images.svg
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
Retrieving results for chromium-mac-snowleopard from Webkit Mac10.6.
- userscripts/another-test.html
- userscripts/images.svg
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
Retrieving results for chromium-win-vista from Webkit Vista.
- userscripts/another-test.html
- userscripts/images.svg
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
Retrieving results for chromium-win-win7 from Webkit Win7.
- userscripts/another-test.html
- userscripts/images.svg
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
Retrieving results for chromium-win-xp from Webkit Win.
- userscripts/another-test.html
- userscripts/images.svg
+ userscripts/another-test.html (txt)
+ userscripts/images.svg (png)
"""
- expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Linux 32', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Linux 32', 'userscripts/images.svg'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Linux', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Linux', 'userscripts/images.svg'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Mac10.5', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Mac10.5', 'userscripts/images.svg'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Mac10.7', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Mac10.7', 'userscripts/images.svg'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Mac10.6', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Mac10.6', 'userscripts/images.svg'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Vista', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Vista', 'userscripts/images.svg'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win7', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win7', 'userscripts/images.svg'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win', 'userscripts/images.svg'], cwd=/mock-checkout
+ expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Linux 32', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Linux 32', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Linux', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Linux', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Mac10.5', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Mac10.5', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Mac10.7', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Mac10.7', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Mac10.6', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Mac10.6', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Vista', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Vista', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Win7', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Win7', 'userscripts/images.svg'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'txt', 'Webkit Win', 'userscripts/another-test.html'], cwd=/mock-checkout
+MOCK run_command: ['echo', 'rebaseline-test', '--suffixes', 'png', 'Webkit Win', 'userscripts/images.svg'], cwd=/mock-checkout
"""
- command._tests_to_rebaseline = lambda port: ['userscripts/another-test.html', 'userscripts/images.svg']
+ command._tests_to_rebaseline = lambda port: {'userscripts/another-test.html': set(['txt']), 'userscripts/images.svg': set(['png'])}
OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=False), [], tool], expected_logs=expected_logs, expected_stderr=expected_stderr)
expected_logs_with_optimize = expected_logs + (
@@ -238,7 +238,7 @@
"MOCK run_command: ['echo', 'optimize-baselines', 'userscripts/another-test.html'], cwd=/mock-checkout\n"
"MOCK run_command: ['echo', 'optimize-baselines', 'userscripts/images.svg'], cwd=/mock-checkout\n")
- command._tests_to_rebaseline = lambda port: ['userscripts/another-test.html', 'userscripts/images.svg']
+ command._tests_to_rebaseline = lambda port: {'userscripts/another-test.html': set(['txt']), 'userscripts/images.svg': set(['png'])}
OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=True), [], tool], expected_logs=expected_logs_with_optimize, expected_stderr=expected_stderr_with_optimize)
def test_overrides_are_included_correctly(self):
@@ -255,5 +255,5 @@
port._filesystem.write_text_file(port.path_to_test_expectations_file(), '')
port._filesystem.write_text_file(port.layout_tests_dir() + '/userscripts/another-test.html', '')
port.test_expectations_overrides = lambda: self.overrides
- self.assertEquals(command._tests_to_rebaseline(port), set(['userscripts/another-test.html']))
+ self.assertEquals(command._tests_to_rebaseline(port), {'userscripts/another-test.html': set(['txt'])})
self.assertEquals(port._filesystem.read_text_file(port.path_to_test_expectations_file()), '')