Beispiel #1
0
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))
Beispiel #2
0
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))
Beispiel #3
0
    dump_path = params.get("dump_path", data_dir.get_root_dir())
    cpuinfo_file = utils.unmap_url(dump_path, dump_file, dump_path)
    host_flags = utils_misc.get_cpu_flags()

    vm = env.get_vm(params["main_vm"])
    guest_cpumodel = vm.cpuinfo.model
    extra_flags = params.get("cpu_model_flags", " ")

    error.context("Boot guest with -cpu %s,%s" % (guest_cpumodel, extra_flags),
                  logging.info)
    vm.verify_alive()
    timeout = float(params.get("login_timeout", 240))
    session = vm.wait_for_login(timeout=timeout)

    # Get qemu model
    host_cpumodel = utils_misc.get_cpu_model()
    if guest_cpumodel not in host_cpumodel:
        qemu_model = host_cpumodel.split(",")[0]
    else:
        qemu_model = guest_cpumodel
    error.context("Get model %s support flags" % qemu_model, logging.info)

    # Get flags for every reg from model's info
    models_info = utils.system_output("cat %s" % cpuinfo_file).split("x86")
    model_info = qemu_model_info(models_info, qemu_model)
    reg_list = params.get("reg_list", "feature_edx ").split()
    model_support_flags = " "
    if model_info:
        for reg in reg_list:
            reg_flags = qemu_support_flag(model_info, reg)
            if reg_flags:
Beispiel #4
0
    dump_path = params.get("dump_path", data_dir.get_root_dir())
    cpuinfo_file = utils.unmap_url(dump_path, dump_file, dump_path)
    host_flags = utils_misc.get_cpu_flags()

    vm = env.get_vm(params["main_vm"])
    guest_cpumodel = vm.cpuinfo.model
    extra_flags = params.get("cpu_model_flags", " ")

    error.context("Boot guest with -cpu %s,%s" %
                 (guest_cpumodel, extra_flags), logging.info)
    vm.verify_alive()
    timeout = float(params.get("login_timeout", 240))
    session = vm.wait_for_login(timeout=timeout)

    # Get qemu model
    host_cpumodel = utils_misc.get_cpu_model()
    if guest_cpumodel not in host_cpumodel:
        qemu_model = host_cpumodel.split(",")[0]
    else:
        qemu_model = guest_cpumodel
    error.context("Get model %s support flags" % qemu_model, logging.info)

    # Get flags for every reg from model's info
    models_info = utils.system_output("cat %s" % cpuinfo_file).split("x86")
    model_info = qemu_model_info(models_info, qemu_model)
    reg_list = params.get("reg_list", "feature_edx ").split()
    model_support_flags = " "
    if model_info:
        for reg in reg_list:
            reg_flags = qemu_support_flag(model_info, reg)
            if reg_flags: