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@xxxxxxxxxx> --- tests/domaincapstest.c | 74 +++++++++++++++++++-------- tests/qemucapabilitiesdata/README.rst | 6 ++- 2 files changed, 57 insertions(+), 23 deletions(-) diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index a34eb82015..21a68e03d2 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -275,6 +275,10 @@ doTestQemuInternal(const char *version, typestr = ""; break; + case VIR_DOMAIN_VIRT_HVF: + typestr = "-hvf"; + break; + default: abort(); break; @@ -317,43 +321,69 @@ 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, "")) - return 0; + if (STRNEQ(variant, "")) { + + if (STREQ(variant, "+hvf")) + hvf = true; + else + 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: * diff --git a/tests/qemucapabilitiesdata/README.rst b/tests/qemucapabilitiesdata/README.rst index 749d59becf..30e5c3726a 100644 --- a/tests/qemucapabilitiesdata/README.rst +++ b/tests/qemucapabilitiesdata/README.rst @@ -45,7 +45,11 @@ Files in this directory have the following naming scheme:: 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 ============== -- 2.39.2