mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add test for reopening socketpair end via procfs.
PiperOrigin-RevId: 227738801 Change-Id: Ic0c5d10c3b1f21b3f85ff9a661a55db77fab77b0
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "test/syscalls/linux/socket_unix.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <net/if.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -1175,6 +1176,17 @@ TEST_P(UnixSocketPairTest, SocketShutdown) {
|
||||
EXPECT_EQ(data, absl::string_view(buf, 3));
|
||||
}
|
||||
|
||||
// TODO: We should be returning ENXIO and NOT EIO.
|
||||
TEST_P(UnixSocketPairTest, DISABLED_SocketReopenFromProcfs) {
|
||||
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
|
||||
|
||||
// Opening a socket pair via /proc/self/fd/X is a ENXIO.
|
||||
for (const int fd : {sockets->first_fd(), sockets->second_fd()}) {
|
||||
ASSERT_THAT(Open(absl::StrCat("/proc/self/fd/", fd), O_WRONLY),
|
||||
PosixErrorIs(ENXIO, ::testing::_));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace testing
|
||||
|
||||
Reference in New Issue
Block a user