[Lldb-commits] [lldb] [lldb] Fix TestGlobalModuleCache.py for remote debugging (PR #111483)

Igor Kudrin via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 8 22:01:57 PDT 2024


https://github.com/igorkudrin updated https://github.com/llvm/llvm-project/pull/111483

>From bb594335d05a4c8cb2949556f5b338242a9b5280 Mon Sep 17 00:00:00 2001
From: Igor Kudrin <ikudrin at accesssoftek.com>
Date: Mon, 7 Oct 2024 22:07:02 -0700
Subject: [PATCH 1/2] [lldb] Fix TestGlobalModuleCache.py for remote debugging

`SBDebugger().Create()` returns a debugger with only the host platform
in its platform list. If the test suite is running for a remote platform,
 it should be explicitly added and selected in the new debugger created
within the test, otherwise, the test will fail because the host platform
may not be able to launch the built binary.
---
 .../API/python_api/global_module_cache/TestGlobalModuleCache.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index ccefc28946e062..16bc86bd4fc44d 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -111,6 +111,8 @@ def do_test(self, one_target, one_debugger):
         else:
             if one_target:
                 new_debugger = lldb.SBDebugger().Create()
+                if lldb.selected_platform is not None:
+                    new_debugger.SetSelectedPlatform(lldb.selected_platform)
                 new_debugger.SetAsync(False)
                 self.old_debugger = self.dbg
                 self.dbg = new_debugger

>From 22e342662c066b2d1d8a689acb69dd72a4a80bcb Mon Sep 17 00:00:00 2001
From: Igor Kudrin <igor.kudrin at gmail.com>
Date: Tue, 8 Oct 2024 21:34:48 -0700
Subject: [PATCH 2/2] Update
 lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py

Co-authored-by: Pavel Labath <pavel at labath.sk>
---
 .../python_api/global_module_cache/TestGlobalModuleCache.py    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index 16bc86bd4fc44d..5dd268be4cb05f 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -111,8 +111,7 @@ def do_test(self, one_target, one_debugger):
         else:
             if one_target:
                 new_debugger = lldb.SBDebugger().Create()
-                if lldb.selected_platform is not None:
-                    new_debugger.SetSelectedPlatform(lldb.selected_platform)
+                new_debugger.SetSelectedPlatform(lldb.selected_platform)
                 new_debugger.SetAsync(False)
                 self.old_debugger = self.dbg
                 self.dbg = new_debugger



More information about the lldb-commits mailing list