61 lines · python
1"""2Test that killing the target while quitting doesn't stall3"""4 5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9from lldbsuite.test.lldbpexpect import PExpectTest10 11 12class DriverQuitSpeedTest(PExpectTest):13 source = "main.c"14 15 @skipIfAsan16 def test_run_quit(self):17 """Test that the lldb driver's batch mode works correctly."""18 import pexpect19 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.child27 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(r"Process ([\d]*) launched:")32 print("Got launch message")33 child.sendline("quit")34 print("sent quit")35 child.expect(pexpect.EOF, timeout=15)36 37 @skipIfAsan38 def test_run_quit_with_prompt(self):39 """Test that the lldb driver's batch mode works correctly with trailing space in confimation."""40 import pexpect41 42 self.build()43 44 exe = self.getBuildArtifact("a.out")45 46 self.launch(executable=exe)47 child = self.child48 49 # Launch the process without a TTY so we don't have to interrupt:50 child.sendline("process launch -n")51 print("launched process")52 child.expect(r"Process ([\d]*) launched:")53 print("Got launch message")54 child.sendline("quit")55 print("sent quit")56 57 child.expect(r".*LLDB will kill one or more processes.*")58 # add trailing space to the confirmation.59 child.sendline("yEs ")60 child.expect(pexpect.EOF, timeout=15)61