Title: [103289] trunk/Tools
Revision
103289
Author
[email protected]
Date
2011-12-19 17:16:29 -0800 (Mon, 19 Dec 2011)

Log Message

webkitpy: remove port.executive, port.filesystem, port.user properties
https://bugs.webkit.org/show_bug.cgi?id=74896

Reviewed by Eric Seidel.

Following on the refactoring of the port and host objects, this
removes the public executive, filesystem, and user properties
from the Port interface (protected versions of executive and
filesystem still exist). There is still some more clean up to
make the code more consistent and rearrange some other files to
talk to Hosts directly instead of getting them off of the Port
class.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.__init__):
(Manager.results_directory):
(Manager._log_worker_stack):
* Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
(ManagerTest.test_fallback_path_in_config):
* Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
(_InlineManager.start_worker):
(_InlineWorkerConnection.__init__):
* Scripts/webkitpy/layout_tests/controllers/worker.py:
(Worker.safe_init):
* Scripts/webkitpy/layout_tests/models/test_configuration.py:
(TestConfiguration.from_port):
* Scripts/webkitpy/layout_tests/port/base.py:
(Port.__init__):
(Port.tests):
(Port.show_results_html_file):
* Scripts/webkitpy/layout_tests/port/base_unittest.py:
(PortTest.test_layout_tests_skipping):
(PortTest.test_test_dirs):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(_set_up_derived_options):
* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner.__init__):
* Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py:
(HtmlGenerator.__init__):
(HtmlGenerator.show_html):
(real_main):
* Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests_unittest.py:
(TestHtmlGenerator.make_generator):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (103288 => 103289)


--- trunk/Tools/ChangeLog	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/ChangeLog	2011-12-20 01:16:29 UTC (rev 103289)
@@ -1,3 +1,49 @@
+2011-12-19  Dirk Pranke  <[email protected]>
+
+        webkitpy: remove port.executive, port.filesystem, port.user properties
+        https://bugs.webkit.org/show_bug.cgi?id=74896
+
+        Reviewed by Eric Seidel.
+
+        Following on the refactoring of the port and host objects, this
+        removes the public executive, filesystem, and user properties
+        from the Port interface (protected versions of executive and
+        filesystem still exist). There is still some more clean up to
+        make the code more consistent and rearrange some other files to
+        talk to Hosts directly instead of getting them off of the Port
+        class.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager.__init__):
+        (Manager.results_directory):
+        (Manager._log_worker_stack):
+        * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
+        (ManagerTest.test_fallback_path_in_config):
+        * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
+        (_InlineManager.start_worker):
+        (_InlineWorkerConnection.__init__):
+        * Scripts/webkitpy/layout_tests/controllers/worker.py:
+        (Worker.safe_init):
+        * Scripts/webkitpy/layout_tests/models/test_configuration.py:
+        (TestConfiguration.from_port):
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.__init__):
+        (Port.tests):
+        (Port.show_results_html_file):
+        * Scripts/webkitpy/layout_tests/port/base_unittest.py:
+        (PortTest.test_layout_tests_skipping):
+        (PortTest.test_test_dirs):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (_set_up_derived_options):
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (PerfTestsRunner.__init__):
+        * Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py:
+        (HtmlGenerator.__init__):
+        (HtmlGenerator.show_html):
+        (real_main):
+        * Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests_unittest.py:
+        (TestHtmlGenerator.make_generator):
+
 2011-12-19  Daniel Bates  <[email protected]>
 
         Pass command line arguments to GDB when debugging a Mac WebKit application

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -290,7 +290,8 @@
           printer: a Printer object to record updates to.
         """
         self._port = port
-        self._fs = port.filesystem
+        # FIXME: Rename to self._filesystem for consistency with other code.
+        self._fs = port.host.filesystem
         self._options = options
         self._printer = printer
         self._message_broker = None
@@ -828,8 +829,8 @@
         if not self._retrying:
             return self._results_directory
         else:
-            self._port._filesystem.maybe_make_directory(self._port._filesystem.join(self._results_directory, 'retries'))
-            return self._port._filesystem.join(self._results_directory, 'retries')
+            self._fs.maybe_make_directory(self._fs.join(self._results_directory, 'retries'))
+            return self._fs.join(self._results_directory, 'retries')
 
     def update(self):
         self.update_summary(self._current_result_summary)
@@ -1461,7 +1462,7 @@
         self._update_summary_with_result(self._current_result_summary, result)
 
     def _log_worker_stack(self, stack):
-        webkitpydir = self._port.path_from_webkit_base('Tools', 'Scripts', 'webkitpy') + self._port.filesystem.sep
+        webkitpydir = self._port.path_from_webkit_base('Tools', 'Scripts', 'webkitpy') + self._fs.sep
         for filename, line_number, function_name, text in stack:
             if filename.startswith(webkitpydir):
                 filename = filename.replace(webkitpydir, '')

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -163,7 +163,7 @@
         host = MockHost()
         port = host.port_factory.get('test-mac-leopard', options=options)
         printer = self.get_printer()
-        manager = Manager(port, port.options, printer)
+        manager = Manager(port, options, printer)
         manager.print_config()
         self.assertTrue('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic' in printer.output)
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -168,7 +168,7 @@
 
     def start_worker(self, worker_number, results_directory):
         self._inline_worker = _InlineWorkerConnection(self._broker, self._port,
-            self._client, self._worker_class, worker_number, results_directory)
+            self._client, self._worker_class, worker_number, results_directory, self._options)
         return self._inline_worker
 
     def run_message_loop(self, delay_secs=None):
@@ -215,8 +215,8 @@
 
 
 class _InlineWorkerConnection(_WorkerConnection):
-    def __init__(self, broker, port, manager_client, worker_class, worker_number, results_directory):
-        _WorkerConnection.__init__(self, broker, worker_class, worker_number, results_directory, port.options)
+    def __init__(self, broker, port, manager_client, worker_class, worker_number, results_directory, options):
+        _WorkerConnection.__init__(self, broker, worker_class, worker_number, results_directory, options)
         self._alive = False
         self._port = port
         self._manager_client = manager_client

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -65,7 +65,7 @@
         This routine exists so that the mixin can be created and then marshaled
         across into a child process."""
         self._port = port
-        self._filesystem = port.filesystem
+        self._filesystem = port.host.filesystem
         self._batch_count = 0
         self._batch_size = self._options.batch_size or 0
         tests_run_filename = self._filesystem.join(self._results_directory, "tests_run%d.txt" % self._worker_number)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -36,15 +36,6 @@
         self.graphics_type = graphics_type
 
     @classmethod
-    def from_port(cls, port):
-        assert(port)
-        version = port.version()
-        architecture = port.architecture()
-        build_type = port.options.configuration.lower()
-        graphics_type = port.graphics_type()
-        return TestConfiguration(version, architecture, build_type, graphics_type)
-
-    @classmethod
     def category_order(cls):
         """The most common human-readable order in which the configuration properties are listed."""
         return ['version', 'architecture', 'build_type', 'graphics_type']

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -93,7 +93,6 @@
         self.assertEquals(TestConfiguration('xp', 'x86', 'release', 'cpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
         host = MockHost()
         test_port = host.port_factory.get('test-win-xp', None)
-        self.assertEquals(TestConfiguration.from_port(test_port), TestConfiguration('xp', 'x86', 'release', 'cpu'))
         self.assertNotEquals(TestConfiguration('xp', 'x86', 'release', 'gpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
         self.assertNotEquals(TestConfiguration('xp', 'x86', 'debug', 'cpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
 
@@ -104,13 +103,7 @@
             result_config_values.append(value)
         self.assertEquals(set(['xp', 'x86', 'release', 'cpu']), set(result_config_values))
 
-    def test_from_port(self):
-        host = MockHost()
-        test_port = host.port_factory.get('test-win-xp', None)
-        config = TestConfiguration.from_port(test_port)
-        self.assertEquals('<xp, x86, release, cpu>', str(config))
 
-
 class SpecifierSorterTest(unittest.TestCase):
     def __init__(self, testFunc):
         self._all_test_configurations = make_mock_all_test_configurations_set()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -100,23 +100,13 @@
         # FIXME: Ideally we'd have a package-wide way to get a
         # well-formed options object that had all of the necessary
         # options defined on it.
-        self.options = options or DummyOptions()
+        self._options = options or DummyOptions()
 
         self.host = host
+        self._executive = host.executive
+        self._filesystem = host.filesystem
+        self._config = config or port_config.Config(self._executive, self._filesystem)
 
-        # FIXME: Remove thes accessors once all callers have moved to using self.host.
-        self.executive = self.host.executive
-        self.user = self.host.user
-        self.filesystem = self.host.filesystem
-        self.config = config or port_config.Config(self.executive, self.filesystem)
-
-        # FIXME: Remove all of the old "protected" versions when we can.
-        self._options = self.options
-        self._executive = self.executive
-        self._filesystem = self.filesystem
-        self._user = self.user
-        self._config = self.config
-
         self._helper = None
         self._http_server = None
         self._websocket_server = None
@@ -503,7 +493,7 @@
         """Return the list of tests found."""
         # When collecting test cases, skip these directories
         skipped_directories = set(['.svn', '_svn', 'resources', 'script-tests', 'reference', 'reftest'])
-        files = find_files.find(self.filesystem, self.layout_tests_dir(), paths, skipped_directories, Port._is_test_file)
+        files = find_files.find(self._filesystem, self.layout_tests_dir(), paths, skipped_directories, Port._is_test_file)
         return set([self.relative_test_filename(f) for f in files])
 
     # When collecting test cases, we include any file with these extensions.
@@ -761,7 +751,7 @@
     def show_results_html_file(self, results_filename):
         """This routine should display the HTML file pointed at by
         results_filename in a users' browser."""
-        return self._user.open_url(results_filename)
+        return self.host.user.open_url(results_filename)
 
     def create_driver(self, worker_number):
         """Return a newly created Driver subclass for starting/stopping the test driver."""
@@ -837,7 +827,7 @@
     def test_configuration(self):
         """Returns the current TestConfiguration for the port."""
         if not self._test_configuration:
-            self._test_configuration = TestConfiguration.from_port(self)
+            self._test_configuration = TestConfiguration(self._version, self._architecture, self._options.configuration.lower(), self._graphics_type)
         return self._test_configuration
 
     # FIXME: Belongs on a Platform object.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -206,8 +206,8 @@
 
     def test_layout_tests_skipping(self):
         port = self.make_port()
-        port.filesystem.write_text_file(port.layout_tests_dir() + '/media/video-zoom.html', '')
-        port.filesystem.write_text_file(port.layout_tests_dir() + '/foo/bar.html', '')
+        port.host.filesystem.write_text_file(port.layout_tests_dir() + '/media/video-zoom.html', '')
+        port.host.filesystem.write_text_file(port.layout_tests_dir() + '/foo/bar.html', '')
         port.skipped_layout_tests = lambda: ['foo/bar.html', 'media']
         self.assertTrue(port.skips_layout_test('foo/bar.html'))
         self.assertTrue(port.skips_layout_test('media/video-zoom.html'))
@@ -220,8 +220,8 @@
 
     def test_test_dirs(self):
         port = self.make_port()
-        port._filesystem.write_text_file(port.layout_tests_dir() + '/canvas/test', '')
-        port._filesystem.write_text_file(port.layout_tests_dir() + '/css2.1/test', '')
+        port.host.filesystem.write_text_file(port.layout_tests_dir() + '/canvas/test', '')
+        port.host.filesystem.write_text_file(port.layout_tests_dir() + '/css2.1/test', '')
         dirs = port.test_dirs()
         self.assertTrue('canvas' in dirs)
         self.assertTrue('css2.1' in dirs)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -50,7 +50,7 @@
         WebKitPort.__init__(self, host=host, **kwargs)
 
     def all_test_configurations(self):
-        return [TestConfiguration.from_port(self)]
+        return [self.test_configuration()]
 
     def _runtime_feature_list(self):
         return self.feature_list

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -127,10 +127,10 @@
     if options.additional_platform_directory:
         normalized_platform_directories = []
         for path in options.additional_platform_directory:
-            if not port.filesystem.isabs(path):
+            if not port.host.filesystem.isabs(path):
                 warnings.append("--additional-platform-directory=%s is ignored since it is not absolute" % path)
                 continue
-            normalized_platform_directories.append(port.filesystem.normpath(path))
+            normalized_platform_directories.append(port.host.filesystem.normpath(path))
         options.additional_platform_directory = normalized_platform_directories
 
     if not options.http and options.force:

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -54,7 +54,7 @@
         self._host._initialize_scm()
         self._port = self._host.port_factory.get(self._options.platform, self._options)
         self._printer = printing.Printer(self._port, self._options, regular_output, buildbot_output, configure_logging=False)
-        self._webkit_base_dir_len = len(self._port.config.webkit_base_dir())
+        self._webkit_base_dir_len = len(self._port.webkit_base())
 
     def _parse_args(self, args=None):
         print_options = printing.print_options()

Modified: trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -652,14 +652,15 @@
                         '<img style="width: 200" src="" /></a></td>')
     HTML_TR = '<tr>%s</tr>'
 
-    def __init__(self, port, target_port, options, platforms, rebaselining_tests):
+    def __init__(self, host, port, target_port, options, platforms, rebaselining_tests):
         self._html_directory = options.html_directory
+        self._host = host
+        self._filesystem = host.filesystem
         self._port = port
         self._target_port = target_port
         self._options = options
         self._platforms = platforms
         self._rebaselining_tests = rebaselining_tests
-        self._filesystem = port._filesystem
         self._html_file = self._filesystem.join(options.html_directory,
                                                 'rebaseline.html')
 
@@ -695,7 +696,7 @@
         """Launch the rebaselining html in brwoser."""
 
         _log.debug('Launching html: "%s"', self._html_file)
-        self._port._user.open_url(self._html_file)
+        self._host.user.open_url(self._html_file)
         _log.debug('Html launched.')
 
     def _generate_baseline_links(self, test_basename, suffix, platform):
@@ -1030,7 +1031,7 @@
 
     _log.debug('')
     log_dashed_string('Rebaselining result comparison started')
-    html_generator = HtmlGenerator(host_port_obj,
+    html_generator = HtmlGenerator(host, host_port_obj,
                                    target_port_obj,
                                    options,
                                    rebaseline_platforms,

Modified: trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests_unittest.py (103288 => 103289)


--- trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests_unittest.py	2011-12-20 01:13:37 UTC (rev 103288)
+++ trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests_unittest.py	2011-12-20 01:16:29 UTC (rev 103289)
@@ -377,7 +377,7 @@
             fs.maybe_make_directory(fs.dirname(filename))
             fs.write_binary_file(filename, contents)
         host_port = host.port_factory.get('test', options)
-        generator = rebaseline_chromium_webkit_tests.HtmlGenerator(host_port,
+        generator = rebaseline_chromium_webkit_tests.HtmlGenerator(host, host_port,
             target_port=None, options=options, platforms=['test-mac-leopard'], rebaselining_tests=tests)
         return generator, host_port
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to