Bug 929125 - Set shared library path in jit-test harness; r=terrence
authorDan Minor <dminor@mozilla.com>
Tue, 22 Oct 2013 13:57:54 -0400
changeset 151847 24db71586336fbf01e04aceb7accf9c27e18627b
parent 151846 4f5ad1f42a3261d3d7cca37185d0a786b5515ffa
child 151848 9687708309c56eb4e7a82404cc9fbb4e5d65c3e1
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersterrence
bugs929125
milestone27.0a1
Bug 929125 - Set shared library path in jit-test harness; r=terrence
js/src/tests/lib/jittests.py
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -295,16 +295,31 @@ def run_test(test, prefix, options):
         run = run_cmd_avoid_stdio
     else:
         run = run_cmd
 
     env = os.environ.copy()
     if test.tz_pacific:
         env['TZ'] = 'PST8PDT'
 
+    # Ensure interpreter directory is in shared library path.
+    pathvar = ''
+    if sys.platform.startswith('linux'):
+        pathvar = 'LD_LIBRARY_PATH'
+    elif sys.platform.startswith('darwin'):
+        pathvar = 'DYLD_LIBRARY_PATH'
+    elif sys.platform.startswith('win'):
+        pathvar = 'PATH'
+    if pathvar:
+        bin_dir = os.path.dirname(cmd[0])
+        if pathvar in env:
+            env[pathvar] = '%s%s%s' % (bin_dir, os.pathsep, env[pathvar])
+        else:
+            env[pathvar] = bin_dir
+
     out, err, code, timed_out = run(cmd, env, options.timeout)
     return TestOutput(test, cmd, out, err, code, None, timed_out)
 
 def run_test_remote(test, device, prefix, options):
     cmd = test.command(prefix, posixpath.join(options.remote_test_root, 'lib/'), posixpath.join(options.remote_test_root, 'tests'))
     if options.show_cmd:
         print(subprocess.list2cmdline(cmd))