From 738c5bae888cfa72ed359899cf1a41fed9dbb0f5 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 8 Mar 2023 15:29:56 +0100 Subject: [PATCH] domaincapstest: Add testing infrastructure for the '+hvf' variant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Martin Kletzander Reviewed-by: Ján Tomko --- tests/domaincapstest.c | 66 +++++++++++++++++++-------- tests/qemucapabilitiesdata/README.rst | 6 ++- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index a34eb82015..a02197c4ea 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,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 (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, "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 (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; + 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 1f34cac72b..63ad69811f 100644 --- a/tests/qemucapabilitiesdata/README.rst +++ b/tests/qemucapabilitiesdata/README.rst @@ -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 ==============