summaryrefslogtreecommitdiff
path: root/tests/virtio-blk-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-blk-test.c
parenta980f7f2c2f4d7e9a1eba4f804cd66dbd458b6d4 (diff)
downloadqemu-30ca440eec9fe1d7eec5a48addac656438778278.tar.gz
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-blk-test.c')
-rw-r--r--tests/virtio-blk-test.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c
index 2382eb5cc1..f737c406e3 100644
--- a/tests/virtio-blk-test.c
+++ b/tests/virtio-blk-test.c
@@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include "libqtest.h"
#include "libqos/libqos-pc.h"
+#include "libqos/libqos-spapr.h"
#include "libqos/virtio.h"
#include "libqos/virtio-pci.h"
#include "libqos/virtio-mmio.h"
@@ -59,6 +60,7 @@ static char *drive_create(void)
static QOSState *pci_test_start(void)
{
QOSState *qs;
+ const char *arch = qtest_get_arch();
char *tmp_path;
const char *cmd = "-drive if=none,id=drive0,file=%s,format=raw "
"-drive if=none,id=drive1,file=/dev/null,format=raw "
@@ -67,7 +69,14 @@ static QOSState *pci_test_start(void)
tmp_path = drive_create();
- qs = qtest_pc_boot(cmd, tmp_path, PCI_SLOT, PCI_FN);
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ qs = qtest_pc_boot(cmd, tmp_path, PCI_SLOT, PCI_FN);
+ } else if (strcmp(arch, "ppc64") == 0) {
+ qs = qtest_spapr_boot(cmd, tmp_path, PCI_SLOT, PCI_FN);
+ } else {
+ g_printerr("virtio-blk tests are only available on x86 or ppc64\n");
+ exit(EXIT_FAILURE);
+ }
unlink(tmp_path);
g_free(tmp_path);
return qs;
@@ -659,6 +668,7 @@ static void pci_hotplug(void)
{
QVirtioPCIDevice *dev;
QOSState *qs;
+ const char *arch = qtest_get_arch();
qs = pci_test_start();
@@ -672,7 +682,9 @@ static void pci_hotplug(void)
g_free(dev);
/* unplug secondary disk */
- qpci_unplug_acpi_device_test("drv1", PCI_SLOT_HP);
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ qpci_unplug_acpi_device_test("drv1", PCI_SLOT_HP);
+ }
qtest_shutdown(qs);
}
@@ -720,12 +732,15 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
- if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0 ||
+ strcmp(arch, "ppc64") == 0) {
qtest_add_func("/virtio/blk/pci/basic", pci_basic);
qtest_add_func("/virtio/blk/pci/indirect", pci_indirect);
qtest_add_func("/virtio/blk/pci/config", pci_config);
- qtest_add_func("/virtio/blk/pci/msix", pci_msix);
- qtest_add_func("/virtio/blk/pci/idx", pci_idx);
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ qtest_add_func("/virtio/blk/pci/msix", pci_msix);
+ qtest_add_func("/virtio/blk/pci/idx", pci_idx);
+ }
qtest_add_func("/virtio/blk/pci/hotplug", pci_hotplug);
} else if (strcmp(arch, "arm") == 0) {
qtest_add_func("/virtio/blk/mmio/basic", mmio_basic);