xref: /llvm-project/lldb/test/API/driver/quit_speed/TestQuitWithProcess.py (revision c4e8e2c67bbfff2d1b23210c375c173aa05e3848)
1"""
2Test that killing the target while quitting doesn't stall
3"""
4
5import lldb
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test import lldbutil
9from lldbsuite.test.lldbpexpect import PExpectTest
10
11
12class DriverQuitSpeedTest(PExpectTest):
13    source = "main.c"
14
15    @skipIfAsan
16    def test_run_quit(self):
17        """Test that the lldb driver's batch mode works correctly."""
18        import pexpect
19
20        self.build()
21
22        exe = self.getBuildArtifact("a.out")
23
24        # Turn on auto-confirm removes the wait for the prompt.
25        self.launch(executable=exe, extra_args=["-O", "settings set auto-confirm 1"])
26        child = self.child
27
28        # Launch the process without a TTY so we don't have to interrupt:
29        child.sendline("process launch -n")
30        print("launched process")
31        child.expect("Process ([\d]*) launched:")
32        print("Got launch message")
33        child.sendline("quit")
34        print("sent quit")
35        child.expect(pexpect.EOF, timeout=15)
36