提交 7fb5d9f0 编写于 作者: L Lucas Meneghel Rodrigues

Merge pull request #1142 from spiceqa/upstream

Spice tests updates/extensions (v3) (was #1076)
......@@ -4,12 +4,13 @@ image_size = 20G
spice_seamless_migration = on
drive_cache=none
# Use non-root user for Spice tests rather than root
# Use non-root user for Spice tests rather than root
# since User gnome session is needed.
username=test
password=123456
proxy_ip= #supply IP of HTTP proxy
# Use static MAC addresses for spice tests to have
# Use static MAC addresses for spice tests to have
# the same IP in all test.
#nics = nic1 nic2
#nics_vm1 = nic1
......@@ -30,7 +31,7 @@ gencerts=None
# Only qcow2 file format
only qcow2
# Only e1000 for nw card
# Only e1000 for nw card
only e1000
# Only ide hard drives
only ide
......@@ -216,7 +217,7 @@ variants:
only os.Windows
# Subtest choice. You can modify that line to add more subtests
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only unattended_install.cdrom
only unattended_install.cdrom.default_install.aio_native
- qemu_kvm_rhel6devel_install_guest:
only os.RHEL
......@@ -226,12 +227,12 @@ variants:
- @remote_viewer_rhel6develssl:
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.ssl.key_password.password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64
- @remote_viewer_rhel6devel_quick:
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64
- @remote_viewer_rhel6devel_password:
only os.RHEL
......@@ -244,19 +245,25 @@ variants:
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_build_install.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64
- @remote_viewer_win_guest_quick:
only os.Windows
only os.Windows
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
#rv_connect_win is specifically a test meant for a windows guest and a rhel client, rv_connect cannot be used.
only rv.rw.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rw.rv_connect.RHEL.6.devel.x86_64
- @spice_negative_rhel6devel:
only os.RHEL
only negative_create
- remote_viewer_verify_only:
only os.RHEL
rv_verify = yes
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64
- @rv_disconnect_rhel6devel:
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64
- @spice_migrate_rhel6devel:
kill_on_vms = "client_vm"
......@@ -265,60 +272,62 @@ variants:
variants:
- no_ssl:
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_migrate.default.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_migrate.default.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64
- ssl:
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.ssl.key_password.password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_migrate.default.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_migrate.default.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64
- ssl_reboot:
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.ssl.key_password.password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_migrate.with_reboot.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_migrate.with_reboot.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64
- ssl_video:
kill_app_name = "totem"
kill_on_vms = "guest_vm"
iterations = 1
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.ssl.key_password.password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_video.RHEL.6.devel.x86_64, rv.rr.rv_migrate.default.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_video.RHEL.6.devel.x86_64, rv.rr.rv_migrate.default.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64
- ssl_vdagent:
config_test = "positive_client_to_guest"
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.ssl.key_password.password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_migrate.default.RHEL.6.devel.x86_64, rv.rr.rv_copyandpaste.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_migrate.default.RHEL.6.devel.x86_64, rv.rr.rv_copyandpaste.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64
- @rv_fullscreen_rhel6devel:
spice_port=3000
spice_port = 3000
clear_interface = no
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.fullscreen_setup.RHEL.6.devel.x86_64, rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_fullscreen.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.password.dcp_off.1monitor.default_sc
only rv.rr.fullscreen_setup.RHEL.6.devel.x86_64, rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_fullscreen.RHEL.6.devel.x86_64
- @rv_smartcard_rhel6devel:
spice_port=3000
spice_port = 3000
clear_interface = no
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.smartcard
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.smartcard_setup.RHEL.6.devel.x86_64, rv.rr.rv_smartcard.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.smartcard_setup.RHEL.6.devel.x86_64, rv.rr.rv_smartcard.RHEL.6.devel.x86_64
- @rv_logging_rhel6devel:
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_logging.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_logging.RHEL.6.devel.x86_64
- @rv_vdagent_rhel6devel:
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_vdagent.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_vdagent.RHEL.6.devel.x86_64
- @rv_copyandpaste_rhel6devel:
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_copyandpaste.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_copyandpaste.RHEL.6.devel.x86_64
- @rv_copyandpaste_dcp_rhel6devel:
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_on.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_copyandpaste.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_copyandpaste.RHEL.6.devel.x86_64
- @rv_input_rhel6devel:
only os.RHEL
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_input.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_input.RHEL.6.devel.x86_64
- @rv_audio_rhel6devel:
only os.RHEL
......@@ -326,10 +335,10 @@ variants:
variants:
- pc:
only spice.default_ipv.pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_audio.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_audio.RHEL.6.devel.x86_64
- no_pc:
only spice.default_ipv.no_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_audio.RHEL.6.devel.x86_64, rv.rr.rv_clearx.RHEL.6.devel.x86_64
only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_audio.RHEL.6.devel.x86_64
- @rv_vmshutdown_rhel6devel:
only os.RHEL
......@@ -358,7 +367,7 @@ variants:
only remote_viewer_rhel6devel_build_install
- build_install_spicegtk:
build_install_pkg = spice-gtk
vm_name = client
vm_name = client
dst_dir = /tmp
celt051_devel_url = path_to_celt051_rpm
libogg_devel_url = path_to_libogg_rpm
......@@ -398,7 +407,7 @@ variants:
- rv_connect_passwd:
only remote_viewer_rhel6devel_password
- rv_connect_menu:
rv_menu=yes
rv_parameters_from = menu
only remote_viewer_rhel6devel_quick
- rv_connect_wrong_passwd:
test_type = negative
......@@ -616,8 +625,8 @@ variants:
- disable_audio:
audio_tgt = "~/tone.wav"
audio_rec = "~/rec.wav"
audio_src = #path to your audio file (recommend generating a square/sine wave)
disable_audio = "yes"
audio_src = #path to your audio file (recommend generating a square/sine wave)
only rv_audio_rhel6devel.pc
- migrate_audio:
audio_tgt = "~/tone.wav"
......@@ -649,9 +658,32 @@ variants:
- spice_vdagent_logging:
logtest = spice-vdagent
only rv_logging_rhel6devel
- rv_proxy:
spice_proxy = http://${proxy_ip}
only remote_viewer_rhel6devel_quick
- rv_from_file_basic:
rv_parameters_from = file
only remote_viewer_rhel6devel_quick
- rv_from_file_proxy:
spice_proxy = http://${proxy_ip}
rv_parameters_from = file
only remote_viewer_rhel6devel_quick
- rv_from_file_ssl:
rv_parameters_from = file
only remote_viewer_rhel6develssl
- proxy_migrate:
spice_proxy = http://${proxy_ip}:3128
only spice_migrate_rhel6devel.no_ssl
- rv_from_file_password:
rv_parameters_from = file
only remote_viewer_rhel6devel_password
- rv_from_file_fullscreen:
full_screen = yes
rv_parameters_from = file
only rv_fullscreen_rhel6devel
#Running all RHEL Client, RHEL Guest Spice Tests
only create_vms, negative_qemu_spice_launch_badport, negative_qemu_spice_launch_badic, negative_qemu_spice_launch_badjpegwc, negative_qemu_spice_launch_badzlib, negative_qemu_spice_launch_badsv, negative_qemu_spice_launch_badpc, remote_viewer_test, remote_viewer_ssl_test, remote_viewer_disconnect_test, guestvmshutdown_cmd, guestvmshutdown_qemu, copy_client_to_guest_largetext_pos, copy_guest_to_client_largetext_pos, copy_client_to_guest_pos, copy_guest_to_client_pos, copy_guest_to_client_neg, copy_client_to_guest_neg, copyimg_client_to_guest_pos, copyimg_client_to_guest_neg, copyimg_guest_to_client_pos, copyimg_guest_to_client_neg, copyimg_client_to_guest_dcp_neg, copyimg_guest_to_client_dcp_neg, copy_guest_to_client_dcp_neg, copy_client_to_guest_dcp_neg, copybmpimg_client_to_guest_pos, copybmpimg_guest_to_client_pos, copy_guest_to_client_largetext_10mb_pos, copy_client_to_guest_largetext_10mb_pos, copyimg_medium_client_to_guest_pos, copyimg_medium_guest_to_client_pos, copyimg_large_client_to_guest_pos, copyimg_large_guest_to_client_pos, restart_vdagent_copy_client_to_guest_pos, restart_vdagent_copy_guest_to_client_pos, restart_vdagent_copyimg_client_to_guest_pos, restart_vdagent_copyimg_guest_to_client_pos, restart_vdagent_copybmpimg_client_to_guest_pos, restart_vdagent_copybmpimg_guest_to_client_pos, restart_vdagent_copy_client_to_guest_largetext_pos, restart_vdagent_copy_guest_to_client_largetext_pos, remote_viewer_fullscreen_test, remote_viewer_fullscreen_test_neg, spice_vdagent_logging, qxl_logging, keyboard_input_leds_and_esc_keys, keyboard_input_non-us_layout, keyboard_input_type_and_func_keys, keyboard_input_leds_migration, rv_connect_passwd, rv_connect_wrong_passwd, rv_qemu_password, rv_qemu_password_overwrite, spice_migrate_simple, spice_migrate_ssl, spice_migrate_reboot, spice_migrate_video, spice_migrate_vdagent, rv_ssl_invalid_explicit_hs, rv_ssl_invalid_implicit_hs, rv_ssl_implicit_hs, rv_ssl_explicit_hs, rv_connect_menu, audio_compression, audio_no_compression, disable_audio, migrate_audio, remote_viewer_ipv6_addr, rv_qemu_report_ipv6, start_vdagent_test, stop_vdagent_test, restart_start_vdagent_test, restart_stop_vdagent_test, remote_viewer_smartcard_certdetail, remote_viewer_smartcard_certinfo
only create_vms, negative_qemu_spice_launch_badport, negative_qemu_spice_launch_badic, negative_qemu_spice_launch_badjpegwc, negative_qemu_spice_launch_badzlib, negative_qemu_spice_launch_badsv, negative_qemu_spice_launch_badpc, remote_viewer_test, remote_viewer_ssl_test, remote_viewer_disconnect_test, guestvmshutdown_cmd, guestvmshutdown_qemu, copy_client_to_guest_largetext_pos, copy_guest_to_client_largetext_pos, copy_client_to_guest_pos, copy_guest_to_client_pos, copy_guest_to_client_neg, copy_client_to_guest_neg, copyimg_client_to_guest_pos, copyimg_client_to_guest_neg, copyimg_guest_to_client_pos, copyimg_guest_to_client_neg, copyimg_client_to_guest_dcp_neg, copyimg_guest_to_client_dcp_neg, copy_guest_to_client_dcp_neg, copy_client_to_guest_dcp_neg, copybmpimg_client_to_guest_pos, copybmpimg_guest_to_client_pos, copy_guest_to_client_largetext_10mb_pos, copy_client_to_guest_largetext_10mb_pos, copyimg_medium_client_to_guest_pos, copyimg_medium_guest_to_client_pos, copyimg_large_client_to_guest_pos, copyimg_large_guest_to_client_pos, restart_vdagent_copy_client_to_guest_pos, restart_vdagent_copy_guest_to_client_pos, restart_vdagent_copyimg_client_to_guest_pos, restart_vdagent_copyimg_guest_to_client_pos, restart_vdagent_copybmpimg_client_to_guest_pos, restart_vdagent_copybmpimg_guest_to_client_pos, restart_vdagent_copy_client_to_guest_largetext_pos, restart_vdagent_copy_guest_to_client_largetext_pos, remote_viewer_fullscreen_test, remote_viewer_fullscreen_test_neg, spice_vdagent_logging, qxl_logging, keyboard_input_leds_and_esc_keys, keyboard_input_non-us_layout, keyboard_input_type_and_func_keys, keyboard_input_leds_migration, rv_connect_passwd, rv_connect_wrong_passwd, rv_qemu_password, rv_qemu_password_overwrite, spice_migrate_simple, spice_migrate_ssl, spice_migrate_reboot, spice_migrate_video, spice_migrate_vdagent, rv_ssl_invalid_explicit_hs, rv_ssl_invalid_implicit_hs, rv_ssl_implicit_hs, rv_ssl_explicit_hs, rv_connect_menu, audio_compression, audio_no_compression, disable_audio, migrate_audio, remote_viewer_ipv6_addr, rv_qemu_report_ipv6, start_vdagent_test, stop_vdagent_test, restart_start_vdagent_test, restart_stop_vdagent_test, remote_viewer_smartcard_certdetail, remote_viewer_smartcard_certinfo, rv_proxy, rv_from_file_basic, rv_from_file_proxy, rv_from_file_ssl, proxy_migrate, rv_from_file_password, rv_from_file_fullscreen
#Running all RHEL Client, Windows Guest Spice Tests
#only install_win_guest, remote_viewer_winguest_test
......
......@@ -44,6 +44,7 @@ def run_client_guest_shutdown(test, params, env):
"(system_powerdown monitor cmd)")
if not utils_misc.wait_for(vm.is_dead, 240, 0, 1):
vm.destroy(gracefully=False, free_mac_addresses=True)
raise error.TestFail("Guest refuses to go down")
finally:
......
......@@ -7,7 +7,7 @@ the same setup will result in them having the same resolution.
"""
import logging
from virttest import utils_spice, aexpect
from virttest import utils_spice
def run_fullscreen_setup(test, params, env):
......@@ -25,12 +25,20 @@ def run_fullscreen_setup(test, params, env):
# Get necessary params
test_timeout = float(params.get("test_timeout", 600))
utils_spice.wait_timeout(20)
for vm in params.get("vms").split():
utils_spice.clear_interface(env.get_vm(vm),
int(params.get("login_timeout", "360")))
utils_spice.wait_timeout(20)
guest_vm = env.get_vm(params["guest_vm"])
guest_vm.verify_alive()
guest_session = guest_vm.wait_for_login(
timeout=int(params.get("login_timeout", 360)))
utils_spice.wait_timeout(10)
timeout=int(params.get("login_timeout", 360)))
guest_root_session = guest_vm.wait_for_login(username="root",
password="123456")
logging.debug("Exporting guest display")
guest_session.cmd("export DISPLAY=:0.0")
......@@ -62,7 +70,7 @@ def run_fullscreen_setup(test, params, env):
current + " to: " + resolution)
# Start vdagent daemon
utils_spice.start_vdagent(guest_session, test_timeout)
utils_spice.start_vdagent(guest_root_session, test_timeout)
client_vm = env.get_vm(params["client_vm"])
client_vm.verify_alive()
......
......@@ -20,7 +20,7 @@ def verify_recording(recording, params):
rec = open(recording).read()
disable_audio = params.get("disable_audio", "no")
threshold = int(params.get("rv_audio_threshold", "15000"))
threshold = int(params.get("rv_audio_threshold", "25000"))
config_test = params.get("config_test", None)
if (len(rec) - rec.count('\0') < 50):
......
......@@ -11,8 +11,7 @@ import time
import re
from autotest.client.shared import error
from virttest.aexpect import ShellCmdError
from virttest import utils_misc, utils_spice, aexpect
from qemu.tests import rv_clearx, rv_input
from virttest import utils_misc, utils_spice
def connect_to_vm(vm_name, env, params):
......@@ -32,7 +31,6 @@ def connect_to_vm(vm_name, env, params):
logging.info("VM %s is up and running" % vm_name)
return (vm, vm_root_session)
def install_req_pkgs(pkgsRequired, vm_root_session, params):
"""
Checks to see if packages are installed and if not, installs the package
......@@ -54,7 +52,6 @@ def install_req_pkgs(pkgsRequired, vm_root_session, params):
except ShellCmdError:
logging.info("Could not install %s" % pkgName)
def build_install_qxl(vm_root_session, vm_script_path, params):
"""
Build and install QXL in the VM
......@@ -65,7 +62,8 @@ def build_install_qxl(vm_root_session, vm_script_path, params):
"""
# Checking to see if required packages exist and if not, install them
pkgsRequired = ["libpciaccess-devel", "xorg-x11-util-macros", "xorg-x11-server-devel"]
pkgsRequired = ["libpciaccess-devel", "xorg-x11-util-macros",
"xorg-x11-server-devel"]
install_req_pkgs(pkgsRequired, vm_root_session, params)
# latest spice-protocol is required to build qxl
......@@ -79,7 +77,6 @@ def build_install_qxl(vm_root_session, vm_script_path, params):
if re.search("Return code", output):
raise error.TestFail("qxl was not installed properly")
def build_install_spicegtk(vm_root_session, vm_script_path, params):
"""
Build and install spice-gtk in the VM
......@@ -91,7 +88,8 @@ def build_install_spicegtk(vm_root_session, vm_script_path, params):
# Get version of spice-gtk before install
try:
output = vm_root_session.cmd("LD_LIBRARY_PATH=/usr/local/lib remote-viewer --spice-gtk-version")
output = vm_root_session.cmd("LD_LIBRARY_PATH=/usr/local/lib"
" remote-viewer --spice-gtk-version")
logging.info(output)
except ShellCmdError:
logging.error(output)
......@@ -99,10 +97,11 @@ def build_install_spicegtk(vm_root_session, vm_script_path, params):
pkgsRequired = ["libogg-devel", "celt051-devel", "libcacard-devel"]
install_req_pkgs(pkgsRequired, vm_root_session, params)
rv_input.deploy_epel_repo(vm_root_session, params)
utils_spice.deploy_epel_repo(vm_root_session, params)
try:
output = vm_root_session.cmd("yum -y install perl-Text-CSV pyparsing", timeout=300)
output = vm_root_session.cmd("yum -y install perl-Text-CSV pyparsing",
timeout=300)
logging.info(output)
except ShellCmdError:
logging.error(output)
......@@ -113,19 +112,20 @@ def build_install_spicegtk(vm_root_session, vm_script_path, params):
if re.search("Return code", output):
raise error.TestFail("spice-protocol was not installed properly")
output = vm_root_session.cmd("%s -p spice-gtk" % (vm_script_path), timeout=300)
output = vm_root_session.cmd("%s -p spice-gtk" % (vm_script_path),
timeout=300)
logging.info(output)
if re.search("Return code", output):
raise error.TestFail("spice-gtk was not installed properly")
# Get version of spice-gtk after install
try:
output = vm_root_session.cmd("LD_LIBRARY_PATH=/usr/local/lib remote-viewer --spice-gtk-version")
output = vm_root_session.cmd("LD_LIBRARY_PATH=/usr/local/lib"
" remote-viewer --spice-gtk-version")
logging.info(output)
except ShellCmdError:
logging.error(output)
def build_install_vdagent(vm_root_session, vm_script_path, params):
"""
Build and install spice-vdagent in the VM
......@@ -172,7 +172,6 @@ def build_install_vdagent(vm_root_session, vm_script_path, params):
except ShellCmdError:
logging.error(output)
def run_rv_build_install(test, params, env):
"""
Build and install packages from git on the client or guest VM
......@@ -221,4 +220,4 @@ def run_rv_build_install(test, params, env):
logging.info("Not supported right now")
raise error.TestFail("Incorrect Test_Setup")
rv_clearx.run_rv_clearx(test, params, env)
utils_spice.clear_interface(vm)
"""
This restarts the x server on all vms by killing gdm in order to eliminate any
side effects and running applications that might interfere with tests.
"""
import logging
from autotest.client.shared import error
from virttest.aexpect import ShellCmdError
from virttest import utils_misc
def is_pid_alive(session, pid):
try:
session.cmd("ps -p %s" % pid)
except ShellCmdError:
return False
return True
def run_rv_clearx(test, params, env):
for vm_name in params.get("vms").split():
vm = env.get_vm(vm_name)
logging.info("restarting X on: %s", vm_name)
session = vm.wait_for_login(username="root", password="123456",
timeout=int(params.get("login_timeout", 360)))
pid = session.cmd("pgrep Xorg")
session.cmd("killall Xorg")
utils_misc.wait_for(lambda: is_pid_alive(session, pid), 10, 5, 0.2)
try:
session.cmd("ps -C Xorg")
except:
raise error.TestFail("X not running")
......@@ -6,7 +6,6 @@ Requires: binaries remote-viewer, Xorg, netstat
"""
import logging
import sys
import socket
from virttest.aexpect import ShellStatusError
from virttest.aexpect import ShellProcessTerminatedError
......@@ -59,43 +58,79 @@ def launch_rv(client_vm, guest_vm, params):
"""
rv_binary = params.get("rv_binary", "remote-viewer")
rv_ld_library_path = params.get("rv_ld_library_path")
display = params.get("display")
proxy = params.get("spice_proxy", None)
if proxy:
try:
socket.inet_aton(params.get("proxy_ip", None))
except socket.error:
raise error.TestNAError('Parameter proxy_ip not changed from default values')
host_ip = utils_net.get_host_ip_address(params)
host_port = None
if guest_vm.get_spice_var("listening_addr") == "ipv6":
host_ip = "[" + utils_misc.convert_ipv4_to_ipv6(host_ip) + "]"
host_ip = ("[" + utils_misc.convert_ipv4_to_ipv6(host_ip) +
"]")
host_tls_port = None
disable_audio = params.get("disable_audio", "no")
full_screen = params.get("full_screen")
check_spice_info = params.get("spice_info")
ssltype = params.get("ssltype")
test_type = params.get("test_type")
host_port = None
full_screen = params.get("full_screen")
disable_audio = params.get("disable_audio", "no")
display = params.get("display")
# cmd var keeps final remote-viewer command line
# to be executed on client
cmd = rv_binary
if client_vm.params.get("os_type") != "windows":
cmd = cmd + " --display=:0.0"
# If qemu_ticket is set, set the password
# of the VM using the qemu-monitor
ticket = None
ticket_send = params.get("spice_password_send")
qemu_ticket = params.get("qemu_password")
gencerts = params.get("gencerts")
certdb = params.get("certdb")
smartcard = params.get("smartcard")
menu = params.get("rv_menu", None)
# cmd var keeps final remote-viewer command line to be executed on client
cmd = rv_binary + " --display=:0.0"
# If qemu_ticket is set, set the password of the VM using the qemu-monitor
if qemu_ticket:
guest_vm.monitor.cmd("set_password spice %s" % qemu_ticket)
logging.info("Sending to qemu monitor: set_password spice %s"
% qemu_ticket)
gencerts = params.get("gencerts")
certdb = params.get("certdb")
smartcard = params.get("smartcard")
host_subj = None
cacert = None
rv_parameters_from = params.get("rv_parameters_from", "cmd")
if rv_parameters_from == 'file':
cmd += " ~/rv_file.vv"
client_session = client_vm.wait_for_login(
timeout=int(params.get("login_timeout", 360)))
if display == "spice":
ticket = guest_vm.get_spice_var("spice_password")
if guest_vm.get_spice_var("spice_ssl") == "yes":
host_tls_port = guest_vm.get_spice_var("spice_tls_port")
host_port = guest_vm.get_spice_var("spice_port")
# client needs cacert file
cacert = "%s/%s" % (guest_vm.get_spice_var("spice_x509_prefix"),
guest_vm.get_spice_var("spice_x509_cacert_file"))
client_session.cmd("rm -rf %s && mkdir -p %s" % (
guest_vm.get_spice_var("spice_x509_prefix"),
guest_vm.get_spice_var("spice_x509_prefix")))
remote.copy_files_to(client_vm.get_address(), 'scp',
params.get("username"),
params.get("password"),
params.get("shell_port"),
cacert, cacert)
host_tls_port = guest_vm.get_spice_var("spice_tls_port")
host_port = guest_vm.get_spice_var("spice_port")
# cacert subj is in format for create certificate(with '/' delimiter)
# remote-viewer needs ',' delimiter. And also is needed to remove
# first character (it's '/')
......@@ -112,36 +147,35 @@ def launch_rv(client_vm, guest_vm, params):
hostname = socket.gethostname()
if ssltype == "invalid_implicit_hs":
spice_url = " spice://%s?tls-port=%s\&port=%s" % (hostname,
host_tls_port, host_port)
host_tls_port,
host_port)
else:
spice_url = " spice://%s?tls-port=%s\&port=%s" % (host_ip,
host_tls_port, host_port)
host_tls_port,
host_port)
if menu == "yes":
if rv_parameters_from == "menu":
line = spice_url
elif rv_parameters_from == "file":
pass
else:
cmd += spice_url
cmd += " --spice-ca-file=%s" % cacert
if not rv_parameters_from == "file":
cmd += " --spice-ca-file=%s" % cacert
if params.get("spice_client_host_subject") == "yes":
if (params.get("spice_client_host_subject") == "yes" and not
rv_parameters_from == "file"):
cmd += " --spice-host-subject=\"%s\"" % host_subj
# client needs cacert file
client_session.cmd("rm -rf %s && mkdir -p %s" % (
guest_vm.get_spice_var("spice_x509_prefix"),
guest_vm.get_spice_var("spice_x509_prefix")))
remote.copy_files_to(client_vm.get_address(), 'scp',
params.get("username"),
params.get("password"),
params.get("shell_port"),
cacert, cacert)
else:
host_port = guest_vm.get_spice_var("spice_port")
if menu == "yes":
if rv_parameters_from == "menu":
# line to be sent through monitor once r-v is started
# without spice url
line = "spice://%s?port=%s" % (host_ip, host_port)
elif rv_parameters_from == "file":
pass
else:
cmd += " spice://%s?port=%s" % (host_ip, host_port)
......@@ -152,7 +186,7 @@ def launch_rv(client_vm, guest_vm, params):
raise Exception("Unsupported display value")
# Check to see if the test is using the full screen option.
if full_screen == "yes":
if full_screen == "yes" and not rv_parameters_from == "file":
logging.info("Remote Viewer Set to use Full Screen")
cmd += " --full-screen"
......@@ -163,7 +197,8 @@ def launch_rv(client_vm, guest_vm, params):
# Check to see if the test is using a smartcard.
if smartcard == "yes":
logging.info("remote viewer Set to use a smartcard")
cmd += " --spice-smartcard"
if not rv_parameters_from == file:
cmd += " --spice-smartcard"
if certdb is not None:
logging.debug("Remote Viewer set to use the following certificate"
......@@ -175,10 +210,16 @@ def launch_rv(client_vm, guest_vm, params):
gencerts)
cmd += " --spice-smartcard-certificates " + gencerts
if rv_ld_library_path:
cmd = "export LD_LIBRARY_PATH=" + rv_ld_library_path + "; nohup " + cmd + " &> /dev/null &" # Launch it on background
else:
if client_vm.params.get("os_type") == "linux":
cmd = "nohup " + cmd + " &> /dev/null &" # Launch it on background
if rv_ld_library_path:
cmd = "export LD_LIBRARY_PATH=" + rv_ld_library_path + ";" + cmd
if rv_parameters_from == "file":
print "Generating file"
utils_spice.gen_rv_file(params, guest_vm, host_subj, cacert)
print "Uploading file to client"
client_vm.copy_files_to("rv_file.vv", "~/rv_file.vv")
# Launching the actual set of commands
try:
......@@ -194,40 +235,55 @@ def launch_rv(client_vm, guest_vm, params):
"print versions of remote-viewer or spice-gtk")
logging.info("Launching %s on the client (virtual)", cmd)
try:
client_session.cmd(cmd)
except ShellStatusError:
logging.debug("Ignoring a status exception, will check connection of"
"remote-viewer later")
# Send command line through monitor since r-v was started without spice url
if menu == "yes":
utils_spice.wait_timeout(1)
str_input(client_vm, line)
client_vm.send_key("tab")
client_vm.send_key("tab")
client_vm.send_key("tab")
client_vm.send_key("kp_enter")
# client waits for user entry (authentication) if spice_password is set
# use qemu monitor password if set, else check if the normal password is
# set
if qemu_ticket:
# Wait for remote-viewer to launch
utils_spice.wait_timeout(5)
str_input(client_vm, qemu_ticket)
elif ticket:
if ticket_send:
ticket = ticket_send
utils_spice.wait_timeout(5) # Wait for remote-viewer to launch
str_input(client_vm, ticket)
if proxy:
if "http" in proxy:
split = proxy.split('//')[1].split(':')
else:
split = proxy.split(':')
host_ip = split[0]
if len(split) > 1:
host_port = split[1]
else:
host_port = "3128"
if rv_parameters_from != "file":
client_session.cmd("export SPICE_PROXY=%s" % proxy)
if not params.get("rv_verify") == "only":
try:
client_session.cmd(cmd)
except ShellStatusError:
logging.debug("Ignoring a status exception, will check connection"
"of remote-viewer later")
# Send command line through monitor since url was not provided
if rv_parameters_from == "menu":
utils_spice.wait_timeout(1)
str_input(client_vm, line)
# client waits for user entry (authentication) if spice_password is set
# use qemu monitor password if set, else, if set, try normal password.
if qemu_ticket:
# Wait for remote-viewer to launch
utils_spice.wait_timeout(5)
str_input(client_vm, qemu_ticket)
elif ticket:
if ticket_send:
ticket = ticket_send
utils_spice.wait_timeout(5) # Wait for remote-viewer to launch
str_input(client_vm, ticket)
utils_spice.wait_timeout(5) # Wait for conncetion to establish
utils_spice.wait_timeout(5) # Wait for conncetion to establish
is_rv_connected = True
try:
utils_spice.verify_established(
client_vm, host_ip, host_port, rv_binary)
utils_spice.verify_established(client_vm, host_ip,
host_port, rv_binary,
host_tls_port,
params.get("spice_secure_channels",
None))
except utils_spice.RVConnectError:
if test_type == "negative":
logging.info("remote-viewer connection failed as expected")
......@@ -268,8 +324,9 @@ def launch_rv(client_vm, guest_vm, params):
" from the qemu monitor")
# prevent from kill remote-viewer after test finish
cmd = "disown -ar"
client_session.cmd(cmd)
if client_vm.params.get("os_type") == "linux":
cmd = "disown -ar"
client_session.cmd_output(cmd)
def run_rv_connect(test, params, env):
......@@ -285,6 +342,7 @@ def run_rv_connect(test, params, env):
"""
guest_vm = env.get_vm(params["guest_vm"])
guest_vm.verify_alive()
guest_session = guest_vm.wait_for_login(
timeout=int(params.get("login_timeout", 360)))
......@@ -294,7 +352,16 @@ def run_rv_connect(test, params, env):
client_session = client_vm.wait_for_login(
timeout=int(params.get("login_timeout", 360)))
utils_spice.wait_timeout(15)
if (client_vm.params.get("os_type") == "windows" and
client_vm.params.get("rv_installer", None)):
utils_spice.install_rv_win(client_vm, params.get("rv_installer"))
return
if params.get("clear_interface", "yes") == "yes":
for vm in params.get("vms").split():
utils_spice.clear_interface(env.get_vm(vm),
int(params.get("login_timeout", "360")))
utils_spice.wait_timeout(15)
launch_rv(client_vm, guest_vm, params)
......
......@@ -3,7 +3,9 @@ rv_input.py - test keyboard inputs through spice
Requires: Two VMs - client and guest and remote-viewer session
from client VM to guest VM created by rv_connect test.
Deployed wxPython on guest VM.
Deployed PyGTK on guest VM.
Presumes the numlock state at startup is 'OFF'.
"""
import logging
......@@ -13,57 +15,21 @@ from virttest.aexpect import ShellCmdError
from virttest import utils_misc, utils_spice, aexpect
def deploy_epel_repo(guest_session, params):
"""
Deploy epel repository to RHEL VM If It's RHEL6 or 5.
:param guest_session - ssh session to guest VM
:param params
"""
# Check existence of epel repository
cmd = ("if [ ! -f /etc/yum.repos.d/epel.repo ]; then echo"
" \"NeedsInstall\"; fi")
output = guest_session.cmd(cmd, timeout=10)
# Install epel repository If needed
if "NeedsInstall" in output:
arch = guest_session.cmd("arch")
if "i686" in arch:
arch = "i386"
else:
arch = arch[:-1]
if "release 5" in guest_session.cmd("cat /etc/redhat-release"):
cmd = ("yum -y localinstall http://download.fedoraproject.org/"
"pub/epel/5/%s/epel-release-5-4.noarch.rpm 2>&1" % arch)
logging.info("Installing epel repository to %s",
params.get("guest_vm"))
guest_session.cmd(cmd, print_func=logging.info, timeout=90)
elif "release 6" in guest_session.cmd("cat /etc/redhat-release"):
cmd = ("yum -y localinstall http://download.fedoraproject.org/"
"pub/epel/6/%s/epel-release-6-8.noarch.rpm 2>&1" % arch)
logging.info("Installing epel repository to %s",
params.get("guest_vm"))
guest_session.cmd(cmd, print_func=logging.info, timeout=90)
else:
raise Exception("Unsupported RHEL guest")
def install_wxpython(guest_session, params):
def install_pygtk(guest_session, params):
"""
Install wxPython to a VM with yum package manager.
Requires epel repository for RHEL guest.
Install PyGTK to a VM with yum package manager.
:param guest_session - ssh session to guest VM
:param params
"""
cmd = "rpm -q wxPython"
cmd = "rpm -q pygtk2"
try:
guest_session.cmd(cmd)
except ShellCmdError:
cmd = "yum -y install wxPython --nogpgcheck > /dev/null"
logging.info("Installing wxPython package to %s",
params.get("guest_vm"))
cmd = "yum -y install pygtk2 --nogpgcheck > /dev/null"
logging.info("Installing pygtk2 package to %s",
params.get("guest_vm"))
guest_session.cmd(cmd, timeout=60)
......@@ -143,7 +109,7 @@ def test_leds_and_esc_keys(client_vm, guest_session, params):
:param params
"""
# Run wxPython form catching KeyEvents on guest
#Run PyGTK form catching KeyEvents on guest
run_test_form(guest_session, params)
utils_spice.wait_timeout(3)
......@@ -174,7 +140,7 @@ def test_nonus_layout(client_vm, guest_session, params):
:param params
"""
# Run wxPython form catching KeyEvents on guest
#Run PyGTK form catching KeyEvents on guest
run_test_form(guest_session, params)
utils_spice.wait_timeout(3)
......@@ -212,7 +178,16 @@ def test_leds_migration(client_vm, guest_vm, guest_session, params):
:param params
"""
# Run wxPython form catching KeyEvents on guest
# Turn numlock on RHEL6 on before the test begins:
grep_ver_cmd = "grep -o 'release [[:digit:]]' /etc/redhat-release"
rhel_ver = guest_session.cmd(grep_ver_cmd).strip()
logging.info("RHEL version: #{0}#".format(rhel_ver))
if rhel_ver == "release 6":
client_vm.send_key('num_lock')
#Run PyGTK form catching KeyEvents on guest
run_test_form(guest_session, params)
utils_spice.wait_timeout(3)
......@@ -224,10 +199,10 @@ def test_leds_migration(client_vm, guest_vm, guest_session, params):
utils_spice.wait_timeout(0.3)
guest_vm.migrate()
utils_spice.wait_timeout(5)
utils_spice.wait_timeout(8)
# Tested keys after migration
test_keys = ['a', 'kp_1']
#Tested keys after migration
test_keys = ['a', 'kp_1', 'caps_lock', 'num_lock']
logging.info("Sending leds keys to client machine after migration")
for key in test_keys:
client_vm.send_key(key)
......@@ -244,33 +219,38 @@ def analyze_results(file_path, test_type):
"""
if test_type == "type_and_func_keys":
# List of expected keycodes from guest machine
correct_keycodes = ['27', '49', '50', '51', '52', '53', '54', '55',
'56', '57', '48', '45', '61', '8', '9', '113',
'119', '101', '114', '116', '121', '117', '105',
'111', '112', '91', '93', '13', '97', '115', '100',
'102', '103', '104', '106', '107', '108', '59',
'39', '96', '92', '122', '120', '99', '118', '98',
'110', '109', '44', '46', '47', '32', '340', '341',
'342', '343', '344', '345', '346', '347', '348',
'349']
#List of expected keycodes from guest machine
correct_keycodes = ['65307', '49', '50', '51', '52', '53', '54', '55',
'56', '57', '48', '45', '61', '65288', '65289',
'113', '119', '101', '114', '116', '121', '117',
'105', '111', '112', '91', '93', '65293', '97',
'115', '100', '102', '103', '104', '106', '107',
'108', '59', '39', '96', '92', '122', '120', '99',
'118', '98', '110', '109', '44', '46', '47', '32',
'65470', '65471', '65472', '65473', '65474',
'65475', '65476', '65477', '65478', '65479']
elif test_type == "leds_and_esc_keys":
correct_keycodes = ['97', '65', '49', '312', '97', '65', '65', '1',
'3', '22', '120', '322', '127', '313', '312', '366',
'367', '315', '317', '316', '314']
correct_keycodes = ['97', '65509', '65', '65509', '65407', '65457',
'65407', '65436', '97', '65505', '65', '65506',
'65', '65507', '97', '65507', '99', '65507', '118',
'65513', '120', '65379', '65535', '65360', '65367',
'65365', '65366', '65362', '65364', '65363',
'65361']
elif test_type == "nonus_layout":
correct_keycodes = ['253', '225', '237', '233', '35', '38', '64',
'223', '252', '64', '181']
correct_keycodes = ['253', '225', '237', '233', '65027', '35', '65027',
'38', '65027', '64', '223', '252', '65027', '64',
'65027', '181']
elif test_type == "leds_migration":
correct_keycodes = ['97', '312', '65', '49', '65', '49']
correct_keycodes = ['97', '65457', '65509', '65407', '65', '65436',
'65', '65436', '65509', '65407']
# Read caught keycodes on guest machine
fileobj = open(file_path, "r")
keycodes = fileobj.read()
fileobj.close()
# Compare caught keycodes with expected keycodes
test_keycodes = keycodes.split(",")
#Compare caught keycodes with expected keycodes
test_keycodes = keycodes.split()
logging.info("Caught keycodes:%s", test_keycodes)
for i in range(len(correct_keycodes)):
if not (test_keycodes[i] == correct_keycodes[i]):
......@@ -298,14 +278,8 @@ def run_rv_input(test, params, env):
guest_session = guest_vm.wait_for_login(
timeout=int(params.get("login_timeout", 360)))
guest_root_session = guest_vm.wait_for_login(
timeout=int(params.get("login_timeout", 360)),
username="root", password="123456")
try:
guest_session.cmd("! test -e /etc/redhat-release")
except ShellCmdError:
deploy_epel_repo(guest_root_session, params)
# utils_spice.launch_startx(guest_vm)
timeout=int(params.get("login_timeout", 360)),
username="root", password="123456")
# Verify that gnome is now running on the guest
try:
......@@ -315,7 +289,7 @@ def run_rv_input(test, params, env):
guest_session.cmd("export DISPLAY=:0.0")
install_wxpython(guest_root_session, params)
install_pygtk(guest_root_session, params)
deploy_test_form(test, guest_vm, params)
......
......@@ -53,8 +53,8 @@ def run_rv_smartcard(test, params, env):
# verify the smart card reader can be seen
output = guest_session.cmd("lsusb")
logging.debug("lsusb output: " + output)
if "Gemplus GemPC433-Swap" in output:
logging.info("Smartcard reader, Gemplus GemPC433-Swap detected.")
if "Gemalto (was Gemplus) GemPC433-Swap" in output:
logging.info("Smartcard reader, Gemalto GemPC433-Swap detected.")
else:
raise error.TestFail("No smartcard reader found")
......
......@@ -42,6 +42,10 @@ def run_smartcard_setup(test, params, env):
timeout=int(params.get("login_timeout", 360)),
username="root", password="123456")
for vm in params.get("vms").split():
utils_spice.clear_interface(env.get_vm(vm),
int(params.get("login_timeout", "360")))
# generate a random string, used to create a random key for the certs
randomstring = utils_misc.generate_random_string(2048)
cmd = "echo '" + randomstring + "' > /tmp/randomtext.txt"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册