tests: virtio-net: Check if hot-plug/unplug works

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Igor Mammedov 2014-09-26 09:28:10 +00:00 committed by Andreas Färber
parent d1f3fc24f8
commit 9224709b7b
2 changed files with 11 additions and 1 deletions

View file

@ -11,18 +11,28 @@
#include <string.h>
#include "libqtest.h"
#include "qemu/osdep.h"
#include "libqos/pci.h"
#define PCI_SLOT_HP 0x06
/* Tests only initialization so far. TODO: Replace with functional tests */
static void pci_nop(void)
{
}
static void hotplug(void)
{
qpci_plug_device_test("virtio-net-pci", "net1", PCI_SLOT_HP, NULL);
qpci_unplug_acpi_device_test("net1", PCI_SLOT_HP);
}
int main(int argc, char **argv)
{
int ret;
g_test_init(&argc, &argv, NULL);
qtest_add_func("/virtio/net/pci/nop", pci_nop);
qtest_add_func("/virtio/net/pci/hotplug", hotplug);
qtest_start("-device virtio-net-pci");
ret = g_test_run();