From d14a6cc87bb1fecc0dc9c580c06ac09d2365b94f Mon Sep 17 00:00:00 2001 From: Vimal Patel Date: Thu, 20 Sep 2012 16:13:55 -0400 Subject: [PATCH] virt.spice: Add a full screen test Adding a test to verify a remote-viewer connection with the full screen option the guest takes the resolution of the client, and it also supports the negative test if connected w/o the full screen option the resolution of the guest will not take on the resolution of the client. Signed-off-by: Vimal Patel --- tests/rv_fullscreen.py | 85 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tests/rv_fullscreen.py diff --git a/tests/rv_fullscreen.py b/tests/rv_fullscreen.py new file mode 100644 index 00000000..54faa271 --- /dev/null +++ b/tests/rv_fullscreen.py @@ -0,0 +1,85 @@ +""" +rv_fullscreen.py - remote-viewer full screen + Testing the remote-viewer --full-screen option + If successfull, the resolution of the guest will + take the resolution of the client. + +Requires: connected binaries remote-viewer, Xorg, gnome session + +""" +import logging +from autotest.client.shared import error +from virttest.aexpect import ShellCmdError + + +def run_rv_fullscreen(test, params, env): + """ + Tests the --full-screen option + Positive test: full_screen param = yes, verify guest res = client res + Negative test: full_screen param= no, verify guest res != client res + + @param test: KVM test object. + @param params: Dictionary with the test parameters. + @param env: Dictionary with test environment. + """ + # Get the parameters needed for the test + full_screen = params.get("full_screen") + guest_vm = env.get_vm(params["guest_vm"]) + client_vm = env.get_vm(params["client_vm"]) + + guest_vm.verify_alive() + guest_session = guest_vm.wait_for_login( + timeout=int(params.get("login_timeout", 360))) + + client_vm.verify_alive() + client_session = client_vm.wait_for_login( + timeout=int(params.get("login_timeout", 360))) + + # Get the resolution of the client & guest + logging.info("Getting the Resolution on the client") + client_session.cmd("export DISPLAY=:0.0") + + try: + client_res_raw = client_session.cmd("xrandr | grep '*'") + client_res = client_res_raw.split()[0] + except ShellCmdError: + raise error.TestFail("Could not get guest resolution, xrandr output:" + + " %s" % client_res_raw) + except IndexError: + raise error.TestFail("Could not get guest resolution, xrandr output:" + + " %s" % client_res_raw) + + logging.info("Getting the Resolution on the guest") + guest_session.cmd("export DISPLAY=:0.0") + + try: + guest_res_raw = guest_session.cmd("xrandr | grep '*'") + guest_res = guest_res_raw.split()[0] + except ShellCmdError: + raise error.TestFail("Could not get guest resolution, xrandr output:" + + " %s" % guest_res_raw) + except IndexError: + raise error.TestFail("Could not get guest resolution, xrandr output:" + + " %s" % guest_res_raw) + + logging.info("Here's the information I have: ") + logging.info("\nClient Resolution: " + client_res) + logging.info("\nGuest Resolution: " + guest_res) + + # Positive Test, verify the guest takes the resolution of the client + if full_screen == "yes": + if(client_res == guest_res): + logging.info("PASS: Guest resolution is the same as the client") + else: + raise error.TestFail("Guest resolution is the same as the client") + # Negative Test, verify the resolutions are not equal + elif full_screen == "no": + if(client_res != guest_res): + logging.info("PASS: Guest resolution differs from the client") + else: + raise error.TestFail("Guest resolution differs from the client") + else: + raise error.TestFail("The test setup is incorrect.") + + client_session.close() + guest_session.close() -- GitLab