Author: Dmitry Vasilyev
Date: 2024-05-14T10:59:16+04:00
New Revision: c441aa51e16e2fa5f407191287f48d2b7c302ceb

URL: 
https://github.com/llvm/llvm-project/commit/c441aa51e16e2fa5f407191287f48d2b7c302ceb
DIFF: 
https://github.com/llvm/llvm-project/commit/c441aa51e16e2fa5f407191287f48d2b7c302ceb.diff

LOG: [lldb] Add lldbutil.install_to_target() helper (#91944)

It can be used in tests #91918, #91931 and such.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbutil.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 58eb37fd742d7..1ec036f885e7e 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 install_to_target(test, path):
+    if lldb.remote_platform:
+        filename = os.path.basename(path)
+        remote_path = 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")


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to