History log of /linux-master/tools/testing/vsock/util.c
Revision Date Author Comments
# e18c7092 23-Jan-2024 Arseniy Krasnov <avkrasnov@salutedevices.com>

vsock/test: add '--peer-port' input argument

Implement port for given CID as input argument instead of using
hardcoded value '1234'. This allows to run different test instances
on a single CID. Port argument is not required parameter and if it is
not set, then default value will be '1234' - thus we preserve previous
behaviour.

Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20240123072750.4084181-1-avkrasnov@salutedevices.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>


# d80f63f6 03-Nov-2023 Filippo Storniolo <f.storniolo95@gmail.com>

test/vsock: add dobule bind connect test

This add bind connect test which creates a listening server socket
and tries to connect a client with a bound local port to it twice.

Co-developed-by: Luigi Leonardi <luigi.leonardi@outlook.com>
Signed-off-by: Luigi Leonardi <luigi.leonardi@outlook.com>
Signed-off-by: Filippo Storniolo <f.storniolo95@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 84d5fb97 03-Nov-2023 Filippo Storniolo <f.storniolo95@gmail.com>

test/vsock: refactor vsock_accept

This is a preliminary patch to introduce SOCK_STREAM bind connect test.
vsock_accept() is split into vsock_listen() and vsock_accept().

Co-developed-by: Luigi Leonardi <luigi.leonardi@outlook.com>
Signed-off-by: Luigi Leonardi <luigi.leonardi@outlook.com>
Signed-off-by: Filippo Storniolo <f.storniolo95@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bfada5a7 03-Nov-2023 Filippo Storniolo <f.storniolo95@gmail.com>

test/vsock fix: add missing check on socket creation

Add check on socket() return value in vsock_listen()
and vsock_connect()

Co-developed-by: Luigi Leonardi <luigi.leonardi@outlook.com>
Signed-off-by: Luigi Leonardi <luigi.leonardi@outlook.com>
Signed-off-by: Filippo Storniolo <f.storniolo95@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bc36442e 10-Oct-2023 Arseniy Krasnov <avkrasnov@salutedevices.com>

test/vsock: MSG_ZEROCOPY flag tests

This adds three tests for MSG_ZEROCOPY feature:
1) SOCK_STREAM tx with different buffers.
2) SOCK_SEQPACKET tx with different buffers.
3) SOCK_STREAM test to read empty error queue of the socket.

Patch also works as preparation for the next patches for tools in this
patchset: vsock_perf and vsock_uring_test:
1) Adds several new functions to util.c - they will be also used by
vsock_uring_test.
2) Adds two new functions for MSG_ZEROCOPY handling to a new source
file - such source will be shared between vsock_test, vsock_perf and
vsock_uring_test, thus avoiding code copy-pasting.

Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 12329bd5 15-Sep-2023 Stefano Garzarella <sgarzare@redhat.com>

vsock/test: add send_buf() utility function

Move the code of send_byte() out in a new utility function that
can be used to send a generic buffer.

This new function can be used when we need to send a custom
buffer and not just a single 'A' byte.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# a8ed71a2 15-Sep-2023 Stefano Garzarella <sgarzare@redhat.com>

vsock/test: add recv_buf() utility function

Move the code of recv_byte() out in a new utility function that
can be used to receive a generic buffer.

This new function can be used when we need to receive a custom
buffer and not just a single 'A' byte.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 5c338112 10-Jan-2023 Arseniy Krasnov <AVKrasnov@sberdevices.ru>

test/vsock: rework message bounds test

This updates message bound test making it more complex. Instead of
sending 1 bytes messages with one MSG_EOR bit, it sends messages of
random length(one half of messages are smaller than page size, second
half are bigger) with random number of MSG_EOR bits set. Receiver
also don't know total number of messages.

Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>


# 41b792d7 11-Jun-2021 Arseny Krasnov <arseny.krasnov@kaspersky.com>

vsock_test: add SOCK_SEQPACKET tests

Implement two tests of SOCK_SEQPACKET socket: first sends data by
several 'write()'s and checks that number of 'read()' were same.
Second test checks MSG_TRUNC flag. Cases for connect(), bind(),
etc. are not tested, because it is same as for stream socket.

Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 5a2b2425 18-Dec-2019 Stefano Garzarella <sgarzare@redhat.com>

testing/vsock: add parameters to list and skip tests

Some tests can fail with transports that have a slightly
different behavior, so let's add the possibility to specify
which tests to skip.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 770ce007 18-Dec-2019 Stefano Garzarella <sgarzare@redhat.com>

vsock_test: wait for the remote to close the connection

Before check if a send returns -EPIPE, we need to make sure the
connection is closed.
To do that, we use epoll API to wait EPOLLRDHUP or EPOLLHUP events
on the socket.

Reported-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 092f32ae 18-Dec-2019 Stefan Hajnoczi <stefanha@redhat.com>

VSOCK: add send_byte()/recv_byte() test utilities

Test cases will want to transfer data. This patch adds utility
functions to do this.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 2f65b44e 18-Dec-2019 Stefan Hajnoczi <stefanha@redhat.com>

VSOCK: add full barrier between test cases

See code comment for details.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 9bb8a29d 18-Dec-2019 Stefan Hajnoczi <stefanha@redhat.com>

VSOCK: extract connect/accept functions from vsock_diag_test.c

Many test cases will need to connect to the server or accept incoming
connections. This patch extracts these operations into utility
functions that can be reused.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# df7e0e0d 18-Dec-2019 Stefan Hajnoczi <stefanha@redhat.com>

VSOCK: extract utility functions from vsock_diag_test.c

Move useful functions into a separate file in preparation for more
vsock test programs.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>