-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Skip tests if socket name is longer than 107 bytes #137405
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
Conversation
@llvm/pr-subscribers-lldb Author: Emre Kultursay (emrekultursay) ChangesTo fix the test failures introduced in Commit 488eeb3 Full diff: https://github.com/llvm/llvm-project/pull/137405.diff 1 Files Affected:
diff --git a/lldb/unittests/Host/SocketTest.cpp b/lldb/unittests/Host/SocketTest.cpp
index 5bfb48b52f7e7..df67943892420 100644
--- a/lldb/unittests/Host/SocketTest.cpp
+++ b/lldb/unittests/Host/SocketTest.cpp
@@ -349,6 +349,10 @@ TEST_F(SocketTest, DomainSocketFromBoundNativeSocket) {
ASSERT_FALSE(EC);
llvm::sys::path::append(name, "test");
+ // Skip the test if the $TMPDIR is too long to hold a domain socket.
+ if (name.size() > 107u)
+ return;
+
DomainSocket socket(true);
Status error = socket.Listen(name, /*backlog=*/10);
ASSERT_THAT_ERROR(error.takeError(), llvm::Succeeded());
@@ -369,6 +373,10 @@ TEST_F(SocketTest, AbstractSocketFromBoundNativeSocket) {
llvm::sys::fs::createUniquePath("AbstractSocketFromBoundNativeSocket", name,
true);
llvm::sys::path::append(name, "test");
+
+ // Skip the test if the $TMPDIR is too long to hold a domain socket.
+ if (name.size() > 107u)
+ return;
AbstractSocket socket;
Status error = socket.Listen(name, /*backlog=*/10);
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
To fix the test failures introduced in Commit 488eeb3
d7ab4d2
to
65de315
Compare
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/21023 Here is the relevant piece of the build log for the reference
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Abstract sockets aren't tied to the filesystem, so you don't need to make them "be in" any particular directory, or even look like a path. The only reason I suggested to use createUniquePath
is because it's a convenient way to create a random (path-like) string, but it looks like you're not making use of that (the first argument to this function has a slightly different meaning than it does for createUniqueDirectory).
The way I envisioned that is to do a
createUniquePath("AbstractSocketFromBoundNativeSocket-%%%%%%%%", name, /*MakeAbsolute=*/false);
.. though now that I think about it, it may be even better to detach this from the file system completely and use something like UUID::Generate().GetAsString()
to generate a random name.
To fix the test failures introduced in Commit 488eeb3
To fix the test failures introduced in Commit 488eeb3
To fix the test failures introduced in Commit 488eeb3
To fix the test failures introduced in Commit 488eeb3
To fix the test failures introduced in Commit 488eeb3
To fix the test failures introduced in Commit 488eeb3