提交 f49c239a 编写于 作者: E Eduardo Habkost 提交者: Lucas Meneghel Rodrigues

qemu/cpuid: default_vendor: support both single-model and multi-model mode

I don't know yet what will be the best way to configure the tests, but
this changes the test code to allow both modes to be used: a single
model can be set using the "cpu_model" option, or multiple models may be
tested using the "cpu_models" option. Or, if cpu_models is "*", all
models reported by QEMU can be tested (that was the current behavior
when cpu_models was not set).
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
上级 ac205cb9
......@@ -40,6 +40,7 @@
- kvm:
# when KVM is enabled, all CPU models have vendor set
# to match host, by default
cpu_models = "*"
# 486 is excluded due to not supporting cpuid
ignore_cpu_models = "486"
# if 'vendor' is missing then host's vendor value is used
......
......@@ -68,6 +68,33 @@ def run_cpuid(test, params, env):
exc_type, exc_value,
exc_traceback.tb_next)))
def cpu_models_to_test():
"""Return the list of CPU models to be tested, based on the
cpu_models and cpu_model config options.
Config option "cpu_model" may be used to ask a single CPU model
to be tested. Config option "cpu_models" may be used to ask
multiple CPU models to be tested.
If cpu_models is "*", all CPU models reported by QEMU will be tested.
"""
models_opt = params.get("cpu_models")
model_opt = params.get("cpu_model")
if (models_opt is None and model_opt is None):
raise error.TestError("No cpu_models or cpu_model option is set")
cpu_models = set()
if models_opt == '*':
cpu_models.update(utils_misc.get_qemu_cpu_models(qemu_binary))
elif models_opt:
cpu_models.update(models_opt.split())
if model_opt:
cpu_models.add(model_opt)
return cpu_models
class test_qemu_cpu_models_list(MiniSubtest):
"""
......@@ -162,10 +189,7 @@ def run_cpuid(test, params, env):
verify that CPU vendor matches requested
"""
def test(self):
if params.get("cpu_models") is None:
cpu_models = set(utils_misc.get_qemu_cpu_models(qemu_binary))
else:
cpu_models = set(params.get("cpu_models").split(' '))
cpu_models = cpu_models_to_test()
cmd = "grep 'vendor_id' /proc/cpuinfo | head -n1 | awk '{print $3}'"
cmd_result = utils.run(cmd, ignore_status=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册