Re: [Autotest] [PATCH] KVM test: Add subtest smbios_table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2011-07-05 at 15:07 -0300, Lucas Meneghel Rodrigues wrote:
> From: pradeep <psuriset@xxxxxxxxxxxxxxxxxx>
> 
>     Check smbios table :
>     1) Boot a guest with smbios options
>     2) verify if host bios options have been emulated,
>        that is, the vendor, date and version options
>        returned by dmidecode are the same on host and
>        on guest.

Hi Pradeep, as you see I've made some changes and commited, check the
final result:

http://autotest.kernel.org/changeset/5484

Thanks!

> Signed-off-by: Pradeep Kumar Surisetty <psuriset@xxxxxxxxxxxxxxxxxx>
> ---
>  client/tests/kvm/tests/smbios_table.py |   67 ++++++++++++++++++++++++++++++++
>  client/tests/kvm/tests_base.cfg.sample |    5 ++
>  2 files changed, 72 insertions(+), 0 deletions(-)
>  create mode 100644 client/tests/kvm/tests/smbios_table.py
> 
> diff --git a/client/tests/kvm/tests/smbios_table.py b/client/tests/kvm/tests/smbios_table.py
> new file mode 100644
> index 0000000..5d5a1ad
> --- /dev/null
> +++ b/client/tests/kvm/tests/smbios_table.py
> @@ -0,0 +1,67 @@
> +import commands, logging
> +from autotest_lib.client.common_lib import utils, error
> +from autotest_lib.client.virt import virt_env_process, virt_test_utils
> +
> +
> +@error.context_aware
> +def run_smbios_table(test, params, env):
> +    """
> +    Check smbios table :
> +    1) Boot a guest with smbios options
> +    2) verify if host bios options have been emulated
> +
> +    @param test: KVM test object.
> +    @param params: Dictionary with the test parameters.
> +    @param env: Dictionary with test environment.
> +    """
> +    vendor_cmd = "dmidecode --type 0 | grep Vendor | awk '{print $2}'"
> +    date_cmd = "dmidecode --type 0 | grep Date | awk '{print $3}'"
> +    version_cmd = "dmidecode --type 0 | grep Version | awk '{print $2}'"
> +
> +    error.context("getting smbios table on host")
> +    host_vendor = utils.system_output(vendor_cmd)
> +    host_date = utils.system_output(date_cmd)
> +    host_version = utils.system_output(version_cmd)
> +
> +    smbios = (" -smbios type=0,vendor=%s,version=%s,date=%s" %
> +              (host_vendor, host_version, host_date))
> +
> +    extra_params = params.get("extra_params", "")
> +    params["extra_params"] = extra_params + smbios
> +
> +    logging.debug("Booting guest %s", params.get("main_vm"))
> +    virt_env_process.preprocess_vm(test, params, env, params.get("main_vm"))
> +    vm = env.get_vm(params["main_vm"])
> +    vm.create()
> +    login_timeout = float(params.get("login_timeout", 360))
> +    session = vm.wait_for_login(timeout=login_timeout)
> +
> +    error.context("getting smbios table on guest")
> +    guest_vendor = session.cmd(vendor_cmd).strip()
> +    guest_date = session.cmd(date_cmd).strip()
> +    guest_version = session.cmd(version_cmd).strip()
> +
> +    failures = []
> +
> +    if host_vendor != guest_vendor:
> +        e_msg = ("Vendor str mismatch -> host: %s guest: %s" %
> +                 (guest_vendor, host_vendor))
> +        logging.error(e_msg)
> +        failures.append(e_msg)
> +
> +    if host_date != guest_date:
> +        e_msg = ("Date str mismatch -> host: %s guest: %s" %
> +                 (guest_date, host_date))
> +        logging.error(e_msg)
> +        failures.append(e_msg)
> +
> +    if host_version != guest_version:
> +        e_msg = ("Version str mismatch -> host: %s guest: %s" %
> +                 (guest_version, host_version))
> +        logging.error(e_msg)
> +        failures.append(e_msg)
> +
> +    error.context("")
> +    if failures:
> +        raise error.TestFail("smbios table test reported %s failures:\n%s" %
> +                             (len(failures), "\n".join(failures)))
> diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
> index 1a86265..a1f1ef0 100644
> --- a/client/tests/kvm/tests_base.cfg.sample
> +++ b/client/tests/kvm/tests_base.cfg.sample
> @@ -416,6 +416,11 @@ variants:
>          extra_params += " -watchdog i6300esb -watchdog-action reset"
>          relogin_timeout = 240
>  
> +    - smbios_table: install setup image_copy unattended_install.cdrom
> +        only Linux
> +        type = smbios_table
> +        start_vm = no
> +
>      - stress_boot: install setup image_copy unattended_install.cdrom
>          type = stress_boot
>          max_vms = 5    


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux