[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 08:59:42 PDT 2024


================
@@ -1654,6 +1654,26 @@ def find_library_callable(test):
     )
 
 
+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)
----------------
slydiman wrote:

I expected the following usage:

1: Use filename
```
target_path = lldbutil.install_to_target(self, "a.out")
```
2: Use path
```
local_path = self.getBuildArtifact("some_file")
# write to local_path here 
...
# avoid typing "some_file" constant twice, just extract the filename from the local_path
target_path = lldbutil.install_to_target(self, path=local_path) 
```
3: Use both
```
# "temp" is the filename on the remote target
target_path = lldbutil.install_to_target(self, "temp", local_temp_path_outside_build_dir)
```

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


More information about the lldb-commits mailing list