[Lldb-commits] [lldb] bad5ee1 - [lldb] Make TestLoadUsingLazyBind work on linux

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 1 05:49:58 PDT 2021


Author: Pavel Labath
Date: 2021-04-01T14:49:42+02:00
New Revision: bad5ee15ea2e5a5aaaed9c9a5d9982e23cedba55

URL: https://github.com/llvm/llvm-project/commit/bad5ee15ea2e5a5aaaed9c9a5d9982e23cedba55
DIFF: https://github.com/llvm/llvm-project/commit/bad5ee15ea2e5a5aaaed9c9a5d9982e23cedba55.diff

LOG: [lldb] Make TestLoadUsingLazyBind work on linux

and probably other posix oses. Use extra_images to ensure
LD_LIBRARY_PATH is set correctly.

Also take the opportunity to remove hand-rolled library extension
management code in favor of the existing one.

Added: 
    

Modified: 
    lldb/test/API/functionalities/load_lazy/TestLoadUsingLazyBind.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/functionalities/load_lazy/TestLoadUsingLazyBind.py b/lldb/test/API/functionalities/load_lazy/TestLoadUsingLazyBind.py
index a32e589884ce6..9ca6229943061 100644
--- a/lldb/test/API/functionalities/load_lazy/TestLoadUsingLazyBind.py
+++ b/lldb/test/API/functionalities/load_lazy/TestLoadUsingLazyBind.py
@@ -21,25 +21,23 @@ class LoadUsingLazyBind(TestBase):
     @skipIfWindows # The Windows platform doesn't implement DoLoadImage.
     # Failing for unknown reasons on Linux, see
     # https://bugs.llvm.org/show_bug.cgi?id=49656.
-    @skipUnlessDarwin
     def test_load_using_lazy_bind(self):
         """Test that we load using RTLD_LAZY"""
 
         self.build()
         wd = os.path.realpath(self.getBuildDir())
 
-        ext = '.so'
-        if self.platformIsDarwin():
-            ext = '.dylib'
+        def make_lib_name(name):
+            return (self.platformContext.shlib_prefix + name + "." +
+                    self.platformContext.shlib_extension)
 
         def make_lib_path(name):
-            libpath = os.path.join(wd, name + ext)
+            libpath = os.path.join(wd, make_lib_name(name))
             self.assertTrue(os.path.exists(libpath))
             return libpath
 
-        libt1 = make_lib_path('libt1')
-        libt2_0 = make_lib_path('libt2_0')
-        libt2_1 = make_lib_path('libt2_1')
+        libt2_0 = make_lib_path('t2_0')
+        libt2_1 = make_lib_path('t2_1')
 
         # Overwrite t2_0 with t2_1 to delete the definition of `use`.
         shutil.copy(libt2_1, libt2_0)
@@ -47,11 +45,12 @@ def make_lib_path(name):
         # Launch a process and break
         (target, process, thread, _) = lldbutil.run_to_source_breakpoint(self,
                                                 "break here",
-                                                lldb.SBFileSpec("main.cpp"))
+                                                lldb.SBFileSpec("main.cpp"),
+                                                extra_images=["t1"])
 
         # Load libt1; should fail unless we use RTLD_LAZY
         error = lldb.SBError()
-        lib_spec = lldb.SBFileSpec('libt1' + ext)
+        lib_spec = lldb.SBFileSpec(make_lib_name('t1'))
         paths = lldb.SBStringList()
         paths.AppendString(wd)
         out_spec = lldb.SBFileSpec()


        


More information about the lldb-commits mailing list