[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 10 01:37:51 PDT 2024


================
@@ -9,22 +9,51 @@
 from lldbsuite.test import lldbutil
 
 
+ at skipUnlessPlatform(["linux"] + lldbplatformutil.getDarwinOSTriples())
 class ModuleLoadedNotifysTestCase(TestBase):
     NO_DEBUG_INFO_TESTCASE = True
 
     # At least DynamicLoaderDarwin and DynamicLoaderPOSIXDYLD should batch up
     # notifications about newly added/removed libraries.  Other DynamicLoaders may
     # not be written this way.
-    @skipUnlessPlatform(["linux"] + lldbplatformutil.getDarwinOSTriples())
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
         # Find the line number to break inside main().
         self.line = line_number("main.cpp", "// breakpoint")
 
+    def setup_test(self, solibs):
+        if lldb.remote_platform:
+            path = lldb.remote_platform.GetWorkingDirectory()
+            for f in solibs:
+                lldbutil.install_to_target(self, self.getBuildArtifact(f))
+        else:
+            path = self.getBuildDir()
+            if self.dylibPath in os.environ:
+                sep = self.platformContext.shlib_path_separator
+                path = os.environ[self.dylibPath] + sep + path
+        self.runCmd(
+            "settings append target.env-vars '{}={}'".format(self.dylibPath, path)
+        )
+        self.default_path = path
+
     def test_launch_notifications(self):
         """Test that lldb broadcasts newly loaded libraries in batches."""
+
+        ext = "so"
+        if self.platformIsDarwin():
+            ext = "dylib"
----------------
labath wrote:

You should be able to get this as `self.platformContext.shlib_extension`

https://github.com/llvm/llvm-project/pull/94672


More information about the lldb-commits mailing list