1"""
2Test completion in our IOHandlers.
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 BreakpointCallbackCommandSource(PExpectTest):
14
15    mydir = TestBase.compute_mydir(__file__)
16    file_to_source = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'source.lldb')
17
18    # PExpect uses many timeouts internally and doesn't play well
19    # under ASAN on a loaded machine..
20    @skipIfAsan
21    @skipIfEditlineSupportMissing
22    def test_breakpoint_callback_command_source(self):
23        self.build()
24        exe = self.getBuildArtifact("a.out")
25
26        self.launch(exe)
27        self.expect("b main", substrs=["Breakpoint 1"])
28        self.child.send("breakpoint command add -s python\n")
29        self.child.send(
30            "frame.GetThread().GetProcess().GetTarget().GetDebugger().HandleCommand('command source -s true {}')\n"
31            .format(self.file_to_source))
32        self.child.send("DONE\n")
33        self.expect_prompt()
34        self.expect("run", substrs=["Process", "stopped"])
35        self.expect("script print(foo)", substrs=["95126"])
36