Skip to content

Commit 93a2730

Browse files
committed
Make sure we don't test with sockets over 104 chars
1 parent 42150df commit 93a2730

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lldb/test/API/commands/protocol/TestMCPUnixSocket.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import os
22
import tempfile
3+
import unittest
34

45
from lldbsuite.test.decorators import *
56
from lldbsuite.test.lldbtest import *
67

8+
# To be safe and portable, Unix domain socket paths should be kept at or below
9+
# 108 characters on Linux, and around 104 characters on macOS:
10+
MAX_SOCKET_PATH_LENGTH = 104
11+
712

813
class MCPUnixSocketCommandTestCase(TestBase):
914
@skipIfWindows
@@ -16,6 +21,11 @@ def test_unix_socket(self):
1621
temp_directory = tempfile.TemporaryDirectory()
1722
socket_file = os.path.join(temp_directory.name, "mcp.sock")
1823

24+
if len(socket_file) >= MAX_SOCKET_PATH_LENGTH:
25+
self.skipTest(
26+
f"Socket path {socket_file} exceeds the {MAX_SOCKET_PATH_LENGTH} character limit"
27+
)
28+
1929
self.expect(
2030
f"protocol-server start MCP accept://{socket_file}",
2131
startstr="MCP server started with connection listeners:",

0 commit comments

Comments
 (0)