The original test didn't use family/model numbers to make better
decisions about the CPU model and thus mis-detected the model in the two
cases which are modified in this commit. The detected CPU models now
match those obtained from raw CPUID data.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
Version 3:
- no change
Version 2:
- updated test results to include vendors
tests/cputest.c | 28 +++++++++++++++-------
tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Core-i5-2500-json.xml | 1 +
.../x86_64-cpuid-Core-i5-2540M-json.xml | 1 +
.../x86_64-cpuid-Core-i5-4670T-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Core-i5-6600-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Core-i7-2600-json.xml | 1 +
.../x86_64-cpuid-Core-i7-3740QM-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Core-i7-3770-json.xml | 1 +
.../x86_64-cpuid-Core-i7-4600U-json.xml | 1 +
.../x86_64-cpuid-Core-i7-5600U-json.xml | 12 ++++++----
.../cputestdata/x86_64-cpuid-Core2-E6850-json.xml | 5 ++--
.../cputestdata/x86_64-cpuid-Opteron-2350-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Opteron-6234-json.xml | 1 +
tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Xeon-E5-2630-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Xeon-E5-2650-json.xml | 1 +
.../cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml | 1 +
tests/cputestdata/x86_64-cpuid-Xeon-W3520-json.xml | 1 +
20 files changed, 48 insertions(+), 14 deletions(-)
diff --git a/tests/cputest.c b/tests/cputest.c
index c0a816b60..8c16fb95c 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -43,7 +43,9 @@
#if WITH_QEMU && WITH_YAJL
# include "testutilsqemu.h"
# include "qemumonitortestutils.h"
-# include "qemu/qemu_monitor_json.h"
+# define __QEMU_CAPSRIV_H_ALLOW__
+# include "qemu/qemu_capspriv.h"
+# undef __QEMU_CAPSRIV_H_ALLOW__
#endif
#define VIR_FROM_THIS VIR_FROM_CPU
@@ -517,14 +519,15 @@ static int
cpuTestJSONCPUID(const void *arg)
{
const struct data *data = arg;
- virCPUDataPtr cpuData = NULL;
+ qemuMonitorCPUModelInfoPtr model = NULL;
+ virQEMUCapsPtr qemuCaps = NULL;
virCPUDefPtr cpu = NULL;
qemuMonitorTestPtr testMon = NULL;
char *json = NULL;
char *result = NULL;
int ret = -1;
- if (virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json",
+ if (virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json.new",
abs_srcdir, virArchToString(data->arch), data->host) < 0 ||
virAsprintf(&result, "cpuid-%s-json", data->host) < 0)
goto cleanup;
@@ -532,26 +535,35 @@ cpuTestJSONCPUID(const void *arg)
if (!(testMon = qemuMonitorTestNewFromFile(json, driver.xmlopt, true)))
goto cleanup;
- if (qemuMonitorJSONGetCPUx86Data(qemuMonitorTestGetMonitor(testMon),
- "feature-words", &cpuData) < 0)
+ if (qemuMonitorGetCPUModelExpansion(qemuMonitorTestGetMonitor(testMon),
+ QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC,
+ "host", &model) < 0)
goto cleanup;
+ if (!(qemuCaps = virQEMUCapsNew()))
+ goto cleanup;
+
+ virQEMUCapsSetArch(qemuCaps, data->arch);
+ virQEMUCapsSetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM, model);
+ model = NULL;
+
if (VIR_ALLOC(cpu) < 0)
goto cleanup;
- cpu->arch = cpuData->arch;
+ cpu->arch = data->arch;
cpu->type = VIR_CPU_TYPE_GUEST;
cpu->match = VIR_CPU_MATCH_EXACT;
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
- if (cpuDecode(cpu, cpuData, NULL, 0, NULL) < 0)
+ if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu) != 0)
goto cleanup;
ret = cpuTestCompareXML(data->arch, cpu, result, false);
cleanup:
+ qemuMonitorCPUModelInfoFree(model);
+ virObjectUnref(qemuCaps);
qemuMonitorTestFree(testMon);
- virCPUDataFree(cpuData);
virCPUDefFree(cpu);
VIR_FREE(result);
VIR_FREE(json);
diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml
b/tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml
index 7a38f0fd4..c021fcddf 100644
--- a/tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Opteron_G5</model>
+ <vendor>AMD</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='hypervisor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2500-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i5-2500-json.xml
index 980cf74a0..2e2430e78 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-2500-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2500-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>SandyBridge</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='pcid'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-json.xml
index 980cf74a0..2e2430e78 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>SandyBridge</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='pcid'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-json.xml
index c93688b89..cf23f59d7 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Haswell</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-json.xml
index 171b482c3..e768aa674 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Skylake-Client</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-json.xml
index 27d9f3580..4e721aba4 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>SandyBridge</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='pcid'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-json.xml
index 9adeecc80..03c22de4b 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>IvyBridge</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='pcid'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3770-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i7-3770-json.xml
index a70ae4866..c1544afd3 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-3770-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3770-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>IvyBridge</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='pcid'/>
<feature policy='require' name='hypervisor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-json.xml
index 5fa3146a7..8e4e9d96a 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Haswell-noTSX</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-json.xml
b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-json.xml
index 159797178..be11fa061 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-json.xml
@@ -1,12 +1,16 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
- <model fallback='forbid'>Skylake-Client</model>
+ <model fallback='forbid'>Broadwell</model>
+ <vendor>Intel</vendor>
+ <feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
+ <feature policy='require' name='f16c'/>
+ <feature policy='require' name='rdrand'/>
<feature policy='require' name='hypervisor'/>
+ <feature policy='require' name='arat'/>
<feature policy='require' name='tsc_adjust'/>
+ <feature policy='require' name='xsaveopt'/>
<feature policy='require' name='pdpe1gb'/>
- <feature policy='disable' name='mpx'/>
- <feature policy='disable' name='xsavec'/>
- <feature policy='disable' name='xgetbv1'/>
+ <feature policy='require' name='abm'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Core2-E6850-json.xml
b/tests/cputestdata/x86_64-cpuid-Core2-E6850-json.xml
index ddd730735..8950119a1 100644
--- a/tests/cputestdata/x86_64-cpuid-Core2-E6850-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core2-E6850-json.xml
@@ -1,11 +1,12 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
- <model fallback='forbid'>Penryn</model>
+ <model fallback='forbid'>Conroe</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
+ <feature policy='require' name='cx16'/>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='tsc-deadline'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='tsc_adjust'/>
- <feature policy='disable' name='sse4.1'/>
</cpu>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-json.xml
b/tests/cputestdata/x86_64-cpuid-Opteron-2350-json.xml
index be4cf5c74..302d6562c 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Opteron_G3</model>
+ <vendor>AMD</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='tsc-deadline'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-json.xml
b/tests/cputestdata/x86_64-cpuid-Opteron-6234-json.xml
index 2e28342fd..cc8918661 100644
--- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Opteron_G4</model>
+ <vendor>AMD</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='tsc-deadline'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml
b/tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml
index c1070de74..d4605263b 100644
--- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Opteron_G3</model>
+ <vendor>AMD</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='hypervisor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml
b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml
index 7a8246e5c..e0e060691 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Skylake-Client</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='hypervisor'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-json.xml
b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-json.xml
index 6b4edc389..ec5f56205 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Haswell-noTSX</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='f16c'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-json.xml
b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-json.xml
index 36b7bf20f..6e4aff07a 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Haswell-noTSX</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='vmx'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml
b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml
index ff6ab65d9..cb69ff56f 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>SandyBridge</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='pcid'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-W3520-json.xml
b/tests/cputestdata/x86_64-cpuid-Xeon-W3520-json.xml
index 1aadbf3d2..348bef829 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-W3520-json.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-W3520-json.xml
@@ -1,6 +1,7 @@
<cpu mode='custom' match='exact'>
<arch>x86_64</arch>
<model fallback='forbid'>Nehalem</model>
+ <vendor>Intel</vendor>
<feature policy='require' name='vme'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='x2apic'/>
--
2.11.1