[Lldb-commits] [lldb] r236957 - We can't use sys.path[0] to determine the script directory because it doesn't work under a debugger
Vince Harron
vince at nethacker.com
Sun May 10 08:24:12 PDT 2015
Author: vharron
Date: Sun May 10 10:24:12 2015
New Revision: 236957
URL: http://llvm.org/viewvc/llvm-project?rev=236957&view=rev
Log:
We can't use sys.path[0] to determine the script directory because it doesn't work under a debugger
Test Plan: run tests with/without python debugger
Tested on OSX & Linux with PyCharm
Reviewers: chying, clayborg
Differential Revision: http://reviews.llvm.org/D9593
Modified:
lldb/trunk/test/dosep.py
lldb/trunk/test/dotest.py
Modified: lldb/trunk/test/dosep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=236957&r1=236956&r2=236957&view=diff
==============================================================================
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Sun May 10 10:24:12 2015
@@ -148,7 +148,9 @@ def walk_and_invoke(test_root, dotest_op
return (timed_out, failed, passed)
def main():
- test_root = sys.path[0]
+ # We can't use sys.path[0] to determine the script directory
+ # because it doesn't work under a debugger
+ test_root = os.path.dirname(os.path.realpath(__file__))
parser = OptionParser(usage="""\
Run lldb test suite using a separate process for each test file.
Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=236957&r1=236956&r2=236957&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Sun May 10 10:24:12 2015
@@ -253,7 +253,9 @@ verbose = 1
progress_bar = False
# By default, search from the script directory.
-testdirs = [ sys.path[0] ]
+# We can't use sys.path[0] to determine the script directory
+# because it doesn't work under a debugger
+testdirs = [ os.path.dirname(os.path.realpath(__file__)) ]
# Separator string.
separator = '-' * 70
@@ -375,6 +377,7 @@ o LLDB_LOG: if defined, specifies the lo
o GDB_REMOTE_LOG: if defined, specifies the log file pathname for the
'process.gdb-remote' subsystem with a default option of 'packets' if
GDB_REMOTE_LOG_OPTION is not defined.
+
"""
sys.exit(0)
@@ -933,10 +936,10 @@ def setupSysPath():
global lldbExecutablePath
# Get the directory containing the current script.
- if ("DOTEST_PROFILE" in os.environ or "DOTEST_PDB" in os.environ) and "DOTEST_SCRIPT_DIR" in os.environ:
+ if "DOTEST_PROFILE" in os.environ and "DOTEST_SCRIPT_DIR" in os.environ:
scriptPath = os.environ["DOTEST_SCRIPT_DIR"]
else:
- scriptPath = sys.path[0]
+ scriptPath = os.path.dirname(os.path.realpath(__file__))
if not scriptPath.endswith('test'):
print "This script expects to reside in lldb's test directory."
sys.exit(-1)
@@ -955,7 +958,7 @@ def setupSysPath():
# Set up the LLDB_SRC environment variable, so that the tests can locate
# the LLDB source code.
- os.environ["LLDB_SRC"] = os.path.join(sys.path[0], os.pardir)
+ os.environ["LLDB_SRC"] = os.path.join(scriptPath, os.pardir)
pluginPath = os.path.join(scriptPath, 'plugins')
pexpectPath = os.path.join(scriptPath, 'pexpect-2.4')
More information about the lldb-commits
mailing list