[Lldb-commits] [lldb] [lldb] Fix TestGdbRemoteForkNonStop.py test (PR #131293)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 18 01:19:39 PDT 2025


================
@@ -743,6 +743,20 @@ def getBuildArtifact(self, name="a.out"):
         """Return absolute path to an artifact in the test's build directory."""
         return os.path.join(self.getBuildDir(), name)
 
+    def get_process_working_directory(self):
+        """Get the working directory that should be used when launching processes for local or remote processes."""
+        if lldb.remote_platform:
+            # Remote tests set the platform working directory up in
+            # TestBase.setUp()
+            return lldb.remote_platform.GetWorkingDirectory()
+        else:
+            # local tests change directory into each test subdirectory
+            return self.getBuildDir()
+
+    def getWorkingDirArtifact(self, name="a.out"):
+        """Return absolute path to an artifact in the test's working directory."""
+        return os.path.join(self.get_process_working_directory(), name)
----------------
labath wrote:

for this we have `lldbutil.append_to_process_working_directory`.

I actually like your api more, so I wouldn't be opposed to using this instead. However I don't think we should have two methods for the same thing, so if you want to go down that path, you should also port the other usages of `append_to_process_working_directory` to this.

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


More information about the lldb-commits mailing list