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
diff --git a/lldb/test/benchmarks/disassembly/TestDisassembly.py b/lldb/test/benchmarks/disassembly/TestDisassembly.py
index 0993f05..9f9920d 100644
--- a/lldb/test/benchmarks/disassembly/TestDisassembly.py
+++ b/lldb/test/benchmarks/disassembly/TestDisassembly.py
@@ -15,7 +15,7 @@
 
     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 @@
         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 @@
     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 @@
     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 @@
         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.
diff --git a/lldb/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py b/lldb/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
index 39eb3d4..0a5f51f 100644
--- a/lldb/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
+++ b/lldb/test/benchmarks/disassembly/TestDoAttachThenDisassembly.py
@@ -16,7 +16,7 @@
         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
diff --git a/lldb/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py b/lldb/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
index fc036d0..aa37157 100644
--- a/lldb/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
+++ b/lldb/test/benchmarks/disassembly/TestXcode41Vs42GDBDisassembly.py
@@ -13,7 +13,7 @@
         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
diff --git a/lldb/test/benchmarks/expression/TestExpressionCmd.py b/lldb/test/benchmarks/expression/TestExpressionCmd.py
index 693398d..46a8582 100644
--- a/lldb/test/benchmarks/expression/TestExpressionCmd.py
+++ b/lldb/test/benchmarks/expression/TestExpressionCmd.py
@@ -40,7 +40,7 @@
         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.
diff --git a/lldb/test/benchmarks/expression/TestRepeatedExprs.py b/lldb/test/benchmarks/expression/TestRepeatedExprs.py
index 8fad1e7..21fe7b3 100644
--- a/lldb/test/benchmarks/expression/TestRepeatedExprs.py
+++ b/lldb/test/benchmarks/expression/TestRepeatedExprs.py
@@ -42,7 +42,7 @@
         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.
diff --git a/lldb/test/benchmarks/frame_variable/TestFrameVariableResponse.py b/lldb/test/benchmarks/frame_variable/TestFrameVariableResponse.py
index 2da6926..7f738f1 100644
--- a/lldb/test/benchmarks/frame_variable/TestFrameVariableResponse.py
+++ b/lldb/test/benchmarks/frame_variable/TestFrameVariableResponse.py
@@ -14,7 +14,7 @@
         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 @@
         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.
diff --git a/lldb/test/benchmarks/startup/TestStartupDelays.py b/lldb/test/benchmarks/startup/TestStartupDelays.py
index 8a9ba43..f307a47 100644
--- a/lldb/test/benchmarks/startup/TestStartupDelays.py
+++ b/lldb/test/benchmarks/startup/TestStartupDelays.py
@@ -19,7 +19,7 @@
         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 @@
         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.
diff --git a/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py b/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py
index 9161cef..234b96c 100644
--- a/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py
+++ b/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py
@@ -29,7 +29,7 @@
         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
diff --git a/lldb/test/benchmarks/stepping/TestSteppingSpeed.py b/lldb/test/benchmarks/stepping/TestSteppingSpeed.py
index 479c4cd..23471da 100644
--- a/lldb/test/benchmarks/stepping/TestSteppingSpeed.py
+++ b/lldb/test/benchmarks/stepping/TestSteppingSpeed.py
@@ -14,7 +14,7 @@
         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 @@
         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.
diff --git a/lldb/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py b/lldb/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
index c3c5fc7..f7b6d4d 100644
--- a/lldb/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
+++ b/lldb/test/benchmarks/turnaround/TestCompileRunToBreakpointTurnaround.py
@@ -11,7 +11,7 @@
 
     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 @@
             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.