From e1468c04aa4b0c19e6e7d3b893de78c1c00575bc Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Mon, 9 Sep 2024 18:04:23 +0200 Subject: [PATCH] tests: Add testDomainCapabilitiesLoongArch64() Inspired by the x86_64 counterpart. Signed-off-by: Andrea Bolognani --- tests/test_capabilities.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_capabilities.py b/tests/test_capabilities.py index c85942e1e..1ebd564d4 100644 --- a/tests/test_capabilities.py +++ b/tests/test_capabilities.py @@ -167,3 +167,33 @@ def testDomainCapabilitiesRISCV64(): assert caps.supports_memorybacking_memfd() assert caps.supports_redirdev_usb() assert caps.supports_channel_spicevmc() + + +def testDomainCapabilitiesLoongArch64(): + xml = open(DATADIR + "/kvm-loongarch64-domcaps.xml").read() + caps = DomainCapabilities(utils.URIs.open_testdriver_cached(), xml) + + host_mode = caps.cpu.get_mode("host-passthrough") + assert bool(host_mode) + assert host_mode.supported + max_mode = caps.cpu.get_mode("maximum") + assert bool(max_mode) + assert max_mode.supported + custom_mode = caps.cpu.get_mode("custom") + assert bool(custom_mode) + cpu_model = custom_mode.get_model("la132") + assert bool(cpu_model) + assert cpu_model.usable + + models = caps.get_cpu_models() + assert len(models) > 2 + assert "la464" in models + + assert "Default" in caps.label_for_firmware_path(None) + assert "Custom:" in caps.label_for_firmware_path("/foobar") + assert "UEFI" in caps.label_for_firmware_path("loongarch64/QEMU_CODE.fd") + + assert caps.supports_filesystem_virtiofs() + assert caps.supports_memorybacking_memfd() + assert caps.supports_redirdev_usb() + assert caps.supports_channel_spicevmc()