Date: Wed, 28 Feb 2024 22:33:08 GMT From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d6ef9649dd92 - main - tests/unix_seqpacket: remove EMSGSIZE tests Message-ID: <202402282233.41SMX8Sc010891@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d6ef9649dd924f12974d66a0c29a4ede71407e7d commit d6ef9649dd924f12974d66a0c29a4ede71407e7d Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2024-02-28 22:32:46 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2024-02-28 22:32:46 +0000 tests/unix_seqpacket: remove EMSGSIZE tests These tests were not testing conformance to the specification, rather than the limitation of our implementation. The specification doesn't say that a SOCK_SEQPACKET shall ever return EMSGSIZE. It says: The SOCK_SEQPACKET socket type is similar to the SOCK_STREAM type, and is also connection-oriented. The only difference between these types is that record boundaries are maintained using the SOCK_SEQPACKET type. A record can be sent using one or more output operations and received using one or more input operations, but a single operation never transfers parts of more than one record. Record boundaries are visible to the receiver via the MSG_EOR flag in the received message flags returned by the recvmsg() function. It is protocol-specific whether a maximum record size is imposed. The EMSGSIZE is specified as 'message is too large to be sent all at once, as the socket requires'. Indeed existing implementation that has unix/seqpacket marked as PR_ATOMIC has such a limitation. But future implementation won't have, thus remove the tests. Reviewed by: tuexen, asomers Differential Revision: https://reviews.freebsd.org/D43756 --- tests/sys/kern/unix_seqpacket_test.c | 61 ------------------------------------ 1 file changed, 61 deletions(-) diff --git a/tests/sys/kern/unix_seqpacket_test.c b/tests/sys/kern/unix_seqpacket_test.c index a2604d065024..be273fbe1246 100644 --- a/tests/sys/kern/unix_seqpacket_test.c +++ b/tests/sys/kern/unix_seqpacket_test.c @@ -868,65 +868,6 @@ ATF_TC_BODY(send_recv_nonblocking, tc) close(sv[1]); } -/* - * We should get EMSGSIZE if we try to send a message larger than the socket - * buffer, with blocking sockets - */ -ATF_TC_WITHOUT_HEAD(emsgsize); -ATF_TC_BODY(emsgsize, tc) -{ - int sv[2]; - const int sndbufsize = 8192; - const int rcvbufsize = 8192; - const size_t pktsize = (sndbufsize + rcvbufsize) * 2; - char sndbuf[pktsize]; - ssize_t ssize; - - /* setup the socket pair */ - do_socketpair(sv); - /* Setup the buffers */ - ATF_REQUIRE_EQ(0, setsockopt(sv[0], SOL_SOCKET, SO_SNDBUF, &sndbufsize, - sizeof(sndbufsize))); - ATF_REQUIRE_EQ(0, setsockopt(sv[1], SOL_SOCKET, SO_RCVBUF, &rcvbufsize, - sizeof(rcvbufsize))); - - ssize = send(sv[0], sndbuf, pktsize, MSG_EOR); - ATF_CHECK_EQ(EMSGSIZE, errno); - ATF_CHECK_EQ(-1, ssize); - close(sv[0]); - close(sv[1]); -} - -/* - * We should get EMSGSIZE if we try to send a message larger than the socket - * buffer, with nonblocking sockets - */ -ATF_TC_WITHOUT_HEAD(emsgsize_nonblocking); -ATF_TC_BODY(emsgsize_nonblocking, tc) -{ - int sv[2]; - const int sndbufsize = 8192; - const int rcvbufsize = 8192; - const size_t pktsize = (sndbufsize + rcvbufsize) * 2; - char sndbuf[pktsize]; - ssize_t ssize; - - /* setup the socket pair */ - do_socketpair_nonblocking(sv); - /* Setup the buffers */ - ATF_REQUIRE_EQ(0, setsockopt(sv[0], SOL_SOCKET, SO_SNDBUF, &sndbufsize, - sizeof(sndbufsize))); - ATF_REQUIRE_EQ(0, setsockopt(sv[1], SOL_SOCKET, SO_RCVBUF, &rcvbufsize, - sizeof(rcvbufsize))); - - ssize = send(sv[0], sndbuf, pktsize, MSG_EOR); - ATF_CHECK_EQ(EMSGSIZE, errno); - ATF_CHECK_EQ(-1, ssize); - close(sv[0]); - close(sv[1]); -} - - /* * We should get EAGAIN if we try to send a message larger than the socket * buffer, with nonblocking sockets. Test with several different sockbuf sizes @@ -1160,8 +1101,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, sendto_recvfrom); ATF_TP_ADD_TC(tp, shutdown_send); ATF_TP_ADD_TC(tp, shutdown_send_sigpipe); - ATF_TP_ADD_TC(tp, emsgsize); - ATF_TP_ADD_TC(tp, emsgsize_nonblocking); ATF_TP_ADD_TC(tp, eagain_8k_8k); ATF_TP_ADD_TC(tp, eagain_8k_128k); ATF_TP_ADD_TC(tp, eagain_128k_8k);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402282233.41SMX8Sc010891>