Files
clang-p2996/lldb/test/API/driver/quit_speed/TestQuitWithProcess.py
jimingham 9d3aec5535 Fix a stall in running quit while a live process is running (#74687)
We need to generate events when finalizing, or we won't know that we
succeeded in stopping the process to detach/kill. Instead, we stall and
then after our 20 interrupt timeout, we kill the process (even if we
were supposed to detach) and exit.

OTOH, we have to not generate events when the Process is being
destructed because shared_from_this has already been torn down, and
using it will cause crashes.
2023-12-07 14:36:27 -08:00

35 lines
1012 B
Python

"""
Test that killing the target while quitting doesn't stall
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import pexpect
from lldbsuite.test.lldbpexpect import PExpectTest
class DriverQuitSpeedTest(PExpectTest):
source = "main.c"
def test_run_quit(self):
"""Test that the lldb driver's batch mode works correctly."""
self.build()
exe = self.getBuildArtifact("a.out")
# Turn on auto-confirm removes the wait for the prompt.
self.launch(executable=exe, extra_args=["-O", "settings set auto-confirm 1"])
child = self.child
# Launch the process without a TTY so we don't have to interrupt:
child.sendline("process launch -n")
print("launched process")
child.expect("Process ([\d]*) launched:")
print("Got launch message")
child.sendline("quit")
print("sent quit")
child.expect(pexpect.EOF, timeout=15)