aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py')
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py84
1 files changed, 84 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py
new file mode 100644
index 000000000000..86a0a65b05a7
--- /dev/null
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py
@@ -0,0 +1,84 @@
+"""
+Test that the lldb-mi driver exits properly.
+"""
+
+from __future__ import print_function
+
+
+
+import lldbmi_testcase
+from lldbsuite.test.lldbtest import *
+
+class MiExitTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_gdb_exit(self):
+ """Test that '-gdb-exit' terminates local debug session and exits."""
+
+ self.spawnLldbMi(args = None)
+
+ # Load executable
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ # Run to main
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ # Test -gdb-exit: try to exit and check that program is finished
+ self.runCmd("-gdb-exit")
+ self.expect("\^exit")
+ import pexpect
+ self.expect(pexpect.EOF)
+
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_quit(self):
+ """Test that 'quit' exits immediately."""
+
+ self.spawnLldbMi(args = None)
+
+ # Load executable
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ # Run to main
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ # Test quit: try to exit and check that program is finished
+ self.runCmd("quit")
+ import pexpect
+ self.expect(pexpect.EOF)
+
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ def test_lldbmi_q(self):
+ """Test that 'q' exits immediately."""
+
+ self.spawnLldbMi(args = None)
+
+ # Load executable
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ # Run to main
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ # Test q: try to exit and check that program is finished
+ self.runCmd("q")
+ import pexpect
+ self.expect(pexpect.EOF)