public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM test: Add subtest smbios_table
@ 2011-07-05 18:07 Lucas Meneghel Rodrigues
  2011-07-05 18:12 ` Lucas Meneghel Rodrigues
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-07-05 18:07 UTC (permalink / raw)
  To: autotest; +Cc: kvm, pradeep

From: pradeep <psuriset@linux.vnet.ibm.com>

    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.

Signed-off-by: Pradeep Kumar Surisetty <psuriset@linux.vnet.ibm.com>
---
 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    
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM test: Add subtest smbios_table
  2011-07-05 18:07 [PATCH] KVM test: Add subtest smbios_table Lucas Meneghel Rodrigues
@ 2011-07-05 18:12 ` Lucas Meneghel Rodrigues
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-07-05 18:12 UTC (permalink / raw)
  To: autotest; +Cc: kvm

On Tue, 2011-07-05 at 15:07 -0300, Lucas Meneghel Rodrigues wrote:
> From: pradeep <psuriset@linux.vnet.ibm.com>
> 
>     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@linux.vnet.ibm.com>
> ---
>  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    

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-05 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-05 18:07 [PATCH] KVM test: Add subtest smbios_table Lucas Meneghel Rodrigues
2011-07-05 18:12 ` Lucas Meneghel Rodrigues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox