[Lldb-commits] [lldb] r340792 - Make the DYLD_INSERT_LIBRARIES workaround for SIP more robut for the various configurations that bots are running

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 27 16:06:38 PDT 2018


Author: adrian
Date: Mon Aug 27 16:06:38 2018
New Revision: 340792

URL: http://llvm.org/viewvc/llvm-project?rev=340792&view=rev
Log:
Make the DYLD_INSERT_LIBRARIES workaround for SIP more robut for the various configurations that bots are running

Modified:
    lldb/trunk/lit/Suite/lldbtest.py

Modified: lldb/trunk/lit/Suite/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lldbtest.py?rev=340792&r1=340791&r2=340792&view=diff
==============================================================================
--- lldb/trunk/lit/Suite/lldbtest.py (original)
+++ lldb/trunk/lit/Suite/lldbtest.py Mon Aug 27 16:06:38 2018
@@ -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:




More information about the lldb-commits mailing list