summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls
diff options
context:
space:
mode:
authorBrian Geffon <bgeffon@google.com>2019-01-03 13:22:12 -0800
committerShentubot <shentubot@google.com>2019-01-03 13:23:18 -0800
commitd89836fe51eeef4920439d6d2433f2ee6f37aec9 (patch)
tree933f5e5262e753bdf5507808b4c44cfd3a386552 /test/syscalls
parent33191e1cc4010693c434b24baa4d830d082c8ce6 (diff)
Add test for reopening socketpair end via procfs.
PiperOrigin-RevId: 227738801 Change-Id: Ic0c5d10c3b1f21b3f85ff9a661a55db77fab77b0
Diffstat (limited to 'test/syscalls')
-rw-r--r--test/syscalls/linux/socket_unix.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/syscalls/linux/socket_unix.cc b/test/syscalls/linux/socket_unix.cc
index c60a965ae..8815ad849 100644
--- a/test/syscalls/linux/socket_unix.cc
+++ b/test/syscalls/linux/socket_unix.cc
@@ -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