[Lldb-commits] [lldb] c9b55eb - [lldb] Update TestModuleLoadedNotifys.py for macOS Ventura

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 8 15:33:46 PDT 2022


Author: Jonas Devlieghere
Date: 2022-06-08T15:33:33-07:00
New Revision: c9b55eb80734a6a840d3210796149f9042ff60c5

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

LOG: [lldb] Update TestModuleLoadedNotifys.py for macOS Ventura

On macOS Ventura and later, dyld and the main binary will be loaded
again when dyld moves itself into the shared cache. Update the test
accordingly.

Differential revision: https://reviews.llvm.org/D127331

Added: 
    

Modified: 
    lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
index 925fbfff22ba..cda0d283dd40 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -80,14 +80,16 @@ def test_launch_notifications(self):
                     total_modules_added_events += 1
                     total_solibs_added += solib_count
                     added_files = []
-                    i = 0
-                    while i < solib_count:
+                    for i in range (solib_count):
                         module = lldb.SBTarget.GetModuleAtIndexFromEvent(i, event)
-                        self.assertTrue(module not in already_loaded_modules)
+                        # On macOS Ventura and later, dyld and the main binary
+                        # will be loaded again when dyld moves itself into the
+                        # shared cache.
+                        if module.file.fullpath not in ['/usr/lib/dyld', exe]:
+                            self.assertTrue(module not in already_loaded_modules, '{} is already loaded'.format(module))
                         already_loaded_modules.append(module)
                         if self.TraceOn():
                             added_files.append(module.GetFileSpec().GetFilename())
-                        i = i + 1
                     if self.TraceOn():
                         # print all of the binaries that have been added
                         print("Loaded files: %s" % (', '.join(added_files)))
@@ -105,11 +107,11 @@ def test_launch_notifications(self):
                             removed_files.append(module.GetFileSpec().GetFilename())
                             i = i + 1
                         print("Unloaded files: %s" % (', '.join(removed_files)))
-        
 
-        # This is testing that we get back a small number of events with the loaded 
-        # binaries in batches.  Check that we got back more than 1 solib per event.  
-        # In practice on Darwin today, we get back two events for a do-nothing c 
+
+        # This is testing that we get back a small number of events with the loaded
+        # binaries in batches.  Check that we got back more than 1 solib per event.
+        # In practice on Darwin today, we get back two events for a do-nothing c
         # program: a.out and dyld, and then all the rest of the system libraries.
         # On Linux we get events for ld.so, [vdso], the binary and then all libraries.
 


        


More information about the lldb-commits mailing list