qemu/tests/virtio-rng-test.c
Markus Armbruster 0b8fa32f55 Include qemu/module.h where needed, drop it from qemu-common.h
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190523143508.25387-4-armbru@redhat.com>
[Rebased with conflicts resolved automatically, except for
hw/usb/dev-hub.c hw/misc/exynos4210_rng.c hw/misc/bcm2835_rng.c
hw/misc/aspeed_scu.c hw/display/virtio-vga.c hw/arm/stm32f205_soc.c;
ui/cocoa.m fixed up]
2019-06-12 13:18:33 +02:00

39 lines
995 B
C

/*
* QTest testcase for VirtIO RNG
*
* Copyright (c) 2014 SUSE LINUX Products GmbH
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
#include "libqtest.h"
#include "qemu/module.h"
#include "libqos/qgraph.h"
#include "libqos/virtio-rng.h"
#define PCI_SLOT_HP 0x06
static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc)
{
QVirtioPCIDevice *dev = obj;
QTestState *qts = dev->pdev->bus->qts;
const char *arch = qtest_get_arch();
qtest_qmp_device_add("virtio-rng-pci", "rng1",
"{'addr': %s}", stringify(PCI_SLOT_HP));
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
qpci_unplug_acpi_device_test(qts, "rng1", PCI_SLOT_HP);
}
}
static void register_virtio_rng_test(void)
{
qos_add_test("hotplug", "virtio-rng-pci", rng_hotplug, NULL);
}
libqos_init(register_virtio_rng_test);