xref: /llvm-project/lldb/test/API/functionalities/pre_run_dylibs/TestPreRunDylibs.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1import lldb
2from lldbsuite.test.lldbtest import *
3import lldbsuite.test.lldbutil as lldbutil
4from lldbsuite.test.decorators import *
5
6
7class TestPreRunLibraries(TestBase):
8    NO_DEBUG_INFO_TESTCASE = True
9
10    @skipIf(oslist=no_match(["darwin", "macos"]))
11    def test(self):
12        """Test that we find directly linked dylib pre-run."""
13
14        self.build()
15        target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
16        self.assertTrue(target, VALID_TARGET)
17
18        # I don't know what the name of a shared library
19        # extension is in general, so instead of using FindModule,
20        # I'll iterate through the module and do a basename match.
21        found_it = False
22        for module in target.modules:
23            file_name = module.GetFileSpec().GetFilename()
24            if file_name.find("unlikely_name") != -1:
25                found_it = True
26                break
27
28        self.assertTrue(
29            found_it, "Couldn't find unlikely_to_occur_name in loaded libraries."
30        )
31