Skip to content

Commit cb1c55b

Browse files
committed
[lldb] Adapted test for remote debugging case
1 parent ac94ccd commit cb1c55b

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,20 @@ def getBuildArtifact(self, name="a.out"):
743743
"""Return absolute path to an artifact in the test's build directory."""
744744
return os.path.join(self.getBuildDir(), name)
745745

746+
def get_process_working_directory(self):
747+
"""Get the working directory that should be used when launching processes for local or remote processes."""
748+
if lldb.remote_platform:
749+
# Remote tests set the platform working directory up in
750+
# TestBase.setUp()
751+
return lldb.remote_platform.GetWorkingDirectory()
752+
else:
753+
# local tests change directory into each test subdirectory
754+
return self.getBuildDir()
755+
756+
def getWorkingDirArtifact(self, name="a.out"):
757+
"""Return absolute path to an artifact in the test's working directory."""
758+
return os.path.join(self.get_process_working_directory(), name)
759+
746760
def getSourcePath(self, name):
747761
"""Return absolute path to a file in the test's source directory."""
748762
return os.path.join(self.getSourceDir(), name)
@@ -2018,16 +2032,6 @@ def frame(self):
20182032
.GetSelectedFrame()
20192033
)
20202034

2021-
def get_process_working_directory(self):
2022-
"""Get the working directory that should be used when launching processes for local or remote processes."""
2023-
if lldb.remote_platform:
2024-
# Remote tests set the platform working directory up in
2025-
# TestBase.setUp()
2026-
return lldb.remote_platform.GetWorkingDirectory()
2027-
else:
2028-
# local tests change directory into each test subdirectory
2029-
return self.getBuildDir()
2030-
20312035
def tearDown(self):
20322036
# Ensure all the references to SB objects have gone away so that we can
20332037
# be sure that all test-specific resources have been freed before we

lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ def get_all_output_via_vStdio(self, output_test):
156156

157157
@add_test_categories(["fork"])
158158
def test_c_both_nonstop(self):
159-
lock1 = self.getBuildArtifact("lock1")
160-
lock2 = self.getBuildArtifact("lock2")
159+
lock1 = self.getWorkingDirArtifact("lock1")
160+
lock2 = self.getWorkingDirArtifact("lock2")
161161
parent_pid, parent_tid, child_pid, child_tid = self.start_fork_test(
162162
[
163163
"fork",
@@ -194,8 +194,8 @@ def test_c_both_nonstop(self):
194194

195195
@add_test_categories(["fork"])
196196
def test_vCont_both_nonstop(self):
197-
lock1 = self.getBuildArtifact("lock1")
198-
lock2 = self.getBuildArtifact("lock2")
197+
lock1 = self.getWorkingDirArtifact("lock1")
198+
lock2 = self.getWorkingDirArtifact("lock2")
199199
parent_pid, parent_tid, child_pid, child_tid = self.start_fork_test(
200200
[
201201
"fork",
@@ -227,8 +227,8 @@ def test_vCont_both_nonstop(self):
227227
self.assertIn("PID: {}".format(int(child_pid, 16)).encode(), output)
228228

229229
def vCont_both_nonstop_test(self, vCont_packet):
230-
lock1 = self.getBuildArtifact("lock1")
231-
lock2 = self.getBuildArtifact("lock2")
230+
lock1 = self.getWorkingDirArtifact("lock1")
231+
lock2 = self.getWorkingDirArtifact("lock2")
232232
parent_pid, parent_tid, child_pid, child_tid = self.start_fork_test(
233233
[
234234
"fork",

0 commit comments

Comments
 (0)