Re: [RFC PATCH v2 4/4] vsock/test: MSG_PEEK test for SOCK_SEQPACKET

From: Arseniy Krasnov
Date: Tue Jul 25 2023 - 11:57:21 EST




On 25.07.2023 18:41, Stefano Garzarella wrote:
> On Wed, Jul 19, 2023 at 10:27:08PM +0300, Arseniy Krasnov wrote:
>> This adds MSG_PEEK test for SOCK_SEQPACKET. It works in the same way as
>> SOCK_STREAM test, except it also tests MSG_TRUNC flag.
>>
>> Signed-off-by: Arseniy Krasnov <AVKrasnov@xxxxxxxxxxxxxx>
>> ---
>> tools/testing/vsock/vsock_test.c | 58 +++++++++++++++++++++++++++++---
>> 1 file changed, 54 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
>> index 444a3ff0681f..2ca2cbfa9808 100644
>> --- a/tools/testing/vsock/vsock_test.c
>> +++ b/tools/testing/vsock/vsock_test.c
>> @@ -257,14 +257,19 @@ static void test_stream_multiconn_server(const struct test_opts *opts)
>>
>> #define MSG_PEEK_BUF_LEN 64
>>
>> -static void test_stream_msg_peek_client(const struct test_opts *opts)
>> +static void __test_msg_peek_client(const struct test_opts *opts,
>
> Let's stay with just test_msg_peek_client(), WDYT?
>
>> +                   bool seqpacket)
>> {
>>     unsigned char buf[MSG_PEEK_BUF_LEN];
>>     ssize_t send_size;
>>     int fd;
>>     int i;
>>
>> -    fd = vsock_stream_connect(opts->peer_cid, 1234);
>> +    if (seqpacket)
>> +        fd = vsock_seqpacket_connect(opts->peer_cid, 1234);
>> +    else
>> +        fd = vsock_stream_connect(opts->peer_cid, 1234);
>> +
>>     if (fd < 0) {
>>         perror("connect");
>>         exit(EXIT_FAILURE);
>> @@ -290,7 +295,8 @@ static void test_stream_msg_peek_client(const struct test_opts *opts)
>>     close(fd);
>> }
>>
>> -static void test_stream_msg_peek_server(const struct test_opts *opts)
>> +static void __test_msg_peek_server(const struct test_opts *opts,
>
> Same here.
>
> The rest LGTM!

Ok! I'll update.

>
> Also the whole series should be ready for net-next, right?

Yes, I'll fix these two things and resend this as 'net-next'

Thanks, Arseniy

>
> Stefano
>