From dfa7755c52b61fb5a53110a12eb5a8351be05f17 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 27 Aug 2018 23:06:38 +0000 Subject: [PATCH] Make the DYLD_INSERT_LIBRARIES workaround for SIP more robut for the various configurations that bots are running llvm-svn: 340792 --- lldb/lit/Suite/lldbtest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lldb/lit/Suite/lldbtest.py b/lldb/lit/Suite/lldbtest.py index d09246e..00ebcbe 100644 --- a/lldb/lit/Suite/lldbtest.py +++ b/lldb/lit/Suite/lldbtest.py @@ -71,13 +71,17 @@ class LLDBTest(TestFormat): # libraries into system binaries, but this can be worked around by # copying the binary into a different location. 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) - assert(builddir) mkdir_p(builddir) copied_python = os.path.join(builddir, 'copied-system-python') - import shutil - shutil.copy(sys.executable, os.path.join(builddir, copied_python)) + if not os.path.isfile(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 try: -- 2.7.4