forked from OSchip/llvm-project
Refactored lldb executable name discovery
The lldb executable was referenced through the code by 7 different (effectively) global variables. global lldbExecutablePath global lldbExecutable os.environ['LLDB_EXEC'] os.environ['LLDB_TEST'] dotest.lldbExec dotest.lldbHere lldbtest.lldbExec This change uses one global variable lldbtest_config.lldbExec to replace them all. Differential Revision: http://reviews.llvm.org/D9817 llvm-svn: 237600
This commit is contained in:
parent
0f173ac130
commit
790d95cbec
|
@ -15,7 +15,7 @@ class DisassembleDriverMainLoop(BenchBase):
|
|||
|
||||
def setUp(self):
|
||||
"""
|
||||
Note that lldbExec can be specified with the LLDB_EXEC env variable (see
|
||||
Note that lldbtest_config.lldbExec can be specified with the LLDB_EXEC env variable (see
|
||||
dotest.py), and gdbExec can be specified with the GDB_EXEC env variable.
|
||||
This provides a flexibility in specifying different versions of gdb for
|
||||
comparison purposes.
|
||||
|
@ -28,7 +28,7 @@ class DisassembleDriverMainLoop(BenchBase):
|
|||
else:
|
||||
self.gdbExec = "gdb"
|
||||
|
||||
self.exe = self.lldbHere
|
||||
self.exe = lldbtest_config.lldbExec
|
||||
self.function = 'Driver::MainLoop()'
|
||||
self.lldb_avg = None
|
||||
self.gdb_avg = None
|
||||
|
@ -41,7 +41,7 @@ class DisassembleDriverMainLoop(BenchBase):
|
|||
def test_run_lldb_then_gdb(self):
|
||||
"""Test disassembly on a large function with lldb vs. gdb."""
|
||||
print
|
||||
print "lldb path: %s" % self.lldbExec
|
||||
print "lldb path: %s" % lldbtest_config.lldbExec
|
||||
print "gdb path: %s" % self.gdbExec
|
||||
|
||||
print
|
||||
|
@ -56,7 +56,7 @@ class DisassembleDriverMainLoop(BenchBase):
|
|||
def test_run_gdb_then_lldb(self):
|
||||
"""Test disassembly on a large function with lldb vs. gdb."""
|
||||
print
|
||||
print "lldb path: %s" % self.lldbExec
|
||||
print "lldb path: %s" % lldbtest_config.lldbExec
|
||||
print "gdb path: %s" % self.gdbExec
|
||||
|
||||
print
|
||||
|
@ -73,7 +73,7 @@ class DisassembleDriverMainLoop(BenchBase):
|
|||
prompt = self.child_prompt
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbExec, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
|
||||
# Turn on logging for what the child sends back.
|
||||
|
|
|
@ -16,7 +16,7 @@ class AttachThenDisassemblyBench(BenchBase):
|
|||
if lldb.bmExecutable:
|
||||
self.exe = lldb.bmExecutable
|
||||
else:
|
||||
self.exe = self.lldbHere
|
||||
self.exe = lldbtest_config.lldbExec
|
||||
self.count = lldb.bmIterationCount
|
||||
if self.count <= 0:
|
||||
self.count = 10
|
||||
|
|
|
@ -13,7 +13,7 @@ class XCode41Vs42GDBDisassembly(BenchBase):
|
|||
BenchBase.setUp(self)
|
||||
self.gdb_41_exe = '/Xcode41/usr/bin/gdb'
|
||||
self.gdb_42_exe = '/Developer/usr/bin/gdb'
|
||||
self.exe = self.lldbHere
|
||||
self.exe = lldbtest_config.lldbExec
|
||||
self.function = 'Driver::MainLoop()'
|
||||
self.gdb_41_avg = None
|
||||
self.gdb_42_avg = None
|
||||
|
|
|
@ -40,7 +40,7 @@ class ExpressionEvaluationCase(BenchBase):
|
|||
self.stopwatch.reset()
|
||||
for i in range(count):
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
|
||||
# Turn on logging for what the child sends back.
|
||||
|
|
|
@ -42,7 +42,7 @@ class RepeatedExprsCase(BenchBase):
|
|||
prompt = self.child_prompt
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbExec, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
|
||||
# Turn on logging for what the child sends back.
|
||||
|
|
|
@ -14,7 +14,7 @@ class FrameVariableResponseBench(BenchBase):
|
|||
if lldb.bmExecutable:
|
||||
self.exe = lldb.bmExecutable
|
||||
else:
|
||||
self.exe = self.lldbHere
|
||||
self.exe = lldbtest_config.lldbExec
|
||||
if lldb.bmBreakpointSpec:
|
||||
self.break_spec = lldb.bmBreakpointSpec
|
||||
else:
|
||||
|
@ -42,7 +42,7 @@ class FrameVariableResponseBench(BenchBase):
|
|||
self.stopwatch.reset()
|
||||
for i in range(count):
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
|
||||
# Turn on logging for what the child sends back.
|
||||
|
|
|
@ -19,7 +19,7 @@ class StartupDelaysBench(BenchBase):
|
|||
if lldb.bmExecutable:
|
||||
self.exe = lldb.bmExecutable
|
||||
else:
|
||||
self.exe = self.lldbHere
|
||||
self.exe = lldbtest_config.lldbExec
|
||||
if lldb.bmBreakpointSpec:
|
||||
self.break_spec = lldb.bmBreakpointSpec
|
||||
else:
|
||||
|
@ -50,7 +50,7 @@ class StartupDelaysBench(BenchBase):
|
|||
self.stopwatch2.reset()
|
||||
for i in range(count):
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption))
|
||||
self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption))
|
||||
child = self.child
|
||||
|
||||
# Turn on logging for what the child sends back.
|
||||
|
|
|
@ -29,7 +29,7 @@ class RunHooksThenSteppingsBench(BenchBase):
|
|||
self.child_prompt = '(lldb) '
|
||||
prompt = self.child_prompt
|
||||
|
||||
self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption))
|
||||
self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption))
|
||||
self.child.expect_exact(prompt)
|
||||
# So that the child gets torn down after the test.
|
||||
child = self.child
|
||||
|
|
|
@ -14,7 +14,7 @@ class SteppingSpeedBench(BenchBase):
|
|||
if lldb.bmExecutable:
|
||||
self.exe = lldb.bmExecutable
|
||||
else:
|
||||
self.exe = self.lldbHere
|
||||
self.exe = lldbtest_config.lldbExec
|
||||
if lldb.bmBreakpointSpec:
|
||||
self.break_spec = lldb.bmBreakpointSpec
|
||||
else:
|
||||
|
@ -42,7 +42,7 @@ class SteppingSpeedBench(BenchBase):
|
|||
prompt = self.child_prompt
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
|
||||
# Turn on logging for what the child sends back.
|
||||
|
|
|
@ -11,7 +11,7 @@ class CompileRunToBreakpointBench(BenchBase):
|
|||
|
||||
def setUp(self):
|
||||
BenchBase.setUp(self)
|
||||
self.exe = self.lldbHere
|
||||
self.exe = lldbtest_config.lldbExec
|
||||
self.function = 'Driver::MainLoop()'
|
||||
|
||||
self.count = lldb.bmIterationCount
|
||||
|
@ -38,7 +38,7 @@ class CompileRunToBreakpointBench(BenchBase):
|
|||
prompt = self.child_prompt
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbExec, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
|
||||
# Turn on logging for what the child sends back.
|
||||
|
|
|
@ -148,9 +148,6 @@ failuresPerCategory = {}
|
|||
# The path to LLDB.framework is optional.
|
||||
lldbFrameworkPath = None
|
||||
|
||||
# The path to lldb is optional
|
||||
lldbExecutablePath = None
|
||||
|
||||
# The config file is optional.
|
||||
configFile = None
|
||||
|
||||
|
@ -482,7 +479,6 @@ def parseOptionsAndInitTestdirs():
|
|||
global useCategories
|
||||
global skipCategories
|
||||
global lldbFrameworkPath
|
||||
global lldbExecutablePath
|
||||
global configFile
|
||||
global archs
|
||||
global compilers
|
||||
|
@ -755,7 +751,7 @@ def parseOptionsAndInitTestdirs():
|
|||
lldbFrameworkPath = args.framework
|
||||
|
||||
if args.executable:
|
||||
lldbExecutablePath = args.executable
|
||||
lldbtest_config.lldbExec = args.executable
|
||||
|
||||
if args.libcxx:
|
||||
os.environ["LIBCXX_PATH"] = args.libcxx
|
||||
|
@ -946,7 +942,6 @@ def setupSysPath():
|
|||
global svn_info
|
||||
global svn_silent
|
||||
global lldbFrameworkPath
|
||||
global lldbExecutablePath
|
||||
|
||||
# Get the directory containing the current script.
|
||||
if "DOTEST_PROFILE" in os.environ and "DOTEST_SCRIPT_DIR" in os.environ:
|
||||
|
@ -1005,23 +1000,18 @@ def setupSysPath():
|
|||
# Some of the tests can invoke the 'lldb' command directly.
|
||||
# We'll try to locate the appropriate executable right here.
|
||||
|
||||
lldbExec = None
|
||||
lldbMiExec = None
|
||||
lldbHere = None
|
||||
if lldbExecutablePath:
|
||||
if is_exe(lldbExecutablePath):
|
||||
lldbExec = lldbExecutablePath
|
||||
lldbHere = lldbExec
|
||||
else:
|
||||
print lldbExecutablePath + " is not an executable, lldb tests will fail."
|
||||
else:
|
||||
|
||||
# The lldb executable can be set from the command line
|
||||
# if it's not set, we try to find it now
|
||||
# first, we try the environment
|
||||
if not lldbtest_config.lldbExec:
|
||||
# First, you can define an environment variable LLDB_EXEC specifying the
|
||||
# full pathname of the lldb executable.
|
||||
if "LLDB_EXEC" in os.environ and is_exe(os.environ["LLDB_EXEC"]):
|
||||
lldbExec = os.environ["LLDB_EXEC"]
|
||||
else:
|
||||
lldbExec = None
|
||||
|
||||
if "LLDB_EXEC" in os.environ:
|
||||
lldbtest_config.lldbExec = os.environ["LLDB_EXEC"]
|
||||
|
||||
if not lldbtest_config.lldbExec:
|
||||
executable = ['lldb']
|
||||
dbgExec = os.path.join(base, *(xcode3_build_dir + dbg + executable))
|
||||
dbgExec2 = os.path.join(base, *(xcode4_build_dir + dbg + executable))
|
||||
|
@ -1034,54 +1024,50 @@ def setupSysPath():
|
|||
|
||||
# The 'lldb' executable built here in the source tree.
|
||||
if is_exe(dbgExec):
|
||||
lldbHere = dbgExec
|
||||
lldbtest_config.lldbExec = dbgExec
|
||||
elif is_exe(dbgExec2):
|
||||
lldbHere = dbgExec2
|
||||
lldbtest_config.lldbExec = dbgExec2
|
||||
elif is_exe(dbcExec):
|
||||
lldbHere = dbcExec
|
||||
lldbtest_config.lldbExec = dbcExec
|
||||
elif is_exe(dbcExec2):
|
||||
lldbHere = dbcExec2
|
||||
lldbtest_config.lldbExec = dbcExec2
|
||||
elif is_exe(relExec):
|
||||
lldbHere = relExec
|
||||
lldbtest_config.lldbExec = relExec
|
||||
elif is_exe(relExec2):
|
||||
lldbHere = relExec2
|
||||
lldbtest_config.lldbExec = relExec2
|
||||
elif is_exe(baiExec):
|
||||
lldbHere = baiExec
|
||||
lldbtest_config.lldbExec = baiExec
|
||||
elif is_exe(baiExec2):
|
||||
lldbHere = baiExec2
|
||||
elif lldbExec:
|
||||
lldbHere = lldbExec
|
||||
lldbtest_config.lldbExec = baiExec2
|
||||
elif lldbtest_config.lldbExec:
|
||||
lldbtest_config.lldbExec = lldbtest_config.lldbExec
|
||||
|
||||
# One last chance to locate the 'lldb' executable.
|
||||
if not lldbExec:
|
||||
lldbExec = which('lldb')
|
||||
if lldbHere and not lldbExec:
|
||||
lldbExec = lldbHere
|
||||
if lldbExec and not lldbHere:
|
||||
lldbHere = lldbExec
|
||||
|
||||
if lldbHere:
|
||||
os.environ["LLDB_HERE"] = lldbHere
|
||||
lldbLibDir = os.path.split(lldbHere)[0] # confusingly, this is the "bin" directory
|
||||
os.environ["LLDB_LIB_DIR"] = lldbLibDir
|
||||
lldbImpLibDir = os.path.join(lldbLibDir, '..', 'lib') if sys.platform.startswith('win32') else lldbLibDir
|
||||
os.environ["LLDB_IMPLIB_DIR"] = lldbImpLibDir
|
||||
if not noHeaders:
|
||||
print "LLDB library dir:", os.environ["LLDB_LIB_DIR"]
|
||||
print "LLDB import library dir:", os.environ["LLDB_IMPLIB_DIR"]
|
||||
os.system('%s -v' % lldbHere)
|
||||
if not lldbtest_config.lldbExec:
|
||||
# Last, check the path
|
||||
lldbtest_config.lldbExec = which('lldb')
|
||||
|
||||
if not lldbExec:
|
||||
if lldbtest_config.lldbExec and not is_exe(lldbtest_config.lldbExec):
|
||||
print "'{}' is not a path to a valid executable"
|
||||
del lldbtest_config.lldbExec
|
||||
|
||||
if not lldbtest_config.lldbExec:
|
||||
print "The 'lldb' executable cannot be located. Some of the tests may not be run as a result."
|
||||
else:
|
||||
os.environ["LLDB_EXEC"] = lldbExec
|
||||
#print "The 'lldb' from PATH env variable", lldbExec
|
||||
sys.exit(-1)
|
||||
|
||||
lldbLibDir = os.path.dirname(lldbtest_config.lldbExec) # confusingly, this is the "bin" directory
|
||||
os.environ["LLDB_LIB_DIR"] = lldbLibDir
|
||||
lldbImpLibDir = os.path.join(lldbLibDir, '..', 'lib') if sys.platform.startswith('win32') else lldbLibDir
|
||||
os.environ["LLDB_IMPLIB_DIR"] = lldbImpLibDir
|
||||
if not noHeaders:
|
||||
print "LLDB library dir:", os.environ["LLDB_LIB_DIR"]
|
||||
print "LLDB import library dir:", os.environ["LLDB_IMPLIB_DIR"]
|
||||
os.system('%s -v' % lldbtest_config.lldbExec)
|
||||
|
||||
# Assume lldb-mi is in same place as lldb
|
||||
# If not found, disable the lldb-mi tests
|
||||
global dont_do_lldbmi_test
|
||||
if lldbExec and is_exe(lldbExec + "-mi"):
|
||||
lldbMiExec = lldbExec + "-mi"
|
||||
if lldbtest_config.lldbExec and is_exe(lldbtest_config.lldbExec + "-mi"):
|
||||
lldbMiExec = lldbtest_config.lldbExec + "-mi"
|
||||
if not lldbMiExec:
|
||||
dont_do_lldbmi_test = True
|
||||
if just_do_lldbmi_test:
|
||||
|
@ -1119,11 +1105,8 @@ def setupSysPath():
|
|||
|
||||
# If our lldb supports the -P option, use it to find the python path:
|
||||
init_in_python_dir = os.path.join('lldb', '__init__.py')
|
||||
lldb_dash_p_result = None
|
||||
|
||||
lldbExecutable = lldbHere if lldbHere else lldbExec
|
||||
if lldbExecutable:
|
||||
lldb_dash_p_result = subprocess.check_output([lldbExecutable, "-P"], stderr=subprocess.STDOUT)
|
||||
lldb_dash_p_result = subprocess.check_output([lldbtest_config.lldbExec, "-P"], stderr=subprocess.STDOUT)
|
||||
|
||||
if lldb_dash_p_result and not lldb_dash_p_result.startswith(("<", "lldb: invalid option:")) \
|
||||
and not lldb_dash_p_result.startswith("Traceback"):
|
||||
|
|
|
@ -55,7 +55,7 @@ class DriverBatchModeTest (TestBase):
|
|||
|
||||
# First time through, pass CRASH so the process will crash and stop in batch mode.
|
||||
run_commands = ' -b -o "break set -n main" -o "run" -o "continue" -k "frame var touch_me_not"'
|
||||
self.child = pexpect.spawn('%s %s %s %s -- CRASH' % (self.lldbHere, self.lldbOption, run_commands, exe))
|
||||
self.child = pexpect.spawn('%s %s %s %s -- CRASH' % (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
|
||||
child = self.child
|
||||
# Turn on logging for what the child sends back.
|
||||
if self.TraceOn():
|
||||
|
@ -78,7 +78,7 @@ class DriverBatchModeTest (TestBase):
|
|||
|
||||
# Now do it again, and see make sure if we don't crash, we quit:
|
||||
run_commands = ' -b -o "break set -n main" -o "run" -o "continue" '
|
||||
self.child = pexpect.spawn('%s %s %s %s -- NOCRASH' % (self.lldbHere, self.lldbOption, run_commands, exe))
|
||||
self.child = pexpect.spawn('%s %s %s %s -- NOCRASH' % (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
|
||||
child = self.child
|
||||
# Turn on logging for what the child sends back.
|
||||
if self.TraceOn():
|
||||
|
|
|
@ -20,7 +20,7 @@ class CommandRegexTestCase(TestBase):
|
|||
regex_prompt = "Enter one of more sed substitution commands in the form: 's/<regex>/<subst>/'.\r\nTerminate the substitution list with an empty line.\r\n"
|
||||
regex_prompt1 = "\r\n"
|
||||
|
||||
child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption))
|
||||
child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption))
|
||||
# Turn on logging for what the child sends back.
|
||||
if self.TraceOn():
|
||||
child.logfile_read = sys.stdout
|
||||
|
|
|
@ -236,7 +236,7 @@ class CommandLineCompletionTestCase(TestBase):
|
|||
prompt = "(lldb) "
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn(self.lldbHere,
|
||||
self.child = pexpect.spawn(lldbtest_config.lldbExec,
|
||||
[self.lldbOption] + ['--no-use-colors'])
|
||||
child = self.child
|
||||
# Turn on logging for input/output to/from the child.
|
||||
|
|
|
@ -41,7 +41,7 @@ class ConvenienceVariablesCase(TestBase):
|
|||
python_prompt = ">>> "
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
# Turn on logging for what the child sends back.
|
||||
if self.TraceOn():
|
||||
|
|
|
@ -18,7 +18,7 @@ class TestFormats(TestBase):
|
|||
self.buildDwarf ()
|
||||
import pexpect
|
||||
prompt = "(lldb) "
|
||||
child = pexpect.spawn('%s %s -x -o "b main" -o r a.out' % (self.lldbHere, self.lldbOption))
|
||||
child = pexpect.spawn('%s %s -x -o "b main" -o r a.out' % (lldbtest_config.lldbExec, self.lldbOption))
|
||||
# Turn on logging for what the child sends back.
|
||||
if self.TraceOn():
|
||||
child.logfile_read = sys.stdout
|
||||
|
|
|
@ -34,7 +34,7 @@ class SingleQuoteInCommandLineTestCase(TestBase):
|
|||
prompt = "(lldb) "
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s "%s"' % (self.lldbHere, self.lldbOption, self.myexe))
|
||||
self.child = pexpect.spawn('%s %s "%s"' % (lldbtest_config.lldbExec, self.lldbOption, self.myexe))
|
||||
child = self.child
|
||||
child.setecho(True)
|
||||
# Turn on logging for input/output to/from the child.
|
||||
|
|
|
@ -45,7 +45,7 @@ class StopHookMechanismTestCase(TestBase):
|
|||
add_prompt1 = "> "
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
# Turn on logging for what the child sends back.
|
||||
if self.TraceOn():
|
||||
|
|
|
@ -48,7 +48,7 @@ class StopHookForMultipleThreadsTestCase(TestBase):
|
|||
prompt = "(lldb) "
|
||||
|
||||
# So that the child gets torn down after the test.
|
||||
self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe))
|
||||
self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
|
||||
child = self.child
|
||||
# Turn on logging for what the child sends back.
|
||||
if self.TraceOn():
|
||||
|
|
|
@ -19,7 +19,7 @@ class PExpectTest(TestBase):
|
|||
def launch(self, timeout=None):
|
||||
if timeout is None: timeout = 30
|
||||
logfile = sys.stdout if self.TraceOn() else None
|
||||
self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.launchArgs()), logfile=logfile)
|
||||
self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.launchArgs()), logfile=logfile)
|
||||
self.child.timeout = timeout
|
||||
self.timeout = timeout
|
||||
|
||||
|
|
|
@ -1060,19 +1060,12 @@ class Base(unittest2.TestCase):
|
|||
else:
|
||||
self.libcxxPath = None
|
||||
|
||||
if "LLDB_EXEC" in os.environ:
|
||||
self.lldbExec = os.environ["LLDB_EXEC"]
|
||||
else:
|
||||
self.lldbExec = None
|
||||
if "LLDBMI_EXEC" in os.environ:
|
||||
self.lldbMiExec = os.environ["LLDBMI_EXEC"]
|
||||
else:
|
||||
self.lldbMiExec = None
|
||||
self.dont_do_lldbmi_test = True
|
||||
if "LLDB_HERE" in os.environ:
|
||||
self.lldbHere = os.environ["LLDB_HERE"]
|
||||
else:
|
||||
self.lldbHere = None
|
||||
|
||||
# If we spawn an lldb process for test (via pexpect), do not load the
|
||||
# init file unless told otherwise.
|
||||
if "NO_LLDBINIT" in os.environ and "NO" == os.environ["NO_LLDBINIT"]:
|
||||
|
@ -1564,9 +1557,9 @@ class Base(unittest2.TestCase):
|
|||
|
||||
# spawn local process
|
||||
command = [
|
||||
self.lldbHere,
|
||||
lldbtest_config.lldbExec,
|
||||
"-o",
|
||||
"file " + self.lldbHere,
|
||||
"file " + lldbtest_config.lldbExec,
|
||||
"-o",
|
||||
"quit"
|
||||
]
|
||||
|
@ -1807,7 +1800,7 @@ class Base(unittest2.TestCase):
|
|||
return path
|
||||
|
||||
# Tries to find clang at the same folder as the lldb
|
||||
path = os.path.join(os.path.dirname(self.lldbExec), "clang")
|
||||
path = os.path.join(os.path.dirname(lldbtest_config.lldbExec), "clang")
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
|
||||
|
|
|
@ -15,3 +15,7 @@ channels = []
|
|||
|
||||
# leave logs/traces even for successful test runs
|
||||
log_success = False
|
||||
|
||||
# path to the lldb command line executable tool
|
||||
lldbExec = None
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class CommandLineCompletionTestCase(TestBase):
|
|||
child.logfile_read = None
|
||||
|
||||
# Invoke the lldb command.
|
||||
child.sendline('%s %s' % (self.lldbHere, self.lldbOption))
|
||||
child.sendline('%s %s' % (lldbtest_config.lldbExec, self.lldbOption))
|
||||
child.expect_exact(lldb_prompt)
|
||||
|
||||
# Immediately quit.
|
||||
|
|
|
@ -34,6 +34,8 @@ def _get_debug_monitor_from_lldb(lldb_exe, debug_monitor_basename):
|
|||
returns None.
|
||||
|
||||
"""
|
||||
if not lldb_exe:
|
||||
return None
|
||||
|
||||
exe_dir = os.path.dirname(lldb_exe)
|
||||
exe_base = os.path.basename(lldb_exe)
|
||||
|
@ -46,27 +48,26 @@ def _get_debug_monitor_from_lldb(lldb_exe, debug_monitor_basename):
|
|||
debug_monitor_exe = os.path.join(exe_dir, new_base)
|
||||
if os.path.exists(debug_monitor_exe):
|
||||
return debug_monitor_exe
|
||||
else:
|
||||
return None
|
||||
|
||||
new_base = regex.sub( 'LLDB.framework/Versions/A/Resources/' + debug_monitor_basename, exe_base)
|
||||
debug_monitor_exe = os.path.join(exe_dir, new_base)
|
||||
if os.path.exists(debug_monitor_exe):
|
||||
return debug_monitor_exe
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def get_lldb_server_exe():
|
||||
"""Return the lldb-server exe path.
|
||||
|
||||
Returns:
|
||||
A path to the lldb-gdbserver exe if it is found to exist; otherwise,
|
||||
A path to the lldb-server exe if it is found to exist; otherwise,
|
||||
returns None.
|
||||
"""
|
||||
if "LLDB_DEBUGSERVER_PATH" in os.environ:
|
||||
return os.environ["LLDB_DEBUGSERVER_PATH"]
|
||||
elif "LLDB_EXEC" in os.environ:
|
||||
lldb_exe = os.environ["LLDB_EXEC"]
|
||||
if not lldb_exe:
|
||||
return None
|
||||
else:
|
||||
return _get_debug_monitor_from_lldb(lldb_exe, "lldb-server")
|
||||
else:
|
||||
return None
|
||||
|
||||
return _get_debug_monitor_from_lldb(lldb_exe, "lldb-server")
|
||||
|
||||
def get_debugserver_exe():
|
||||
"""Return the debugserver exe path.
|
||||
|
@ -77,15 +78,8 @@ def get_debugserver_exe():
|
|||
"""
|
||||
if "LLDB_DEBUGSERVER_PATH" in os.environ:
|
||||
return os.environ["LLDB_DEBUGSERVER_PATH"]
|
||||
elif "LLDB_EXEC" in os.environ:
|
||||
lldb_exe = os.environ["LLDB_EXEC"]
|
||||
if not lldb_exe:
|
||||
return None
|
||||
else:
|
||||
return _get_debug_monitor_from_lldb(lldb_exe, "debugserver")
|
||||
else:
|
||||
return None
|
||||
|
||||
return _get_debug_monitor_from_lldb(lldbtest_config.lldbExec, "debugserver")
|
||||
|
||||
_LOG_LINE_REGEX = re.compile(r'^(lldb-server|debugserver)\s+<\s*(\d+)>' +
|
||||
'\s+(read|send)\s+packet:\s+(.+)$')
|
||||
|
|
Loading…
Reference in New Issue