On 11/6/23 21:41, Jonathon Jongsma wrote: > 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 49c945a6f5c885394507f88086cc2f9461df7c27. 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@xxxxxxxxxx> > --- > tests/cputest.c | 4 ---- > 1 file changed, 4 deletions(-) > Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx> Michal _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx