2014-02-09 04:43:10 +01:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2016-02-08 19:08:51 +01:00
|
|
|
#include "qemu/osdep.h"
|
2014-02-09 04:43:10 +01:00
|
|
|
#include "libqtest.h"
|
2018-07-26 11:24:50 +02:00
|
|
|
#include "libqos/qgraph.h"
|
|
|
|
#include "libqos/virtio-rng.h"
|
2014-09-26 11:28:09 +02:00
|
|
|
|
|
|
|
#define PCI_SLOT_HP 0x06
|
2014-02-09 04:43:10 +01:00
|
|
|
|
2018-07-26 11:24:50 +02:00
|
|
|
static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc)
|
2014-09-26 11:28:09 +02:00
|
|
|
{
|
2016-10-17 12:30:24 +02:00
|
|
|
const char *arch = qtest_get_arch();
|
|
|
|
|
2018-08-06 08:53:35 +02:00
|
|
|
qtest_qmp_device_add("virtio-rng-pci", "rng1",
|
|
|
|
"{'addr': %s}", stringify(PCI_SLOT_HP));
|
2016-10-17 12:30:24 +02:00
|
|
|
|
|
|
|
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
|
|
|
|
qpci_unplug_acpi_device_test("rng1", PCI_SLOT_HP);
|
|
|
|
}
|
2014-09-26 11:28:09 +02:00
|
|
|
}
|
|
|
|
|
2018-07-26 11:24:50 +02:00
|
|
|
static void register_virtio_rng_test(void)
|
2014-02-09 04:43:10 +01:00
|
|
|
{
|
2018-07-26 11:24:50 +02:00
|
|
|
qos_add_test("hotplug", "virtio-rng-pci", rng_hotplug, NULL);
|
2014-02-09 04:43:10 +01:00
|
|
|
}
|
2018-07-26 11:24:50 +02:00
|
|
|
|
|
|
|
libqos_init(register_virtio_rng_test);
|