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    @skipIf(compiler="clang", compiler_version=['<', '11.0'])
11    def test(self):
12        self.build()
13        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.m"))
14
15        # Try importing our custom module. This will fail as LLDB won't define
16        # the CLANG_ONLY define when it compiles the module for the expression
17        # evaluator.
18        # Check that the error message shows file/line/column, prints the relevant
19        # line from the source code and mentions the module that failed to build.
20        self.expect("expr @import LLDBTestModule", error=True,
21                    substrs=["module.h:4:1: error: unknown type name 'syntax_error_for_lldb_to_find'",
22                             "syntax_error_for_lldb_to_find // comment that tests source printing",
23                             "could not build module 'LLDBTestModule'"])
24