diff mbox

[Autotest] KVM test: Add a subtest vnc via which interacts with guest

Message ID 1261111846-4564-1-git-send-email-yzhou@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yolkfull Chow Dec. 18, 2009, 4:50 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/tests/vnc.py b/client/tests/kvm/tests/vnc.py
new file mode 100644
index 0000000..0f00379
--- /dev/null
+++ b/client/tests/kvm/tests/vnc.py
@@ -0,0 +1,24 @@ 
+import logging, pexpect
+from autotest_lib.client.common_lib import  error
+import kvm_test_utils, kvm_subprocess
+
+def run_vnc(test, params, env):
+    """
+    Test whether guest could be interacted with vnc.
+
+    @param test: kvm test object
+    @param params: Dictionary with the test parameters
+    @param env: Dictionary with test environment.
+    """
+    vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
+    session = kvm_test_utils.wait_for_login(vm)
+
+    # Start vnc connection test
+    vnc_port = str(vm.vnc_port - 5900)
+    vnc_cmd = "vncviewer" + " localhost:" + vnc_port
+    logging.debug("Using command to vnc connect: %s" % vnc_cmd)
+
+    p = kvm_subprocess.run_bg(vnc_cmd, None, logging.debug, "(vnc) ")
+    if not p.is_alive():
+        raise error.TestFail("Vnc connect to guest failed")
+    p.close()
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index a403399..0eaccae 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -270,6 +270,9 @@  variants:
         type = physical_resources_check
         catch_uuid_cmd = dmidecode | awk -F: '/UUID/ {print $2}'
 
+    - vnc: install setup unattended_install
+        type = vnc
+
 # NICs
 variants:
     - @rtl8139: