Diff
Modified: trunk/Tools/ChangeLog (120235 => 120236)
--- trunk/Tools/ChangeLog 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/ChangeLog 2012-06-13 19:40:50 UTC (rev 120236)
@@ -1,3 +1,61 @@
+2012-06-13 Dirk Pranke <[email protected]>
+
+ nrwt: restructure the port classes to handle multiple expectations files
+ https://bugs.webkit.org/show_bug.cgi?id=88944
+
+ Reviewed by Ojan Vafai.
+
+ This patch restructures the Port classes so that each port
+ returns a list of TestExpectations files to be used (in a new, public,
+ expectations_files() method), and the base implementation rolls them
+ up into the ordered expectations_dict(), which becomes a public
+ method.
+
+ port.path_to_test_expectations_file(), port.test_expectations(),
+ and port.test_expectations_overrides() are then reimplemented as
+ wrappers around port.expectations_dict().
+ port.test_expectations() and port.test_expectations_overrides()
+ will eventually be removed when the cascade is fully completed,
+ and port.path_to_test_expectations_file() will be removed when
+ the rebaselining tool supports the cascade
+ (expectations_files() may also become private at that point).
+
+ There should be no functional changes in this patch, but a bunch
+ of custom logic gets deleted!
+
+ * Scripts/webkitpy/layout_tests/port/base.py:
+ (Port.expectations_dict):
+ (Port):
+ (Port.expectations_files):
+ (Port.test_expectations):
+ (Port.test_expectations_overrides):
+ * Scripts/webkitpy/layout_tests/port/base_unittest.py:
+ (PortTest.test_additional_expectations):
+ (PortTest.test_uses_test_expectations_file):
+ * Scripts/webkitpy/layout_tests/port/chromium.py:
+ (ChromiumPort.all_baseline_variants):
+ (ChromiumPort.expectations_files):
+ * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
+ (ChromiumPortTest.test_overrides_and_builder_names):
+ * Scripts/webkitpy/layout_tests/port/google_chrome.py:
+ (_expectations_files):
+ (GoogleChromeLinux32Port.expectations_files):
+ (GoogleChromeLinux64Port.expectations_files):
+ (GoogleChromeMacPort.expectations_files):
+ (GoogleChromeWinPort.expectations_files):
+ * Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py:
+ (TestGoogleChromePort._verify_expectations_overrides):
+ * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+ (PortTestCase.test_expectations_ordering):
+ * Scripts/webkitpy/layout_tests/port/webkit.py:
+ (WebKitPort._skipped_file_search_paths):
+ * Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
+ (TestRebaseline.test_rebaseline_updates_expectations_file_noop):
+ (test_rebaseline_updates_expectations_file):
+ (test_rebaseline_does_not_include_overrides):
+ (test_rebaseline_expectations):
+ (test_overrides_are_included_correctly):
+
2012-06-13 Brent Fulgham <[email protected]>
[WinCairo] Update URL of WinCairoRequirements.zip download.
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -236,6 +236,7 @@
expectation_line.original_string = test_name
expectation_line.modifiers = [TestExpectationParser.DUMMY_BUG_MODIFIER, TestExpectationParser.SKIP_MODIFIER]
expectation_line.name = test_name
+ # FIXME: we should pass in a more descriptive string here.
expectation_line.filename = '<Skipped file>'
expectation_line.line_number = 0
expectation_line.expectations = [TestExpectationParser.PASS_EXPECTATION]
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -894,7 +894,7 @@
# some ports have Skipped files which are returned as part of test_expectations().
return self._filesystem.exists(self.path_to_test_expectations_file())
- def _expectations_dict(self):
+ def expectations_dict(self):
"""Returns an OrderedDict of name -> expectations strings. The names
are expected to be (but not required to be) paths in the filesystem.
If the name is a path, the file can be considered updatable for things
@@ -904,30 +904,31 @@
honors both formats), then any built-in expectations (e.g., from compile-time
exclusions), then --additional-expectations options."""
# FIXME: rename this to test_expectations() once all the callers are updated to know about the ordered dict.
- overrides = OrderedDict()
- path = self.path_to_test_expectations_file()
- overrides[path] = self._filesystem.read_text_file(path)
- return overrides
+ expectations = OrderedDict()
- def test_expectations(self):
- """Returns the test expectations for this port.
+ for path in self.expectations_files():
+ expectations[path] = self._filesystem.read_text_file(path)
- Basically this string should contain the equivalent of a
- test_expectations file. See test_expectations.py for more details."""
- return ''.join(self._expectations_dict().values())
-
- def _expectations_overrides_dict(self):
- # FIXME: merge this into test_expectations() when _expectations_dict() is renamed.
- overrides = OrderedDict()
for path in self.get_option('additional_expectations', []):
expanded_path = self._filesystem.expanduser(path)
if self._filesystem.exists(expanded_path):
_log.debug("reading additional_expectations from path '%s'" % path)
- overrides[path] = self._filesystem.read_text_file(path)
+ expectations[path] = self._filesystem.read_text_file(expanded_path)
else:
_log.warning("additional_expectations path '%s' does not exist" % path)
- return overrides
+ return expectations
+ def expectations_files(self):
+ return [self.path_to_test_expectations_file()]
+
+ def test_expectations(self):
+ """Returns the test expectations for this port.
+
+ Basically this string should contain the equivalent of a
+ test_expectations file. See test_expectations.py for more details."""
+ # FIXME: remove this when the cascade works fully.
+ return self.expectations_dict().values()[0]
+
def test_expectations_overrides(self):
"""Returns an optional set of overrides for the test_expectations.
@@ -935,9 +936,9 @@
it is possible that you might need "downstream" expectations that
temporarily override the "upstream" expectations until the port can
sync up the two repos."""
- overrides = self._expectations_overrides_dict()
- if overrides:
- return ''.join(overrides.values())
+ # FIXME: remove this when the cascade works fully.
+ if len(self.expectations_dict()) > 1:
+ return ''.join(self.expectations_dict().values()[1:])
return None
def repository_paths(self):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -280,6 +280,8 @@
def test_additional_expectations(self):
port = self.make_port(port_name='foo')
+ port.port_name = 'foo'
+ port._filesystem.write_text_file('/mock-checkout/LayoutTests/platform/foo/TestExpectations', '')
port._filesystem.write_text_file(
'/tmp/additional-expectations-1.txt', 'content1\n')
@@ -302,6 +304,7 @@
def test_uses_test_expectations_file(self):
port = self.make_port(port_name='foo')
+ port.port_name = 'foo'
port.path_to_test_expectations_file = lambda: '/mock-results/test_expectations.txt'
self.assertFalse(port.uses_test_expectations_file())
port._filesystem = MockFileSystem({'/mock-results/test_expectations.txt': ''})
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -310,14 +310,6 @@
def all_baseline_variants(self):
return self.ALL_BASELINE_VARIANTS
- def test_expectations(self):
- """Returns the test expectations for this port.
-
- Basically this string should contain the equivalent of a
- test_expectations file. See test_expectations.py for more details."""
- expectations_path = self.path_to_test_expectations_file()
- return self._filesystem.read_text_file(expectations_path)
-
def _generate_all_test_configurations(self):
"""Returns a sequence of the TestConfigurations the port supports."""
# By default, we assume we want to test every graphics type in
@@ -337,38 +329,13 @@
'win_layout_rel',
])
- def _expectations_file_contents(self, filetype, filepath):
- if self._filesystem.exists(filepath):
- _log.debug(
- "reading %s test_expectations overrides from file '%s'" %
- (filetype, filepath))
- return (self._filesystem.read_text_file(filepath) or '')
- else:
- # FIXME: This allows this to work with mock checkouts;
- # This probably shouldn't be used with a mock checkout, though.
- if not 'mock-checkout' in filepath:
- _log.warning(
- "%s test_expectations overrides file '%s' does not exist" %
- (filetype, filepath))
- return ''
-
- def test_expectations_overrides(self):
- combined_overrides = ''
- combined_overrides += self._expectations_file_contents(
- 'skia', self.path_from_chromium_base(
- 'skia', 'skia_test_expectations.txt'))
- # FIXME: It seems bad that run_webkit_tests.py uses a hardcoded dummy
- # builder string instead of just using None.
+ def expectations_files(self):
+ paths = [self.path_to_test_expectations_file(), self.path_from_chromium_base('skia', 'skia_test_expectations.txt')]
builder_name = self.get_option('builder_name', 'DUMMY_BUILDER_NAME')
if builder_name == 'DUMMY_BUILDER_NAME' or '(deps)' in builder_name or builder_name in self.try_builder_names:
- combined_overrides += self._expectations_file_contents(
- 'chromium', self.path_from_chromium_base(
- 'webkit', 'tools', 'layout_tests', 'test_expectations.txt'))
+ paths.append(self.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations.txt'))
+ return paths
- base_overrides = super(ChromiumPort, self).test_expectations_overrides()
- combined_overrides += (base_overrides or '')
- return combined_overrides
-
def repository_paths(self):
repos = super(ChromiumPort, self).repository_paths()
repos.append(('chromium', self.path_from_chromium_base('build')))
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -294,8 +294,11 @@
def test_overrides_and_builder_names(self):
port = self.make_port()
+ port.port_name = 'chromium'
filesystem = MockFileSystem()
+ filesystem.write_text_file('/mock-checkout/LayoutTests/platform/chromium/TestExpectations', '')
+
port._filesystem = filesystem
port.path_from_chromium_base = lambda *comps: '/' + '/'.join(comps)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -29,23 +29,10 @@
import chromium_win
-def _test_expectations_overrides(port, super):
- # The chrome ports use the regular overrides plus anything in the
- # official test_expectations as well. Hopefully we don't get collisions.
- chromium_overrides = super.test_expectations_overrides(port)
+def _expectations_files(port, super):
+ return super.expectations_files(port) + [port.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations_chrome.txt')]
- # FIXME: It used to be that AssertionError would get raised by
- # path_from_chromium_base() if we weren't in a Chromium checkout, but
- # this changed in r60427. This should probably be changed back.
- overrides_path = port.path_from_chromium_base('webkit', 'tools',
- 'layout_tests', 'test_expectations_chrome.txt')
- if not port._filesystem.exists(overrides_path):
- return chromium_overrides
- chromium_overrides = chromium_overrides or ''
- return chromium_overrides + port._filesystem.read_text_file(overrides_path)
-
-
class GoogleChromeLinux32Port(chromium_linux.ChromiumLinuxPort):
port_name = 'google-chrome-linux32'
@@ -59,8 +46,8 @@
paths.insert(0, self._webkit_baseline_path('google-chrome-linux32'))
return paths
- def test_expectations_overrides(self):
- return _test_expectations_overrides(self, chromium_linux.ChromiumLinuxPort)
+ def expectations_files(self):
+ return _expectations_files(self, chromium_linux.ChromiumLinuxPort)
def architecture(self):
return 'x86'
@@ -79,8 +66,8 @@
paths.insert(0, self._webkit_baseline_path('google-chrome-linux64'))
return paths
- def test_expectations_overrides(self):
- return _test_expectations_overrides(self, chromium_linux.ChromiumLinuxPort)
+ def expectations_files(self):
+ return _expectations_files(self, chromium_linux.ChromiumLinuxPort)
def architecture(self):
return 'x86_64'
@@ -99,8 +86,8 @@
paths.insert(0, self._webkit_baseline_path('google-chrome-mac'))
return paths
- def test_expectations_overrides(self):
- return _test_expectations_overrides(self, chromium_mac.ChromiumMacPort)
+ def expectations_files(self):
+ return _expectations_files(self, chromium_mac.ChromiumMacPort)
class GoogleChromeWinPort(chromium_win.ChromiumWinPort):
@@ -116,5 +103,5 @@
paths.insert(0, self._webkit_baseline_path('google-chrome-win'))
return paths
- def test_expectations_overrides(self):
- return _test_expectations_overrides(self, chromium_win.ChromiumWinPort)
+ def expectations_files(self):
+ return _expectations_files(self, chromium_win.ChromiumWinPort)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -38,24 +38,11 @@
def _verify_expectations_overrides(self, port_name):
host = MockSystemHost()
- chromium_port = PortFactory(host).get("chromium-mac-leopard")
- chromium_base = chromium_port.path_from_chromium_base()
port = PortFactory(host).get(port_name=port_name, options=None)
+ self.assertTrue('TestExpectations' in port.expectations_files()[0])
+ self.assertTrue('skia_test_expectations.txt' in port.expectations_files()[1])
+ self.assertTrue('test_expectations_chrome.txt' in port.expectations_files()[-1])
- expected_chromium_overrides = '// chromium overrides\n'
- expected_chrome_overrides = '// chrome overrides\n'
- chromium_path = host.filesystem.join(chromium_base, 'webkit', 'tools', 'layout_tests', 'test_expectations.txt')
- chrome_path = host.filesystem.join(chromium_base, 'webkit', 'tools', 'layout_tests', 'test_expectations_chrome.txt')
-
- host.filesystem.files[chromium_path] = expected_chromium_overrides
- host.filesystem.files[chrome_path] = None
- actual_chrome_overrides = port.test_expectations_overrides()
- self.assertEqual(expected_chromium_overrides, actual_chrome_overrides)
-
- host.filesystem.files[chrome_path] = expected_chrome_overrides
- actual_chrome_overrides = port.test_expectations_overrides()
- self.assertEqual(actual_chrome_overrides, expected_chromium_overrides + expected_chrome_overrides)
-
def test_get_google_chrome_port(self):
self._verify_baseline_search_path_startswith('google-chrome-linux32', ['google-chrome-linux32', 'chromium-linux-x86'])
self._verify_baseline_search_path_startswith('google-chrome-linux64', ['google-chrome-linux64', 'chromium-linux'])
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -341,20 +341,20 @@
def test_expectations_ordering(self):
port = self.make_port()
- path = port.path_to_test_expectations_file()
- if not port._filesystem.exists(path):
+ for path in port.expectations_files():
port._filesystem.write_text_file(path, '')
- ordered_dict = port._expectations_dict()
- self.assertEquals(path, ordered_dict.keys()[0])
+ ordered_dict = port.expectations_dict()
+ self.assertEquals(port.path_to_test_expectations_file(), ordered_dict.keys()[0])
- def test_expectations_overrides_ordering(self):
options = MockOptions(additional_expectations=['/tmp/foo', '/tmp/bar'])
port = self.make_port(options=options)
+ for path in port.expectations_files():
+ port._filesystem.write_text_file(path, '')
port._filesystem.write_text_file('/tmp/foo', 'foo')
port._filesystem.write_text_file('/tmp/bar', 'bar')
- ordered_dict = port._expectations_overrides_dict()
- self.assertEquals(ordered_dict.keys(), options.additional_expectations)
- self.assertEquals(ordered_dict.values(), ['foo', 'bar'])
+ ordered_dict = port.expectations_dict()
+ self.assertEquals(ordered_dict.keys()[-2:], options.additional_expectations)
+ self.assertEquals(ordered_dict.values()[-2:], ['foo', 'bar'])
# FIXME: This class and main() should be merged into test-webkitpy.
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -356,15 +356,6 @@
return search_paths
- def test_expectations(self):
- # This allows ports to use a combination of TestExpectations files and Skipped lists.
- expectations = ''
- expectations_path = self.path_to_test_expectations_file()
- if self._filesystem.exists(expectations_path):
- _log.debug("Using test expectations: %s" % expectations_path)
- expectations = self._filesystem.read_text_file(expectations_path)
- return expectations
-
def skipped_layout_tests(self, test_list):
tests_to_skip = set(self._expectations_from_skipped_files(self._skipped_file_search_paths()))
tests_to_skip.update(self._tests_for_other_platforms())
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py (120235 => 120236)
--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py 2012-06-13 19:28:17 UTC (rev 120235)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py 2012-06-13 19:40:50 UTC (rev 120236)
@@ -48,6 +48,8 @@
command.bind_to_tool(tool)
lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
+ for path in lion_port.expectations_files():
+ tool.filesystem.write_text_file(path, '')
tool.filesystem.write_text_file(lion_port.path_to_test_expectations_file(), """BUGB MAC LINUX XP DEBUG : fast/dom/Window/window-postmessage-clone-really-deep-array.html = PASS
BUGA DEBUG : fast/css/large-list-of-rules-crash.html = TEXT
""")
@@ -72,6 +74,7 @@
command.bind_to_tool(tool)
lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
+ tool.filesystem.write_text_file(lion_port.path_from_chromium_base('skia', 'skia_test_expectations.txt'), '')
tool.filesystem.write_text_file(lion_port.path_to_test_expectations_file(), "BUGX MAC : userscripts/another-test.html = IMAGE\nBUGZ LINUX : userscripts/another-test.html = IMAGE\n")
tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "userscripts/another-test.html"), "Dummy test contents")
@@ -90,6 +93,7 @@
command.bind_to_tool(tool)
lion_port = tool.port_factory.get_from_builder_name("Webkit Mac10.7")
+ tool.filesystem.write_text_file(lion_port.path_from_chromium_base('skia', 'skia_test_expectations.txt'), '')
tool.filesystem.write_text_file(lion_port.path_to_test_expectations_file(), "BUGX MAC : userscripts/another-test.html = IMAGE\nBUGZ LINUX : userscripts/another-test.html = IMAGE\n")
tool.filesystem.write_text_file(lion_port.path_from_chromium_base('skia', 'skia_test_expectations.txt'), "BUGY MAC : other-test.html = TEXT\n")
tool.filesystem.write_text_file(os.path.join(lion_port.layout_tests_dir(), "userscripts/another-test.html"), "Dummy test contents")
@@ -179,7 +183,8 @@
for port_name in tool.port_factory.all_port_names():
port = tool.port_factory.get(port_name)
- tool.filesystem.write_text_file(port.path_to_test_expectations_file(), '')
+ for path in port.expectations_files():
+ tool.filesystem.write_text_file(path, '')
# Don't enable logging until after we create the mock expectation files as some Port.__init__'s run subcommands.
tool.executive = MockExecutive(should_log=True)
@@ -252,7 +257,8 @@
self.overrides = ('BUGX REBASELINE : userscripts/another-test.html = TEXT\n'
'BUGY : userscripts/test.html = CRASH\n')
- port._filesystem.write_text_file(port.path_to_test_expectations_file(), '')
+ for path in port.expectations_files():
+ port._filesystem.write_text_file(path, '')
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), {'userscripts/another-test.html': set(['txt'])})