Signed-off-by: Igor Mammedov <[email protected]>
---
qemu/tests/cfg/qemu_cpu.cfg | 19 +++++++++++++++++++
qemu/tests/cpuid.py | 28 ++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/qemu/tests/cfg/qemu_cpu.cfg b/qemu/tests/cfg/qemu_cpu.cfg
index a210c09..2da092d 100644
--- a/qemu/tests/cfg/qemu_cpu.cfg
+++ b/qemu/tests/cfg/qemu_cpu.cfg
@@ -164,6 +164,25 @@
bits = "5"
leaf = "0x40000004"
flags = "hv_relaxed"
+ - hv_spinlocks:
+ test_type = "cpuid_reg_test"
+ reg = "ebx"
+ leaf = "0x40000004"
+ variants:
+ - min:
+ value = "4095"
+ flags = "hv_spinlocks=0xfff"
+ - nan:
+ xfail = "yes"
+ value = "4095"
+ flags = "hv_spinlocks=0xg"
+ - FFFFFFFF_xfail:
+ xfail = "yes"
+ value = "4294967295"
+ flags = "hv_spinlocks=0xffffffff"
+ - def:
+ value = "4294967295"
+ flags = "hv_relaxed"
- custom:
# the checks below will be run without setting the CPU
model
# explicitly. they can be repeated for each known CPU model
diff --git a/qemu/tests/cpuid.py b/qemu/tests/cpuid.py
index f1556b7..db4299e 100644
--- a/qemu/tests/cpuid.py
+++ b/qemu/tests/cpuid.py
@@ -516,6 +516,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")
+ class cpuid_reg_test(MiniSubtest):
+ """
+ test register value in specified leaf:index:reg
+ """
+ def test(self):
+ has_error = False
+ flags = params.get("flags","")
+ leaf = params.get("leaf")
+ idx = params.get("index","0x00")
+ reg = params.get("reg","eax")
+ if params.get("value") is None:
+ raise error.TestNAError("'value' must be specified in"
+ "config for this test")
+ val = int(params.get("value"))
+ try:
+ out = get_guest_cpuid(self, cpu_model, flags)
+ r = cpuid_regs_to_dic('%s %s' % (leaf, idx), out)[reg]
+ logging.debug("CPUID(%s.%s).%s=0x%08x" % (leaf, idx, reg, r))
+ if r != val:
+ raise error.TestFail("CPUID(%s.%s).%s is not 0x%08x" %
+ (leaf, idx, reg, val))
+ 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")
--
1.7.1
_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel