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