[Lldb-commits] [lldb] r138608 - in /lldb/trunk/test: benchmarks/disassembly/TestDisassembly.py benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py dotest.py functionalities/command_regex/TestCommandRegex.py functionalities/embedded_interpreter/TestConvenienceVariables.py functionalities/stop-hook/TestStopHookMechanism.py lldbtest.py

Johnny Chen johnny.chen at apple.com
Thu Aug 25 17:00:01 PDT 2011


Author: johnny
Date: Thu Aug 25 19:00:01 2011
New Revision: 138608

URL: http://llvm.org/viewvc/llvm-project?rev=138608&view=rev
Log:
Add a new attribute self.lldbHere, representing the fullpath to the 'lldb' executable
built locally from the source tree.  This is distinguished from self.lldbExec, which
can be used by test/benchmarks to measure the performances against other debuggers.

You can use environment variable LLDB_EXEC to specify self.lldbExec to the dotest.py
test driver, otherwise it is going to be populated with self.lldbHere.

Modify the regular tests under test dir, i.e., not test/benchmarks, to use self.lldbHere.
Also modify the benchmarks tests to use self.lldbHere when it needs an 'lldb' executable
with debug info to do the performance measurements.

Modified:
    lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
    lldb/trunk/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py
    lldb/trunk/test/dotest.py
    lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py
    lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
    lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py?rev=138608&r1=138607&r2=138608&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py (original)
+++ lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py Thu Aug 25 19:00:01 2011
@@ -12,7 +12,7 @@
 
     def setUp(self):
         BenchBase.setUp(self)
-        self.exe = self.lldbExec
+        self.exe = self.lldbHere
         self.function = 'Driver::MainLoop()'
         self.lldb_avg = None
         self.gdb_avg = None

Modified: lldb/trunk/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py?rev=138608&r1=138607&r2=138608&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py (original)
+++ lldb/trunk/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py Thu Aug 25 19:00:01 2011
@@ -14,7 +14,7 @@
         BenchBase.setUp(self)
         self.gdb_41_exe = '/Flint/usr/bin/gdb'
         self.gdb_42_exe = '/Developer/usr/bin/gdb'
-        self.exe = self.lldbExec
+        self.exe = self.lldbHere
         self.function = 'Driver::MainLoop()'
         self.gdb_41_avg = None
         self.gdb_42_avg = None

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=138608&r1=138607&r2=138608&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Thu Aug 25 19:00:01 2011
@@ -567,6 +567,13 @@
     # Some of the tests can invoke the 'lldb' command directly.
     # We'll try to locate the appropriate executable right here.
 
+    # 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
+
     executable = ['lldb']
     dbgExec  = os.path.join(base, *(xcode3_build_dir + dbg + executable))
     dbgExec2 = os.path.join(base, *(xcode4_build_dir + dbg + executable))
@@ -575,26 +582,34 @@
     baiExec  = os.path.join(base, *(xcode3_build_dir + bai + executable))
     baiExec2 = os.path.join(base, *(xcode4_build_dir + bai + executable))
 
-    lldbExec = None
+    # The 'lldb' executable built here in the source tree.
+    lldbHere = None
     if is_exe(dbgExec):
-        lldbExec = dbgExec
+        lldbHere = dbgExec
     elif is_exe(dbgExec2):
-        lldbExec = dbgExec2
+        lldbHere = dbgExec2
     elif is_exe(relExec):
-        lldbExec = relExec
+        lldbHere = relExec
     elif is_exe(relExec2):
-        lldbExec = relExec2
+        lldbHere = relExec2
     elif is_exe(baiExec):
-        lldbExec = baiExec
+        lldbHere = baiExec
     elif is_exe(baiExec2):
-        lldbExec = baiExec2
+        lldbHere = baiExec2
 
-    if lldbExec:
+    if lldbHere:
+        os.environ["LLDB_HERE"] = lldbHere
+        if not lldbExec:
+            lldbExec = lldbHere
         os.environ["LLDB_BUILD_DIR"] = os.path.split(lldbExec)[0]
         print os.environ["LLDB_BUILD_DIR"]
 
+    # One last chance to locate the 'lldb' executable.
     if not lldbExec:
-        lldbExec = which('lldb')
+        if lldbHere:
+            lldbExec = lldbHere
+        else:
+            lldbExec = which('lldb')
 
     if not lldbExec:
         print "The 'lldb' executable cannot be located.  Some of the tests may not be run as a result."

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=138608&r1=138607&r2=138608&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py (original)
+++ lldb/trunk/test/functionalities/command_regex/TestCommandRegex.py Thu Aug 25 19:00:01 2011
@@ -18,7 +18,7 @@
         regex_prompt = "Enter regular expressions in the form 's/<regex>/<subst>/' and terminate with an empty line:\r\n"
         regex_prompt1 = "\r\n"
 
-        child = pexpect.spawn('%s' % self.lldbExec)
+        child = pexpect.spawn('%s' % self.lldbHere)
         # Turn on logging for what the child sends back.
         if self.TraceOn():
             child.logfile_read = sys.stdout

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=138608&r1=138607&r2=138608&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py (original)
+++ lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py Thu Aug 25 19:00:01 2011
@@ -34,7 +34,7 @@
         python_prompt = ">>> "
 
         # So that the child gets torn down after the test.
-        self.child = pexpect.spawn('%s %s' % (self.lldbExec, exe))
+        self.child = pexpect.spawn('%s %s' % (self.lldbHere, exe))
         child = self.child
         # Turn on logging for what the child sends back.
         if self.TraceOn():

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=138608&r1=138607&r2=138608&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py (original)
+++ lldb/trunk/test/functionalities/stop-hook/TestStopHookMechanism.py Thu Aug 25 19:00:01 2011
@@ -39,7 +39,7 @@
         add_prompt1 = "\r\n> "
 
         # So that the child gets torn down after the test.
-        self.child = pexpect.spawn('%s %s' % (self.lldbExec, exe))
+        self.child = pexpect.spawn('%s %s' % (self.lldbHere, exe))
         child = self.child
         # Turn on logging for what the child sends back.
         if self.TraceOn():

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=138608&r1=138607&r2=138608&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Aug 25 19:00:01 2011
@@ -475,6 +475,12 @@
 
         if "LLDB_EXEC" in os.environ:
             self.lldbExec = os.environ["LLDB_EXEC"]
+        else:
+            self.lldbExec = None
+        if "LLDB_HERE" in os.environ:
+            self.lldbHere = os.environ["LLDB_HERE"]
+        else:
+            self.lldbHere = None
 
         # Assign the test method name to self.testMethodName.
         #





More information about the lldb-commits mailing list