Title: [94718] trunk/Tools
Revision
94718
Author
[email protected]
Date
2011-09-07 15:19:14 -0700 (Wed, 07 Sep 2011)

Log Message

Teach the PortFactory object how to pass along executive/user/filesystem to port objects (which fixes the failing rebaseline_test on bots)
https://bugs.webkit.org/show_bug.cgi?id=67737

Reviewed by Adam Barth.

I got a little over-eager when deprecating host.port_factory in the previous commit.
Turns out that Host.port_factory was already the "modern" port/factory.py
it was just the Module object.  I un-deprecated the variable, and changed it from
being the module to being an actual PortFactory, passing it a host object.
I also taught PortFactory how to set user/executive/filesystem in the kwargs
when instantiating a new Port object.
This magically fixed the test_rebaseline test, since its now no longer talking
to the real filesystem.

* Scripts/webkitpy/common/host.py:
* Scripts/webkitpy/layout_tests/port/factory.py:
* Scripts/webkitpy/tool/commands/queries.py:
* Scripts/webkitpy/tool/mocktool.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (94717 => 94718)


--- trunk/Tools/ChangeLog	2011-09-07 21:44:49 UTC (rev 94717)
+++ trunk/Tools/ChangeLog	2011-09-07 22:19:14 UTC (rev 94718)
@@ -1,5 +1,26 @@
 2011-09-07  Eric Seidel  <[email protected]>
 
+        Teach the PortFactory object how to pass along executive/user/filesystem to port objects (which fixes the failing rebaseline_test on bots)
+        https://bugs.webkit.org/show_bug.cgi?id=67737
+
+        Reviewed by Adam Barth.
+
+        I got a little over-eager when deprecating host.port_factory in the previous commit.
+        Turns out that Host.port_factory was already the "modern" port/factory.py
+        it was just the Module object.  I un-deprecated the variable, and changed it from
+        being the module to being an actual PortFactory, passing it a host object.
+        I also taught PortFactory how to set user/executive/filesystem in the kwargs
+        when instantiating a new Port object.
+        This magically fixed the test_rebaseline test, since its now no longer talking
+        to the real filesystem.
+
+        * Scripts/webkitpy/common/host.py:
+        * Scripts/webkitpy/layout_tests/port/factory.py:
+        * Scripts/webkitpy/tool/commands/queries.py:
+        * Scripts/webkitpy/tool/mocktool.py:
+
+2011-09-07  Eric Seidel  <[email protected]>
+
         Add a new PortFactory class for creating new-style ports and deprecate the old PortFactory
         https://bugs.webkit.org/show_bug.cgi?id=67734
 

Modified: trunk/Tools/Scripts/webkitpy/common/host.py (94717 => 94718)


--- trunk/Tools/Scripts/webkitpy/common/host.py	2011-09-07 21:44:49 UTC (rev 94717)
+++ trunk/Tools/Scripts/webkitpy/common/host.py	2011-09-07 22:19:14 UTC (rev 94718)
@@ -36,7 +36,7 @@
 from webkitpy.common.net.buildbot.chromiumbuildbot import ChromiumBuildBot
 from webkitpy.common.net.irc import ircproxy
 from webkitpy.common.system import executive, filesystem, platforminfo, user, workspace
-from webkitpy.layout_tests import port
+from webkitpy.layout_tests.port.factory import PortFactory
 
 
 class Host(object):
@@ -53,7 +53,10 @@
         self._scm = None
         self._checkout = None
         self.status_server = statusserver.StatusServer()
-        self._deprecated_port_factory = port.factory
+        # FIXME: Unfortunately Port objects are currently the central-dispatch objects of the NRWT world.
+        # In order to instantiate a port correctly, we have to pass it at least an executive, user, scm, and filesystem
+        # so for now we just pass along the whole Host object.
+        self.port_factory = PortFactory(self)
         self.platform = platforminfo.PlatformInfo()
 
     def _initialize_scm(self, patch_directories=None):

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py (94717 => 94718)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py	2011-09-07 21:44:49 UTC (rev 94717)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py	2011-09-07 22:19:14 UTC (rev 94718)
@@ -43,7 +43,6 @@
 
 class PortFactory(object):
     def __init__(self, host=None):
-        # FIXME: All callers should pass a port.
         self._host = host
 
     def _port_name_from_arguments_and_options(self, **kwargs):
@@ -109,6 +108,15 @@
             maker = google_chrome.GetGoogleChromePort
         else:
             raise NotImplementedError('unsupported port: %s' % port_to_use)
+
+        # Make sure that any Ports created by this factory inherit
+        # the executive/user/filesystem from the provided host.
+        # FIXME: Eventually NRWT will use a Host object and Port will no longer store these pointers.
+        if self._host:
+            kwargs.setdefault('executive', self._host.executive)
+            kwargs.setdefault('user', self._host.user)
+            kwargs.setdefault('filesystem', self._host.filesystem)
+
         return maker(**kwargs)
 
     def all_port_names(self):

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queries.py (94717 => 94718)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queries.py	2011-09-07 21:44:49 UTC (rev 94717)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries.py	2011-09-07 22:19:14 UTC (rev 94718)
@@ -387,7 +387,7 @@
 
     def execute(self, options, args, tool):
         results = dict([(test_name, []) for test_name in args])
-        for port_name, port_object in tool._deprecated_port_factory.get_all().iteritems():
+        for port_name, port_object in tool.port_factory.get_all().iteritems():
             for test_name in args:
                 if port_object.skips_layout_test(test_name):
                     results[test_name].append(port_name)

Modified: trunk/Tools/Scripts/webkitpy/tool/mocktool.py (94717 => 94718)


--- trunk/Tools/Scripts/webkitpy/tool/mocktool.py	2011-09-07 21:44:49 UTC (rev 94717)
+++ trunk/Tools/Scripts/webkitpy/tool/mocktool.py	2011-09-07 22:19:14 UTC (rev 94718)
@@ -790,19 +790,16 @@
 
 
 class MockTestPort1(object):
-
     def skips_layout_test(self, test_name):
         return test_name in ["media/foo/bar.html", "foo"]
 
 
 class MockTestPort2(object):
-
     def skips_layout_test(self, test_name):
         return test_name == "media/foo/bar.html"
 
 
-class MockDeprecatedPortFactory(object):
-
+class MockPortFactory(object):
     def get_all(self, options=None):
         return {"test_port1": MockTestPort1(), "test_port2": MockTestPort2()}
 
@@ -826,7 +823,6 @@
 
 
 class MockTool(object):
-
     def __init__(self, log_executive=False):
         self.wakeup_event = threading.Event()
         self.bugs = MockBugzilla()
@@ -845,7 +841,7 @@
         self._checkout = MockCheckout()
         self.status_server = MockStatusServer()
         self.irc_password = "MOCK irc password"
-        self._deprecated_port_factory = MockDeprecatedPortFactory()
+        self.port_factory = MockPortFactory()
         self.platform = MockPlatformInfo()
 
     def scm(self):
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to