diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-03-05 01:20:11 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-03-05 01:20:11 +0000 |
commit | 930e3ad51e23e6ef29657d607173faf3e0e2b7b8 (patch) | |
tree | 687f0c3e3f177903282d5c486963b08965a2f137 /lldb/test/python_api/process/TestProcessAPI.py | |
parent | 4b598e156ad58843d93319fd88832c77c06191ff (diff) | |
download | bcm5719-llvm-930e3ad51e23e6ef29657d607173faf3e0e2b7b8.tar.gz bcm5719-llvm-930e3ad51e23e6ef29657d607173faf3e0e2b7b8.zip |
Add a test case ProcessAPITestCase.test_remote_launch() which tests SBProcess.RemoteLaunch()
API with a process not in eStateConnected, and checks that the remote launch failed.
Modify SBProcess::RemoteLaunch()/RemoteAttachToProcessWithID()'s log statements to fix a
crasher when logging is turned on.
llvm-svn: 127055
Diffstat (limited to 'lldb/test/python_api/process/TestProcessAPI.py')
-rw-r--r-- | lldb/test/python_api/process/TestProcessAPI.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lldb/test/python_api/process/TestProcessAPI.py b/lldb/test/python_api/process/TestProcessAPI.py index 474ae062059..d00ad19ca09 100644 --- a/lldb/test/python_api/process/TestProcessAPI.py +++ b/lldb/test/python_api/process/TestProcessAPI.py @@ -5,7 +5,7 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others. import os, time import unittest2 import lldb -from lldbutil import get_stopped_thread +from lldbutil import get_stopped_thread, StateTypeString from lldbtest import * class ProcessAPITestCase(TestBase): @@ -51,6 +51,12 @@ class ProcessAPITestCase(TestBase): self.buildDwarf() self.access_my_int() + @python_api_test + def test_remote_launch(self): + """Test SBProcess.RemoteLaunch() API with a process not in eStateConnected, and it should fail.""" + self.buildDefault() + self.remote_launch_should_fail() + def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -230,6 +236,24 @@ class ProcessAPITestCase(TestBase): for i in new_bytes: print "byte:", i + def remote_launch_should_fail(self): + """Test SBProcess.RemoteLaunch() API with a process not in eStateConnected, and it should fail.""" + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target.IsValid(), 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) + + print "process state:", StateTypeString(process.GetState()) + self.assertTrue(process.GetState() != lldb.eStateConnected) + + success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error) + self.assertTrue(not success, "RemoteLaunch() should fail for process state != eStateConnected") + if __name__ == '__main__': import atexit |