summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux
diff options
context:
space:
mode:
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r--test/syscalls/linux/BUILD2
-rw-r--r--test/syscalls/linux/socket_generic_test_cases.cc (renamed from test/syscalls/linux/socket_generic.cc)21
2 files changed, 22 insertions, 1 deletions
diff --git a/test/syscalls/linux/BUILD b/test/syscalls/linux/BUILD
index 31dc2525c..1a492bca3 100644
--- a/test/syscalls/linux/BUILD
+++ b/test/syscalls/linux/BUILD
@@ -2305,7 +2305,7 @@ cc_library(
name = "socket_generic_test_cases",
testonly = 1,
srcs = [
- "socket_generic.cc",
+ "socket_generic_test_cases.cc",
],
hdrs = [
"socket_generic.h",
diff --git a/test/syscalls/linux/socket_generic.cc b/test/syscalls/linux/socket_generic_test_cases.cc
index f70047a09..5c4cb6c35 100644
--- a/test/syscalls/linux/socket_generic.cc
+++ b/test/syscalls/linux/socket_generic_test_cases.cc
@@ -98,6 +98,27 @@ TEST_P(AllSocketPairTest, BasicSendmmsg) {
EXPECT_EQ(0, memcmp(sent_data, received_data, sizeof(sent_data)));
}
+TEST_P(AllSocketPairTest, SendmmsgIsLimitedByMAXIOV) {
+ std::unique_ptr<SocketPair> sockets =
+ ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
+ char c = 0;
+
+ std::vector<struct mmsghdr> msgs(UIO_MAXIOV + 1);
+ std::vector<struct iovec> iovs(msgs.size());
+ for (size_t i = 0; i < msgs.size(); i++) {
+ iovs[i].iov_len = 1;
+ iovs[i].iov_base = &c;
+ msgs[i].msg_hdr.msg_iov = &iovs[i];
+ msgs[i].msg_hdr.msg_iovlen = 1;
+ }
+
+ int n;
+ ASSERT_THAT(n = RetryEINTR(sendmmsg)(sockets->first_fd(), msgs.data(),
+ msgs.size(), MSG_DONTWAIT),
+ SyscallSucceeds());
+ EXPECT_LE(n, UIO_MAXIOV);
+}
+
TEST_P(AllSocketPairTest, BasicRecvmmsg) {
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
char sent_data[200];