提交 54448ceb 编写于 作者: S Suqin Huang 提交者: Lucas Meneghel Rodrigues

qemu.tests: Add boot_cpu_model test cases

1). boot guest with cpu_model in the cluster one by one
2). check flags in guest if flag check is required, otherwise shutdown guest

Change from v1:
use cpu_model_%s instead of intel_model/amd_model
Signed-off-by: NSuqin Huang <shuang@redhat.com>
Acked-by: NFeng Yang <fyang@redhat.com>
上级 f3e49093
import logging
from autotest.client.shared import error, utils
from virttest import env_process, utils_misc, utils_test
@error.context_aware
def run_boot_cpu_model(test, params, env):
"""
boot cpu model test:
steps:
1). boot guest with cpu model
2). check flags if enable_check == "yes", otherwise shutdown guest
@param test: QEMU test object
@param params: Dictionary with the test parameters
"""
host_flags = utils_misc.get_cpu_flags()
cpu_vendor = utils_misc.get_cpu_vendor(host_flags)
host_model = utils_misc.get_cpu_model()
model_list = params.get("cpu_model")
if not model_list:
if cpu_vendor == "unknow":
raise error.TestError("unknow cpu vendor")
else:
model_list = params.get("cpu_model_%s" % cpu_vendor,
host_model.split(",")[-1])
if model_list:
model_list = model_list.split(" ")
for model in model_list:
if model in host_model or model == "host":
params["cpu_model"] = model
params["start_vm"] = "yes"
env_process.preprocess_vm(test, params, env, params["main_vm"])
# check guest flags
if params.get("enable_check", "no") == "yes":
utils_test.run_virt_sub_test(test, params,
env, sub_type="flag_check")
else:
# log in and shutdown guest
utils_test.run_virt_sub_test(test, params,
env, sub_type="shutdown")
logging.info("shutdown guest successfully")
else:
if params.get("enable_check", "no") == "yes":
raise error.TestWarn("Can not test %s model on %s host, pls"
" use %s host" % (model, host_model.split(",")[0], model))
- boot_cpu_model:
virt_test_type = qemu
type = "boot_cpu_model"
auto_cpu_model = "no"
start_vm = "no"
cpu_model = ""
shutdown_method = "shell"
variants:
- cpu_host:
cpu_model = "host"
- model_cluster:
cpu_model_GenuineIntel = "Haswell SandyBridge Westmere Nehalem Penryn Conroe"
cpu_model_AuthenticAMD = "Opteron_G5 Opteron_G4 Opteron_G3 Opteron_G2 Opteron_G1"
- check_flag:
# this case work on other guest as well
# but some flags is not recognized by old kernel
# test only on one guest is acceptable for flag check
only RHEL.6
# option_flags are generated by kernel or kvm
option_flags = "rep_good unfair_spinlock extd_apicid hypervisor"
# out_flags are flags not in guest
# dont support rdtscp because bug 814426
# dont support svm|vmx according to bug 869991#c2
out_flags = "rdtscp svm vmx"
dump_file = "shared/deps/cpuid_dump.txt"
# use dump_path when you download dump_file from internet
# dump_path = "/tmp"
reg_list = "feature_edx feature_ecx extfeature_edx extfeature_ecx cpuid_7_0_feature_ebx"
enable_check = "yes"
variants:
- disable_tsc_deadline:
cpu_model = "SandyBridge"
cpu_model_flags = ",-tsc-deadline"
- enabled_tsc_deadline:
cpu_model = "Westmere"
cpu_model_flags = ",+tsc-deadline"
- disable_tsc_deadline_with_m6.3:
cpu_model = "SandyBridge"
machine_type = "rhel6.3.0"
#tsc-deadline is not exposed to guest with -M rhel6.3.0
out_flags += " tsc-deadline"
- add_flag:
cpu_model_GenuineIntel = "Westmere"
cpu_model_AuthenticAMD = "Opteron_G2"
cpu_model_flags = ",+xsave,+sse4a,+aes,+sep,+sse4.2"
- remove_flag:
cpu_model_GenuineIntel = "SandyBridge"
cpu_model_AuthenticAMD = "Opteron_G3"
cpu_model_flags = ",-sse4a,-xsave,-aes,-sse4.2"
- cpuid_7_0_ebx_feature:
cpu_model_flags = ",+fsgsbase"
cpu_model = "SandyBridge"
- cpu_host:
cpu_model = "host"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册