aboutsummaryrefslogtreecommitdiff
path: root/tests/vhost-user-test.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-02-01 14:27:56 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-02-07 14:09:25 +0100
commit83265145a4f42a38f10bad0051e3a8229f19c166 (patch)
tree73d83fa969befb1e6ccf267ba1387eba37b50fd5 /tests/vhost-user-test.c
parent7a9ec6541be5a3e70e9760811601454a92e0f4bb (diff)
downloadqemu-83265145a4f42a38f10bad0051e3a8229f19c166.zip
qemu-83265145a4f42a38f10bad0051e3a8229f19c166.tar.gz
qemu-83265145a4f42a38f10bad0051e3a8229f19c166.tar.bz2
vhost-user-test: make read-guest-mem setup its own qemu
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180201132757.23063-7-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/vhost-user-test.c')
-rw-r--r--tests/vhost-user-test.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 713ff5c..a22075f 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -48,6 +48,14 @@
#define QEMU_CMD QEMU_CMD_MEM QEMU_CMD_CHR \
QEMU_CMD_NETDEV QEMU_CMD_NET
+#define GET_QEMU_CMD(s) \
+ g_strdup_printf(QEMU_CMD, 512, 512, (root), (s)->chr_name, \
+ (s)->socket_path, "", (s)->chr_name)
+
+#define GET_QEMU_CMDE(s, mem, chr_opts, extra, ...) \
+ g_strdup_printf(QEMU_CMD extra, (mem), (mem), (root), (s)->chr_name, \
+ (s)->socket_path, (chr_opts), (s)->chr_name, ##__VA_ARGS__)
+
#define HUGETLBFS_MAGIC 0x958458f6
/*********** FROM hw/virtio/vhost-user.c *************************************/
@@ -159,6 +167,10 @@ typedef struct TestServer {
QGuestAllocator *alloc;
} TestServer;
+static TestServer *test_server_new(const gchar *name);
+static void test_server_free(TestServer *server);
+static void test_server_listen(TestServer *server);
+
static const char *tmpfs;
static const char *root;
@@ -225,9 +237,8 @@ static void wait_for_fds(TestServer *s)
g_mutex_unlock(&s->data_mutex);
}
-static void read_guest_mem(const void *data)
+static void read_guest_mem_server(TestServer *s)
{
- TestServer *s = (void *)data;
uint32_t *guest_mem;
int i, j;
size_t size;
@@ -492,14 +503,6 @@ static void test_server_listen(TestServer *server)
test_server_create_chr(server, ",server,nowait");
}
-#define GET_QEMU_CMD(s) \
- g_strdup_printf(QEMU_CMD, 512, 512, (root), (s)->chr_name, \
- (s)->socket_path, "", (s)->chr_name)
-
-#define GET_QEMU_CMDE(s, mem, chr_opts, extra, ...) \
- g_strdup_printf(QEMU_CMD extra, (mem), (mem), (root), (s)->chr_name, \
- (s)->socket_path, (chr_opts), (s)->chr_name, ##__VA_ARGS__)
-
static gboolean _test_server_free(TestServer *server)
{
int i;
@@ -652,7 +655,7 @@ static void test_read_guest_mem(void)
init_virtio_dev(server, 1u << VIRTIO_NET_F_MAC);
- read_guest_mem(server);
+ read_guest_mem_server(server);
uninit_virtio_dev(server);
@@ -730,7 +733,7 @@ static void test_migrate(void)
global_qtest = to;
qmp_eventwait("RESUME");
- read_guest_mem(dest);
+ read_guest_mem_server(dest);
uninit_virtio_dev(s);