mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 23:55:23 +00:00
3704b9003f
So far we only test CPUID -> CPU def conversion on artificial CPUID data computed from another CPU def. This patch adds the infrastructure to test this conversion on real data gathered from a host CPU and two helper scripts for adding new test data: - cpu-gather.sh runs cpuid tool and qemu-system-x86_64 to get CPUID data from the host CPU; this is what users can be asked to run if they run into an issue with host CPU detection in libvirt - cpu-parse.sh takes the data generated by cpu-gather.sh and creates data files for CPU detection tests The CPUID data queried from QEMU will eventually switch to the format used by query-host-cpu QMP command once QEMU implements it. Until then we just spawn QEMU with -cpu host and query the guest CPU in QOM. They should both provide the same CPUID results, but query-host-cpu does not require any guest CPU to be created by QEMU. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
36 lines
827 B
Bash
Executable File
36 lines
827 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# The cpuid tool can be usually found in a package called "cpuid". If your
|
|
# distro does not provide such package, you can find the sources or binary
|
|
# packages at http://www.etallen.com/cpuid.html
|
|
|
|
grep 'model name' /proc/cpuinfo | head -n1
|
|
|
|
cpuid -1r
|
|
|
|
echo
|
|
qemu=qemu-system-x86_64
|
|
for cmd in /usr/bin/$qemu /usr/bin/qemu-kvm /usr/libexec/qemu-kvm; do
|
|
if [[ -x $cmd ]]; then
|
|
qemu=$cmd
|
|
break
|
|
fi
|
|
done
|
|
|
|
qom_get()
|
|
{
|
|
path='/machine/unattached/device[0]'
|
|
echo '{"execute":"qom-get","arguments":{"path":"'$path'",' \
|
|
'"property":"'$1'"},"id":"'$1'"}'
|
|
}
|
|
|
|
$qemu -machine accel=kvm -cpu host -nodefaults -nographic -qmp stdio <<EOF
|
|
{"execute":"qmp_capabilities"}
|
|
`qom_get feature-words`
|
|
`qom_get family`
|
|
`qom_get model`
|
|
`qom_get stepping`
|
|
`qom_get model-id`
|
|
{"execute":"quit"}
|
|
EOF
|