The only case where the hardware capabilities influence the result
is when no <gic/> element was provided.

The test programs now ensure both that the correct GIC version is
picked in that case, and that hardware capabilities are not taken
into account when the user has already picked a GIC version.
---
 .../qemuxml2argv-aarch64-gic-none-both.args        |  1 +
 .../qemuxml2argv-aarch64-gic-none-both.xml         |  1 +
 .../qemuxml2argv-aarch64-gic-none-v2.args          |  1 +
 .../qemuxml2argv-aarch64-gic-none-v2.xml           |  1 +
 .../qemuxml2argv-aarch64-gic-none-v3.args          |  1 +
 .../qemuxml2argv-aarch64-gic-none-v3.xml           |  1 +
 tests/qemuxml2argvtest.c                           | 76 ++++++++++++++++++----
 .../qemuxml2xmlout-aarch64-gic-none-both.xml       |  1 +
 .../qemuxml2xmlout-aarch64-gic-none-v2.xml         |  1 +
 .../qemuxml2xmlout-aarch64-gic-none-v3.xml         |  1 +
 tests/qemuxml2xmltest.c                            | 25 +++++--
 11 files changed, 91 insertions(+), 19 deletions(-)
 create mode 120000 
tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-both.args
 create mode 120000 
tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-both.xml
 create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v2.args
 create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v2.xml
 create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v3.args
 create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v3.xml
 create mode 120000 
tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-both.xml
 create mode 120000 
tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-v2.xml
 create mode 120000 
tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-v3.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-both.args 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-both.args
new file mode 120000
index 0000000..5b20f61
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-both.args
@@ -0,0 +1 @@
+qemuxml2argv-aarch64-gic-v3.args
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-both.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-both.xml
new file mode 120000
index 0000000..d859f53
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-both.xml
@@ -0,0 +1 @@
+qemuxml2argv-aarch64-gic-none.xml
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v2.args 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v2.args
new file mode 120000
index 0000000..3234039
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v2.args
@@ -0,0 +1 @@
+qemuxml2argv-aarch64-gic-v2.args
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v2.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v2.xml
new file mode 120000
index 0000000..d859f53
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v2.xml
@@ -0,0 +1 @@
+qemuxml2argv-aarch64-gic-none.xml
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v3.args 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v3.args
new file mode 120000
index 0000000..5b20f61
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v3.args
@@ -0,0 +1 @@
+qemuxml2argv-aarch64-gic-v3.args
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v3.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v3.xml
new file mode 120000
index 0000000..88c660c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-none-v3.xml
@@ -0,0 +1 @@
+qemuxml2argv-aarch64-gic-none-v2.xml
\ No newline at end of file
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 6b804b8..734861d 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -540,6 +540,9 @@ mymain(void)
 # define DO_TEST(name, ...)                                             \
     DO_TEST_FULL(name, NULL, -1, 0, 0, GIC_NONE, __VA_ARGS__)
 
+# define DO_TEST_GIC(name, gic, ...)                                    \
+    DO_TEST_FULL(name, NULL, -1, 0, 0, gic, __VA_ARGS__)
+
 # define DO_TEST_FAILURE(name, ...)                                     \
     DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE,                   \
                  0, GIC_NONE, __VA_ARGS__)
@@ -1740,38 +1743,83 @@ mymain(void)
     DO_TEST("aarch64-cpu-passthrough",
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_CPU_HOST, QEMU_CAPS_KVM);
-    DO_TEST("aarch64-gic-none",
+    DO_TEST_GIC("aarch64-gic-none", GIC_NONE,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
+    DO_TEST_GIC("aarch64-gic-none", GIC_NONE,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_MACH_VIRT_GIC_VERSION);
-    DO_TEST("aarch64-gic-none",
-            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
-    DO_TEST("aarch64-gic-default",
+    DO_TEST_GIC("aarch64-gic-none-v2", GIC_V2,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-none-v3", GIC_V3,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_MACH_VIRT_GIC_VERSION);
-    DO_TEST("aarch64-gic-default",
+    DO_TEST_GIC("aarch64-gic-none-both", GIC_BOTH,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-default", GIC_NONE,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
-    DO_TEST("aarch64-gic-v2",
+    DO_TEST_GIC("aarch64-gic-default", GIC_NONE,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-default", GIC_V2,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_MACH_VIRT_GIC_VERSION);
-    DO_TEST("aarch64-gic-v2",
+    DO_TEST_GIC("aarch64-gic-default", GIC_V3,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-default", GIC_BOTH,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-v2", GIC_NONE,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
-    DO_TEST("aarch64-gic-v3",
+    DO_TEST_GIC("aarch64-gic-v2", GIC_NONE,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-v2", GIC_V2,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-v2", GIC_V3,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_MACH_VIRT_GIC_VERSION);
-    DO_TEST_FAILURE("aarch64-gic-v3",
+    DO_TEST_GIC("aarch64-gic-v2", GIC_BOTH,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_FAILURE("aarch64-gic-v3", GIC_NONE,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
-    DO_TEST("aarch64-gic-host",
+    DO_TEST_GIC("aarch64-gic-v3", GIC_NONE,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-v3", GIC_V2,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-v3", GIC_V3,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-v3", GIC_BOTH,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_MACH_VIRT_GIC_VERSION);
-    DO_TEST_FAILURE("aarch64-gic-host",
+    DO_TEST_FAILURE("aarch64-gic-host", GIC_NONE,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST);
-    DO_TEST_PARSE_ERROR("aarch64-gic-invalid",
+    DO_TEST_GIC("aarch64-gic-host", GIC_NONE,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-host", GIC_V2,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-host", GIC_V3,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_GIC("aarch64-gic-host", GIC_BOTH,
+            QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
+            QEMU_CAPS_MACH_VIRT_GIC_VERSION);
+    DO_TEST_PARSE_ERROR("aarch64-gic-invalid", GIC_NONE,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_MACH_VIRT_GIC_VERSION);
-    DO_TEST_FAILURE("aarch64-gic-not-virt",
+    DO_TEST_FAILURE("aarch64-gic-not-virt", GIC_NONE,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_MACH_VIRT_GIC_VERSION);
-    DO_TEST_FAILURE("aarch64-gic-not-arm",
+    DO_TEST_FAILURE("aarch64-gic-not-arm", GIC_NONE,
             QEMU_CAPS_KVM, QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_CPU_HOST,
             QEMU_CAPS_MACH_VIRT_GIC_VERSION);
 
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-both.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-both.xml
new file mode 120000
index 0000000..f586fa1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-both.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-v2.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-v2.xml
new file mode 120000
index 0000000..80a01c2
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-v2.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-v3.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-v3.xml
new file mode 120000
index 0000000..f586fa1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-gic-none-v3.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 9d2109b..404cd10 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -775,11 +775,26 @@ mymain(void)
             QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VIRTIO_SCSI);
 
-    DO_TEST("aarch64-gic-none");
-    DO_TEST("aarch64-gic-default");
-    DO_TEST("aarch64-gic-v2");
-    DO_TEST("aarch64-gic-v3");
-    DO_TEST("aarch64-gic-host");
+    DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, GIC_NONE, NONE);
+    DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, GIC_V2, NONE);
+    DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, GIC_V3, NONE);
+    DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, GIC_BOTH, NONE);
+    DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_NONE, NONE);
+    DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_V2, NONE);
+    DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_V3, NONE);
+    DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_BOTH, NONE);
+    DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_NONE, NONE);
+    DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V2, NONE);
+    DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V3, NONE);
+    DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_BOTH, NONE);
+    DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_NONE, NONE);
+    DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V2, NONE);
+    DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V3, NONE);
+    DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_BOTH, NONE);
+    DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_NONE, NONE);
+    DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V2, NONE);
+    DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V3, NONE);
+    DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_BOTH, NONE);
 
     DO_TEST("memory-hotplug");
     DO_TEST("memory-hotplug-nonuma");
-- 
2.5.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to