[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/13] vhost-user-test: added proper TestServer *dest
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/13] vhost-user-test: added proper TestServer *dest initialization in test_migrate() |
Date: |
Tue, 17 Jul 2018 17:06:47 +0200 |
From: Emanuele Giuseppe Esposito <address@hidden>
server->bus in _test_server_free() could be NULL, since TestServer
*dest in test_migrate() was not properly initialized like TestServer *s.
Added init_virtio_dev(dest) and uninit_virtio_dev(dest), so the fields
are properly set and when test_server_free(dest); is called, they can
be correctly freed.
The reason for that is init_virtio_dev() calls qpci_init_pc(), that
creates a QPCIBusPC * (returned as QPCIBus *), while test_server_free()
calls qpci_free_pc(), that frees the QPCIBus *. Not calling
init_virtio_dev() would leave the QPCIBus * of TestServer unset.
Problem came out once I modified pci-pc.c and pci-pc.h, modifying
QPCIBusPC by adding another field before QPCIBus bus. Re-running the
tests showed vhost-user-test failing.
Signed-off-by: Emanuele Giuseppe Esposito <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
tests/vhost-user-test.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 8ff2106..fecc832 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -537,6 +537,7 @@ static gboolean _test_server_free(TestServer *server)
g_free(server->mig_path);
g_free(server->chr_name);
+ g_assert(server->bus);
qpci_free_pc(server->bus);
g_free(server);
@@ -684,6 +685,7 @@ static void test_migrate(void)
g_free(cmd);
init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC);
+ init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC);
wait_for_fds(s);
size = get_log_size(s);
g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8));
@@ -739,6 +741,7 @@ static void test_migrate(void)
read_guest_mem_server(dest);
uninit_virtio_dev(s);
+ uninit_virtio_dev(dest);
g_source_destroy(source);
g_source_unref(source);
--
1.8.3.1
- [Qemu-devel] [PULL 00/13] Misc fixes for QEMU 3.0.0-rc1, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 01/13] dump: add kernel_gs_base to QEMU CPU state, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 03/13] hyperv: rename vcpu_id to vp_index, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 02/13] accel: Fix typo and grammar in comment, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 06/13] PC Chipset: Improve serial divisor calculation, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 05/13] vhost-user-test: added proper TestServer *dest initialization in test_migrate(),
Paolo Bonzini <=
- [Qemu-devel] [PULL 04/13] hyperv: ensure VP index equal to QEMU cpu_index, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 07/13] hw/char/serial: retry write if EAGAIN, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 09/13] virtio-scsi: fix hotplug ->reset() vs event race, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 12/13] opts: remove redundant check for NULL parameter, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 08/13] qdev: add HotplugHandler->post_plug() callback, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 10/13] i386: fix regression parsing multiboot initrd modules, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 11/13] i386: only parse the initrd_filename once for multiboot modules, Paolo Bonzini, 2018/07/17
- [Qemu-devel] [PULL 13/13] Document command line options with single dash, Paolo Bonzini, 2018/07/17
- Re: [Qemu-devel] [PULL 00/13] Misc fixes for QEMU 3.0.0-rc1, Peter Maydell, 2018/07/17