public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org, pradeep <psuriset@linux.vnet.ibm.com>
Subject: [PATCH] KVM test: Add subtest smbios_table
Date: Tue,  5 Jul 2011 15:07:38 -0300	[thread overview]
Message-ID: <1309889258-21833-1-git-send-email-lmr@redhat.com> (raw)

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


             reply	other threads:[~2011-07-05 18:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05 18:07 Lucas Meneghel Rodrigues [this message]
2011-07-05 18:12 ` [PATCH] KVM test: Add subtest smbios_table Lucas Meneghel Rodrigues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309889258-21833-1-git-send-email-lmr@redhat.com \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=psuriset@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox