Signed-off-by: Yolkfull Chow <yz...@redhat.com>
---
 client/tests/kvm/tests/vnc.py          |   24 ++++++++++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample |    3 +++
 2 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/vnc.py

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:
-- 
1.6.5.5

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

Reply via email to