- Revision
- 198066
- Author
- [email protected]
- Date
- 2016-03-12 11:59:41 -0800 (Sat, 12 Mar 2016)
Log Message
run-webkit-tests: handle Darwin framework/library environment variables more consistently
<http://webkit.org/b/155392>
Reviewed by Daniel Bates.
These changes will make it possible to pass through environment
variables from the run-webkit-tests command-line.
* Scripts/webkitpy/port/base.py:
(Port.to.setup_environ_for_server): Add DYLD_FRAMEWORK_PATH,
__XPC_DYLD_FRAMEWORK_PATH and __XPC_DYLD_LIBRARY_PATH to the
list of variables to keep from the run-webkit-test environment.
* Scripts/webkitpy/port/driver.py:
(Driver._append_environment_variable_path): Add method to append
a path to an environment variable, or set the path if the
variable doesn't exist.
(Driver._setup_environ_for_driver): Extract build_root_path into
a local variable. Use Driver._append_environment_variable_path
to extend DYLD_LIBRARY_PATH, __XPC_DYLD_LIBRARY_PATH,
DYLD_FRAMEWORK_PATH and __XPC_DYLD_FRAMEWORK_PATH instead of
overwriting them.
* Scripts/webkitpy/port/driver_unittest.py:
(DriverTest.test__append_environment_variable_path): Add test
method to test Driver._append_environment_variable_path.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (198065 => 198066)
--- trunk/Tools/ChangeLog 2016-03-12 18:16:32 UTC (rev 198065)
+++ trunk/Tools/ChangeLog 2016-03-12 19:59:41 UTC (rev 198066)
@@ -1,3 +1,32 @@
+2016-03-12 David Kilzer <[email protected]>
+
+ run-webkit-tests: handle Darwin framework/library environment variables more consistently
+ <http://webkit.org/b/155392>
+
+ Reviewed by Daniel Bates.
+
+ These changes will make it possible to pass through environment
+ variables from the run-webkit-tests command-line.
+
+ * Scripts/webkitpy/port/base.py:
+ (Port.to.setup_environ_for_server): Add DYLD_FRAMEWORK_PATH,
+ __XPC_DYLD_FRAMEWORK_PATH and __XPC_DYLD_LIBRARY_PATH to the
+ list of variables to keep from the run-webkit-test environment.
+
+ * Scripts/webkitpy/port/driver.py:
+ (Driver._append_environment_variable_path): Add method to append
+ a path to an environment variable, or set the path if the
+ variable doesn't exist.
+ (Driver._setup_environ_for_driver): Extract build_root_path into
+ a local variable. Use Driver._append_environment_variable_path
+ to extend DYLD_LIBRARY_PATH, __XPC_DYLD_LIBRARY_PATH,
+ DYLD_FRAMEWORK_PATH and __XPC_DYLD_FRAMEWORK_PATH instead of
+ overwriting them.
+
+ * Scripts/webkitpy/port/driver_unittest.py:
+ (DriverTest.test__append_environment_variable_path): Add test
+ method to test Driver._append_environment_variable_path.
+
2016-03-11 Alexey Proskuryakov <[email protected]>
[ios-sim debug] API test WTF_Lock.ContendedShortSection and WTF_ParkingLot.UnparkOneFifty timing out
Modified: trunk/Tools/Scripts/webkitpy/port/base.py (198065 => 198066)
--- trunk/Tools/Scripts/webkitpy/port/base.py 2016-03-12 18:16:32 UTC (rev 198065)
+++ trunk/Tools/Scripts/webkitpy/port/base.py 2016-03-12 19:59:41 UTC (rev 198066)
@@ -838,8 +838,11 @@
'XDG_RUNTIME_DIR',
# Darwin:
+ 'DYLD_FRAMEWORK_PATH',
'DYLD_LIBRARY_PATH',
'HOME',
+ '__XPC_DYLD_FRAMEWORK_PATH',
+ '__XPC_DYLD_LIBRARY_PATH',
# CYGWIN:
'HOMEDRIVE',
Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (198065 => 198066)
--- trunk/Tools/Scripts/webkitpy/port/driver.py 2016-03-12 18:16:32 UTC (rev 198065)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py 2016-03-12 19:59:41 UTC (rev 198066)
@@ -311,10 +311,18 @@
self._start(pixel_tests, per_test_args)
self._run_post_start_tasks()
+ def _append_environment_variable_path(self, environment, variable, path):
+ if variable in environment:
+ environment[variable] = environment[variable] + os.pathsep + path
+ else:
+ environment[variable] = path
+
def _setup_environ_for_driver(self, environment):
- environment['DYLD_LIBRARY_PATH'] = str(self._port._build_path())
- environment['__XPC_DYLD_LIBRARY_PATH'] = environment['DYLD_LIBRARY_PATH']
- environment['DYLD_FRAMEWORK_PATH'] = str(self._port._build_path())
+ build_root_path = str(self._port._build_path())
+ self._append_environment_variable_path(environment, 'DYLD_LIBRARY_PATH', build_root_path)
+ self._append_environment_variable_path(environment, '__XPC_DYLD_LIBRARY_PATH', build_root_path)
+ self._append_environment_variable_path(environment, 'DYLD_FRAMEWORK_PATH', build_root_path)
+ self._append_environment_variable_path(environment, '__XPC_DYLD_FRAMEWORK_PATH', build_root_path)
# Use an isolated temp directory that can be deleted after testing (especially important on Mac, as
# CoreMedia disk cache is in the temp directory).
environment['TMPDIR'] = str(self._driver_tempdir)
Modified: trunk/Tools/Scripts/webkitpy/port/driver_unittest.py (198065 => 198066)
--- trunk/Tools/Scripts/webkitpy/port/driver_unittest.py 2016-03-12 18:16:32 UTC (rev 198065)
+++ trunk/Tools/Scripts/webkitpy/port/driver_unittest.py 2016-03-12 19:59:41 UTC (rev 198066)
@@ -38,6 +38,7 @@
from webkitpy.tool.mocktool import MockOptions
+import os
import sys
class DriverOutputTest(unittest.TestCase):
@@ -281,3 +282,28 @@
driver = Driver(port, 0, pixel_tests=True)
driver.start(True, [])
self.assertTrue(driver._server_process.started)
+
+ def test__append_environment_variable_path(self):
+ port = self.make_port()
+ driver = Driver(port, None, pixel_tests=False)
+
+ environment = {}
+ variable = 'DYLD_FAKE_PATH'
+ path = '/tmp/fake-dyld-path'
+ driver._append_environment_variable_path(environment, variable, path)
+ self.assertEqual(environment[variable], path)
+
+ base_value = ''
+ environment[variable] = base_value
+ driver._append_environment_variable_path(environment, variable, path)
+ self.assertEqual(environment[variable], base_value + os.pathsep + path)
+
+ base_value = '/usr/lib'
+ environment[variable] = base_value
+ driver._append_environment_variable_path(environment, variable, path)
+ self.assertEqual(environment[variable], base_value + os.pathsep + path)
+
+ base_value = os.pathsep.join(['/usr/lib', '/usr/local/lib'])
+ environment[variable] = base_value
+ driver._append_environment_variable_path(environment, variable, path)
+ self.assertEqual(environment[variable], base_value + os.pathsep + path)