[Lldb-commits] [lldb] [lldb] Fixed the test TestPlatformProcessLaunch (PR #91923)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dmitry Vasilyev (slydiman) Changes Transfer `stdio.log` from the remote target if necessary. --- Full diff: https://github.com/llvm/llvm-project/pull/91923.diff 1 Files Affected: - (modified) lldb/test/API/commands/platform/process/launch/TestPlatformProcessLaunch.py (+47-44) ``diff 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, +) `` https://github.com/llvm/llvm-project/pull/91923 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestPlatformProcessLaunch (PR #91923)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/91923 Transfer `stdio.log` from the remote target if necessary. >From 47839ef62cea9d1c79c97a70c4714f365eeb4e02 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 10:56:36 +0400 Subject: [PATCH] [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, +) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits