Title: [112981] trunk/Tools
Revision
112981
Author
[email protected]
Date
2012-04-02 20:52:16 -0700 (Mon, 02 Apr 2012)

Log Message

run-webkit-tests with a relative --root causes tests to fail because DYLD_LIBRARY_PATH is not set
https://bugs.webkit.org/show_bug.cgi?id=82962

Reviewed by Dirk Pranke.

Ensure that _build_path() returns an absolute path.

Eric Seidel also had to deploy MockConfig in a bunch of places
in order to correct previous testing errors where we were
pretending that "Mock Output from child process" (returned by MockExecutive.run_command)
was a real path.  The real Config object calls run_command("webkit-build-directory")
to read the WebKit build directory from the webkitdirs.pm perl code.
MockConfig abstracts this away and always returns "/mock-build" during
testing.  This change is much larger than one would think necessary
because of needing to deploy this MockConfig class.

* Scripts/webkitpy/layout_tests/port/webkit.py:
(WebKitPort._build_path):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (112980 => 112981)


--- trunk/Tools/ChangeLog	2012-04-03 03:31:26 UTC (rev 112980)
+++ trunk/Tools/ChangeLog	2012-04-03 03:52:16 UTC (rev 112981)
@@ -1,3 +1,24 @@
+2012-04-02  Simon Fraser  <[email protected]>
+
+        run-webkit-tests with a relative --root causes tests to fail because DYLD_LIBRARY_PATH is not set
+        https://bugs.webkit.org/show_bug.cgi?id=82962
+
+        Reviewed by Dirk Pranke.
+
+        Ensure that _build_path() returns an absolute path.
+
+        Eric Seidel also had to deploy MockConfig in a bunch of places
+        in order to correct previous testing errors where we were
+        pretending that "Mock Output from child process" (returned by MockExecutive.run_command)
+        was a real path.  The real Config object calls run_command("webkit-build-directory")
+        to read the WebKit build directory from the webkitdirs.pm perl code.
+        MockConfig abstracts this away and always returns "/mock-build" during
+        testing.  This change is much larger than one would think necessary
+        because of needing to deploy this MockConfig class.
+
+        * Scripts/webkitpy/layout_tests/port/webkit.py:
+        (WebKitPort._build_path):
+
 2012-04-02  Ojan Vafai  <[email protected]>
 
         Fix snafu in r112971. We were never calling parseParameter for builder.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/config_mock.py (112980 => 112981)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/config_mock.py	2012-04-03 03:31:26 UTC (rev 112980)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/config_mock.py	2012-04-03 03:52:16 UTC (rev 112981)
@@ -29,13 +29,24 @@
 
 """Wrapper objects for WebKit-specific utility routines."""
 
+from webkitpy.common.system.filesystem_mock import MockFileSystem
 
+
 class MockConfig(object):
-    def __init__(self, default_configuration='Release'):
+    _FLAGS_FROM_CONFIGURATIONS = {
+        "Debug": "--debug",
+        "Release": "--release",
+    }
+
+    def __init__(self, filesystem=None, default_configuration='Release'):
+        self._filesystem = filesystem or MockFileSystem()
         self._default_configuration = default_configuration
 
+    def flag_for_configuration(self, configuration):
+        return self._FLAGS_FROM_CONFIGURATIONS[configuration]
+
     def build_directory(self, configuration):
-        return "/build"
+        return "/mock-build"
 
     def build_dumprendertree(self, configuration):
         return True
@@ -44,7 +55,12 @@
         return self._default_configuration
 
     def path_from_webkit_base(self, *comps):
-        return "/" + "/".join(list(comps))
+        # FIXME: This could use self._filesystem.join, but that doesn't handle empty lists.
+        return self.webkit_base_dir() + "/" + "/".join(list(comps))
 
+    def script_path(self, script_name):
+        # This is intentionally relative. Callers should pass the checkout_root/webkit_base_dir to run_command as the cwd.
+        return self._filesystem.join("Tools", "Scripts", script_name)
+
     def webkit_base_dir(self):
-        return "/"
+        return "/mock-checkout"

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-04-03 03:31:26 UTC (rev 112980)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2012-04-03 03:52:16 UTC (rev 112981)
@@ -40,6 +40,7 @@
 from webkitpy.layout_tests.servers import http_server_base
 from webkitpy.layout_tests.servers import http_server_base
 from webkitpy.layout_tests.port import factory
+from webkitpy.layout_tests.port.config_mock import MockConfig
 from webkitpy.tool.mocktool import MockOptions
 
 
@@ -53,12 +54,13 @@
     os_version = None
     port_maker = None
 
-    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
+    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, config=None, **kwargs):
         host = host or MockSystemHost(os_name=(os_name or self.os_name), os_version=(os_version or self.os_version))
         options = options or MockOptions(configuration='Release')
+        config = config or MockConfig(filesystem=host.filesystem, default_configuration='Release')
         port_name = port_name or self.port_name
         port_name = self.port_maker.determine_full_port_name(host, options, port_name)
-        return self.port_maker(host, port_name, options=options, **kwargs)
+        return self.port_maker(host, port_name, options=options, config=config, **kwargs)
 
     def test_driver_cmd_line(self):
         port = self.make_port()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py (112980 => 112981)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py	2012-04-03 03:31:26 UTC (rev 112980)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py	2012-04-03 03:52:16 UTC (rev 112981)
@@ -81,7 +81,7 @@
     def test_setup_environ_for_server(self):
         port = self.make_port()
         env = port.setup_environ_for_server(port.driver_name())
-        self.assertEquals(env['QTWEBKIT_PLUGIN_PATH'], 'MOCK output of child process/lib/plugins')
+        self.assertEquals(env['QTWEBKIT_PLUGIN_PATH'], '/mock-build/lib/plugins')
 
     def test_operating_system(self):
         self.assertEqual('linux', self.make_port(port_name='qt-linux', os_name='linux').operating_system())

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (112980 => 112981)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2012-04-03 03:31:26 UTC (rev 112980)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2012-04-03 03:52:16 UTC (rev 112981)
@@ -374,7 +374,7 @@
             # Set --build-directory here Since this modifies the options object used by the worker subprocesses,
             # it avoids the slow call out to build_directory in each subprocess.
             self.set_option_default('build_directory', build_directory)
-        return self._filesystem.join(build_directory, *comps)
+        return self._filesystem.join(self._filesystem.abspath(build_directory), *comps)
 
     def _path_to_driver(self):
         return self._build_path(self.driver_name())

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py	2012-04-03 03:31:26 UTC (rev 112980)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py	2012-04-03 03:52:16 UTC (rev 112981)
@@ -35,6 +35,7 @@
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 from webkitpy.layout_tests.port import port_testcase
 from webkitpy.layout_tests.port.webkit import WebKitPort, WebKitDriver
+from webkitpy.layout_tests.port.config_mock import MockConfig
 from webkitpy.tool.mocktool import MockOptions
 
 
@@ -42,11 +43,12 @@
     port_name = "testwebkitport"
 
     def __init__(self, symbols_string=None,
-                 expectations_file=None, skips_file=None, host=None,
+                 expectations_file=None, skips_file=None, host=None, config=None,
                  **kwargs):
         self.symbols_string = symbols_string  # Passing "" disables all staticly-detectable features.
         host = host or MockSystemHost()
-        WebKitPort.__init__(self, host=host, **kwargs)
+        config = config or MockConfig()
+        WebKitPort.__init__(self, host=host, config=config, **kwargs)
 
     def all_test_configurations(self):
         return [self.test_configuration()]
@@ -295,7 +297,7 @@
     def test_no_timeout(self):
         port = TestWebKitPort()
         driver = WebKitDriver(port, 0, pixel_tests=True, no_timeout=True)
-        self.assertEquals(driver.cmd_line(True, []), ['MOCK output of child process/DumpRenderTree', '--no-timeout', '--pixel-tests', '-'])
+        self.assertEquals(driver.cmd_line(True, []), ['/mock-build/DumpRenderTree', '--no-timeout', '--pixel-tests', '-'])
 
     def test_check_for_driver_crash(self):
         port = TestWebKitPort()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to