[Lldb-commits] [lldb] r133280 - /lldb/trunk/test/hello_world/TestHelloWorld.py
Johnny Chen
johnny.chen at apple.com
Fri Jun 17 12:38:48 PDT 2011
Author: johnny
Date: Fri Jun 17 14:38:48 2011
New Revision: 133280
URL: http://llvm.org/viewvc/llvm-project?rev=133280&view=rev
Log:
Modify a bunch of docstrings to be more correct. Check the SBError.Success() after attaching.
Also eat the stdout of the spawned "hello_world" process if not in TraceOn() mode.
Modified:
lldb/trunk/test/hello_world/TestHelloWorld.py
Modified: lldb/trunk/test/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/hello_world/TestHelloWorld.py?rev=133280&r1=133279&r2=133280&view=diff
==============================================================================
--- lldb/trunk/test/hello_world/TestHelloWorld.py (original)
+++ lldb/trunk/test/hello_world/TestHelloWorld.py Fri Jun 17 14:38:48 2011
@@ -48,7 +48,7 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@python_api_test
def test_with_dsym_and_attach_to_process_with_id_api(self):
- """Create target, breakpoint, spawn a process, and attach to it with process id.
+ """Create target, spawn a process, and attach to it with process id.
Use dsym info and attach to process with id API.
"""
@@ -57,7 +57,7 @@
@python_api_test
def test_with_dwarf_and_attach_to_process_with_id_api(self):
- """Create target, breakpoint, spawn a process, and attach to it with process id.
+ """Create target, spawn a process, and attach to it with process id.
Use dwarf map (no dsym) and attach to process with id API.
"""
@@ -67,7 +67,7 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@python_api_test
def test_with_dsym_and_attach_to_process_with_name_api(self):
- """Create target, breakpoint, spawn a process, and attach to it with process name.
+ """Create target, spawn a process, and attach to it with process name.
Use dsym info and attach to process with name API.
"""
@@ -76,7 +76,7 @@
@python_api_test
def test_with_dwarf_and_attach_to_process_with_name_api(self):
- """Create target, breakpoint, spawn a process, and attach to it with process name.
+ """Create target, spawn a process, and attach to it with process name.
Use dwarf map (no dsym) and attach to process with name API.
"""
@@ -138,20 +138,21 @@
self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
def hello_world_attach_with_id_api(self):
- """Create target, breakpoint, spawn a process, and attach to it by id."""
+ """Create target, spawn a process, and attach to it by id."""
target = self.dbg.CreateTarget(self.exe)
- # Spawn a new process.
+ # Spawn a new process and don't display the stdout if not in TraceOn() mode.
import subprocess
- popen = subprocess.Popen([self.exe, "abc", "xyz"])
+ popen = subprocess.Popen([self.exe, "abc", "xyz"],
+ stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
#print "pid of spawned process: %d" % popen.pid
listener = lldb.SBListener("my.attach.listener")
error = lldb.SBError()
process = target.AttachToProcessWithID(listener, popen.pid, error)
- self.assertTrue(process, PROCESS_IS_VALID)
+ self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
# Let's check the stack traces of the attached process.
import lldbutil
@@ -161,13 +162,14 @@
'(int)argc=3'])
def hello_world_attach_with_name_api(self):
- """Create target, breakpoint, spawn a process, and attach to it by name."""
+ """Create target, spawn a process, and attach to it by name."""
target = self.dbg.CreateTarget(self.exe)
- # Spawn a new process.
+ # Spawn a new process and don't display the stdout if not in TraceOn() mode.
import subprocess
- popen = subprocess.Popen([self.exe, "abc", "xyz"])
+ popen = subprocess.Popen([self.exe, "abc", "xyz"],
+ stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
#print "pid of spawned process: %d" % popen.pid
listener = lldb.SBListener("my.attach.listener")
@@ -176,7 +178,7 @@
name = os.path.basename(self.exe)
process = target.AttachToProcessWithName(listener, name, False, error)
- self.assertTrue(process, PROCESS_IS_VALID)
+ self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
# Verify that after attach, our selected target indeed matches name.
self.expect(self.dbg.GetSelectedTarget().GetExecutable().GetFilename(), exe=False,
More information about the lldb-commits
mailing list