]>
Commit | Line | Data |
---|---|---|
b6f46f02 AF |
1 | /* |
2 | * QTest testcase for VirtIO RNG | |
3 | * | |
4 | * Copyright (c) 2014 SUSE LINUX Products GmbH | |
5 | * | |
6 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | |
7 | * See the COPYING file in the top-level directory. | |
8 | */ | |
9 | ||
681c28a3 | 10 | #include "qemu/osdep.h" |
b6f46f02 | 11 | #include "libqtest.h" |
a25f56ae EGE |
12 | #include "libqos/qgraph.h" |
13 | #include "libqos/virtio-rng.h" | |
d1f3fc24 IM |
14 | |
15 | #define PCI_SLOT_HP 0x06 | |
b6f46f02 | 16 | |
a25f56ae | 17 | static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc) |
d1f3fc24 | 18 | { |
30ca440e LV |
19 | const char *arch = qtest_get_arch(); |
20 | ||
82cab70b MA |
21 | qtest_qmp_device_add("virtio-rng-pci", "rng1", |
22 | "{'addr': %s}", stringify(PCI_SLOT_HP)); | |
30ca440e LV |
23 | |
24 | if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { | |
25 | qpci_unplug_acpi_device_test("rng1", PCI_SLOT_HP); | |
26 | } | |
d1f3fc24 IM |
27 | } |
28 | ||
a25f56ae | 29 | static void register_virtio_rng_test(void) |
b6f46f02 | 30 | { |
a25f56ae | 31 | qos_add_test("hotplug", "virtio-rng-pci", rng_hotplug, NULL); |
b6f46f02 | 32 | } |
a25f56ae EGE |
33 | |
34 | libqos_init(register_virtio_rng_test); |