提交 330128bc 编写于 作者: I Igor Mammedov 提交者: Lucas Meneghel Rodrigues

cpuid: add custom_level test

Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
---
v2:
    * s/TestFail/TestNAError/
    * s/custom_level/custom.level/ in config
上级 5099b46b
......@@ -82,3 +82,10 @@
xfail = "yes"
vendor = ""
test_type = "custom_vendor"
- cpuid.custom.level:
level = 5
test_type = "custom_level"
- cpuid.custom.level.NaN:
xfail = "yes"
level = "five"
test_type = "custom_level"
......@@ -238,6 +238,34 @@ def run_cpuid(test, params, env):
if (has_error is False) and (xfail is True):
raise error.TestFail("Test was expected to fail, but it didn't")
def cpuid_to_level(cpuid_dump):
r = cpuid_regs_to_dic('0x00000000 0x00', cpuid_dump)
return r['eax']
class custom_level(MiniSubtest):
"""
Boot qemu with specified level
"""
def test(self):
has_error = False
if params.get("level") is None:
raise error.TestNAError("'level' must be specified in config"
" for this test")
try:
out = get_guest_cpuid(self, cpu_model, "level=" +
params.get("level"))
guest_level = str(cpuid_to_level(out))
if guest_level != params.get("level"):
raise error.TestFail("Guest's level [%s], doesn't match "
"required level [%s]" %
(guest_level, params.get("level")))
except:
has_error = True
if xfail is False:
raise
if (has_error is False) and (xfail is True):
raise error.TestFail("Test was expected to fail, but it didn't")
# subtests runner
test_type = params.get("test_type")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册