-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[lldb-dap] Test Gardening, attach tests. #141981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Trimming unused imports, adjusting the test to use the `DEFAULT_TIMEOUT` instead of a custom timeout and adjusting the flow to stopOnEntry for improving consistency.
@llvm/pr-subscribers-lldb Author: John Harrison (ashgti) ChangesTrimming unused imports, adjusting the test to use the Full diff: https://github.com/llvm/llvm-project/pull/141981.diff 1 Files Affected:
diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
index 7c2b540195d15..edb87a9314d78 100644
--- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
+++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attachByPortNum.py
@@ -2,26 +2,16 @@
Test lldb-dap "port" configuration to "attach" request
"""
-import dap_server
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
from lldbsuite.test import lldbplatformutil
from lldbgdbserverutils import Pipe
import lldbdap_testcase
-import os
-import shutil
-import subprocess
-import tempfile
-import threading
-import sys
-import socket
+import lldb
-@skip("https://github.com/llvm/llvm-project/issues/138803")
+@skip(bugnumber="https://github.com/llvm/llvm-project/issues/138803")
class TestDAP_attachByPortNum(lldbdap_testcase.DAPTestCaseBase):
- default_timeout = 20
-
def set_and_hit_breakpoint(self, continueToExit=True):
self.dap_server.wait_for_stopped()
@@ -50,7 +40,7 @@ def get_debug_server_command_line_args(self):
def get_debug_server_pipe(self):
pipe = Pipe(self.getBuildDir())
self.addTearDownHook(lambda: pipe.close())
- pipe.finish_connection(self.default_timeout)
+ pipe.finish_connection(self.DEFAULT_TIMEOUT)
return pipe
@skipIfWindows
@@ -73,28 +63,33 @@ def test_by_port(self):
)
# Read the port number from the debug server pipe.
- port = pipe.read(10, self.default_timeout)
+ port = pipe.read(10, self.DEFAULT_TIMEOUT)
# Trim null byte, convert to int
port = int(port[:-1])
self.assertIsNotNone(
port, " Failed to read the port number from debug server pipe"
)
- self.attach(program=program, gdbRemotePort=port, sourceInitFile=True)
+ self.attach(
+ program=program,
+ gdbRemotePort=port,
+ sourceInitFile=True,
+ stopOnEntry=True,
+ )
self.set_and_hit_breakpoint(continueToExit=True)
- self.process.terminate()
@skipIfWindows
@skipIfNetBSD
- def test_by_port_and_pid(self):
+ def test_fails_if_both_port_and_pid_are_set(self):
"""
Tests attaching to a process by process ID and port number.
"""
program = self.build_and_create_debug_adapter_for_attach()
- # It is not necessary to launch "lldb-server" to obtain the actual port and pid for attaching.
- # However, when providing the port number and pid directly, "lldb-dap" throws an error message, which is expected.
- # So, used random pid and port numbers here.
+ # It is not necessary to launch "lldb-server" to obtain the actual port
+ # and pid for attaching. However, when providing the port number and pid
+ # directly, "lldb-dap" throws an error message, which is expected. So,
+ # used random pid and port numbers here.
pid = 1354
port = 1234
@@ -106,10 +101,9 @@ def test_by_port_and_pid(self):
sourceInitFile=True,
expectFailure=True,
)
- if not (response and response["success"]):
- self.assertFalse(
- response["success"], "The user can't specify both pid and port"
- )
+ self.assertFalse(
+ response["success"], "The user can't specify both pid and port"
+ )
@skipIfWindows
@skipIfNetBSD
@@ -123,11 +117,10 @@ def test_by_invalid_port(self):
response = self.attach(
program=program, gdbRemotePort=port, sourceInitFile=True, expectFailure=True
)
- if not (response and response["success"]):
- self.assertFalse(
- response["success"],
- "The user can't attach with invalid port (%s)" % port,
- )
+ self.assertFalse(
+ response["success"],
+ "The user can't attach with invalid port (%s)" % port,
+ )
@skipIfWindows
@skipIfNetBSD
@@ -147,9 +140,7 @@ def test_by_illegal_port(self):
response = self.attach(
program=program, gdbRemotePort=port, sourceInitFile=True, expectFailure=True
)
- if not (response and response["success"]):
- self.assertFalse(
- response["success"],
- "The user can't attach with illegal port (%s)" % port,
- )
- self.process.terminate()
+ self.assertFalse(
+ response["success"],
+ "The user can't attach with illegal port (%s)" % port,
+ )
|
JDevlieghere
approved these changes
May 29, 2025
rorth
pushed a commit
to rorth/llvm-project
that referenced
this pull request
Jun 11, 2025
Trimming unused imports, adjusting the test to use the `DEFAULT_TIMEOUT` instead of a custom timeout and adjusting the flow to stopOnEntry for improving consistency.
DhruvSrivastavaX
pushed a commit
to DhruvSrivastavaX/lldb-for-aix
that referenced
this pull request
Jun 12, 2025
Trimming unused imports, adjusting the test to use the `DEFAULT_TIMEOUT` instead of a custom timeout and adjusting the flow to stopOnEntry for improving consistency.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trimming unused imports, adjusting the test to use the
DEFAULT_TIMEOUT
instead of a custom timeout and adjusting the flow to stopOnEntry for improving consistency.