On 16/06/2021 17.24, Igor Mammedov wrote:
Sometimes it's necessary to execute a test that depends on KVM, however qtest is not aware if tested QEMU binary supports KVM on the host it the test is executed. For an example: test q35 machine with intel_iommu This test will run only is KVM is available and fail to start QEMU if it fallsback to TCG, thus failing whole test. So if test is executed in VM where nested KVM is not enabled or on other than x86 host, it will break 'make check-qtest' Series adds a lightweight qtest_has_kvm() check, which abuses build system and should help to avoid running KVM only tests on hosts that do not support it.
You also might want to update the check in tests/qtest/migration-test.c while you're at it.
PS: there is an alternative 'query-accels' QMP command proposal https://patchwork.kernel.org/project/qemu-devel/patch/20210503211020.894589-3-phi...@redhat.com/ which I think is more robust compared to qtest_has_kvm() and could be extended to take into account machine type.
Could you please get in touch with Philippe directly and discuss which way to go? We certainly don't need two approaches in the end...
Thanks, Thomas