[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)

via lldb-commits lldb-commits at lists.llvm.org
Mon May 13 03:46:43 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)

<details>
<summary>Changes</summary>

It can be used in tests #<!-- -->91918, #<!-- -->91931 and such.

---
Full diff: https://github.com/llvm/llvm-project/pull/91944.diff


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/lldbutil.py (+16) 


``````````diff
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")

``````````

</details>


https://github.com/llvm/llvm-project/pull/91944


More information about the lldb-commits mailing list