[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Wed May 15 08:22:54 PDT 2024


https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92281

Install the image to the remote target if necessary. Platform::LoadImage() uses the following logic before DoLoadImage()
```
if (IsRemote() || local_file != remote_file) {
  error = Install(local_file, remote_file);
  ...
}
```
The FileSpec for the local path may be resolved, so it is necessary to use the condition `if lldb.remote_platform:`.

>From f2badfe871dc3d17d4053be1c25f9abdf8d10a0c Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Wed, 15 May 2024 19:21:25 +0400
Subject: [PATCH] [lldb] Fixed the TestCompletion test running on a remote
 target

Install the image to the remote target if necessary. Platform::LoadImage() uses the following logic before DoLoadImage()
```
if (IsRemote() || local_file != remote_file) {
  error = Install(local_file, remote_file);
  ...
}
```
The FileSpec for the local path may be resolved, so it is necessary to use the condition `if lldb.remote_platform:`.
---
 .../completion/TestCompletion.py                | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index 0d6907e0c3d22..9959c7363aa2b 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -107,9 +107,20 @@ def test_process_unload(self):
             self, "// Break here", lldb.SBFileSpec("main.cpp")
         )
         err = lldb.SBError()
-        self.process().LoadImage(
-            lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), err
-        )
+        if lldb.remote_platform:
+            self.process().LoadImage(
+                lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+                lldb.SBFileSpec(
+                    lldbutil.append_to_process_working_directory(self, "libshared.so"),
+                    False,
+                ),
+                err,
+            )
+        else:
+            self.process().LoadImage(
+                lldb.SBFileSpec(self.getBuildArtifact("libshared.so")),
+                err,
+            )
         self.assertSuccess(err)
 
         self.complete_from_to("process unload ", "process unload 0")



More information about the lldb-commits mailing list