aboutsummaryrefslogtreecommitdiff
path: root/tests/virtio-net-test.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-10-17 12:30:24 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2016-10-28 09:36:58 +1100
commit30ca440eec9fe1d7eec5a48addac656438778278 (patch)
tree68e20f4d2ffa59169c9597ee0e1fac8b6d4a210e /tests/virtio-net-test.c
parenta980f7f2c2f4d7e9a1eba4f804cd66dbd458b6d4 (diff)
tests: enable virtio tests on SPAPR
but disable MSI-X tests on SPAPR as we can't check the result (the memory region used on PC is not readable on SPAPR). Signed-off-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/virtio-net-test.c')
-rw-r--r--tests/virtio-net-test.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
index 6bec784f81..8f94360480 100644
--- a/tests/virtio-net-test.c
+++ b/tests/virtio-net-test.c
@@ -13,6 +13,7 @@
#include "qemu/sockets.h"
#include "qemu/iov.h"
#include "libqos/libqos-pc.h"
+#include "libqos/libqos-spapr.h"
#include "libqos/virtio.h"
#include "libqos/virtio-pci.h"
#include "qemu/bswap.h"
@@ -52,10 +53,18 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)
static QOSState *pci_test_start(int socket)
{
+ const char *arch = qtest_get_arch();
const char *cmd = "-netdev socket,fd=%d,id=hs0 -device "
"virtio-net-pci,netdev=hs0";
- return qtest_pc_boot(cmd, socket);
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ return qtest_pc_boot(cmd, socket);
+ }
+ if (strcmp(arch, "ppc64") == 0) {
+ return qtest_spapr_boot(cmd, socket);
+ }
+ g_printerr("virtio-net tests are only available on x86 or ppc64\n");
+ exit(EXIT_FAILURE);
}
static void driver_init(QVirtioDevice *dev)
@@ -232,10 +241,15 @@ static void pci_basic(gconstpointer data)
static void hotplug(void)
{
+ const char *arch = qtest_get_arch();
+
qtest_start("-device virtio-net-pci");
qpci_plug_device_test("virtio-net-pci", "net1", PCI_SLOT_HP, NULL);
- qpci_unplug_acpi_device_test("net1", PCI_SLOT_HP);
+
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ qpci_unplug_acpi_device_test("net1", PCI_SLOT_HP);
+ }
test_end();
}