On Thu, Feb 28, 2019 at 17:29:15 +0100, Ján Tomko wrote:
On Wed, Feb 27, 2019 at 02:29:07PM +0100, Jiri Denemark wrote:
The signature computation code is not too complicated and it will likely never change so testing it is not very important. We do it mostly for a nice side effect of easily accessible signature numbers for all CPU data files.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- +static int +cpuTestCompareSignature(const struct data *data, + virCPUDataPtr hostData) +{ + unsigned long signature; + unsigned int family; + unsigned int model; + unsigned int stepping; + char *result = NULL; + char *sigStr = NULL;
Could have used VIR_AUTOFREE
+ int ret = -1; + + signature = virCPUx86DataGetSignature(hostData, &family, &model, &stepping); + + if (virAsprintf(&result, "%s/cputestdata/%s-cpuid-%s.sig", + abs_srcdir, virArchToString(data->arch), data->host) < 0) + goto cleanup; + + if (virAsprintf(&sigStr, + "%1$06lx\n" + "family: %2$2u (0x%2$02x)\n" + "model: %3$2u (0x%3$02x)\n" + "stepping: %4$2u (0x%4$02x)\n",
$3u to nicely align numbers greater than 0x63
Done (both changes). Jirka