Files
clang-p2996/lldb/test/API/driver/quit_speed/TestQuitWithProcess.py
Jordan Rupprecht 503075e4d4 [lldb][test][NFC] Narrow scope of import pexpect
We do not run `pexpect` based tests on Windows, but there are still cases where those tests run `import pexpect` outside of the scope where the test is skipped. By moving the import statement to a different scope, those tests can run even when `pexpect` truly isn't installed.

Tangentially related: TestSTTYBeforeAndAfter.py is using a manual `@expectedFailureAll` for windows instead of the common `@skipIfWindows`. If `pexepect` is generally expected to not be available, we should not bother running the test at all.
2024-03-04 11:21:47 -08:00

35 lines
1020 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
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."""
import pexpect
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)