The extra burden for the Python API test case to assign its process object to self.process

in order to have its process cleaned up (terminated) upon tearDown is gone for good.
Let's simplify a bunch of Python API test cases.

llvm-svn: 133097
This commit is contained in:
Johnny Chen
2011-06-15 22:14:12 +00:00
parent c20b1393e1
commit 5a0bee7c5f
28 changed files with 149 additions and 174 deletions

View File

@@ -53,14 +53,12 @@ class DisasmAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
self.process = target.LaunchSimple(None, None, os.getcwd())
self.process = target.GetProcess()
self.assertTrue(self.process, PROCESS_IS_VALID)
process = target.LaunchSimple(None, None, os.getcwd())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1.
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(process.GetState() == lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
@@ -77,9 +75,9 @@ class DisasmAPITestCase(TestBase):
print "context1:", context1
# Continue the inferior, the breakpoint 2 should be hit.
self.process.Continue()
self.assertTrue(self.process.GetState() == lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()