diff options
author | Johnny Chen <johnny.chen@apple.com> | 2010-09-01 00:15:19 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2010-09-01 00:15:19 +0000 |
commit | 63dfb276472b925d3b865dd6bd1940db8b299c6c (patch) | |
tree | cf8e431faf4db19645d13cc2ab0c87c4f2765ed2 | |
parent | f9e43cef544d33c6d86ce82d9e82e2f3b6152098 (diff) | |
download | bcm5719-llvm-63dfb276472b925d3b865dd6bd1940db8b299c6c.tar.gz bcm5719-llvm-63dfb276472b925d3b865dd6bd1940db8b299c6c.zip |
Avoid killing the inferior process twice by passing a setCookie=False keyword
argument when issuing a "run" lldb command within the test case meant to
exercise the Python APIs, but is using the command interface due to certain
reason (such as target.LaunchProcess() does not reliably bring up the inferior).
llvm-svn: 112682
-rw-r--r-- | lldb/test/array_types/TestArrayTypes.py | 2 | ||||
-rw-r--r-- | lldb/test/bitfields/TestBitfields.py | 6 | ||||
-rw-r--r-- | lldb/test/lldbtest.py | 11 |
3 files changed, 12 insertions, 7 deletions
diff --git a/lldb/test/array_types/TestArrayTypes.py b/lldb/test/array_types/TestArrayTypes.py index 5f24d8dbe6f..6b12c526844 100644 --- a/lldb/test/array_types/TestArrayTypes.py +++ b/lldb/test/array_types/TestArrayTypes.py @@ -84,7 +84,7 @@ class TestArrayTypes(TestBase): breakpoint = target.BreakpointCreateByLocation("main.c", 42) self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT) - self.runCmd("run", RUN_SUCCEEDED) + self.runCmd("run", RUN_SUCCEEDED, setCookie=False) # This does not work, and results in the process stopped at dyld_start? #process = target.LaunchProcess([''], [''], os.ctermid(), False) diff --git a/lldb/test/bitfields/TestBitfields.py b/lldb/test/bitfields/TestBitfields.py index e1b13a30d57..ca88263a4c2 100644 --- a/lldb/test/bitfields/TestBitfields.py +++ b/lldb/test/bitfields/TestBitfields.py @@ -86,7 +86,7 @@ class TestBitfields(TestBase): breakpoint = target.BreakpointCreateByLocation("main.c", 42) self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT) - self.runCmd("run", RUN_SUCCEEDED) + self.runCmd("run", RUN_SUCCEEDED, setCookie=False) # This does not work, and results in the process stopped at dyld_start? #process = target.LaunchProcess([''], [''], os.ctermid(), False) @@ -131,6 +131,10 @@ class TestBitfields(TestBase): int(four.GetValue(frame), 16) == 0x0f, 'bits.four has type uint32_t:4, is in scope, and == 0x0f') + # Now kill the process, and we are done. + rc = target.GetProcess().Kill() + self.assertTrue(rc.Success()) + if __name__ == '__main__': import atexit diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index dfd12cce1b8..74aa21c9aac 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -323,7 +323,7 @@ class TestBase(unittest2.TestCase): # Restore old working directory. os.chdir(self.oldcwd) - def runCmd(self, cmd, msg=None, check=True, trace=False): + def runCmd(self, cmd, msg=None, check=True, trace=False, setCookie=True): """ Ask the command interpreter to handle the command and then check its return status. @@ -334,10 +334,9 @@ class TestBase(unittest2.TestCase): trace = (True if traceAlways else trace) - self.runStarted = (cmd.startswith("run") or - cmd.startswith("process launch")) + running = (cmd.startswith("run") or cmd.startswith("process launch")) - for i in range(self.maxLaunchCount if self.runStarted else 1): + for i in range(self.maxLaunchCount if running else 1): self.ci.HandleCommand(cmd, self.res) if trace: @@ -350,10 +349,12 @@ class TestBase(unittest2.TestCase): if self.res.Succeeded(): break else: - if self.runStarted: + if running: # Process launch failed, wait some time before the next try. time.sleep(self.timeWait) + self.runStarted = running and setCookie + if check: self.assertTrue(self.res.Succeeded(), msg if msg else CMD_MSG(cmd)) |