From: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"kys@microsoft.com" <kys@microsoft.com>,
"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
Dexuan Cui <decui@microsoft.com>, Bryan Tan <bryantan@vmware.com>,
Vishnu Dasa <vdasa@vmware.com>,
Krasnov Arseniy <oxffffaa@gmail.com>,
Bobby Eshleman <bobby.eshleman@gmail.com>,
"Bobby Eshleman" <bobby.eshleman@bytedance.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
kernel <kernel@sberdevices.ru>
Subject: Re: [RFC PATCH v2 5/6] test/vsock: add big message test
Date: Thu, 1 Dec 2022 11:44:39 +0000 [thread overview]
Message-ID: <2694faa5-c460-857d-6ca9-a6328530ff23@sberdevices.ru> (raw)
In-Reply-To: <20221201094541.gj7zthelbeqhsp63@sgarzare-redhat>
On 01.12.2022 12:45, Stefano Garzarella wrote:
> On Fri, Nov 25, 2022 at 05:13:06PM +0000, Arseniy Krasnov wrote:
>> This adds test for sending message, bigger than peer's buffer size.
>> For SOCK_SEQPACKET socket it must fail, as this type of socket has
>> message size limit.
>>
>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
>> ---
>> tools/testing/vsock/vsock_test.c | 69 ++++++++++++++++++++++++++++++++
>> 1 file changed, 69 insertions(+)
>>
>> diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
>> index 12ef0cca6f93..a8e43424fb32 100644
>> --- a/tools/testing/vsock/vsock_test.c
>> +++ b/tools/testing/vsock/vsock_test.c
>> @@ -569,6 +569,70 @@ static void test_seqpacket_timeout_server(const struct test_opts *opts)
>> close(fd);
>> }
>>
>> +static void test_seqpacket_bigmsg_client(const struct test_opts *opts)
>> +{
>> + unsigned long sock_buf_size;
>> + ssize_t send_size;
>> + socklen_t len;
>> + void *data;
>> + int fd;
>> +
>> + len = sizeof(sock_buf_size);
>> +
>> + fd = vsock_seqpacket_connect(opts->peer_cid, 1234);
>> + if (fd < 0) {
>> + perror("connect");
>> + exit(EXIT_FAILURE);
>> + }
>> +
>> + if (getsockopt(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_SIZE,
>> + &sock_buf_size, &len)) {
>> + perror("getsockopt");
>> + exit(EXIT_FAILURE);
>> + }
>> +
>> + sock_buf_size++;
>> +
>> + data = malloc(sock_buf_size);
>> + if (!data) {
>> + perror("malloc");
>> + exit(EXIT_FAILURE);
>> + }
>> +
>> + send_size = send(fd, data, sock_buf_size, 0);
>> + if (send_size != -1) {
>> + fprintf(stderr, "expected 'send(2)' failure, got %zi\n",
>> + send_size);
>> + exit(EXIT_FAILURE);
>> + }
>> +
>> + if (errno != EMSGSIZE) {
>> + fprintf(stderr, "expected EMSGSIZE in 'errno', got %i\n",
>> + errno);
>> + exit(EXIT_FAILURE);
>> + }
>
> We should make sure that this is true for all transports, but since now only virtio-vsock supports it, we should be okay.
Hm, in general: I've tested this test suite for vmci may be several months ago, and found, that some tests
didn't work. I'm thinking about reworking this test suite a little bit: each transport must have own set of
tests for features that it supports. I had feeling, that all these tests are run only with virtio transport :)
Because for example SEQPACKET mode is suported only for virtio.
Thanks
>
>> +
>> + control_writeln("CLISENT");
>> +
>> + free(data);
>> + close(fd);
>> +}
>> +
>> +static void test_seqpacket_bigmsg_server(const struct test_opts *opts)
>> +{
>> + int fd;
>> +
>> + fd = vsock_seqpacket_accept(VMADDR_CID_ANY, 1234, NULL);
>> + if (fd < 0) {
>> + perror("accept");
>> + exit(EXIT_FAILURE);
>> + }
>> +
>> + control_expectln("CLISENT");
>> +
>> + close(fd);
>> +}
>> +
>> #define BUF_PATTERN_1 'a'
>> #define BUF_PATTERN_2 'b'
>>
>> @@ -851,6 +915,11 @@ static struct test_case test_cases[] = {
>> .run_client = test_stream_poll_rcvlowat_client,
>> .run_server = test_stream_poll_rcvlowat_server,
>> },
>> + {
>> + .name = "SOCK_SEQPACKET big message",
>> + .run_client = test_seqpacket_bigmsg_client,
>> + .run_server = test_seqpacket_bigmsg_server,
>> + },
>> {},
>> };
>>
>> --
>> 2.25.1
>
> LGTM!
>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>
next prev parent reply other threads:[~2022-12-01 11:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 17:00 [RFC PATCH v2 0/6] vsock: update tools and error handling Arseniy Krasnov
2022-11-25 17:03 ` [RFC PATCH v2 1/6] vsock: return errors other than -ENOMEM to socket Arseniy Krasnov
2022-12-01 9:17 ` Stefano Garzarella
2022-11-25 17:05 ` [RFC PATCH v2 2/6] hv_sock: always return ENOMEM in case of error Arseniy Krasnov
2022-12-01 9:23 ` Stefano Garzarella
2022-12-01 21:43 ` Dexuan Cui
2022-11-25 17:08 ` [RFC PATCH v2 3/6] vsock/vmci: " Arseniy Krasnov
[not found] ` <20221201093048.q2pradrgn5limcfb@sgarzare-redhat>
2022-12-01 11:36 ` Arseniy Krasnov
2022-12-01 15:14 ` Vishnu Dasa
2022-12-01 15:16 ` Arseniy Krasnov
2022-11-25 17:10 ` [RFC PATCH v2 4/6] test/vsock: rework message bounds test Arseniy Krasnov
2022-12-01 9:41 ` Stefano Garzarella
2022-12-01 11:40 ` Arseniy Krasnov
2022-11-25 17:13 ` [RFC PATCH v2 5/6] test/vsock: add big message test Arseniy Krasnov
2022-12-01 9:45 ` Stefano Garzarella
2022-12-01 11:44 ` Arseniy Krasnov [this message]
2022-12-05 9:38 ` Stefano Garzarella
2022-11-25 17:15 ` [RFC PATCH v2 6/6] test/vsock: vsock_perf utility Arseniy Krasnov
2022-12-01 10:21 ` Stefano Garzarella
2022-12-01 11:46 ` Arseniy Krasnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2694faa5-c460-857d-6ca9-a6328530ff23@sberdevices.ru \
--to=avkrasnov@sberdevices.ru \
--cc=bobby.eshleman@bytedance.com \
--cc=bobby.eshleman@gmail.com \
--cc=bryantan@vmware.com \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=haiyangz@microsoft.com \
--cc=kernel@sberdevices.ru \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oxffffaa@gmail.com \
--cc=pabeni@redhat.com \
--cc=sgarzare@redhat.com \
--cc=vdasa@vmware.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®