diff options
author | Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com> | 2018-07-26 11:24:50 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-03-07 17:28:27 +0100 |
commit | a25f56aebec807c9c8f9c7c8c13d59ff4431773a (patch) | |
tree | 1ebbfdfaff88cec498d65f9bc418c7ea470e016e /tests/virtio-rng-test.c | |
parent | d3d400d3df0146575a8af44382978f404d57def9 (diff) |
qos-test: virtio-rng test node
Convert tests/virtio-rng-test in qgraph test node,
virtio-rng-test. This test consumes a virtio-rng interface
and checks that its function return the expected values.
Some functions are implemented only for virtio-rng-pci, so they
don't consume virtio-rng, but virtio-rng-pci
Note that this test does not allocate any virtio-rng structure,
it's all done by the qtest walking graph mechanism
Signed-off-by: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/virtio-rng-test.c')
-rw-r--r-- | tests/virtio-rng-test.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/tests/virtio-rng-test.c b/tests/virtio-rng-test.c index 657d9a4105..5309c7c8ab 100644 --- a/tests/virtio-rng-test.c +++ b/tests/virtio-rng-test.c @@ -9,16 +9,12 @@ #include "qemu/osdep.h" #include "libqtest.h" -#include "libqos/pci.h" +#include "libqos/qgraph.h" +#include "libqos/virtio-rng.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) +static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc) { const char *arch = qtest_get_arch(); @@ -30,18 +26,9 @@ static void hotplug(void) } } -int main(int argc, char **argv) +static void register_virtio_rng_test(void) { - int ret; - - g_test_init(&argc, &argv, NULL); - qtest_add_func("/virtio/rng/pci/nop", pci_nop); - qtest_add_func("/virtio/rng/pci/hotplug", hotplug); - - qtest_start("-device virtio-rng-pci"); - ret = g_test_run(); - - qtest_end(); - - return ret; + qos_add_test("hotplug", "virtio-rng-pci", rng_hotplug, NULL); } + +libqos_init(register_virtio_rng_test); |