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