mbox series

[net-next,0/5] vsock/test: add recv_buf()/send_buf() utility functions and some improvements

Message ID 20230915121452.87192-1-sgarzare@redhat.com (mailing list archive)
Headers show
Series vsock/test: add recv_buf()/send_buf() utility functions and some improvements | expand

Message

Stefano Garzarella Sept. 15, 2023, 12:14 p.m. UTC
We recently found that some tests were failing [1].

The problem was that we were not waiting for all the bytes correctly,
so we had a partial read. I had initially suggested using MSG_WAITALL,
but this could have timeout problems.

Since we already had send_byte() and recv_byte() that handled the timeout,
but also the expected return value, I moved that code to two new functions
that we can now use to send/receive generic buffers.

The last commit is just an improvement to a test I found difficult to
understand while using the new functions.

@Arseniy a review and some testing are really appreciated :-)

[1] https://lore.kernel.org/netdev/63xflnwiohdfo6m3vnrrxgv2ulplencpwug5qqacugqh7xxpu3@tsczkuqgwurb/

Stefano Garzarella (5):
  vsock/test: add recv_buf() utility function
  vsock/test: use recv_buf() in vsock_test.c
  vsock/test: add send_buf() utility function
  vsock/test: use send_buf() in vsock_test.c
  vsock/test: track bytes in MSG_PEEK test for SOCK_SEQPACKET

 tools/testing/vsock/util.h       |   3 +
 tools/testing/vsock/util.c       | 124 ++++++++++++--------
 tools/testing/vsock/vsock_test.c | 187 ++++++-------------------------
 3 files changed, 117 insertions(+), 197 deletions(-)

Comments

Arseniy Krasnov Sept. 15, 2023, 7:30 p.m. UTC | #1
On 15.09.2023 15:14, Stefano Garzarella wrote:
> We recently found that some tests were failing [1].
> 
> The problem was that we were not waiting for all the bytes correctly,
> so we had a partial read. I had initially suggested using MSG_WAITALL,
> but this could have timeout problems.
> 
> Since we already had send_byte() and recv_byte() that handled the timeout,
> but also the expected return value, I moved that code to two new functions
> that we can now use to send/receive generic buffers.
> 
> The last commit is just an improvement to a test I found difficult to
> understand while using the new functions.
> 
> @Arseniy a review and some testing are really appreciated :-)

Thanks for this cleanup of the tests, I reviewed this patchset and run local
testing, seems everything is ok! :)

Thanks, Arseniy

> 
> [1] https://lore.kernel.org/netdev/63xflnwiohdfo6m3vnrrxgv2ulplencpwug5qqacugqh7xxpu3@tsczkuqgwurb/
> 
> Stefano Garzarella (5):
>   vsock/test: add recv_buf() utility function
>   vsock/test: use recv_buf() in vsock_test.c
>   vsock/test: add send_buf() utility function
>   vsock/test: use send_buf() in vsock_test.c
>   vsock/test: track bytes in MSG_PEEK test for SOCK_SEQPACKET
> 
>  tools/testing/vsock/util.h       |   3 +
>  tools/testing/vsock/util.c       | 124 ++++++++++++--------
>  tools/testing/vsock/vsock_test.c | 187 ++++++-------------------------
>  3 files changed, 117 insertions(+), 197 deletions(-)
>
patchwork-bot+netdevbpf@kernel.org Sept. 17, 2023, 4:50 p.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 15 Sep 2023 14:14:47 +0200 you wrote:
> We recently found that some tests were failing [1].
> 
> The problem was that we were not waiting for all the bytes correctly,
> so we had a partial read. I had initially suggested using MSG_WAITALL,
> but this could have timeout problems.
> 
> Since we already had send_byte() and recv_byte() that handled the timeout,
> but also the expected return value, I moved that code to two new functions
> that we can now use to send/receive generic buffers.
> 
> [...]

Here is the summary with links:
  - [net-next,1/5] vsock/test: add recv_buf() utility function
    (no matching commit)
  - [net-next,2/5] vsock/test: use recv_buf() in vsock_test.c
    https://git.kernel.org/netdev/net-next/c/a0bcb8357716
  - [net-next,3/5] vsock/test: add send_buf() utility function
    (no matching commit)
  - [net-next,4/5] vsock/test: use send_buf() in vsock_test.c
    https://git.kernel.org/netdev/net-next/c/2a8548a9bb4c
  - [net-next,5/5] vsock/test: track bytes in MSG_PEEK test for SOCK_SEQPACKET
    https://git.kernel.org/netdev/net-next/c/bc7bea452d32

You are awesome, thank you!