mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krasnov Arseniy Vladimirovich <AVKrasnov@sberdevices.ru>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: Krasnov Arseniy <oxffffaa@gmail.com>,
	Rokosov Dmitry Dmitrievich <DDRokosov@sberdevices.ru>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v1 2/3] af_vsock: SOCK_SEQPACKET receive timeout test
Date: Tue, 15 Mar 2022 08:35:44 +0000	[thread overview]
Message-ID: <457e03a0-7f74-4b9d-3699-ce8775ed69c0@sberdevices.ru> (raw)
In-Reply-To: <20220315081517.m7rvlpintqipdu6i@sgarzare-redhat>

On 15.03.2022 11:15, Stefano Garzarella wrote:
> On Fri, Mar 11, 2022 at 10:55:42AM +0000, Krasnov Arseniy Vladimirovich wrote:
>> Test for receive timeout check: connection is established,
>> receiver sets timeout, but sender does nothing. Receiver's
>> 'read()' call must return EAGAIN.
>>
>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
>> ---
>> tools/testing/vsock/vsock_test.c | 49 ++++++++++++++++++++++++++++++++
>> 1 file changed, 49 insertions(+)
>>
>> diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
>> index 2a3638c0a008..aa2de27d0f77 100644
>> --- a/tools/testing/vsock/vsock_test.c
>> +++ b/tools/testing/vsock/vsock_test.c
>> @@ -391,6 +391,50 @@ static void test_seqpacket_msg_trunc_server(const struct test_opts *opts)
>>     close(fd);
>> }
>>
>> +static void test_seqpacket_timeout_client(const struct test_opts *opts)
>> +{
>> +    int fd;
>> +    struct timeval tv;
>> +    char dummy;
>> +
>> +    fd = vsock_seqpacket_connect(opts->peer_cid, 1234);
>> +    if (fd < 0) {
>> +        perror("connect");
>> +        exit(EXIT_FAILURE);
>> +    }
>> +
>> +    tv.tv_sec = 1;
>> +    tv.tv_usec = 0;
>> +
>> +    if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv)) == -1) {
>> +        perror("setsockopt 'SO_RCVTIMEO'");
>> +        exit(EXIT_FAILURE);
>> +    }
>> +
>> +    if ((read(fd, &dummy, sizeof(dummy)) != -1) ||
>> +        (errno != EAGAIN)) {
>> +        perror("EAGAIN expected");
>> +        exit(EXIT_FAILURE);
>> +    }
> 
> The patch LGTM, maybe the only thing I would add here is a check on the time spent in the read(), to see that it is approximately the timeout we have set.

Ack, I'll add it on v2

> 
> Thanks,
> Stefano
> 


  reply	other threads:[~2022-03-15  8:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 10:52 [RFC PATCH v1 1/3] af_vsock: add two new tests for SOCK_SEQPACKET Krasnov Arseniy Vladimirovich
2022-03-11 10:55 ` [RFC PATCH v1 2/3] af_vsock: SOCK_SEQPACKET receive timeout test Krasnov Arseniy Vladimirovich
2022-03-15  8:15   ` Stefano Garzarella
2022-03-15  8:35     ` Krasnov Arseniy Vladimirovich [this message]
2022-03-11 10:58 ` [RFC PATCH v1 3/3] af_vsock: SOCK_SEQPACKET broken buffer test Krasnov Arseniy Vladimirovich
2022-03-15  8:36   ` Stefano Garzarella
2022-03-15  9:34     ` Krasnov Arseniy Vladimirovich
2022-03-15 11:49       ` Stefano Garzarella
2022-03-15 12:43       ` Krasnov Arseniy Vladimirovich
2022-03-15 12:55         ` Stefano Garzarella
2022-03-15  8:42 ` [RFC PATCH v1 1/3] af_vsock: add two new tests for SOCK_SEQPACKET Stefano Garzarella
2022-03-15 11:00   ` Krasnov Arseniy Vladimirovich

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=457e03a0-7f74-4b9d-3699-ce8775ed69c0@sberdevices.ru \
    --to=avkrasnov@sberdevices.ru \
    --cc=DDRokosov@sberdevices.ru \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oxffffaa@gmail.com \
    --cc=sgarzare@redhat.com \
    --cc=virtualization@lists.linux-foundation.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®