提交 5ac21119 编写于 作者: I Igor Mammedov 提交者: Lucas Meneghel Rodrigues

cpuid: add custom_xlevel test

Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
---
v2:
    * s/TestFail/TestNAError/
    * s/custom_xlevel/custom.xlevel/ in config
上级 1457391a
......@@ -135,3 +135,21 @@
xfail = "yes"
stepping = foo
test_type = "custom_stepping"
- cpuid.custom.xlevel.fixup:
# fix me when fixup in QEMU is removed
xlevel = 5
# expect fixup to 0x80000005
expect_xlevel = 2147483653
test_type = "custom_xlevel"
- cpuid.custom.xlevel:
# xlevel = 0x80000001
xlevel = 2147483649
test_type = "custom_xlevel"
- cpuid.custom.xlevel.supported_max:
# xlevel = 0x8000000A
xlevel = 2147483658
test_type = "custom_xlevel"
- cpuid.custom.xlevel.Nan:
xfail = "yes"
xlevel = foo
test_type = "custom_xlevel"
......@@ -368,6 +368,40 @@ 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_xlevel(cpuid_dump):
# Intel Processor Identification and the CPUID Instruction
# http://www.intel.com/Assets/PDF/appnote/241618.pdf
# 5.2.1 Largest Extendend Function # (Function 80000000h)
return cpuid_regs_to_dic('0x80000000 0x00', cpuid_dump)['eax']
class custom_xlevel(MiniSubtest):
"""
Boot qemu with specified xlevel
"""
def test(self):
has_error = False
if params.get("xlevel") is None:
raise error.TestNAError("'xlevel' must be specified in config"
" for this test")
xlevel = params.get("xlevel")
if params.get("expect_xlevel") is not None:
xlevel = params.get("expect_xlevel")
try:
out = get_guest_cpuid(self, cpu_model, "xlevel=" +
params.get("xlevel"))
guest_xlevel = str(cpuid_to_xlevel(out))
if guest_xlevel != xlevel:
raise error.TestFail("Guest's xlevel [%s], doesn't match "
"required xlevel [%s]" %
(guest_xlevel, xlevel))
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.
先完成此消息的编辑!
想要评论请 注册