[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 58/88] tests/qtest/vhost-user-test: add a test case for memory-
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 58/88] tests/qtest/vhost-user-test: add a test case for memory-backend-shm |
Date: |
Tue, 2 Jul 2024 16:19:02 -0400 |
From: Stefano Garzarella <sgarzare@redhat.com>
`memory-backend-shm` can be used with vhost-user devices, so let's
add a new test case for it.
Acked-by: Thomas Huth <thuth@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20240618100534.145917-1-sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
tests/qtest/vhost-user-test.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
index 255bde54ab..0fa8951c9f 100644
--- a/tests/qtest/vhost-user-test.c
+++ b/tests/qtest/vhost-user-test.c
@@ -44,6 +44,8 @@
"mem-path=%s,share=on -numa node,memdev=mem"
#define QEMU_CMD_MEMFD " -m %d -object memory-backend-memfd,id=mem,size=%dM,"
\
" -numa node,memdev=mem"
+#define QEMU_CMD_SHM " -m %d -object memory-backend-shm,id=mem,size=%dM," \
+ " -numa node,memdev=mem"
#define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s"
#define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s,vhostforce=on"
@@ -195,6 +197,7 @@ enum test_memfd {
TEST_MEMFD_AUTO,
TEST_MEMFD_YES,
TEST_MEMFD_NO,
+ TEST_MEMFD_SHM,
};
static void append_vhost_net_opts(TestServer *s, GString *cmd_line,
@@ -228,6 +231,8 @@ static void append_mem_opts(TestServer *server, GString
*cmd_line,
if (memfd == TEST_MEMFD_YES) {
g_string_append_printf(cmd_line, QEMU_CMD_MEMFD, size, size);
+ } else if (memfd == TEST_MEMFD_SHM) {
+ g_string_append_printf(cmd_line, QEMU_CMD_SHM, size, size);
} else {
const char *root = init_hugepagefs() ? : server->tmpfs;
@@ -791,6 +796,19 @@ static void *vhost_user_test_setup_memfd(GString
*cmd_line, void *arg)
return server;
}
+static void *vhost_user_test_setup_shm(GString *cmd_line, void *arg)
+{
+ TestServer *server = test_server_new("vhost-user-test", arg);
+ test_server_listen(server);
+
+ append_mem_opts(server, cmd_line, 256, TEST_MEMFD_SHM);
+ server->vu_ops->append_opts(server, cmd_line, "");
+
+ g_test_queue_destroy(vhost_user_test_cleanup, server);
+
+ return server;
+}
+
static void test_read_guest_mem(void *obj, void *arg, QGuestAllocator *alloc)
{
TestServer *server = arg;
@@ -1084,6 +1102,11 @@ static void register_vhost_user_test(void)
"virtio-net",
test_read_guest_mem, &opts);
+ opts.before = vhost_user_test_setup_shm;
+ qos_add_test("vhost-user/read-guest-mem/shm",
+ "virtio-net",
+ test_read_guest_mem, &opts);
+
if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
opts.before = vhost_user_test_setup_memfd;
qos_add_test("vhost-user/read-guest-mem/memfd",
--
MST
- [PULL v2 47/88] libvhost-user: set msg.msg_control to NULL when it is empty, (continued)
- [PULL v2 47/88] libvhost-user: set msg.msg_control to NULL when it is empty, Michael S. Tsirkin, 2024/07/02
- [PULL v2 52/88] contrib/vhost-user-*: use QEMU bswap helper functions, Michael S. Tsirkin, 2024/07/02
- [PULL v2 49/88] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported, Michael S. Tsirkin, 2024/07/02
- [PULL v2 45/88] hw/net/virtio-net.c: fix crash in iov_copy(), Michael S. Tsirkin, 2024/07/02
- [PULL v2 53/88] vhost-user: enable frontends on any POSIX system, Michael S. Tsirkin, 2024/07/02
- [PULL v2 54/88] libvhost-user: enable it on any POSIX system, Michael S. Tsirkin, 2024/07/02
- [PULL v2 55/88] contrib/vhost-user-blk: enable it on any POSIX system, Michael S. Tsirkin, 2024/07/02
- [PULL v2 57/88] tests/qtest/vhost-user-blk-test: use memory-backend-shm, Michael S. Tsirkin, 2024/07/02
- [PULL v2 51/88] contrib/vhost-user-blk: fix bind() using the right size of the address, Michael S. Tsirkin, 2024/07/02
- [PULL v2 56/88] hostmem: add a new memory backend based on POSIX shm_open(), Michael S. Tsirkin, 2024/07/02
- [PULL v2 58/88] tests/qtest/vhost-user-test: add a test case for memory-backend-shm,
Michael S. Tsirkin <=
- [PULL v2 59/88] hw/virtio: Fix the de-initialization of vhost-user devices, Michael S. Tsirkin, 2024/07/02
- [PULL v2 60/88] hw/arm/virt-acpi-build: Drop local iort_node_offset, Michael S. Tsirkin, 2024/07/02
- [PULL v2 61/88] hw/i386/fw_cfg: Add etc/e820 to fw_cfg late, Michael S. Tsirkin, 2024/07/02
- [PULL v2 62/88] hw/arm/virt-acpi-build: Fix id_count in build_iort_id_mapping, Michael S. Tsirkin, 2024/07/02
- [PULL v2 63/88] uefi-test-tools/UefiTestToolsPkg: Add RISC-V support, Michael S. Tsirkin, 2024/07/02
- [PULL v2 64/88] uefi-test-tools: Add support for python based build script, Michael S. Tsirkin, 2024/07/02
- [PULL v2 66/88] qtest: bios-tables-test: Rename aarch64 tests with aarch64 in them, Michael S. Tsirkin, 2024/07/02
- [PULL v2 65/88] tests/data/uefi-boot-images: Add RISC-V ISO image, Michael S. Tsirkin, 2024/07/02
- [PULL v2 67/88] tests/qtest/bios-tables-test.c: Add support for arch in path, Michael S. Tsirkin, 2024/07/02
- [PULL v2 68/88] tests/qtest/bios-tables-test.c: Set "arch" for aarch64 tests, Michael S. Tsirkin, 2024/07/02