]> xenbits.xensource.com Git - libvirt.git/commitdiff
domaincapstest: Add testing infrastructure for the '+hvf' variant
authorPeter Krempa <pkrempa@redhat.com>
Wed, 8 Mar 2023 14:29:56 +0000 (15:29 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 3 Apr 2023 07:19:06 +0000 (09:19 +0200)
Allow testing of capabilities of OSX systems with the hvf accelerator.

'domaincapstest' requires special handling as we need to set
VIR_DOMAIN_VIRT_HVF virt type in such case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/domaincapstest.c
tests/qemucapabilitiesdata/README.rst

index a34eb820155ae3cfe98a62f2bbcc47872af3ccee..a02197c4ea0e1ffcb396e89918d4a5f6f85b9ffd 100644 (file)
@@ -275,6 +275,10 @@ doTestQemuInternal(const char *version,
         typestr = "";
         break;
 
+    case VIR_DOMAIN_VIRT_HVF:
+        typestr = "-hvf";
+        break;
+
     default:
         abort();
         break;
@@ -317,43 +321,65 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
            const char *suffix G_GNUC_UNUSED,
            void *opaque)
 {
+    bool hvf = false;
     int ret = 0;
 
-    /* currently variant tests are not handled here */
-    if (STRNEQ(variant, ""))
+    if (STREQ(variant, "+hvf"))
+        hvf = true;
+    else if (STREQ(variant, ""))
         return 0;
 
     if (STREQ(arch, "x86_64")) {
-        /* For x86_64 we test three combinations:
+        /* For x86_64 based on the test variant we test:
+         *
+         *   '' (default) variant (KVM):
+         *      - KVM with default machine
+         *      - KVM with Q35 machine
+         *  '+hvf' variant:
+         *      - hvf with default machine
          *
-         *   - KVM with default machine
-         *   - KVM with Q35 machine
          *   - TCG with default machine
          */
-        if (doTestQemuInternal(version, NULL, arch, variant,
-                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
-            ret = -1;
-
-        if (doTestQemuInternal(version, "q35", arch, variant,
-                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
-            ret = -1;
+        if (hvf) {
+            if (doTestQemuInternal(version, NULL, arch, variant,
+                                   VIR_DOMAIN_VIRT_HVF, opaque) < 0)
+                ret = -1;
+        } else {
+            if (doTestQemuInternal(version, NULL, arch, variant,
+                                   VIR_DOMAIN_VIRT_KVM, opaque) < 0)
+                ret = -1;
+
+            if (doTestQemuInternal(version, "q35", arch, variant,
+                                   VIR_DOMAIN_VIRT_KVM, opaque) < 0)
+                ret = -1;
+        }
 
         if (doTestQemuInternal(version, NULL, arch, variant,
                                VIR_DOMAIN_VIRT_QEMU, opaque) < 0)
             ret = -1;
     } else if (STREQ(arch, "aarch64")) {
-        /* For aarch64 we test two combinations:
+        /* For aarch64 based on the test variant we test:
          *
-         *   - KVM with default machine
-         *   - KVM with virt machine
+         *   '' (default) variant (KVM):
+         *      - KVM with default machine
+         *      - KVM with virt machine
+         *
+         *  '+hvf' variant:
+         *    - hvf with default machine
          */
-        if (doTestQemuInternal(version, NULL, arch, variant,
-                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
-            ret = -1;
-
-        if (doTestQemuInternal(version, "virt", arch, variant,
-                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
-            ret = -1;
+        if (hvf) {
+            if (doTestQemuInternal(version, NULL, arch, variant,
+                                   VIR_DOMAIN_VIRT_HVF, opaque) < 0)
+                ret = -1;
+        } else {
+            if (doTestQemuInternal(version, NULL, arch, variant,
+                                   VIR_DOMAIN_VIRT_KVM, opaque) < 0)
+                ret = -1;
+
+            if (doTestQemuInternal(version, "virt", arch, variant,
+                                   VIR_DOMAIN_VIRT_KVM, opaque) < 0)
+                ret = -1;
+        }
     } else if (STRPREFIX(arch, "riscv")) {
         /* For riscv64 we test two combinations:
          *
index 1f34cac72bffd0d71bf9ad25edc03101870ed8a0..63ad69811fe8f0c471c8a00388ca97eee7618e3e 100644 (file)
@@ -52,7 +52,11 @@ or::
 Known test variants
 -------------------
 
-This section will contain a list of variants that are used in the test suite.
+``+hvf``
+
+  Variant of the test data using the Apple OSX Hypervisor Framework acceleration
+  for qemu.
+
 
 Usage in tests
 ==============