https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/91944
>From de7135a8a4a40b5aa5ac1f44e58d62874c96448b Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev <dvassil...@accesssoftek.com> Date: Mon, 13 May 2024 14:45:33 +0400 Subject: [PATCH 1/2] [lldb] Add lldbutil.target_install() helper It can be used in tests #91918, #91931 and such. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 58eb37fd742d7..e67b68b727b80 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,6 +1654,22 @@ def find_library_callable(test): ) +def target_install(test, filename): + path = test.getBuildArtifact(filename) + if lldb.remote_platform: + remote_path = lldbutil.append_to_process_working_directory(test, filename) + err = lldb.remote_platform.Install( + lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) + ) + if err.Fail(): + raise Exception( + "remote_platform.Install('%s', '%s') failed: %s" + % (path, remote_path, err) + ) + path = remote_path + return path + + def read_file_on_target(test, remote): if lldb.remote_platform: local = test.getBuildArtifact("file_from_target") >From b4f5798258b29996b6805037bed70a819a671618 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev <dvassil...@accesssoftek.com> Date: Mon, 13 May 2024 15:51:36 +0400 Subject: [PATCH 2/2] Added the full local path as optional parameter. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index e67b68b727b80..4290fe94590a1 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,10 +1654,14 @@ def find_library_callable(test): ) -def target_install(test, filename): - path = test.getBuildArtifact(filename) +def target_install(test, filename=None, path=None): + test.assertTrue(filename or path, "filename or path must be specified.") + if filename is None: + filename = os.path.basename(path) + if path is None: + path = test.getBuildArtifact(filename) if lldb.remote_platform: - remote_path = lldbutil.append_to_process_working_directory(test, filename) + remote_path = append_to_process_working_directory(test, filename) err = lldb.remote_platform.Install( lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) ) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits