提交 d065934c 编写于 作者: J Jiri Denemark

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: NJiri Denemark <jdenemar@redhat.com>
上级 2f882dbf
此差异已折叠。
......@@ -24,12 +24,39 @@ qom_get()
'"property":"'$1'"},"id":"'$1'"}'
}
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"}
$(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"}
`qom_get feature-words`
`qom_get family`
`qom_get model`
`qom_get stepping`
`qom_get model-id`
$(
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
......@@ -52,6 +52,9 @@ echo $fname.xml
json <<<"$data" >$fname.json
if [[ -s $fname.json ]]; then
echo $fname.json
if ! grep -q model-expansion $fname.json; then
$(dirname $0)/cpu-convert.py $fname.json
fi
else
rm $fname.json
fi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册