[Lldb-commits] [lldb] r141626 - /lldb/trunk/test/dotest.py

Johnny Chen johnny.chen at apple.com
Mon Oct 10 18:30:28 PDT 2011


Author: johnny
Date: Mon Oct 10 20:30:27 2011
New Revision: 141626

URL: http://llvm.org/viewvc/llvm-project?rev=141626&view=rev
Log:
Add '-k' option to the test driver to be able to specify a runhook, which is an lldb command
for the debugger to execute for certain kind of tests (for example, a benchmark).
A list of runhooks can be used to steer the debugger into the desired state before more
actions can be performed.

Modified:
    lldb/trunk/test/dotest.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=141626&r1=141625&r2=141626&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Mon Oct 10 20:30:27 2011
@@ -114,6 +114,10 @@
 # The filters (testclass.testmethod) used to admit tests into our test suite.
 filters = []
 
+# The runhooks is a list of lldb commands specifically for the debugger.
+# Use '-k' to specify a runhook.
+runHooks = []
+
 # If '-g' is specified, the filterspec is not exclusive.  If a test module does
 # not contain testclass.testmethod which matches the filterspec, the whole test
 # module is still admitted into our test suite.  fs4all flag defaults to True.
@@ -190,6 +194,10 @@
        still admitted to the test suite
 -i   : ignore (don't bailout) if 'lldb.py' module cannot be located in the build
        tree relative to this script; use PYTHONPATH to locate the module
+-k   : specify a runhook, which is an lldb command to be executed by the debugger;
+       '-k' option can occur multiple times, the commands are executed one after the
+       other to bring the debugger to a desired state, so that, for example, further
+       benchmarking can be done
 -l   : don't skip long running test
 -p   : specify a regexp filename pattern for inclusion in the test suite
 -r   : specify a dir to relocate the tests and their intermediate files to;
@@ -317,6 +325,7 @@
     global filters
     global fs4all
     global ignore
+    global runHooks
     global skipLongRunningTest
     global regexp
     global rdir
@@ -419,6 +428,13 @@
         elif sys.argv[index].startswith('-i'):
             ignore = True
             index += 1
+        elif sys.argv[index].startswith('-k'):
+            # Increment by 1 to fetch the runhook lldb command.
+            index += 1
+            if index >= len(sys.argv) or sys.argv[index].startswith('-'):
+                usage()
+            runHooks.append(sys.argv[index])
+            index += 1
         elif sys.argv[index].startswith('-l'):
             skipLongRunningTest = False
             index += 1
@@ -890,6 +906,9 @@
 lldb.bmExecutable = bmExecutable
 lldb.bmBreakpointSpec = bmBreakpointSpec
 
+# And don't forget the runHooks!
+lldb.runHooks = runHooks
+
 # Turn on lldb loggings if necessary.
 lldbLoggings()
 





More information about the lldb-commits mailing list