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

Georgiy Samoylov via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 17 09:28:08 PDT 2025


https://github.com/sga-sc updated https://github.com/llvm/llvm-project/pull/131293

>From cb1c55bd6015520a1b0834546d083f22823d1d2e Mon Sep 17 00:00:00 2001
From: Georgiy Samoylov <g.samoylov at syntacore.com>
Date: Mon, 17 Mar 2025 19:21:22 +0300
Subject: [PATCH] [lldb] Adapted test for remote debugging case

---
 .../Python/lldbsuite/test/lldbtest.py         | 24 +++++++++++--------
 .../lldb-server/TestGdbRemoteForkNonStop.py   | 12 +++++-----
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 590024ef77119..4b388a156fb56 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -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)
+
     def getSourcePath(self, name):
         """Return absolute path to a file in the test's source directory."""
         return os.path.join(self.getSourceDir(), name)
@@ -2018,16 +2032,6 @@ def frame(self):
             .GetSelectedFrame()
         )
 
-    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 tearDown(self):
         # Ensure all the references to SB objects have gone away so that we can
         # be sure that all test-specific resources have been freed before we
diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
index 090d4e1bcac95..35da92e3cc2f5 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
@@ -156,8 +156,8 @@ def get_all_output_via_vStdio(self, output_test):
 
     @add_test_categories(["fork"])
     def test_c_both_nonstop(self):
-        lock1 = self.getBuildArtifact("lock1")
-        lock2 = self.getBuildArtifact("lock2")
+        lock1 = self.getWorkingDirArtifact("lock1")
+        lock2 = self.getWorkingDirArtifact("lock2")
         parent_pid, parent_tid, child_pid, child_tid = self.start_fork_test(
             [
                 "fork",
@@ -194,8 +194,8 @@ def test_c_both_nonstop(self):
 
     @add_test_categories(["fork"])
     def test_vCont_both_nonstop(self):
-        lock1 = self.getBuildArtifact("lock1")
-        lock2 = self.getBuildArtifact("lock2")
+        lock1 = self.getWorkingDirArtifact("lock1")
+        lock2 = self.getWorkingDirArtifact("lock2")
         parent_pid, parent_tid, child_pid, child_tid = self.start_fork_test(
             [
                 "fork",
@@ -227,8 +227,8 @@ def test_vCont_both_nonstop(self):
         self.assertIn("PID: {}".format(int(child_pid, 16)).encode(), output)
 
     def vCont_both_nonstop_test(self, vCont_packet):
-        lock1 = self.getBuildArtifact("lock1")
-        lock2 = self.getBuildArtifact("lock2")
+        lock1 = self.getWorkingDirArtifact("lock1")
+        lock2 = self.getWorkingDirArtifact("lock2")
         parent_pid, parent_tid, child_pid, child_tid = self.start_fork_test(
             [
                 "fork",



More information about the lldb-commits mailing list