OSDN Git Service

vhost-user-test: added proper TestServer *dest initialization in test_migrate()
authorEmanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
Tue, 26 Jun 2018 14:18:53 +0000 (16:18 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 16 Jul 2018 14:58:16 +0000 (16:58 +0200)
commit9ee8a692f1da77d798842fdc1e0dc2a5ff0fc0c1
tree30eca24cf9b6ff644a2dc4a628663f9089eff566
parente9688fabc32b532c9a93794c37e343facd5ecd36
vhost-user-test: added proper TestServer *dest initialization in test_migrate()

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 <e.emanuelegiuseppe@gmail.com>
Message-Id: <1530022733-29581-1-git-send-email-esposem@usi.ch>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tests/vhost-user-test.c