[Lldb-commits] [lldb] r178552 - Fix test case to not run to main and "next" 5 times. Use a breakpoint.

Greg Clayton gclayton at apple.com
Tue Apr 2 10:48:53 PDT 2013


Author: gclayton
Date: Tue Apr  2 12:48:53 2013
New Revision: 178552

URL: http://llvm.org/viewvc/llvm-project?rev=178552&view=rev
Log:
Fix test case to not run to main and "next" 5 times. Use a breakpoint.


Modified:
    lldb/trunk/test/expression_command/issue_11588/Test11588.py
    lldb/trunk/test/expression_command/issue_11588/main.cpp

Modified: lldb/trunk/test/expression_command/issue_11588/Test11588.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/issue_11588/Test11588.py?rev=178552&r1=178551&r2=178552&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/issue_11588/Test11588.py (original)
+++ lldb/trunk/test/expression_command/issue_11588/Test11588.py Tue Apr  2 12:48:53 2013
@@ -7,6 +7,7 @@ expected in a SyntheticChildrenProvider
 import os, time
 import unittest2
 import lldb
+import lldbutil
 from lldbtest import *
 
 class Issue11581TestCase(TestBase):
@@ -19,23 +20,27 @@ class Issue11581TestCase(TestBase):
         def cleanup():
             self.runCmd('type synthetic clear', check=False)
 
+
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
         """valobj.AddressOf() should return correct values."""
         self.buildDefault()
-
-        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
-        self.runCmd("breakpoint set --name main")
-
-        self.runCmd("run", RUN_SUCCEEDED)
-
-        self.runCmd("next", RUN_SUCCEEDED)
-        self.runCmd("next", RUN_SUCCEEDED)
-        self.runCmd("next", RUN_SUCCEEDED)
-        self.runCmd("next", RUN_SUCCEEDED)
-        self.runCmd("next", RUN_SUCCEEDED)
+        
+        exe = os.path.join(os.getcwd(), "a.out")
+        
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        breakpoint = target.BreakpointCreateBySourceRegex('Set breakpoint here.',lldb.SBFileSpec ("main.cpp", False))
+        
+        process = target.LaunchSimple (None, None, os.getcwd())
+        self.assertTrue (process, "Created a process.")
+        self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped it too.")
+
+        thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
+        self.assertTrue (len(thread_list) == 1)
+        thread = thread_list[0]
 
         self.runCmd("command script import --allow-reload s11588.py")
         self.runCmd("type synthetic add --python-class s11588.Issue11581SyntheticProvider StgClosure")

Modified: lldb/trunk/test/expression_command/issue_11588/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/issue_11588/main.cpp?rev=178552&r1=178551&r2=178552&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/issue_11588/main.cpp (original)
+++ lldb/trunk/test/expression_command/issue_11588/main.cpp Tue Apr  2 12:48:53 2013
@@ -50,5 +50,5 @@ int main()
 	ptr_type r14 = (ptr_type)r14_;
 	int x = 0;
 	x = 3;
-	return (x-1);
+	return (x-1); // Set breakpoint here.
 }





More information about the lldb-commits mailing list