提交 1457391a 编写于 作者: I Igor Mammedov 提交者: Lucas Meneghel Rodrigues

cpuid: add custom_stepping test

Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
---
v2:
   * s/TestFail/TestNAError/
   * s/custom_stepping/custom.stepping/ in config
上级 82e782b0
......@@ -121,3 +121,17 @@
xfail = "yes"
model = foo
test_type = "custom_model"
- cpuid.custom.stepping:
stepping = 5
test_type = "custom_stepping"
- cpuid.custom.stepping.max:
stepping = 15
test_type = "custom_stepping"
- cpuid.custom.stepping.out_of_range:
xfail = "yes"
stepping = 16
test_type = "custom_stepping"
- cpuid.custom.stepping.Nan:
xfail = "yes"
stepping = foo
test_type = "custom_stepping"
......@@ -335,6 +335,39 @@ 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_stepping(cpuid_dump):
# Intel Processor Identification and the CPUID Instruction
# http://www.intel.com/Assets/PDF/appnote/241618.pdf
# 5.1.2 Feature Information (Function 01h)
eax = cpuid_regs_to_dic('0x00000001 0x00', cpuid_dump)['eax']
stepping = eax & 0xf
return stepping
class custom_stepping(MiniSubtest):
"""
Boot qemu with specified stepping
"""
def test(self):
has_error = False
if params.get("stepping") is None:
raise error.TestNAError("'stepping' must be specified in config"
" for this test")
try:
out = get_guest_cpuid(self, cpu_model, "stepping=" +
params.get("stepping"))
guest_stepping = str(cpuid_to_stepping(out))
if guest_stepping != params.get("stepping"):
raise error.TestFail("Guest's stepping [%s], doesn't match "
"required stepping [%s]" %
(guest_stepping,
params.get("stepping")))
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.
先完成此消息的编辑!
想要评论请 注册