xref: /llvm-project/lldb/test/API/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
199451b44SJordan Rupprecht"""Test that inline functions from modules are imported correctly"""
299451b44SJordan Rupprecht
399451b44SJordan Rupprecht
499451b44SJordan Rupprechtimport lldb
599451b44SJordan Rupprechtfrom lldbsuite.test.decorators import *
699451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import *
799451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil
899451b44SJordan Rupprecht
999451b44SJordan Rupprecht
1099451b44SJordan Rupprechtclass ModulesInlineFunctionsTestCase(TestBase):
111c6826e8SMichael Buch    @add_test_categories(["gmodules"])
121c6826e8SMichael Buch    @skipIf(macos_version=["<", "10.12"])
1399451b44SJordan Rupprecht    def test_expr(self):
1499451b44SJordan Rupprecht        self.build()
1599451b44SJordan Rupprecht        exe = self.getBuildArtifact("a.out")
1699451b44SJordan Rupprecht        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
1799451b44SJordan Rupprecht
1899451b44SJordan Rupprecht        # Break inside the foo function which takes a bar_ptr argument.
1999451b44SJordan Rupprecht        lldbutil.run_to_source_breakpoint(
20*2238dcc3SJonas Devlieghere            self, "// Set breakpoint here.", lldb.SBFileSpec("main.m")
21*2238dcc3SJonas Devlieghere        )
2299451b44SJordan Rupprecht
2399451b44SJordan Rupprecht        self.runCmd(
24*2238dcc3SJonas Devlieghere            'settings set target.clang-module-search-paths "'
25*2238dcc3SJonas Devlieghere            + self.getSourceDir()
26*2238dcc3SJonas Devlieghere            + '"'
27*2238dcc3SJonas Devlieghere        )
2899451b44SJordan Rupprecht
29*2238dcc3SJonas Devlieghere        self.expect(
30*2238dcc3SJonas Devlieghere            "expr @import myModule; 3",
31*2238dcc3SJonas Devlieghere            VARIABLES_DISPLAYED_CORRECTLY,
32*2238dcc3SJonas Devlieghere            substrs=["int", "3"],
33*2238dcc3SJonas Devlieghere        )
3499451b44SJordan Rupprecht
35*2238dcc3SJonas Devlieghere        self.expect("expr isInline(2)", VARIABLES_DISPLAYED_CORRECTLY, substrs=["4"])
36