On 07/05/2011 10:21 AM, Pradeep Kumar wrote:
 From 2813840a93e9679f224cf6c78c83b340c1d46964 Mon Sep 17 00:00:00 2001
From: pradeepkumar<sp@pradeep.(none)>
Date: Tue, 5 Jul 2011 07:08:05 +0530
Subject: [PATCH] [AUTOTEST][KVM] verifying smbios table for guest patch
  Signed-off-by: pradeepkumar<[email protected]>

        new file:   client/tests/kvm/tests/smbios_table.py
        modified:   client/tests/kvm/tests_base.cfg.sample
---
  client/tests/kvm/tests/smbios_table.py |   62 ++++++++++++++++++++++++++++++++
  client/tests/kvm/tests_base.cfg.sample |    3 ++
  2 files changed, 65 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..5b11441
--- /dev/null
+++ b/client/tests/kvm/tests/smbios_table.py
@@ -0,0 +1,62 @@
+import commands, logging
"Deprecated since version 2.6: The commands module has been removed in Python 3.0. Use the subprocess <http://docs.python.org/library/subprocess.html#module-subprocess> module instead." So we'd better change commands to autotest's utils module or subprocess module
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.virt import virt_env_process, virt_test_utils
+
+def run_smbios_table(test, params, env):
+    """
+    Check Memory ballooning:
+    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.
+    """
+
+    s_vendor, vendor = commands.getstatusoutput("dmidecode --type 0 | grep Vendor | 
awk '{print $2}'")
+    if s_vendor != 0:
+        raise error.TestFail("couldnt get Vendor")
+
+    s_date, date = commands.getstatusoutput("dmidecode --type 0 | grep Date | awk 
'{print $3}'")
+    if s_date != 0:
+        raise error.TestFail("couldnt get Date")
+
+    s_version, version = commands.getstatusoutput("dmidecode --type 0 | grep 
Version | awk '{print $2}'")
+    if s_version != 0:
+        raise error.TestFail("couldnt get version")
+
+    def boot_with_smbios():
+        """
+        boot geust with  host bios options
+       """
+       params['extra_params'] = standard_extra_params
Seems unexpected indent here
+        params['extra_params'] += ("-smbios 
type=0,vendor=%s,version=%s,date=%s" % (vendor, version, date))
+
+        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"])
+        login_timeout = float(params.get("login_timeout", 360))
+        session = virt_test_utils.wait_for_login(vm, timeout=login_timeout)
We have vm.wait_for_login() now.
+
+       guest_vendor = session.cmd("dmidecode --type 0 | grep Vendor | awk '{print 
$2}'")
Seems unexpected indent here
+        guest_date = session.cmd("dmidecode --type 0 | grep Date | awk '{print 
$3}'")

Seems unexpected indent following part.
+       guest_version = session.cmd("dmidecode --type 0 | grep Version | awk '{print 
$2}'")
+
+       if vendor != guest_vendor.strip():
+            logging.info("Vendor is not matching")
+
+       if date != guest_date.strip():
+            logging.info("Date is not matching")
+
+       if version != guest_version.strip():
+            logging.info("Version is not matching")
+
+
+    # INITIALIZE
+    if "extra_params" in params:
+        standard_extra_params = params['extra_params']
+    else:
+        standard_extra_params = ""
+    boot_with_smbios()
+
diff --git a/client/tests/kvm/tests_base.cfg.sample 
b/client/tests/kvm/tests_base.cfg.sample
index 1a86265..e02d536 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -416,6 +416,9 @@ variants:
          extra_params += " -watchdog i6300esb -watchdog-action reset"
          relogin_timeout = 240

+    - smbios_table: install setup image_copy unattended_install.cdrom
+        type = smbios_table
Need add start_vm = no if you want start vm in your own way. Also need set this case for linux only. Or expand it to support windows guest.


Thanks very much!

BR

Feng Yang

+
      - stress_boot: install setup image_copy unattended_install.cdrom
          type = stress_boot
          max_vms = 5

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to