Author: vharron Date: Mon May 18 14:39:03 2015 New Revision: 237600 URL: http://llvm.org/viewvc/llvm-project?rev=237600&view=rev Log: 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 Modified: lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py lldb/trunk/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py lldb/trunk/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py lldb/trunk/test/benchmarks/expression/TestExpressionCmd.py lldb/trunk/test/benchmarks/expression/TestRepeatedExprs.py lldb/trunk/test/benchmarks/frame_variable/TestFrameVariableResponse.py lldb/trunk/test/benchmarks/startup/TestStartupDelays.py lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py lldb/trunk/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py lldb/trunk/test/dotest.py lldb/trunk/test/driver/batch_mode/TestBatchMode.py lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py lldb/trunk/test/functionalities/completion/TestCompletion.py lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py lldb/trunk/test/functionalities/format/TestFormats.py lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py lldb/trunk/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py lldb/trunk/test/lldbpexpect.py lldb/trunk/test/lldbtest.py lldb/trunk/test/lldbtest_config.py lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py Modified: lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py (original) +++ lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py Mon May 18 14:39:03 2015 @@ -15,7 +15,7 @@ class DisassembleDriverMainLoop(BenchBas 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(BenchBas 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(BenchBas 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(BenchBas 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(BenchBas 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. Modified: lldb/trunk/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py (original) +++ lldb/trunk/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py Mon May 18 14:39:03 2015 @@ -16,7 +16,7 @@ class AttachThenDisassemblyBench(BenchBa 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 Modified: lldb/trunk/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py (original) +++ lldb/trunk/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py Mon May 18 14:39:03 2015 @@ -13,7 +13,7 @@ class XCode41Vs42GDBDisassembly(BenchBas 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 Modified: lldb/trunk/test/benchmarks/expression/TestExpressionCmd.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/expression/TestExpressionCmd.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/expression/TestExpressionCmd.py (original) +++ lldb/trunk/test/benchmarks/expression/TestExpressionCmd.py Mon May 18 14:39:03 2015 @@ -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. Modified: lldb/trunk/test/benchmarks/expression/TestRepeatedExprs.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/expression/TestRepeatedExprs.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/expression/TestRepeatedExprs.py (original) +++ lldb/trunk/test/benchmarks/expression/TestRepeatedExprs.py Mon May 18 14:39:03 2015 @@ -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. Modified: lldb/trunk/test/benchmarks/frame_variable/TestFrameVariableResponse.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/frame_variable/TestFrameVariableResponse.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/frame_variable/TestFrameVariableResponse.py (original) +++ lldb/trunk/test/benchmarks/frame_variable/TestFrameVariableResponse.py Mon May 18 14:39:03 2015 @@ -14,7 +14,7 @@ class FrameVariableResponseBench(BenchBa 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(BenchBa 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. Modified: lldb/trunk/test/benchmarks/startup/TestStartupDelays.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/startup/TestStartupDelays.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/startup/TestStartupDelays.py (original) +++ lldb/trunk/test/benchmarks/startup/TestStartupDelays.py Mon May 18 14:39:03 2015 @@ -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. Modified: lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py (original) +++ lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py Mon May 18 14:39:03 2015 @@ -29,7 +29,7 @@ class RunHooksThenSteppingsBench(BenchBa 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 Modified: lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py (original) +++ lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py Mon May 18 14:39:03 2015 @@ -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. Modified: lldb/trunk/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py (original) +++ lldb/trunk/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py Mon May 18 14:39:03 2015 @@ -11,7 +11,7 @@ class CompileRunToBreakpointBench(BenchB 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(BenchB 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. Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Mon May 18 14:39:03 2015 @@ -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 - - # 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) + lldbtest_config.lldbExec = baiExec2 + elif lldbtest_config.lldbExec: + lldbtest_config.lldbExec = lldbtest_config.lldbExec + + if not lldbtest_config.lldbExec: + # Last, check the path + lldbtest_config.lldbExec = which('lldb') + + 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 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"): Modified: lldb/trunk/test/driver/batch_mode/TestBatchMode.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/driver/batch_mode/TestBatchMode.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/driver/batch_mode/TestBatchMode.py (original) +++ lldb/trunk/test/driver/batch_mode/TestBatchMode.py Mon May 18 14:39:03 2015 @@ -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(): Modified: lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py (original) +++ lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py Mon May 18 14:39:03 2015 @@ -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 Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/test/functionalities/completion/TestCompletion.py Mon May 18 14:39:03 2015 @@ -236,7 +236,7 @@ class CommandLineCompletionTestCase(Test 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. Modified: lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py (original) +++ lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py Mon May 18 14:39:03 2015 @@ -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(): Modified: lldb/trunk/test/functionalities/format/TestFormats.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/format/TestFormats.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/functionalities/format/TestFormats.py (original) +++ lldb/trunk/test/functionalities/format/TestFormats.py Mon May 18 14:39:03 2015 @@ -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 Modified: lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py (original) +++ lldb/trunk/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py Mon May 18 14:39:03 2015 @@ -34,7 +34,7 @@ class SingleQuoteInCommandLineTestCase(T 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. Modified: lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py (original) +++ lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py Mon May 18 14:39:03 2015 @@ -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(): Modified: lldb/trunk/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py (original) +++ lldb/trunk/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py Mon May 18 14:39:03 2015 @@ -48,7 +48,7 @@ class StopHookForMultipleThreadsTestCase 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(): Modified: lldb/trunk/test/lldbpexpect.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbpexpect.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/lldbpexpect.py (original) +++ lldb/trunk/test/lldbpexpect.py Mon May 18 14:39:03 2015 @@ -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 Modified: lldb/trunk/test/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/lldbtest.py (original) +++ lldb/trunk/test/lldbtest.py Mon May 18 14:39:03 2015 @@ -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 Modified: lldb/trunk/test/lldbtest_config.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest_config.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/lldbtest_config.py (original) +++ lldb/trunk/test/lldbtest_config.py Mon May 18 14:39:03 2015 @@ -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 + Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (original) +++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Mon May 18 14:39:03 2015 @@ -63,7 +63,7 @@ class CommandLineCompletionTestCase(Test 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. Modified: lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py?rev=237600&r1=237599&r2=237600&view=diff ============================================================================== --- lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py (original) +++ lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py Mon May 18 14:39:03 2015 @@ -34,6 +34,8 @@ def _get_debug_monitor_from_lldb(lldb_ex 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_ex 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+(.+)$') _______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits