1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6class TestCase(TestBase):
7
8    mydir = TestBase.compute_mydir(__file__)
9
10    def test(self):
11        self.build()
12        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.m"))
13
14        # Try importing our custom module. This will fail as LLDB won't define
15        # the CLANG_ONLY define when it compiles the module for the expression
16        # evaluator.
17        # Check that the error message shows file/line/column, prints the relevant
18        # line from the source code and mentions the module that failed to build.
19        self.expect("expr @import LLDBTestModule", error=True,
20                    substrs=["module.h:4:1: error: unknown type name 'syntax_error_for_lldb_to_find'",
21                             "syntax_error_for_lldb_to_find // comment that tests source printing",
22                             "could not build module 'LLDBTestModule'"])
23