[Lldb-commits] [lldb] [lldb-dap] Split the launch IO redirection tests. (PR #179974)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 5 10:05:10 PST 2026
https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/179974
>From 03a21c6b9eb9c2b086b6b534d2340f5bdd5d61d8 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Thu, 5 Feb 2026 16:25:42 +0000
Subject: [PATCH 1/2] [lldb-dap] Split the launch IO redirection tests.
Tests in the same python file share the same build directory.
although they are the same binary. The logs are different.
---
...{TestDAP_launch_io.py => DAP_launch_io.py} | 158 ------------------
.../TestDAP_launch_io_integratedTerminal.py | 119 +++++++++++++
.../io/TestDAP_launch_io_internalConsole.py | 50 ++++++
3 files changed, 169 insertions(+), 158 deletions(-)
rename lldb/test/API/tools/lldb-dap/launch/io/{TestDAP_launch_io.py => DAP_launch_io.py} (63%)
create mode 100644 lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_integratedTerminal.py
create mode 100644 lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py
diff --git a/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io.py b/lldb/test/API/tools/lldb-dap/launch/io/DAP_launch_io.py
similarity index 63%
rename from lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io.py
rename to lldb/test/API/tools/lldb-dap/launch/io/DAP_launch_io.py
index f6cc1589cb71c..f5253f6ba7935 100644
--- a/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io.py
+++ b/lldb/test/API/tools/lldb-dap/launch/io/DAP_launch_io.py
@@ -11,18 +11,9 @@
"""
from abc import abstractmethod
-from typing import IO
import lldbdap_testcase
from tempfile import NamedTemporaryFile
-from lldbsuite.test.decorators import (
- skip,
- skipIfAsan,
- skipIfBuildType,
- skipIfRemote,
- skipIfWindows,
-)
-
class DAP_launchIO(lldbdap_testcase.DAPTestCaseBase):
"""The class holds the implementation different ways to redirect the debuggee I/O streams
@@ -210,152 +201,3 @@ def _get_debuggee_stderr(self) -> str:
It requires subclasses to implement the specific mechanism for obtaining the stderr stream.
"""
raise RuntimeError(f"NotImplemented for {self}")
-
-
- at skipIfWindows
-class TestDAP_launchInternalConsole(DAP_launchIO):
- console = "internalConsole"
- __debuggee_stdout = None
-
- # all redirection
- def test_all_redirection(self):
- self.all_redirection(console=self.console)
-
- def test_all_redirection_with_args(self):
- self.all_redirection(console=self.console, with_args=True)
-
- # stdin
- def test_stdin_redirection(self):
- self.stdin_redirection(console=self.console)
-
- def test_stdin_redirection_with_args(self):
- self.stdin_redirection(console=self.console, with_args=True)
-
- # stdout
- def test_stdout_redirection(self):
- self.stdout_redirection(console=self.console)
-
- def test_stdout_redirection_with_env(self):
- self.stdout_redirection(console=self.console, with_env=True)
-
- # stderr
- def test_stderr_redirection(self):
- self.stderr_redirection(console=self.console)
-
- def test_stderr_redirection_with_env(self):
- self.stderr_redirection(console=self.console, with_env=True)
-
- def _get_debuggee_stdout(self) -> str:
- # self.get_stdout is not idempotent.
- if self.__debuggee_stdout is None:
- self.__debuggee_stdout = self.get_stdout()
- return self.__debuggee_stdout
-
- def _get_debuggee_stderr(self) -> str:
- # NOTE: In internalConsole stderr writes to stdout.
- return self._get_debuggee_stdout()
-
-
- at skipIfRemote
- at skipIfAsan
- at skipIfBuildType(["debug"])
- at skipIfWindows
-class TestDAP_launchIntegratedTerminal(DAP_launchIO):
- console = "integratedTerminal"
-
- # all redirection
- def test_all_redirection(self):
- self.all_redirection(console=self.console)
-
- def test_all_redirection_with_args(self):
- self.all_redirection(console=self.console, with_args=True)
-
- # stdin
- def test_stdin_redirection(self):
- self.stdin_redirection(console=self.console)
-
- def test_stdin_redirection_with_args(self):
- self.stdin_redirection(console=self.console, with_args=True)
-
- # stdout
- def test_stdout_redirection(self):
- self.stdout_redirection(console=self.console)
-
- def test_stdout_redirection_with_env(self):
- self.stdout_redirection(console=self.console, with_env=True)
-
- # stderr
- def test_stderr_redirection(self):
- self.stderr_redirection(console=self.console)
-
- def test_stderr_redirection_with_env(self):
- self.stderr_redirection(console=self.console, with_env=True)
-
- def _get_debuggee_stdout(self) -> str:
- self.assertIsNotNone(
- self.dap_server.reverse_process, "Expected a debuggee process."
- )
- proc_stdout: IO = self.dap_server.reverse_process.stdout
- self.assertIsNotNone(proc_stdout)
- return proc_stdout.read().decode()
-
- def _get_debuggee_stderr(self) -> str:
- self.assertIsNotNone(
- self.dap_server.reverse_process, "Expected a debuggee process."
- )
- proc_stderr = self.dap_server.reverse_process.stderr
- self.assertIsNotNone(proc_stderr)
- return proc_stderr.read().decode()
-
-
- at skip # NOTE: Currently there is no difference between internal and externalTerminal.
- at skipIfRemote
- at skipIfAsan
- at skipIfBuildType(["debug"])
- at skipIfWindows
-class TestDAP_launchExternalTerminal(DAP_launchIO):
- console = "externalTerminal"
-
- # all redirection
- def test_all_redirection(self):
- self.all_redirection(console=self.console)
-
- def test_all_redirection_with_args(self):
- self.all_redirection(console=self.console, with_args=True)
-
- # stdin
- def test_stdin_redirection(self):
- self.stdin_redirection(console=self.console)
-
- def test_stdin_redirection_with_args(self):
- self.stdin_redirection(console=self.console, with_args=True)
-
- # stdout
- def test_stdout_redirection(self):
- self.stdout_redirection(console=self.console)
-
- def test_stdout_redirection_with_env(self):
- self.stdout_redirection(console=self.console, with_env=True)
-
- # stderr
- def test_stderr_redirection(self):
- self.stderr_redirection(console=self.console)
-
- def test_stderr_redirection_with_env(self):
- self.stderr_redirection(console=self.console, with_env=True)
-
- def _get_debuggee_stdout(self) -> str:
- self.assertIsNotNone(
- self.dap_server.reverse_process, "Expected a debuggee process."
- )
- proc_stdout: IO = self.dap_server.reverse_process.stdout
- self.assertIsNotNone(proc_stdout)
- return proc_stdout.read().decode()
-
- def _get_debuggee_stderr(self) -> str:
- self.assertIsNotNone(
- self.dap_server.reverse_process, "Expected a debuggee process."
- )
- proc_stderr = self.dap_server.reverse_process.stderr
- self.assertIsNotNone(proc_stderr)
- return proc_stderr.read().decode()
diff --git a/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_integratedTerminal.py b/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_integratedTerminal.py
new file mode 100644
index 0000000000000..989f96ec747cc
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_integratedTerminal.py
@@ -0,0 +1,119 @@
+"""
+Test the redirection after launching in the integrated terminal.
+"""
+
+from typing import IO
+from lldbsuite.test.decorators import (
+ skip,
+ skipIfAsan,
+ skipIfBuildType,
+ skipIfRemote,
+ skipIfWindows,
+)
+
+from DAP_launch_io import DAP_launchIO
+
+
+ at skipIfRemote
+ at skipIfAsan
+ at skipIfBuildType(["debug"])
+ at skipIfWindows
+class TestDAP_launchIntegratedTerminal(DAP_launchIO):
+ console = "integratedTerminal"
+
+ # all redirection
+ def test_all_redirection(self):
+ self.all_redirection(console=self.console)
+
+ def test_all_redirection_with_args(self):
+ self.all_redirection(console=self.console, with_args=True)
+
+ # stdin
+ def test_stdin_redirection(self):
+ self.stdin_redirection(console=self.console)
+
+ def test_stdin_redirection_with_args(self):
+ self.stdin_redirection(console=self.console, with_args=True)
+
+ # stdout
+ def test_stdout_redirection(self):
+ self.stdout_redirection(console=self.console)
+
+ def test_stdout_redirection_with_env(self):
+ self.stdout_redirection(console=self.console, with_env=True)
+
+ # stderr
+ def test_stderr_redirection(self):
+ self.stderr_redirection(console=self.console)
+
+ def test_stderr_redirection_with_env(self):
+ self.stderr_redirection(console=self.console, with_env=True)
+
+ def _get_debuggee_stdout(self) -> str:
+ self.assertIsNotNone(
+ self.dap_server.reverse_process, "Expected a debuggee process."
+ )
+ proc_stdout: IO = self.dap_server.reverse_process.stdout
+ self.assertIsNotNone(proc_stdout)
+ return proc_stdout.read().decode()
+
+ def _get_debuggee_stderr(self) -> str:
+ self.assertIsNotNone(
+ self.dap_server.reverse_process, "Expected a debuggee process."
+ )
+ proc_stderr = self.dap_server.reverse_process.stderr
+ self.assertIsNotNone(proc_stderr)
+ return proc_stderr.read().decode()
+
+
+ at skip # NOTE: Currently there is no difference between internal and externalTerminal.
+ at skipIfRemote
+ at skipIfAsan
+ at skipIfBuildType(["debug"])
+ at skipIfWindows
+class TestDAP_launchExternalTerminal(DAP_launchIO):
+ console = "externalTerminal"
+
+ # all redirection
+ def test_all_redirection(self):
+ self.all_redirection(console=self.console)
+
+ def test_all_redirection_with_args(self):
+ self.all_redirection(console=self.console, with_args=True)
+
+ # stdin
+ def test_stdin_redirection(self):
+ self.stdin_redirection(console=self.console)
+
+ def test_stdin_redirection_with_args(self):
+ self.stdin_redirection(console=self.console, with_args=True)
+
+ # stdout
+ def test_stdout_redirection(self):
+ self.stdout_redirection(console=self.console)
+
+ def test_stdout_redirection_with_env(self):
+ self.stdout_redirection(console=self.console, with_env=True)
+
+ # stderr
+ def test_stderr_redirection(self):
+ self.stderr_redirection(console=self.console)
+
+ def test_stderr_redirection_with_env(self):
+ self.stderr_redirection(console=self.console, with_env=True)
+
+ def _get_debuggee_stdout(self) -> str:
+ self.assertIsNotNone(
+ self.dap_server.reverse_process, "Expected a debuggee process."
+ )
+ proc_stdout: IO = self.dap_server.reverse_process.stdout
+ self.assertIsNotNone(proc_stdout)
+ return proc_stdout.read().decode()
+
+ def _get_debuggee_stderr(self) -> str:
+ self.assertIsNotNone(
+ self.dap_server.reverse_process, "Expected a debuggee process."
+ )
+ proc_stderr = self.dap_server.reverse_process.stderr
+ self.assertIsNotNone(proc_stderr)
+ return proc_stderr.read().decode()
diff --git a/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py b/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py
new file mode 100644
index 0000000000000..2fd2592b63f7f
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py
@@ -0,0 +1,50 @@
+"""
+Test the redirection after launching in the integrated terminal.
+"""
+
+from lldbsuite.test.decorators import skipIfWindows
+from DAP_launch_io import DAP_launchIO
+
+
+ at skipIfWindows
+class TestDAP_launchInternalConsole(DAP_launchIO):
+ console = "internalConsole"
+ __debuggee_stdout = None
+
+ # all redirection
+ def test_all_redirection(self):
+ self.all_redirection(console=self.console)
+
+ def test_all_redirection_with_args(self):
+ self.all_redirection(console=self.console, with_args=True)
+
+ # stdin
+ def test_stdin_redirection(self):
+ self.stdin_redirection(console=self.console)
+
+ def test_stdin_redirection_with_args(self):
+ self.stdin_redirection(console=self.console, with_args=True)
+
+ # stdout
+ def test_stdout_redirection(self):
+ self.stdout_redirection(console=self.console)
+
+ def test_stdout_redirection_with_env(self):
+ self.stdout_redirection(console=self.console, with_env=True)
+
+ # stderr
+ def test_stderr_redirection(self):
+ self.stderr_redirection(console=self.console)
+
+ def test_stderr_redirection_with_env(self):
+ self.stderr_redirection(console=self.console, with_env=True)
+
+ def _get_debuggee_stdout(self) -> str:
+ # self.get_stdout is not idempotent.
+ if self.__debuggee_stdout is None:
+ self.__debuggee_stdout = self.get_stdout()
+ return self.__debuggee_stdout
+
+ def _get_debuggee_stderr(self) -> str:
+ # NOTE: In internalConsole stderr writes to stdout.
+ return self._get_debuggee_stdout()
>From ec1a117257095a32d13ad0b2f515b95bf330e1a3 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Thu, 5 Feb 2026 18:04:42 +0000
Subject: [PATCH 2/2] fix typo
---
.../lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py b/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py
index 2fd2592b63f7f..b62d994758163 100644
--- a/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py
+++ b/lldb/test/API/tools/lldb-dap/launch/io/TestDAP_launch_io_internalConsole.py
@@ -1,5 +1,5 @@
"""
-Test the redirection after launching in the integrated terminal.
+Test the redirection after launching in the internal console.
"""
from lldbsuite.test.decorators import skipIfWindows
More information about the lldb-commits
mailing list