]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Properly reset mocked CPU model
authorJiri Denemark <jdenemar@redhat.com>
Tue, 28 Aug 2018 14:04:13 +0000 (16:04 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 4 Sep 2018 08:40:34 +0000 (10:40 +0200)
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@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
tests/testutilsqemu.c

index 8438613f28db1e36764156bb1cb5fa82bc74aa77..70bed461b5130743c43ea5f9d7b139a6c41f4dcb 100644 (file)
@@ -569,12 +569,11 @@ qemuTestSetHostCPU(virCapsPtr caps,
             cpu = cpuPower8;
     }
 
+    unsetenv("VIR_TEST_MOCK_FAKE_HOST_CPU");
     if (cpu) {
         caps->host.arch = cpu->arch;
         if (cpu->model)
             setenv("VIR_TEST_MOCK_FAKE_HOST_CPU", cpu->model, 1);
-        else
-            unsetenv("VIR_TEST_MOCK_FAKE_HOST_CPU");
     }
     caps->host.cpu = cpu;
 }