[Lldb-commits] [lldb] [lldb] Fixed the test TestPlatformProcessLaunch running on a remote target (PR #91923)
Dmitry Vasilyev via lldb-commits
lldb-commits at lists.llvm.org
Mon May 13 03:23:09 PDT 2024
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/91923
>From 47839ef62cea9d1c79c97a70c4714f365eeb4e02 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Mon, 13 May 2024 10:56:36 +0400
Subject: [PATCH 1/2] [lldb] Fixed the test TestPlatformProcessLaunch
Transfer `stdio.log` from the remote target if necessary.
---
.../launch/TestPlatformProcessLaunch.py | 91 ++++++++++---------
1 file changed, 47 insertions(+), 44 deletions(-)
diff --git a/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py b/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
index 3fb7d00c93d29..21c12bcb9369f 100644
--- a/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
+++ b/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
@@ -2,7 +2,9 @@
Test platform process launch.
"""
+import lldb
from textwrap import dedent
+from lldbsuite.test import lldbutil
from lldbsuite.test.lldbtest import TestBase
@@ -11,9 +13,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 +24,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 +44,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 +67,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,
+ )
>From 966de73bf351ece5968145bbdec8021762133391 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Mon, 13 May 2024 14:21:09 +0400
Subject: [PATCH 2/2] Cleanup
---
.../platform/process/launch/TestPlatformProcessLaunch.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py b/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
index 21c12bcb9369f..7cbad03eeeead 100644
--- a/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
+++ b/lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py
@@ -2,7 +2,6 @@
Test platform process launch.
"""
-import lldb
from textwrap import dedent
from lldbsuite.test import lldbutil
from lldbsuite.test.lldbtest import TestBase
More information about the lldb-commits
mailing list