[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
Fri Jun 7 00:00:01 PDT 2024


================
@@ -118,6 +118,6 @@ def test_launch_notifications(self):
         # On Linux we get events for ld.so, [vdso], the binary and then all libraries.
 
         avg_solibs_added_per_event = round(
-            float(total_solibs_added) / float(total_modules_added_events)
+            10.0 * float(total_solibs_added) / float(total_modules_added_events)
----------------
labath wrote:

You can't really call it "number of libraries per event" anymore if you multiply by ten. It's more like number of decilibraries/event :P. Maybe you could just remove the round call, and compare to 1.0, but I'm wondering if this is even the right metric for the test. Since what we're trying to check is that we don't send these notifications one by one, I think some check like "number of events with more than one module" or "number of total events" (or both) would be better. @jasonmolenda, what do you think?

Also, this test is very unhermetic in the sense that it depends on the environment to provide enough shared libraries to measure. In the extreme case we could have a totally statically linked binary and zero shared libraries. So, another way to make this test be more resilient is to introduce a couple of shared libraries of our own, so that we can be sure there is something to measure. You could copy the pattern from TestLoadUnload.py to link a bunch of shared libraries to this binary.

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


More information about the lldb-commits mailing list