Make the DYLD_INSERT_LIBRARIES workaround for SIP more robut for the various configurations that bots are running

llvm-svn: 340792
This commit is contained in:
Adrian Prantl 2018-08-27 23:06:38 +00:00
parent 7e6ce43ef0
commit dfa7755c52
1 changed files with 8 additions and 4 deletions

View File

@ -71,13 +71,17 @@ class LLDBTest(TestFormat):
# libraries into system binaries, but this can be worked around by # libraries into system binaries, but this can be worked around by
# copying the binary into a different location. # copying the binary into a different location.
if 'DYLD_INSERT_LIBRARIES' in test.config.environment and \ if 'DYLD_INSERT_LIBRARIES' in test.config.environment and \
sys.executable.startswith('/System/'): sys.executable.startswith('/System/') or \
sys.executable.startswith('/usr/'):
builddir = getBuildDir(cmd) builddir = getBuildDir(cmd)
assert(builddir)
mkdir_p(builddir) mkdir_p(builddir)
copied_python = os.path.join(builddir, 'copied-system-python') copied_python = os.path.join(builddir, 'copied-system-python')
import shutil if not os.path.isfile(copied_python):
shutil.copy(sys.executable, os.path.join(builddir, copied_python)) import shutil, subprocess
python = subprocess.check_output([
'/usr/bin/python2.7', '-c',
'import sys; print sys.executable']).strip()
shutil.copy(python, copied_python)
cmd[0] = copied_python cmd[0] = copied_python
try: try: