run-webkit-test should look in --root directory for LayoutTestRelay
authorjmarcell@apple.com <jmarcell@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Nov 2015 00:06:56 +0000 (00:06 +0000)
committerjmarcell@apple.com <jmarcell@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Nov 2015 00:06:56 +0000 (00:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150859

Reviewed by Daniel Bates.

For iOS run-webkit-tests, use LayoutTestRelay specified by --root; otherwise find
LayoutTestRelay in the Mac build directory when --root is unspecified.

* Scripts/webkitpy/port/base.py:
(Port._build_path): Use '_cached_root' instead of 'root' so that we don't overwrite the
argument that was passed in via the --root argument.
* Scripts/webkitpy/port/ios.py:
(IOSSimulatorPort.relay_path):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192087 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/port/base.py
Tools/Scripts/webkitpy/port/ios.py

index ac61326..d8ae17b 100644 (file)
@@ -1,3 +1,19 @@
+2015-11-05  Jason Marcell  <jmarcell@apple.com>
+
+        run-webkit-test should look in --root directory for LayoutTestRelay
+        https://bugs.webkit.org/show_bug.cgi?id=150859
+
+        Reviewed by Daniel Bates.
+
+        For iOS run-webkit-tests, use LayoutTestRelay specified by --root; otherwise find
+        LayoutTestRelay in the Mac build directory when --root is unspecified.
+
+        * Scripts/webkitpy/port/base.py:
+        (Port._build_path): Use '_cached_root' instead of 'root' so that we don't overwrite the
+        argument that was passed in via the --root argument.
+        * Scripts/webkitpy/port/ios.py:
+        (IOSSimulatorPort.relay_path):
+
 2015-11-05  David Kilzer  <ddkilzer@apple.com>
 
         TestWebKitAPI crashed in TestWebKitAPI: TestWebKitAPI::SharedBufferTest_copyBufferCreatedWithContentsOfExistingFile_Test::TestBody
index 559e2a5..be6f977 100644 (file)
@@ -1133,18 +1133,22 @@ class Port(object):
         return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', config_file_name)
 
     def _build_path(self, *comps):
-        root_directory = self.get_option('root')
+        root_directory = self.get_option('_cached_root') or self.get_option('root')
         if not root_directory:
             build_directory = self.get_option('build_directory')
             if build_directory:
                 root_directory = self._filesystem.join(build_directory, self.get_option('configuration'))
             else:
                 root_directory = self._config.build_directory(self.get_option('configuration'))
-            # Set --root so that we can pass this to subprocesses and avoid making the
-            # slow call to config.build_directory() N times in each worker.
-            # FIXME: This is like @memoized, but more annoying and fragile; there should be another
-            # way to propagate values without mutating the options list.
-            self.set_option_default('root', root_directory)
+            # We take advantage of the behavior that self._options is passed by reference to worker
+            # subprocesses to use it as data store to cache the computed root directory path. This
+            # avoids making each worker subprocess compute this path again which is slow because of
+            # the call to config.build_directory().
+            #
+            # FIXME: This is like decorating this function with @memoized, but more annoying and fragile;
+            # there should be another way to propagate precomputed values to workers without modifying
+            # the options list.
+            self.set_option('_cached_root', root_directory)
         return self._filesystem.join(self._filesystem.abspath(root_directory), *comps)
 
     def _path_to_driver(self, configuration=None):
index c704892..870f239 100644 (file)
@@ -123,8 +123,12 @@ class IOSSimulatorPort(Port):
     @property
     @memoized
     def relay_path(self):
-        mac_config = port_config.Config(self._executive, self._filesystem, 'mac')
-        return self._filesystem.join(mac_config.build_directory(self.get_option('configuration')), self.relay_name)
+        if self._root_was_set:
+            path = self._filesystem.abspath(self.get_option('root'))
+        else:
+            mac_config = port_config.Config(self._executive, self._filesystem, 'mac')
+            path = mac_config.build_directory(self.get_option('configuration'))
+        return self._filesystem.join(path, self.relay_name)
 
     def default_timeout_ms(self):
         if self.get_option('guard_malloc'):