Title: [119649] trunk/Tools
Revision
119649
Author
[email protected]
Date
2012-06-06 17:31:55 -0700 (Wed, 06 Jun 2012)

Log Message

nrwt should look in 'out' for binaries on chromium win to support ninja
https://bugs.webkit.org/show_bug.cgi?id=88273

Reviewed by Tony Chang.

This patch standardizes the search algorithm the chromium ports
use to figure out which driver to run. We will look in a
chromium location before a webkit location (e.g., in
Source/WebKit/chromium/out before out/) and we will look in the
"legacy" directory (xcodebuild) before the directory ninja uses
(out).

Unfortunately due to the way the test code is set up testing the
properly requires some duplication of test code. I will fix that
in a followup patch.

* Scripts/webkitpy/layout_tests/port/chromium.py:
(ChromiumPort):
(ChromiumPort._static_build_path):
(ChromiumPort._build_path):
* Scripts/webkitpy/layout_tests/port/chromium_linux.py:
(ChromiumLinuxPort):
(ChromiumLinuxPort._determine_driver_path_statically):
* Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py:
(ChromiumLinuxPortTest.test_build_path):
(ChromiumLinuxPortTest):
(ChromiumLinuxPortTest.test_driver_name_option):
(ChromiumLinuxPortTest.path_to_image_diff):
* Scripts/webkitpy/layout_tests/port/chromium_mac.py:
(ChromiumMacPort):
* Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py:
(ChromiumMacPortTest.test_build_path):
(ChromiumMacPortTest):
(ChromiumMacPortTest.test_driver_name_option):
(ChromiumMacPortTest.path_to_image_diff):
* Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
(ChromiumPortTest.test_overrides_and_builder_names):
* Scripts/webkitpy/layout_tests/port/chromium_win.py:
(ChromiumWinPort):
* Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
(ChromiumWinTest.test_build_path):
(ChromiumWinTest.test_operating_system):
(ChromiumWinTest):
(ChromiumWinTest.test_driver_name_option):
(ChromiumWinPortTest.path_to_image_diff):
* Scripts/webkitpy/layout_tests/port/port_testcase.py:
(PortTestCase.assert_build_path):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (119648 => 119649)


--- trunk/Tools/ChangeLog	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/ChangeLog	2012-06-07 00:31:55 UTC (rev 119649)
@@ -1,3 +1,53 @@
+2012-06-06  Dirk Pranke  <[email protected]>
+
+        nrwt should look in 'out' for binaries on chromium win to support ninja
+        https://bugs.webkit.org/show_bug.cgi?id=88273
+
+        Reviewed by Tony Chang.
+
+        This patch standardizes the search algorithm the chromium ports
+        use to figure out which driver to run. We will look in a
+        chromium location before a webkit location (e.g., in
+        Source/WebKit/chromium/out before out/) and we will look in the
+        "legacy" directory (xcodebuild) before the directory ninja uses
+        (out).
+
+        Unfortunately due to the way the test code is set up testing the
+        properly requires some duplication of test code. I will fix that
+        in a followup patch.
+
+        * Scripts/webkitpy/layout_tests/port/chromium.py:
+        (ChromiumPort):
+        (ChromiumPort._static_build_path):
+        (ChromiumPort._build_path):
+        * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
+        (ChromiumLinuxPort):
+        (ChromiumLinuxPort._determine_driver_path_statically):
+        * Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py:
+        (ChromiumLinuxPortTest.test_build_path):
+        (ChromiumLinuxPortTest):
+        (ChromiumLinuxPortTest.test_driver_name_option):
+        (ChromiumLinuxPortTest.path_to_image_diff):
+        * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+        (ChromiumMacPort):
+        * Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py:
+        (ChromiumMacPortTest.test_build_path):
+        (ChromiumMacPortTest):
+        (ChromiumMacPortTest.test_driver_name_option):
+        (ChromiumMacPortTest.path_to_image_diff):
+        * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
+        (ChromiumPortTest.test_overrides_and_builder_names):
+        * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+        (ChromiumWinPort):
+        * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
+        (ChromiumWinTest.test_build_path):
+        (ChromiumWinTest.test_operating_system):
+        (ChromiumWinTest):
+        (ChromiumWinTest.test_driver_name_option):
+        (ChromiumWinPortTest.path_to_image_diff):
+        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+        (PortTestCase.assert_build_path):
+
 2012-06-06  Jessie Berlin  <[email protected]>
 
         Remove very red Windows WebKit2 testers

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -85,7 +85,27 @@
         'android': ['icecreamsandwich'],
     }
 
+    DEFAULT_BUILD_DIRECTORIES = ('out',)
+
     @classmethod
+    def _static_build_path(cls, filesystem, build_directory, chromium_base, webkit_base, *comps):
+        if build_directory:
+            return filesystem.join(build_directory, *comps)
+
+        for directory in cls.DEFAULT_BUILD_DIRECTORIES:
+            base_dir = filesystem.join(chromium_base, directory)
+            if filesystem.exists(base_dir):
+                return filesystem.join(base_dir, *comps)
+
+        for directory in cls.DEFAULT_BUILD_DIRECTORIES:
+            base_dir = filesystem.join(webkit_base, directory)
+            if filesystem.exists(base_dir):
+                return filesystem.join(base_dir, *comps)
+
+        # We have to default to something, so pick the last one.
+        return filesystem.join(base_dir, *comps)
+
+    @classmethod
     def _chromium_base_dir(cls, filesystem):
         module_path = filesystem.path_to_module(cls.__module__)
         offset = module_path.find('third_party')
@@ -384,6 +404,9 @@
     # or any subclasses.
     #
 
+    def _build_path(self, *comps):
+        return self._static_build_path(self._filesystem, self.get_option('build_directory'), self.path_from_chromium_base(), self.path_from_webkit_base(), *comps)
+
     def _check_driver_build_up_to_date(self, configuration):
         if configuration in ('Debug', 'Release'):
             try:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -57,6 +57,8 @@
         ],
     }
 
+    DEFAULT_BUILD_DIRECTORIES = ('sconsbuild', 'out')
+
     @classmethod
     def _determine_driver_path_statically(cls, host, options):
         config_object = config.Config(host.executive, host.filesystem)
@@ -70,18 +72,6 @@
         return cls._static_build_path(host.filesystem, build_directory, chromium_base, webkit_base, configuration, 'DumpRenderTree')
 
     @staticmethod
-    def _static_build_path(filesystem, build_directory, chromium_base, webkit_base, *comps):
-        if build_directory:
-            return filesystem.join(build_directory, *comps)
-        if filesystem.exists(filesystem.join(chromium_base, 'sconsbuild')):
-            return filesystem.join(chromium_base, 'sconsbuild', *comps)
-        if filesystem.exists(filesystem.join(chromium_base, 'out')):
-            return filesystem.join(chromium_base, 'out', *comps)
-        if filesystem.exists(filesystem.join(webkit_base, 'sconsbuild')):
-            return filesystem.join(webkit_base, 'sconsbuild', *comps)
-        return filesystem.join(webkit_base, 'out', *comps)
-
-    @staticmethod
     def _determine_architecture(filesystem, executive, driver_path):
         file_output = ''
         if filesystem.exists(driver_path):
@@ -137,9 +127,6 @@
     # PROTECTED METHODS
     #
 
-    def _build_path(self, *comps):
-        return self._static_build_path(self._filesystem, self.get_option('build_directory'), self.path_from_chromium_base(), self.path_from_webkit_base(), *comps)
-
     def _check_apache_install(self):
         result = self._check_file_exists(self._path_to_apache(), "apache2")
         result = self._check_file_exists(self._path_to_apache_config_file(), "apache2 config file") and result

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -30,6 +30,7 @@
 
 from webkitpy.common.system import executive_mock
 from webkitpy.common.system.systemhost_mock import MockSystemHost
+from webkitpy.tool.mocktool import MockOptions
 
 from webkitpy.layout_tests.port import chromium_linux
 from webkitpy.layout_tests.port import port_testcase
@@ -89,6 +90,29 @@
     def test_operating_system(self):
         self.assertEqual('linux', self.make_port().operating_system())
 
+    def test_build_path(self):
+        # Test that optional paths are used regardless of whether they exist.
+        options = MockOptions(configuration='Release', build_directory='/foo')
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out'], '/foo')
 
+        # Test that optional relative paths are returned unmodified.
+        options = MockOptions(configuration='Release', build_directory='foo')
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out'], 'foo')
+
+        # Test that we look in a chromium directory before the webkit directory.
+        options = MockOptions(configuration='Release', build_directory=None)
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out', '/mock-checkout/out'], '/mock-checkout/Source/WebKit/chromium/out')
+
+        # Test that we prefer the legacy dir over the new dir.
+        options = MockOptions(configuration='Release', build_directory=None)
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/sconsbuild', '/mock-checkout/Source/WebKit/chromium/out'], '/mock-checkout/Source/WebKit/chromium/sconsbuild')
+
+    def test_driver_name_option(self):
+        self.assertTrue(self.make_port()._path_to_driver().endswith('DumpRenderTree'))
+        self.assertTrue(self.make_port(options=MockOptions(driver_name='OtherDriver'))._path_to_driver().endswith('OtherDriver'))
+
+    def test_path_to_image_diff(self):
+        self.assertEquals(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff')
+
 if __name__ == '__main__':
     port_testcase.main()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -68,6 +68,8 @@
         ],
     }
 
+    DEFAULT_BUILD_DIRECTORIES = ('xcodebuild', 'out')
+
     @classmethod
     def determine_full_port_name(cls, host, options, port_name):
         if port_name.endswith('-mac'):
@@ -113,26 +115,6 @@
     # PROTECTED METHODS
     #
 
-    def _build_path(self, *comps):
-        if self.get_option('build_directory'):
-            return self._filesystem.join(self.get_option('build_directory'),
-                                         *comps)
-        base = self.path_from_chromium_base()
-        path = self._filesystem.join(base, 'out', *comps)
-        if self._filesystem.exists(path):
-            return path
-
-        path = self._filesystem.join(base, 'xcodebuild', *comps)
-        if self._filesystem.exists(path):
-            return path
-
-        base = self.path_from_webkit_base()
-        path = self._filesystem.join(base, 'out', *comps)
-        if self._filesystem.exists(path):
-            return path
-
-        return self._filesystem.join(base, 'xcodebuild', *comps)
-
     def check_wdiff(self, logging=True):
         try:
             # We're ignoring the return and always returning True

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -30,6 +30,7 @@
 
 from webkitpy.layout_tests.port import chromium_mac
 from webkitpy.layout_tests.port import port_testcase
+from webkitpy.tool.mocktool import MockOptions
 
 
 class ChromiumMacPortTest(port_testcase.PortTestCase):
@@ -81,6 +82,30 @@
     def test_operating_system(self):
         self.assertEqual('mac', self.make_port().operating_system())
 
+    def test_build_path(self):
+        # Test that optional paths are used regardless of whether they exist.
+        options = MockOptions(configuration='Release', build_directory='/foo')
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out'], '/foo')
 
+        # Test that optional relative paths are returned unmodified.
+        options = MockOptions(configuration='Release', build_directory='foo')
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out'], 'foo')
+
+        # Test that we look in a chromium directory before the webkit directory.
+        options = MockOptions(configuration='Release', build_directory=None)
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out', '/mock-checkout/out'], '/mock-checkout/Source/WebKit/chromium/out')
+
+        # Test that we prefer the legacy dir over the new dir.
+        options = MockOptions(configuration='Release', build_directory=None)
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/xcodebuild', '/mock-checkout/Source/WebKit/chromium/out'], '/mock-checkout/Source/WebKit/chromium/xcodebuild')
+
+    def test_driver_name_option(self):
+        self.assertTrue(self.make_port()._path_to_driver().endswith('DumpRenderTree'))
+        self.assertTrue(self.make_port(options=MockOptions(driver_name='OtherDriver'))._path_to_driver().endswith('OtherDriver'))
+
+    def test_path_to_image_diff(self):
+        self.assertEquals(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff')
+
+
 if __name__ == '__main__':
     port_testcase.main()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -252,12 +252,6 @@
             self.default_configuration_called = True
             return 'default'
 
-    def test_path_to_image_diff(self):
-        # FIXME: These don't need to use endswith now that the port uses a MockFileSystem.
-        self.assertTrue(ChromiumPortTest.TestLinuxPort()._path_to_image_diff().endswith('/out/default/ImageDiff'))
-        self.assertTrue(ChromiumPortTest.TestMacPort()._path_to_image_diff().endswith('/xcodebuild/default/ImageDiff'))
-        self.assertTrue(ChromiumPortTest.TestWinPort()._path_to_image_diff().endswith('/default/ImageDiff.exe'))
-
     def test_default_configuration(self):
         mock_options = MockOptions()
         port = ChromiumPortTest.TestLinuxPort(options=mock_options)
@@ -345,17 +339,7 @@
         self.assertEquals(port.test_expectations_overrides(),
                           SKIA_OVERRIDES + ADDITIONAL_EXPECTATIONS)
 
-    def test_driver_name_option(self):
-        self.assertTrue(ChromiumPortTest.TestLinuxPort()._path_to_driver().endswith('/out/default/DumpRenderTree'))
-        self.assertTrue(ChromiumPortTest.TestMacPort()._path_to_driver().endswith('/xcodebuild/default/DumpRenderTree.app/Contents/MacOS/DumpRenderTree'))
-        self.assertTrue(ChromiumPortTest.TestWinPort()._path_to_driver().endswith('/default/DumpRenderTree.exe'))
 
-        options = MockOptions(driver_name='OtherDriver')
-        self.assertTrue(ChromiumPortTest.TestLinuxPort(options)._path_to_driver().endswith('/out/default/OtherDriver'))
-        self.assertTrue(ChromiumPortTest.TestMacPort(options)._path_to_driver().endswith('/xcodebuild/default/OtherDriver.app/Contents/MacOS/OtherDriver'))
-        self.assertTrue(ChromiumPortTest.TestWinPort(options)._path_to_driver().endswith('/default/OtherDriver.exe'))
-
-
 class ChromiumPortLoggingTest(logtesting.LoggingTestCase):
     def test_check_sys_deps(self):
         port = ChromiumPortTest.TestLinuxPort()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -66,6 +66,8 @@
         ],
     }
 
+    DEFAULT_BUILD_DIRECTORIES = ('build', 'out')
+
     @classmethod
     def determine_full_port_name(cls, host, options, port_name):
         if port_name.endswith('-win'):
@@ -128,15 +130,7 @@
     #
     # PROTECTED ROUTINES
     #
-    def _build_path(self, *comps):
-        if self.get_option('build_directory'):
-            return self._filesystem.join(self.get_option('build_directory'), *comps)
 
-        p = self.path_from_chromium_base('build', *comps)
-        if self._filesystem.exists(p):
-            return p
-        return self._filesystem.join(self.path_from_webkit_base(), 'Source', 'WebKit', 'chromium', 'build', *comps)
-
     def _uses_apache(self):
         return False
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -34,6 +34,7 @@
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.layout_tests.port import chromium_win
 from webkitpy.layout_tests.port import port_testcase
+from webkitpy.tool.mocktool import MockOptions
 
 
 class ChromiumWinTest(port_testcase.PortTestCase):
@@ -111,16 +112,28 @@
         self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-win'))
 
     def test_build_path(self):
-        port = self.make_port()
-        port._filesystem.files = {
-            '/mock-checkout/Source/WebKit/chromium/build/Release/DumpRenderTree.exe': 'exe',
-        }
-        self.assertEquals(
-            '/mock-checkout/Source/WebKit/chromium/build/Release/DumpRenderTree.exe',
-            port._path_to_driver('Release'))
-        self.assertEquals(
-            '/mock-checkout/Source/WebKit/chromium/build/Debug/DumpRenderTree.exe',
-            port._path_to_driver('Debug'))
+        # Test that optional paths are used regardless of whether they exist.
+        options = MockOptions(configuration='Release', build_directory='/foo')
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out'], '/foo')
 
+        # Test that optional relative paths are returned unmodified.
+        options = MockOptions(configuration='Release', build_directory='foo')
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out'], 'foo')
+
+        # Test that we look in a chromium directory before the webkit directory.
+        options = MockOptions(configuration='Release', build_directory=None)
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/out', '/mock-checkout/out'], '/mock-checkout/Source/WebKit/chromium/out')
+
+        # Test that we prefer the legacy dir over the new dir.
+        options = MockOptions(configuration='Release', build_directory=None)
+        self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/build', '/mock-checkout/Source/WebKit/chromium/out'], '/mock-checkout/Source/WebKit/chromium/build')
+
     def test_operating_system(self):
         self.assertEqual('win', self.make_port().operating_system())
+
+    def test_driver_name_option(self):
+        self.assertTrue(self.make_port()._path_to_driver().endswith('DumpRenderTree.exe'))
+        self.assertTrue(self.make_port(options=MockOptions(driver_name='OtherDriver'))._path_to_driver().endswith('OtherDriver.exe'))
+
+    def test_path_to_image_diff(self):
+        self.assertEquals(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff.exe')

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py (119648 => 119649)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-06-07 00:27:35 UTC (rev 119648)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-06-07 00:31:55 UTC (rev 119649)
@@ -333,6 +333,13 @@
              u'STDOUT: foo\ufffdbar\n'
              u'STDERR: foo\ufffdbar\n'))
 
+    def assert_build_path(self, options, dirs, expected_path):
+        port = self.make_port(options=options)
+        for directory in dirs:
+            port.host.filesystem.maybe_make_directory(directory)
+        self.assertEquals(port._build_path(), expected_path)
+
+
 # FIXME: This class and main() should be merged into test-webkitpy.
 class EnhancedTestLoader(unittest.TestLoader):
     integration_tests = False
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to