[Lldb-commits] [lldb] 1a25b72 - [lldb] Fixed the test TestPlatformProcessLaunch running on a remote target (#91923)
via lldb-commits
lldb-commits at lists.llvm.org
Mon May 13 06:47:07 PDT 2024
Author: Dmitry Vasilyev
Date: 2024-05-13T17:47:03+04:00
New Revision: 1a25b723628e439d62dfb28ca5fa52e4b2a78e5a
URL: https://github.com/llvm/llvm-project/commit/1a25b723628e439d62dfb28ca5fa52e4b2a78e5a
DIFF: https://github.com/llvm/llvm-project/commit/1a25b723628e439d62dfb28ca5fa52e4b2a78e5a.diff
LOG: [lldb] Fixed the test TestPlatformProcessLaunch running on a remote target (#91923)
Transfer `stdio.log` from the remote target if necessary.
Added:
Modified:
lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
Removed:
################################################################################
diff --git a/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py b/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
index 3fb7d00c93d29..7cbad03eeeead 100644
--- a/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
+++ b/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
@@ -3,6 +3,7 @@
"""
from textwrap import dedent
+from lldbsuite.test import lldbutil
from lldbsuite.test.lldbtest import TestBase
@@ -11,9 +12,10 @@ class ProcessLaunchTestCase(TestBase):
def setup(self):
self.build()
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe)
- return (exe, self.getBuildArtifact("stdio.log"))
+ self.runCmd("file " + self.getBuildArtifact("a.out"))
+ exe = lldbutil.append_to_process_working_directory(self, "a.out")
+ outfile = lldbutil.append_to_process_working_directory(self, "stdio.log")
+ return (exe, outfile)
def test_process_launch_no_args(self):
# When there are no extra arguments we just have 0, the program name.
@@ -21,18 +23,18 @@ def test_process_launch_no_args(self):
self.runCmd("platform process launch --stdout {} -s".format(outfile))
self.runCmd("continue")
- with open(outfile) as f:
- self.assertEqual(
- dedent(
- """\
- Got 1 argument(s).
- [0]: {}
- """.format(
- exe
- )
- ),
- f.read(),
- )
+ stdio_log = lldbutil.read_file_on_target(self, outfile)
+ self.assertEqual(
+ dedent(
+ """\
+ Got 1 argument(s).
+ [0]: {}
+ """.format(
+ exe
+ )
+ ),
+ stdio_log,
+ )
def test_process_launch_command_args(self):
exe, outfile = self.setup()
@@ -41,21 +43,21 @@ def test_process_launch_command_args(self):
self.runCmd("platform process launch --stdout {} -s -- A B C".format(outfile))
self.runCmd("continue")
- with open(outfile) as f:
- self.assertEqual(
- dedent(
- """\
- Got 4 argument(s).
- [0]: {}
- [1]: A
- [2]: B
- [3]: C
- """.format(
- exe
- )
- ),
- f.read(),
- )
+ stdio_log = lldbutil.read_file_on_target(self, outfile)
+ self.assertEqual(
+ dedent(
+ """\
+ Got 4 argument(s).
+ [0]: {}
+ [1]: A
+ [2]: B
+ [3]: C
+ """.format(
+ exe
+ )
+ ),
+ stdio_log,
+ )
def test_process_launch_target_args(self):
exe, outfile = self.setup()
@@ -64,17 +66,17 @@ def test_process_launch_target_args(self):
self.runCmd("platform process launch --stdout {} -s".format(outfile))
self.runCmd("continue")
- with open(outfile) as f:
- self.assertEqual(
- dedent(
- """\
- Got 3 argument(s).
- [0]: {}
- [1]: D
- [2]: E
- """.format(
- exe
- )
- ),
- f.read(),
- )
+ stdio_log = lldbutil.read_file_on_target(self, outfile)
+ self.assertEqual(
+ dedent(
+ """\
+ Got 3 argument(s).
+ [0]: {}
+ [1]: D
+ [2]: E
+ """.format(
+ exe
+ )
+ ),
+ stdio_log,
+ )
More information about the lldb-commits
mailing list