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

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


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

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

>From de7135a8a4a40b5aa5ac1f44e58d62874c96448b Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Mon, 13 May 2024 14:45:33 +0400
Subject: [PATCH] [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")



More information about the lldb-commits mailing list