mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
cputest: Switch host CPU data scripts to model expansion
Instantiating "host" CPU and querying it using qom-get has been the only way of probing host CPU via QEMU until 2.9.0 implemented query-cpu-model-expansion for x86_64. Even though libvirt never really used the old way its result can be easily converted into the one produced by query-cpu-model-expansion. Thus we can reuse the original test data and possible get new data from hosts where QEMU does not support the new QMP command. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
@@ -24,12 +24,39 @@ qom_get()
|
||||
'"property":"'$1'"},"id":"'$1'"}'
|
||||
}
|
||||
|
||||
$qemu -machine accel=kvm -cpu host -nodefaults -nographic -qmp stdio <<EOF
|
||||
model_expansion()
|
||||
{
|
||||
mode=$1
|
||||
model=$2
|
||||
|
||||
echo '{"execute":"query-cpu-model-expansion","arguments":' \
|
||||
'{"type":"'"$mode"'","model":'"$model"'},"id":"model-expansion"}'
|
||||
}
|
||||
|
||||
model=$(
|
||||
$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`
|
||||
$(model_expansion static '{"name":"host"}')
|
||||
{"execute":"quit"}
|
||||
EOF
|
||||
)
|
||||
model=$(
|
||||
echo "$model" | \
|
||||
sed -ne 's/^{"return": {"model": {\(.*{.*}\)}}, .*/{\1}/p'
|
||||
)
|
||||
|
||||
$qemu -machine accel=kvm -cpu host -nodefaults -nographic -qmp stdio <<EOF
|
||||
{"execute":"qmp_capabilities"}
|
||||
$(
|
||||
if [ "x$model" != x ]; then
|
||||
model_expansion full "$model"
|
||||
else
|
||||
qom_get feature-words
|
||||
qom_get family
|
||||
qom_get model
|
||||
qom_get stepping
|
||||
qom_get model-id
|
||||
fi
|
||||
)
|
||||
{"execute":"quit"}
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user