From 669ec429851a6a5987c1752ecf07e77afd77e951 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 9 Jun 2015 09:28:39 +0200 Subject: [PATCH] Add a test for KVM support --- tests/modules/qemu/test_qemu_vm.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/modules/qemu/test_qemu_vm.py b/tests/modules/qemu/test_qemu_vm.py index c150fd60..6b5ab538 100644 --- a/tests/modules/qemu/test_qemu_vm.py +++ b/tests/modules/qemu/test_qemu_vm.py @@ -278,6 +278,17 @@ def test_build_command(vm, loop, fake_qemu_binary, port_manager): ] +def test_build_command_with_kvm(vm, loop, fake_qemu_binary): + + vm.kvm = True + with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process: + cmd = loop.run_until_complete(asyncio.async(vm._build_command())) + if sys.platform.startswith("linux"): + assert "-enable-kvm" in cmd + else: + assert "-enable-kvm" not in cmd + + @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") def test_build_command_without_display(vm, loop, fake_qemu_binary):