Passing in os.ctermid() as the arg for SBTarget.Launch(...) for stdin_path, stdout_path, and stderr_path

is just wrong and resulted in the inferior's output getting mixed into the GDB remote communication's
log file.  Change all test cases to not pass os.ctermid() and either use SBTarget.LaunchSimple() or
SBTarget.Launch() and pass None as stdin_path/stdout_path/srderr_path to use a pseudo terminal.

rdar://problem/9716499 program output is getting mixed into the GDB remote communications

llvm-svn: 134940
This commit is contained in:
Johnny Chen
2011-07-11 23:38:23 +00:00
parent 3472838c7a
commit 1d3e880c2c
11 changed files with 27 additions and 36 deletions

View File

@@ -149,7 +149,7 @@ class EventAPITestCase(TestBase):
# Now launch the process, and do not stop at entry point.
error = lldb.SBError()
process = target.Launch (listener, None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
process = target.Launch (listener, None, None, None, None, None, None, 0, False, error)
self.assertTrue(process, PROCESS_IS_VALID)
# Get a handle on the process's broadcaster.

View File

@@ -44,10 +44,9 @@ class LLDBIteratorTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
rc = lldb.SBError()
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
process = target.LaunchSimple(None, None, os.getcwd())
if not rc.Success() or not process:
if not process:
self.fail("SBTarget.LaunchProcess() failed")
from lldbutil import get_description
@@ -105,10 +104,9 @@ class LLDBIteratorTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
rc = lldb.SBError()
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
process = target.LaunchSimple(None, None, os.getcwd())
if not rc.Success() or not process:
if not process:
self.fail("SBTarget.LaunchProcess() failed")
from lldbutil import print_stacktrace

View File

@@ -33,10 +33,9 @@ class RegistersIteratorTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
rc = lldb.SBError()
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
process = target.LaunchSimple(None, None, os.getcwd())
if not rc.Success() or not process:
if not process:
self.fail("SBTarget.LaunchProcess() failed")
import lldbutil

View File

@@ -34,10 +34,9 @@ class ThreadsStackTracesTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
rc = lldb.SBError()
process = target.Launch (self.dbg.GetListener(), ["abc", "xyz"], None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, rc)
process = target.LaunchSimple(["abc", "xyz"], None, os.getcwd())
if not rc.Success() or not process:
if not process:
self.fail("SBTarget.LaunchProcess() failed")
import lldbutil

View File

@@ -75,8 +75,7 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
error = lldb.SBError()
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
process = target.LaunchSimple(None, None, os.getcwd())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
@@ -95,6 +94,7 @@ class ProcessAPITestCase(TestBase):
# Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and
# expect to get a Python string as the result object!
error = lldb.SBError()
content = process.ReadMemory(location, 1, error)
if not error.Success():
self.fail("SBProcess.ReadMemory() failed")
@@ -117,8 +117,7 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
error = lldb.SBError()
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
process = target.LaunchSimple(None, None, os.getcwd())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
@@ -139,6 +138,7 @@ class ProcessAPITestCase(TestBase):
# But we want to use the WriteMemory() API to assign 'a' to the variable.
# Now use WriteMemory() API to write 'a' into the global variable.
error = lldb.SBError()
result = process.WriteMemory(location, 'a', error)
if not error.Success() or result != 1:
self.fail("SBProcess.WriteMemory() failed")
@@ -168,8 +168,7 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
error = lldb.SBError()
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
process = target.LaunchSimple(None, None, os.getcwd())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
@@ -207,6 +206,7 @@ class ProcessAPITestCase(TestBase):
# Now use WriteMemory() API to write 256 into the global variable.
new_value = str(bytes)
error = lldb.SBError()
result = process.WriteMemory(location, new_value, error)
if not error.Success() or result != byteSize:
self.fail("SBProcess.WriteMemory() failed")
@@ -254,13 +254,13 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Launch the process, and do not stop at the entry point.
error = lldb.SBError()
process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error)
process = target.LaunchSimple(None, None, os.getcwd())
if self.TraceOn():
print "process state:", state_type_to_str(process.GetState())
self.assertTrue(process.GetState() != lldb.eStateConnected)
error = lldb.SBError()
success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error)
self.assertTrue(not success, "RemoteLaunch() should fail for process state != eStateConnected")