[Lldb-commits] [lldb] r146050 - /lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py

Johnny Chen johnny.chen at apple.com
Wed Dec 7 11:27:06 PST 2011


Author: johnny
Date: Wed Dec  7 13:27:06 2011
New Revision: 146050

URL: http://llvm.org/viewvc/llvm-project?rev=146050&view=rev
Log:
Modified the script to have the flexibility of specifying the gdb executable path
for use in the benchmark against lldb's disassembly speed.  Note that the lldb
executable path can already be specified using the LLDB_EXEC env variable.

rdar://problem/7511194

Modified:
    lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py

Modified: lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py?rev=146050&r1=146049&r2=146050&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py (original)
+++ lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py Wed Dec  7 13:27:06 2011
@@ -6,12 +6,33 @@
 import pexpect
 from lldbbench import *
 
+def is_exe(fpath):
+    """Returns true if fpath is an executable."""
+    return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
 class DisassembleDriverMainLoop(BenchBase):
 
     mydir = os.path.join("benchmarks", "disassembly")
 
     def setUp(self):
+        """
+        Note that 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.
+        """
         BenchBase.setUp(self)
+        # If env var GDB_EXEC is specified, use it; otherwise, use gdb in your
+        # PATH env var.
+        if "GDB_EXEC" in os.environ and is_exe(os.environ["GDB_EXEC"]):
+            self.gdbExec = os.environ["GDB_EXEC"]
+        else:
+            self.gdbExec = "gdb"
+
+        print
+        print "lldb path: %s" % self.lldbExec
+        print "gdb path: %s" % self.gdbExec
+
         self.exe = self.lldbHere
         self.function = 'Driver::MainLoop()'
         self.lldb_avg = None
@@ -86,7 +107,7 @@
         prompt = self.child_prompt
 
         # So that the child gets torn down after the test.
-        self.child = pexpect.spawn('gdb --nx %s' % exe)
+        self.child = pexpect.spawn('%s --nx %s' % (self.gdbExec, exe))
         child = self.child
 
         # Turn on logging for what the child sends back.





More information about the lldb-commits mailing list