[Lldb-commits] [lldb] [lldb] Fix TestModuleLoadedNotifys API test to work correctly on most of Linux targets (PR #94672)
Dmitry Vasilyev via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 7 01:36:57 PDT 2024
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/94672
>From 3f91ecacdcf1eedc95b72e8a85591e60a863431e Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Thu, 6 Jun 2024 23:38:03 +0400
Subject: [PATCH 1/2] [lldb] Fix TestModuleLoadedNotifys API test to work
correctly on most of Linux targets.
The different build configuration and target Linux system can load a different number of .so libraries (2 and more).
As example, Linux x86_64 host shows the following loaded modules:
```
Loaded files: ld-linux-x86-64.so.2
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6
```
avg_solibs_added_per_event = 1.75
But Linux Aarch64 (remote target) with statically linked C++ library (clang) shows:
```
Loaded files: ld-2.31.so
Loaded files: [vdso]
Loaded files: a.out
Loaded files: libm.so.6, libc.so.6
```
avg_solibs_added_per_event = 1.25
Increase precision by 1 digit to fix the test.
---
.../target-new-solib-notifications/TestModuleLoadedNotifys.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 abf761fb3420b..28a1026ae4fcc 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -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)
)
- self.assertGreater(avg_solibs_added_per_event, 1)
+ self.assertGreater(avg_solibs_added_per_event, 10)
>From 0518bff0710a8f4404847e1cd28c6bcdbbb00093 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Fri, 7 Jun 2024 12:36:44 +0400
Subject: [PATCH 2/2] Keep the `avg_solibs_added_per_event` name correct.
---
.../TestModuleLoadedNotifys.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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 28a1026ae4fcc..ef407abce59fc 100644
--- a/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
+++ b/lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
@@ -117,7 +117,7 @@ def test_launch_notifications(self):
# 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.
- avg_solibs_added_per_event = round(
- 10.0 * float(total_solibs_added) / float(total_modules_added_events)
+ avg_solibs_added_per_event = float(total_solibs_added) / float(
+ total_modules_added_events
)
- self.assertGreater(avg_solibs_added_per_event, 10)
+ self.assertGreater(round(10.0 * avg_solibs_added_per_event), 10)
More information about the lldb-commits
mailing list