[libvirt] [PATCH] tests: Properly reset mocked CPU model

Jiri Denemark jdenemar at redhat.com
Tue Aug 28 14:17:30 UTC 2018


When switching the host architecture to something for which we do not
have any host CPU model defined, the mocked
virQEMUCapsProbeHostCPUForEmulator would just return the previous CPU
model resulting in strange combinations, such as "core2duo" host CPU
model in QEMU capabilities for "AArch64" architecture. It currently
doesn't break any test case, but we should fix it anyway to avoid future
surprises which would be quite hard to debug.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 tests/testutilsqemu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 8438613f28..52ea6bf655 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -575,6 +575,8 @@ qemuTestSetHostCPU(virCapsPtr caps,
             setenv("VIR_TEST_MOCK_FAKE_HOST_CPU", cpu->model, 1);
         else
             unsetenv("VIR_TEST_MOCK_FAKE_HOST_CPU");
+    } else {
+        unsetenv("VIR_TEST_MOCK_FAKE_HOST_CPU");
     }
     caps->host.cpu = cpu;
 }
-- 
2.18.0




More information about the libvir-list mailing list