mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
test: remove redundant cpuTestGuestCPUID test
DO_TEST_CPUID(arch, host, json) is a multipart test. It consists of the
following tests:
- cpuTestHostCPUID()
- cpuTestGuestCPUID(with JSON_* flag)
- cpuTestCPUIDSignature()
- DO_TEST_JSON():
- if json==JSON_MODELS:
- cpuTestGuestCPUID(without JSON_* flag)
- cpuTestJSONCPUID()
- cputestJSONSignature()
Notice that for tests with json==JSON_MODELS, cpuTestGuestCPUID() is
actually called twice but with different arguments. The first one passes
JSON_MODELS to the test function, while the second one passes 0.
The main difference in behavior when calling cpuTestGuestCPUID() with or
without the flag is that in the first case, it parses the captured qemu
output from $ARCH-cpuid-$CPU.json. It extracts the cpu model list from
that JSON, and uses that to filter out possible cpu models to match.
In other words, it tries to match the cpu to a model that was supported
by the qemu version that was used to generate this JSON file. When it
finds a match, it generates a cpu definition and compares the xml form
of that definition with the file $ARCH-cpuid-$CPU-guest.xml.
When called without the JSON_MODELS flag, it simply attempts to match it
against the full libvirt cpu map and doesn't attempt to filter out any
matches based on the JSON qemu cpu model list. After it finds a match,
it generates an xml definition for the cpu and compares it to the same
file listed above. So if these two invocations disagree on the cpu match
(e.g. because libvirt has added a cpu model to its cpu map that matches
better than one that was supported by the version of qemu that generated
the JSON file) the test will fail.
This duplicate call to cpuTestGuestCPUID() was originally added in
commit 49c945a6f5
. The original
justification for that commit was to fix test failures when the Qemu
driver was disabled. But since DO_TEST_JSON() is #defined empty when
qemu is disabled, this particular invocation would not even be executed
in this scenario, so it doesn't seem relevant.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
3b45fcd6b6
commit
a949a53e13
@ -993,10 +993,6 @@ mymain(void)
|
|||||||
#if WITH_QEMU
|
#if WITH_QEMU
|
||||||
# define DO_TEST_JSON(arch, host, json) \
|
# define DO_TEST_JSON(arch, host, json) \
|
||||||
do { \
|
do { \
|
||||||
if (json == JSON_MODELS) { \
|
|
||||||
DO_TEST(arch, cpuTestGuestCPUID, host, host, \
|
|
||||||
NULL, NULL, 0, NULL, 0, 0); \
|
|
||||||
} \
|
|
||||||
if (json != JSON_NONE) { \
|
if (json != JSON_NONE) { \
|
||||||
DO_TEST(arch, cpuTestJSONCPUID, host, host, \
|
DO_TEST(arch, cpuTestJSONCPUID, host, host, \
|
||||||
NULL, NULL, 0, NULL, json, 0); \
|
NULL, NULL, 0, NULL, json, 0); \
|
||||||
|
Loading…
Reference in New Issue
Block a user