[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
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 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") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dmitry Vasilyev (slydiman) Changes 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:`. --- Full diff: https://github.com/llvm/llvm-project/pull/92281.diff 1 Files Affected: - (modified) lldb/test/API/functionalities/completion/TestCompletion.py (+14-3) ``diff 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") `` https://github.com/llvm/llvm-project/pull/92281 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
@@ -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, +) JDevlieghere wrote: I think this can be simplified to: ``` err = lldb.SBError() 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) ``` https://github.com/llvm/llvm-project/pull/92281 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
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 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 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) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
@@ -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, +) slydiman wrote: I have updated the patch. Thanks. https://github.com/llvm/llvm-project/pull/92281 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
https://github.com/JDevlieghere approved this pull request. Thanks. LGTM! https://github.com/llvm/llvm-project/pull/92281 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92281 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
@@ -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, +) labath wrote: Unfortunately, this ends up modifying the source tree. I'm going to revert this back to the intermediate version. https://github.com/llvm/llvm-project/pull/92281 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits