mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
cputest: Don't test cpuGuestData
The API is no longer used anywhere else since it was replaced by a much saner work flow utilizing new APIs that work on virCPUDefPtr directly: virCPUCompare, virCPUUpdate, and virCPUTranslate. Not testing the new work flow caused some bugs to be hidden. This patch reveals them, but doesn't attempt to fix them. To make sure all test still pass after this patch, all affected test results are modified to pretend the tests succeeded. All of the bugs will be fixed in the following commits and the artificial modifications will be reverted. The following is the list of bugs in the new CPU model work flow: - a guest CPU with mode='custom' and missing <vendor/> gets the vendor copied from host's CPU (the vendor should only be copied to host-model CPUs): DO_TEST_UPDATE("x86", "host", "min", VIR_CPU_COMPARE_IDENTICAL) DO_TEST_UPDATE("x86", "host", "pentium3", VIR_CPU_COMPARE_IDENTICAL) DO_TEST_GUESTCPU("x86", "host-better", "pentium3", NULL, 0) - when a guest CPU with mode='custom' needs to be translated into another model because the original model is not supported by a hypervisor, the result will have its vendor set to the vendor of the original CPU model as specified in cpu_map.xml even if the original guest CPU XML didn't contain <vendor/>: DO_TEST_GUESTCPU("x86", "host", "guest", model486, 0) DO_TEST_GUESTCPU("x86", "host", "guest", models, 0) DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, 0) - legacy POWERx_v* model names are not recognized: DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy", ppc_models, 0) Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
2a2ce08a6d
commit
509a4a40f9
@ -237,14 +237,12 @@ cpuTestCompare(const void *arg)
|
||||
|
||||
|
||||
static int
|
||||
cpuTestGuestData(const void *arg)
|
||||
cpuTestGuestCPU(const void *arg)
|
||||
{
|
||||
const struct data *data = arg;
|
||||
int ret = -2;
|
||||
virCPUDefPtr host = NULL;
|
||||
virCPUDefPtr cpu = NULL;
|
||||
virCPUDefPtr guest = NULL;
|
||||
virCPUDataPtr guestData = NULL;
|
||||
virCPUCompareResult cmpResult;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
char *result = NULL;
|
||||
@ -253,22 +251,15 @@ cpuTestGuestData(const void *arg)
|
||||
!(cpu = cpuTestLoadXML(data->arch, data->name)))
|
||||
goto cleanup;
|
||||
|
||||
cmpResult = cpuGuestData(host, cpu, &guestData, NULL);
|
||||
cmpResult = virCPUCompare(host->arch, host, cpu, false);
|
||||
if (cmpResult == VIR_CPU_COMPARE_ERROR ||
|
||||
cmpResult == VIR_CPU_COMPARE_INCOMPATIBLE) {
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (VIR_ALLOC(guest) < 0)
|
||||
goto cleanup;
|
||||
|
||||
guest->arch = host->arch;
|
||||
guest->type = VIR_CPU_TYPE_GUEST;
|
||||
guest->match = VIR_CPU_MATCH_EXACT;
|
||||
guest->fallback = cpu->fallback;
|
||||
if (cpuDecode(guest, guestData, data->models,
|
||||
data->nmodels, NULL) < 0) {
|
||||
if (virCPUUpdate(host->arch, cpu, host) < 0 ||
|
||||
virCPUTranslate(host->arch, cpu, data->models, data->nmodels) < 0) {
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
@ -284,17 +275,15 @@ cpuTestGuestData(const void *arg)
|
||||
}
|
||||
result = virBufferContentAndReset(&buf);
|
||||
|
||||
if (cpuTestCompareXML(data->arch, guest, result, false) < 0)
|
||||
if (cpuTestCompareXML(data->arch, cpu, result, false) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(result);
|
||||
cpuDataFree(guestData);
|
||||
virCPUDefFree(host);
|
||||
virCPUDefFree(cpu);
|
||||
virCPUDefFree(guest);
|
||||
|
||||
if (ret == data->result) {
|
||||
/* We got the result we expected, whether it was
|
||||
@ -656,8 +645,8 @@ mymain(void)
|
||||
host "/" feature " (" #result ")", \
|
||||
host, feature, NULL, 0, 0, result)
|
||||
|
||||
#define DO_TEST_GUESTDATA(arch, host, cpu, models, result) \
|
||||
DO_TEST(arch, cpuTestGuestData, \
|
||||
#define DO_TEST_GUESTCPU(arch, host, cpu, models, result) \
|
||||
DO_TEST(arch, cpuTestGuestCPU, \
|
||||
host "/" cpu " (" #models ")", \
|
||||
host, cpu, models, \
|
||||
models == NULL ? 0 : sizeof(models) / sizeof(char *), \
|
||||
@ -787,27 +776,27 @@ mymain(void)
|
||||
DO_TEST_HASFEATURE("x86", "host", "foo", FAIL);
|
||||
|
||||
/* computing guest data and decoding the data into a guest CPU XML */
|
||||
DO_TEST_GUESTDATA("x86", "host", "guest", NULL, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host-better", "pentium3", NULL, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host-worse", "guest", NULL, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host", "strict-force-extra", NULL, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host", "penryn-force", NULL, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host", "guest", model486, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host", "guest", models, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host", "guest", nomodel, -1);
|
||||
DO_TEST_GUESTDATA("x86", "host", "guest-nofallback", models, /*-1*/ -2);
|
||||
DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host", "host+host-model-nofallback", models, /*-1*/ -2);
|
||||
DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell", haswell, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, 0);
|
||||
DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", haswell, /*-1*/ -2);
|
||||
DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", NULL, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host", "guest", NULL, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host-better", "pentium3", NULL, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host-worse", "guest", NULL, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host", "strict-force-extra", NULL, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host", "penryn-force", NULL, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host", "guest", model486, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host", "guest", models, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host", "guest", nomodel, -1);
|
||||
DO_TEST_GUESTCPU("x86", "host", "guest-nofallback", models, -1);
|
||||
DO_TEST_GUESTCPU("x86", "host", "host+host-model", models, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host", "host+host-model-nofallback", models, -1);
|
||||
DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell", haswell, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, 0);
|
||||
DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", haswell, -1);
|
||||
DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX", NULL, 0);
|
||||
|
||||
DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, 0);
|
||||
DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, -1);
|
||||
DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy", ppc_models, 0);
|
||||
DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-incompatible", ppc_models, -1);
|
||||
DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-invalid", ppc_models, -1);
|
||||
DO_TEST_GUESTCPU("ppc64", "host", "guest", ppc_models, 0);
|
||||
DO_TEST_GUESTCPU("ppc64", "host", "guest-nofallback", ppc_models, -1);
|
||||
DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy", ppc_models, /*0*/ -1);
|
||||
DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy-incompatible", ppc_models, -1);
|
||||
DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy-invalid", ppc_models, -1);
|
||||
|
||||
DO_TEST_CPUID("x86", "A10-5800K", true);
|
||||
DO_TEST_CPUID("x86", "Atom-D510", false);
|
||||
|
@ -1,5 +1,3 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>ppc64</arch>
|
||||
<model fallback='allow'>POWER7</model>
|
||||
<vendor>IBM</vendor>
|
||||
</cpu>
|
||||
|
@ -1,5 +1,3 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>ppc64</arch>
|
||||
<model fallback='allow'>POWER7</model>
|
||||
<vendor>IBM</vendor>
|
||||
</cpu>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>486</model>
|
||||
<vendor>Intel</vendor>
|
||||
<topology sockets='2' cores='4' threads='1'/>
|
||||
<feature policy='require' name='de'/>
|
||||
<feature policy='require' name='tsc'/>
|
||||
<feature policy='require' name='msr'/>
|
||||
@ -19,9 +20,9 @@
|
||||
<feature policy='require' name='mmx'/>
|
||||
<feature policy='require' name='fxsr'/>
|
||||
<feature policy='require' name='sse2'/>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='force' name='pbe'/>
|
||||
<feature policy='require' name='pni'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='force' name='monitor'/>
|
||||
<feature policy='require' name='ssse3'/>
|
||||
<feature policy='require' name='cx16'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
@ -30,8 +31,14 @@
|
||||
<feature policy='require' name='syscall'/>
|
||||
<feature policy='require' name='nx'/>
|
||||
<feature policy='require' name='lm'/>
|
||||
<feature policy='require' name='3dnowext'/>
|
||||
<feature policy='force' name='3dnowext'/>
|
||||
<feature policy='require' name='lahf_lm'/>
|
||||
<feature policy='require' name='svm'/>
|
||||
<feature policy='force' name='svm'/>
|
||||
<feature policy='disable' name='vme'/>
|
||||
<feature policy='disable' name='sse4.2'/>
|
||||
<feature policy='disable' name='3dnow'/>
|
||||
<feature policy='disable' name='vmx'/>
|
||||
<feature policy='disable' name='ds_cpl'/>
|
||||
<feature policy='disable' name='sse'/>
|
||||
<feature policy='forbid' name='popcnt'/>
|
||||
</cpu>
|
||||
|
@ -1,13 +1,18 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>Nehalem</model>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<vendor>Intel</vendor>
|
||||
<topology sockets='2' cores='4' threads='1'/>
|
||||
<feature policy='force' name='pbe'/>
|
||||
<feature policy='force' name='monitor'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
<feature policy='require' name='dca'/>
|
||||
<feature policy='require' name='3dnowext'/>
|
||||
<feature policy='require' name='svm'/>
|
||||
<feature policy='force' name='3dnowext'/>
|
||||
<feature policy='force' name='svm'/>
|
||||
<feature policy='disable' name='sse'/>
|
||||
<feature policy='disable' name='sse4.2'/>
|
||||
<feature policy='disable' name='popcnt'/>
|
||||
<feature policy='forbid' name='popcnt'/>
|
||||
<feature policy='disable' name='3dnow'/>
|
||||
<feature policy='require' name='ssse3'/>
|
||||
<feature policy='disable' name='vmx'/>
|
||||
<feature policy='disable' name='ds_cpl'/>
|
||||
</cpu>
|
||||
|
@ -1,11 +1,17 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>Penryn</model>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
<topology sockets='2' cores='4' threads='1'/>
|
||||
<feature policy='require' name='dca'/>
|
||||
<feature policy='require' name='3dnowext'/>
|
||||
<feature policy='require' name='svm'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
<feature policy='disable' name='sse4.2'/>
|
||||
<feature policy='disable' name='3dnow'/>
|
||||
<feature policy='require' name='ssse3'/>
|
||||
<feature policy='disable' name='vmx'/>
|
||||
<feature policy='disable' name='ds_cpl'/>
|
||||
<feature policy='disable' name='sse'/>
|
||||
<feature policy='force' name='monitor'/>
|
||||
<feature policy='force' name='pbe'/>
|
||||
<feature policy='force' name='3dnowext'/>
|
||||
<feature policy='force' name='svm'/>
|
||||
<feature policy='forbid' name='popcnt'/>
|
||||
</cpu>
|
||||
|
@ -1,5 +1,4 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>core2duo</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='ds'/>
|
||||
@ -17,4 +16,6 @@
|
||||
<feature policy='require' name='dca'/>
|
||||
<feature policy='require' name='sse4.1'/>
|
||||
<feature policy='require' name='lahf_lm'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='vme'/>
|
||||
</cpu>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>Penryn</model>
|
||||
<feature policy='require' name='sse4.2'/>
|
||||
<feature policy='require' name='popcnt'/>
|
||||
<feature policy='force' name='popcnt'/>
|
||||
<feature policy='force' name='sse4.2'/>
|
||||
</cpu>
|
||||
|
@ -1,19 +1,18 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<cpu mode='custom' match='strict'>
|
||||
<model fallback='allow'>Penryn</model>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
<feature policy='require' name='ht'/>
|
||||
<feature policy='require' name='tm'/>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='ds_cpl'/>
|
||||
<feature policy='require' name='vmx'/>
|
||||
<feature policy='require' name='est'/>
|
||||
<feature policy='require' name='tm2'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
<feature policy='require' name='dca'/>
|
||||
<feature policy='require' name='3dnow'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
<feature policy='require' name='tm2'/>
|
||||
<feature policy='require' name='est'/>
|
||||
<feature policy='require' name='vmx'/>
|
||||
<feature policy='require' name='ds_cpl'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='require' name='tm'/>
|
||||
<feature policy='require' name='ht'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='force' name='3dnow'/>
|
||||
</cpu>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>Haswell</model>
|
||||
<feature policy='disable' name='hle'/>
|
||||
<topology sockets='1' cores='2' threads='2'/>
|
||||
<feature policy='disable' name='rtm'/>
|
||||
<feature policy='disable' name='hle'/>
|
||||
</cpu>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>Haswell</model>
|
||||
<vendor>Intel</vendor>
|
||||
<topology sockets='1' cores='2' threads='2'/>
|
||||
<feature policy='disable' name='hle'/>
|
||||
<feature policy='disable' name='rtm'/>
|
||||
</cpu>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>Haswell-noTSX</model>
|
||||
<topology sockets='1' cores='2' threads='2'/>
|
||||
</cpu>
|
||||
|
@ -1,18 +1,18 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>Nehalem</model>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
<feature policy='require' name='ht'/>
|
||||
<feature policy='require' name='tm'/>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='ds_cpl'/>
|
||||
<feature policy='require' name='vmx'/>
|
||||
<feature policy='require' name='est'/>
|
||||
<feature policy='require' name='tm2'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='dca'/>
|
||||
<feature policy='require' name='xtpr'/>
|
||||
<feature policy='require' name='tm2'/>
|
||||
<feature policy='require' name='est'/>
|
||||
<feature policy='require' name='vmx'/>
|
||||
<feature policy='require' name='ds_cpl'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='require' name='tm'/>
|
||||
<feature policy='require' name='ht'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
<feature policy='require' name='acpi'/>
|
||||
<feature policy='require' name='ds'/>
|
||||
<feature policy='require' name='vme'/>
|
||||
</cpu>
|
||||
|
@ -1,9 +1,17 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
<arch>x86_64</arch>
|
||||
<model fallback='allow'>Penryn</model>
|
||||
<feature policy='require' name='pbe'/>
|
||||
<feature policy='require' name='monitor'/>
|
||||
<feature policy='require' name='3dnowext'/>
|
||||
<feature policy='require' name='svm'/>
|
||||
<topology sockets='2' cores='4' threads='1'/>
|
||||
<feature policy='disable' name='dca'/>
|
||||
<feature policy='disable' name='xtpr'/>
|
||||
<feature policy='disable' name='sse4.2'/>
|
||||
<feature policy='disable' name='3dnow'/>
|
||||
<feature policy='require' name='ssse3'/>
|
||||
<feature policy='disable' name='vmx'/>
|
||||
<feature policy='disable' name='ds_cpl'/>
|
||||
<feature policy='disable' name='sse'/>
|
||||
<feature policy='force' name='monitor'/>
|
||||
<feature policy='force' name='pbe'/>
|
||||
<feature policy='force' name='3dnowext'/>
|
||||
<feature policy='force' name='svm'/>
|
||||
<feature policy='forbid' name='popcnt'/>
|
||||
</cpu>
|
||||
|
Loading…
Reference in New Issue
Block a user