[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 09:43:55 PDT 2024
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92281
>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 1/2] [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")
>From 3661437dd9df68210b5f92b03ac53abc65922189 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Wed, 15 May 2024 20:43:42 +0400
Subject: [PATCH 2/2] Optimized.
---
.../completion/TestCompletion.py | 24 ++++++++-----------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index 9959c7363aa2b..63842487fc338 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -107,20 +107,16 @@ def test_process_unload(self):
self, "// Break here", lldb.SBFileSpec("main.cpp")
)
err = lldb.SBError()
- 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,
+ local_spec = lldb.SBFileSpec(self.getBuildArtifact("libshared.so"))
+ remote_spec = (
+ lldb.SBFileSpec(
+ lldbutil.append_to_process_working_directory(self, "libshared.so"),
+ False,
)
+ if lldb.remote_platform
+ else lldb.SBFileSpec()
+ )
+ self.process().LoadImage(local_spec, remote_spec, err)
self.assertSuccess(err)
self.complete_from_to("process unload ", "process unload 0")
@@ -484,7 +480,7 @@ def test_custom_command_completion(self):
self.complete_from_to("my_test_cmd main.cp", ["main.cpp"])
self.expect("my_test_cmd main.cpp", substrs=["main.cpp"])
- @skipIfWindows
+ @skipIf(hostoslist=["windows"])
def test_completion_target_create_from_root_dir(self):
"""Tests source file completion by completing ."""
root_dir = os.path.abspath(os.sep)
More information about the lldb-commits
mailing list