Set LD_LIBRARY_PATH when running tests from cake

This commit is contained in:
Lewis Baker 2017-12-13 21:13:13 +10:30
parent 7666375511
commit e3f3fadeda
2 changed files with 14 additions and 0 deletions

View File

@ -253,6 +253,17 @@ elif cake.system.isLinux() or cake.system.isDarwin():
platform=platform,
architecture='x64')
# If libc++ is installed in a non-standard location, add the path to libc++.so
# to the library search path by adding libc++'s /lib directory to LD_LIBRARY_PATH
if libcxxInstallPrefix not in defaultInstallPaths:
libcxxLibPath = os.path.abspath(cake.path.join(libcxxInstallPrefix, 'lib'))
ldPaths = [libcxxLibPath]
test = clangVariant.tools["test"]
oldLdPath = test.env.get('LD_LIBRARY_PATH', None)
if oldLdPath:
ldPaths.append(oldLdPath)
test.env['LD_LIBRARY_PATH'] = os.path.pathsep.join(ldPaths)
compiler = ClangCompiler(
configuration=configuration,
clangExe=clangExe,

View File

@ -4,6 +4,7 @@
###############################################################################
import subprocess
import os
import cake.filesys
import cake.path
@ -22,6 +23,7 @@ class UnitTestTool(Tool):
Tool.__init__(self, configuration)
self.dependencies = []
self.extraArgs = []
self.env = dict(os.environ)
def run(self, program, results=None, cwd=None, extraArgs=[], dependencies=[]):
@ -106,6 +108,7 @@ class UnitTestTool(Tool):
stdout=stdout,
stderr=subprocess.STDOUT,
cwd=cwd,
env=self.env
)
except EnvironmentError, e:
msg = "cake: failed to launch %s: %s\n" % (programPath, str(e))