xref: /llvm-project/lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py (revision 1b70580dd867195b0442e582eccd42abc41ee12d)
1"""
2Test sending SIGINT Process IOHandler
3"""
4
5import os
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test.lldbpexpect import PExpectTest
11
12
13class TestCase(PExpectTest):
14    @skipIf(macos_version=["<", "14.0"], asan=True)
15    @skipIf(compiler="clang", compiler_version=["<", "11.0"])
16    @skipIf(oslist=["linux"], archs=["arm", "aarch64"])
17    def test(self):
18        self.build(dictionary={"CXX_SOURCES": "cat.cpp"})
19        self.launch(executable=self.getBuildArtifact())
20
21        self.child.sendline("process launch")
22        self.child.expect("Process .* launched")
23
24        self.child.sendline("Hello cat")
25        self.child.expect_exact("read: Hello cat")
26
27        self.child.sendintr()
28        self.child.expect("Process .* stopped")
29        self.expect_prompt()
30
31        self.expect("bt", substrs=["input_copy_loop"])
32
33        self.child.sendline("continue")
34        self.child.expect("Process .* resuming")
35
36        self.child.sendline("Goodbye cat")
37        self.child.expect_exact("read: Goodbye cat")
38
39        self.child.sendeof()
40        self.child.expect("Process .* exited")
41        self.expect_prompt()
42
43        self.quit()
44