diff --git a/qemu/cfg/tests-spice.cfg b/qemu/cfg/tests-spice.cfg index af94b7c27..26559b101 100644 --- a/qemu/cfg/tests-spice.cfg +++ b/qemu/cfg/tests-spice.cfg @@ -1,10 +1,57 @@ include tests-shared.cfg image_size = 20G +spice_seamless_migration = on +drive_cache=none + +dogtail_rpm = http://dl.fedoraproject.org/pub/epel/6/x86_64/dogtail-0.7.1.1-1.el6.noarch.rpm +test_dir = /home/tjamrisk/autotest-beaker/virt-viewer-gui +test_script_tgt = /home/test/tests + + +# Use non-root user for Spice tests rather than root +# since User gnome session is needed. +username=test +password=123456 + +# Use static MAC addresses for spice tests to have +# the same IP in all test. +nics = nic1 nic2 +nics_vm1 = nic1 +nics_vm2 = nic2 +mac_nic1 = 9a:96:97:9f:99:9a +mac_nic2 = 9a:9b:9c:9e:9e:9f + +qemu_binary = /usr/libexec/qemu-kvm +qemu_img_binary = /usr/bin/qemu-img +qemu_io_binary = /usr/bin/qemu-io +rv_binary = /usr/bin/remote-viewer + +# Only qcow2 file format +only qcow2 +# Only e1000 for nw card +only e1000 +# Only ide hard drives +only ide +# qemu-kvm will start with a single processor +only up +# Disable 9p export by default +only no_9p_export +# No PCI assignable devices +only no_pci_assignable +# No large memory pages +only smallpages variants: - qxl: + - os: + variants: + - RHEL: + only Linux.RHEL.6.devel.x86_64 + - Windows: + only Win7.64.sp1 + variants: - vnc: display = vnc @@ -141,225 +188,98 @@ variants: variants: - qemu_kvm_rhel6devel_install_client: - # Use this only when you need to create rhel6devel image qcow - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - image_name = images/rhel6devel-64_client - only qcow2 - only rtl8139 - only ide - only smp2 - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + image_name += "_client" + 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 only unattended_install.cdrom.extra_cdrom_ks # Runs qemu-kvm Windows guest install - @qemu_kvm_windows_install_guest: - # We want qemu-kvm for this run - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - # Only qcow2 file format - only qcow2 - # Only rtl8139 for nw card (default on qemu-kvm) - only rtl8139 - # Only ide hard drives - only ide - # qemu-kvm will start only with -smp 2 (2 processors) - only smp2 - # Disable 9p export by default - only no_9p_export - # No PCI assignable devices - only no_pci_assignable - # No large memory pages - only smallpages - # Operating system choice - only Win7.64.sp1 + 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 only unattended_install.cdrom - - qemu_kvm_rhel6devel_install_guest: - # Use this only when you need to create rhel6devel image qcow - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - only qcow2 - only rtl8139 - only ide - only smp2 - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + 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 only unattended_install.cdrom.extra_cdrom_ks - @remote_viewer_rhel6develssl: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + 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 - only rv_connect.RHEL.6.devel.x86_64, shutdown + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 - @remote_viewer_rhel6devel_quick: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + 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 + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 + + - @remote_viewer_rhel6devel_password: + 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 - only rv_connect.RHEL.6.devel.x86_64, shutdown + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 - @remote_viewer_win_guest_quick: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages - only Win7.64.sp1 + 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 #rv_connect_win is specifically a test meant for a windows guest and a rhel client, rv_connect cannot be used. - only rv_connect_win.RHEL.6.devel.x86_64, shutdown + only rv.rw.rv_connect.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 - @spice_negative_rhel6devel: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + only os.RHEL only negative_create - @rv_disconnect_rhel6devel: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + 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 - only rv_connect.RHEL.6.devel.x86_64, rv_disconnect.RHEL.6.devel.x86_64, shutdown + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_disconnect.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 - @rv_fullscreen_rhel6devel: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - spice_port = 3000 - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + spice_port=3000 + 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 - only fullscreen_setup.RHEL.6.devel.x86_64, rv_connect.RHEL.6.devel.x86_64, rv_fullscreen.RHEL.6.devel.x86_64, shutdown + 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.client_guest_shutdown.RHEL.6.devel.x86_64 - @rv_logging_rhel6devel: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + 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 - only rv_connect.RHEL.6.devel.x86_64, rv_logging.RHEL.6.devel.x86_64, shutdown + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_logging.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 - @rv_copyandpaste_rhel6devel: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages + 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 - only Linux.RHEL.6.devel.x86_64 - only rv_connect.RHEL.6.devel.x86_64, rv_copyandpaste.RHEL.6.devel.x86_64, shutdown + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_copyandpaste.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 - @rv_copyandpaste_dcp_rhel6devel: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages + 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 - only Linux.RHEL.6.devel.x86_64 - only rv_connect.RHEL.6.devel.x86_64, rv_copyandpaste.RHEL.6.devel.x86_64, shutdown + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_copyandpaste.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 - @rv_input_rhel6devel: - qemu_binary = /usr/libexec/qemu-kvm - qemu_img_binary = /usr/bin/qemu-img - qemu_io_binary = /usr/bin/qemu-io - rv_binary = /usr/bin/remote-viewer - only qcow2 - only e1000 - only ide - only up - only no_9p_export - only no_pci_assignable - only smallpages - only Linux.RHEL.6.devel.x86_64 + 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 + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_input.RHEL.6.devel.x86_64, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 + + - @rv_gui: + 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 + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv.rr.rv_gui.RHEL.6.devel.x86_64 + + - @rv_migration: + password=123456 + username=root + only rv.rr.rv_vmshutdown.RHEL.6.devel.x86_64 + + - @rv_vmshutdown_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 + only rv.rr.rv_connect.RHEL.6.devel.x86_64, rv_migration, rv.rr.client_guest_shutdown.RHEL.6.devel.x86_64 + + - @qxl_test_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 - only rv_connect.RHEL.6.devel.x86_64, rv_input.RHEL.6.devel.x86_64, shutdown + only rv.rr.qxl_test.RHEL.6.devel.x86_64 variants: #The following are all the individual tests for spice @@ -387,6 +307,24 @@ variants: only spice_negative_rhel6devel - remote_viewer_test: only remote_viewer_rhel6devel_quick + - rv_connect_passwd: + only remote_viewer_rhel6devel_password + - rv_connect_wrong_passwd: + test_type = negative + spice_password_send = incorrectpass + only remote_viewer_rhel6devel_password + - rv_qemu_password: + qemu_password = qemupassword + only remote_viewer_rhel6devel_quick + - rv_qemu_password_overwrite: + qemu_password = qemupassword + only remote_viewer_rhel6devel_password + - guestvmshutdown_cmd: + shutdownfrom = cmd + only rv_vmshutdown_rhel6devel + - guestvmshutdown_qemu: + shutdownfrom = qemu_monitor + only rv_vmshutdown_rhel6devel - remote_viewer_fullscreen_test: full_screen = yes only rv_fullscreen_rhel6devel @@ -517,28 +455,53 @@ variants: text_to_test=262144 only rv_copyandpaste_rhel6devel - keyboard_input_leds_and_esc_keys: + full_screen = yes config_test = "leds_and_esc_keys" only rv_input_rhel6devel - keyboard_input_non-us_layout: + full_screen = yes config_test = "nonus_layout" only rv_input_rhel6devel - keyboard_input_type_and_func_keys: + full_screen = yes config_test = "type_and_func_keys" only rv_input_rhel6devel - keyboard_input_leds_migration: + full_screen = yes config_test = "leds_migration" only rv_input_rhel6devel + + - rv_gui_test: + rv_gui_test_list = autoresize screenshot quit + #close fullscreen help + rv_gui_subdir = + only rv_gui + - qxl_logging: only rv_logging_rhel6devel - spice_vdagent_logging: logtest = spice-vdagent only rv_logging_rhel6devel + - qxl_test: + rendercheck_path = http://download.eng.brq.redhat.com/scratch/mdomonko/myrepo/6.92Workstation/x86_64/rendercheck-1.4-1.el7.x86_64.rpm + only qxl_test_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 + +only qxl_test +#only rv_vmshutdown_rhel6devel +#only remote_viewer_test_setup +#only rv_gui_test +#only rv_multiple_monitors + -#Running all Logging Tests -#only spice_vdagent_logging, qxl_logging +#Running all RHEL Client, Windows Guest Spice Tests +#only install_win_guest, remote_viewer_winguest_test -#Spice Vdagent Tests: -#only 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, only 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 +#Running all Windows Client, RHEL Guest Spice Tests +#to be added -#Running all Spice Tests -only create_vms, install_win_guest, 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_winguest_test, remote_viewer_disconnect_test, 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, only 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 +#Running all Windows Client, Windows Guest Spice Tests +#to be added diff --git a/qemu/tests/cfg/fullscreen_setup.cfg b/qemu/tests/cfg/fullscreen_setup.cfg deleted file mode 100644 index 0bc09a496..000000000 --- a/qemu/tests/cfg/fullscreen_setup.cfg +++ /dev/null @@ -1,23 +0,0 @@ -- fullscreen_setup: - no JeOS - type = fullscreen_setup - vms = vm1 vm2 - guest_vm = vm1 - client_vm = vm2 - image_name_vm2 = client_vm - display_vm2 = vnc - vga_vm2 = cirrus - virtio_ports_vm1 = "vdagent" - virtio_port_type_vm1 = "serialport" - virtio_port_chardev_vm1 = "spicevmc" - virtio_port_name_prefix_vm1 = "com.redhat.spice." - - variants: - - RHEL: - variants: - # This is current solution of handling - # multiple guests running exact same OS - -6.3.x86_64: - image_name_vm2 = images/rhel6devel-64_client - -6.3.i386: - image_name_vm2 = images/rhel6devel-32_client diff --git a/qemu/tests/cfg/rv_connect.cfg b/qemu/tests/cfg/rv_connect.cfg deleted file mode 100644 index 4b4a4c543..000000000 --- a/qemu/tests/cfg/rv_connect.cfg +++ /dev/null @@ -1,24 +0,0 @@ -- rv_connect: - no JeOS - type = rv_connect - vms = vm1 vm2 - guest_vm = vm1 - client_vm = vm2 - image_name_vm2 = client_vm - display_vm2 = vnc - vga_vm2 = cirrus - full_screen = no - virtio_ports_vm1 = "vdagent" - virtio_port_type_vm1 = "serialport" - virtio_port_chardev_vm1 = "spicevmc" - virtio_port_name_prefix_vm1 = "com.redhat.spice." - - variants: - - RHEL: - variants: - # This is current solution of handling - # multiple guests running exact same OS - -6.3.x86_64: - image_name_vm2 = images/rhel6devel-64_client - -6.3.i386: - image_name_vm2 = images/rhel6devel-32_client diff --git a/qemu/tests/cfg/rv_connect_win.cfg b/qemu/tests/cfg/rv_connect_win.cfg deleted file mode 100644 index 6422d4250..000000000 --- a/qemu/tests/cfg/rv_connect_win.cfg +++ /dev/null @@ -1,28 +0,0 @@ -- rv_connect_win: - no JeOS - type = rv_connect - vms = vm1 vm2 - guest_vm = vm1 - client_vm = vm2 - image_name_vm2 = client_vm - display_vm2 = vnc - os_type_vm2 = linux - shell_prompt_vm2 = ^\[.*\][\#\$]\s*$ - shell_client_vm2 = ssh - username_vm2 = root - shell_port_vm2 = 22 - status_test_command_vm2 = echo $? - virtio_ports_vm1 = "vdagent" - virtio_port_type_vm1 = "serialport" - virtio_port_chardev_vm1 = "spicevmc" - virtio_port_name_prefix_vm1 = "com.redhat.spice." - - variants: - - RHEL: - variants: - # This is current solution of handling - # multiple guests running exact same OS - -6.3.x86_64: - image_name_vm2 = images/rhel6devel-64_client - -6.3.i386: - image_name_vm2 = images/rhel6devel-32_client diff --git a/qemu/tests/cfg/rv_copyandpaste.cfg b/qemu/tests/cfg/rv_copyandpaste.cfg deleted file mode 100644 index f0782b34c..000000000 --- a/qemu/tests/cfg/rv_copyandpaste.cfg +++ /dev/null @@ -1,40 +0,0 @@ -- rv_copyandpaste: rv_connect - no JeOS - type = rv_copyandpaste - vms = vm1 vm2 - shell_prompt_vm2 = ^\[.*\][\#\$]\s*$ - guest_vm = vm1 - client_vm = vm2 - image_name_vm2 = client_vm - display_vm2 = vnc - vga_vm2 = cirrus - interpreter = python - dst_dir = /tmp - guest_script = cb.py - script_params_img_set = --set_image - script_params_img_save = -m - script_params_writef = -f - script_params_createf = -n - final_textfile = StringLengthTest.txt - final_image = PNGTest.png - image_tocopy_name = Image-small.png - final_image_bmp = BMPTest.bmp - image_tocopy_name_bmp = Image2.bmp - image_type = png - script_params = --set - script_params_clear = --clear - text_to_test = Testing_this_text_was_copied - virtio_ports_vm1 = "vdagent" - virtio_port_type_vm1 = "serialport" - virtio_port_chardev_vm1 = "spicevmc" - virtio_port_name_prefix_vm1 = "com.redhat.spice." - - variants: - - RHEL: - variants: - # This is current solution of handling - # multiple guests running exact same OS - -6.3.x86_64: - image_name_vm2 = images/rhel6devel-64_client - -6.3.i386: - image_name_vm2 = images/rhel6devel-32_client diff --git a/qemu/tests/cfg/rv_disconnect.cfg b/qemu/tests/cfg/rv_disconnect.cfg deleted file mode 100644 index c064cf837..000000000 --- a/qemu/tests/cfg/rv_disconnect.cfg +++ /dev/null @@ -1,23 +0,0 @@ -- rv_disconnect: rv_connect - no JeOS - type = rv_disconnect - vms = vm1 vm2 - guest_vm = vm1 - client_vm = vm2 - image_name_vm2 = client_vm - display_vm2 = vnc - vga_vm2 = cirrus - virtio_ports_vm1 = "vdagent" - virtio_port_type_vm1 = "serialport" - virtio_port_chardev_vm1 = "spicevmc" - virtio_port_name_prefix_vm1 = "com.redhat.spice." - - variants: - - RHEL: - variants: - # This is current solution of handling - # multiple guests running exact same OS - -6.3.x86_64: - image_name_vm2 = images/rhel6devel-64_client - -6.3.i386: - image_name_vm2 = images/rhel6devel-32_client diff --git a/qemu/tests/cfg/rv_fullscreen.cfg b/qemu/tests/cfg/rv_fullscreen.cfg deleted file mode 100644 index a3fb611a1..000000000 --- a/qemu/tests/cfg/rv_fullscreen.cfg +++ /dev/null @@ -1,24 +0,0 @@ -- rv_fullscreen: rv_connect - no JeOS - type = rv_fullscreen - vms = vm1 vm2 - guest_vm = vm1 - client_vm = vm2 - image_name_vm2 = client_vm - display_vm2 = vnc - vga_vm2 = cirrus - virtio_ports_vm1 = "vdagent" - virtio_port_type_vm1 = "serialport" - virtio_port_chardev_vm1 = "spicevmc" - virtio_port_name_prefix_vm1 = "com.redhat.spice." - - - variants: - - RHEL: - variants: - # This is current solution of handling - # multiple guests running exact same OS - -6.3.x86_64: - image_name_vm2 = images/rhel6devel-64_client - -6.3.i386: - image_name_vm2 = images/rhel6devel-32_client diff --git a/qemu/tests/cfg/rv_input.cfg b/qemu/tests/cfg/rv_input.cfg deleted file mode 100644 index 8890498b0..000000000 --- a/qemu/tests/cfg/rv_input.cfg +++ /dev/null @@ -1,24 +0,0 @@ -- rv_input: rv_connect - type = rv_input - vms = vm1 vm2 - guest_vm = vm1 - client_vm = vm2 - image_name_vm2 = client_vm - display_vm2 = vnc - vga_vm2 = cirrus - full_screen = "False" - guest_script = key_event_form.py - virtio_ports_vm1 = "vdagent" - virtio_port_type_vm1 = "serialport" - virtio_port_chardev_vm1 = "spicevmc" - virtio_port_name_prefix_vm1 = "com.redhat.spice." - - variants: - - RHEL: - variants: - # This is current solution of handling - # multiple guests running exact same OS - -6.3.x86_64: - image_name_vm2 = images/rhel6devel-64_client - -6.3.i386: - image_name_vm2 = images/rhel6devel-32_client diff --git a/qemu/tests/cfg/rv_logging.cfg b/qemu/tests/cfg/rv_logging.cfg deleted file mode 100644 index 2a8782ea3..000000000 --- a/qemu/tests/cfg/rv_logging.cfg +++ /dev/null @@ -1,32 +0,0 @@ -- rv_logging: rv_connect - type = rv_logging - logtest = qxl - qxl_log = /var/log/Xorg.0.log - spice_log = /var/log/spice-vdagent.log - vms = vm1 vm2 - guest_vm = vm1 - client_vm = vm2 - image_name_vm2 = client_vm - display_vm2 = vnc - vga_vm2 = cirrus - interpreter = python - dst_dir = /tmp - guest_script = cb.py - script_params = --set - text_to_test = Testing_this_text_was_copied - virtio_ports_vm1 = "vdagent" - virtio_port_type_vm1 = "serialport" - virtio_port_chardev_vm1 = "spicevmc" - virtio_port_name_prefix_vm1 = "com.redhat.spice." - - variants: - - RHEL: - variants: - # This is current solution of handling - # multiple guests running exact same OS - -6.3.x86_64: - image_name_vm2 = images/rhel6devel-64_client - -6.3.i386: - image_name_vm2 = images/rhel6devel-32_client - - diff --git a/qemu/tests/cfg/spice.cfg b/qemu/tests/cfg/spice.cfg new file mode 100644 index 000000000..9ee2aada5 --- /dev/null +++ b/qemu/tests/cfg/spice.cfg @@ -0,0 +1,97 @@ +- rv: + no JeOS + vms = vm1 vm2 + guest_vm = vm1 + client_vm = vm2 + display_vm2 = vnc + vga_vm2 = cirrus + full_screen = no + virtio_ports_vm1 = "vdagent" + virtio_port_type_vm1 = "serialport" + virtio_port_chardev_vm1 = "spicevmc" + virtio_port_name_prefix_vm1 = "com.redhat.spice." + + variants: + -RHEL.6.3.x86_64: + image_name_vm2 = images/rhel63-64_client + -RHEL.6.3.i386: + image_name_vm2 = images/rhel63-32_client + -RHEL.6.devel.x86_64: + image_name_vm2 = images/rhel6devel-64_client + -RHEL.6.devel.i386: + image_name_vm2 = images/rhel6devel-32_client + variants: + -fullscreen_setup: + type = fullscreen_setup + -rv_connect: + type = rv_connect + -rv_disconnect: rv_connect + type = rv_disconnect + -rv_fullscreen: fullscreen_setup, rv_connect + type = rv_fullscreen + -rv_copyandpaste: rv_connect + type = rv_copyandpaste + interpreter = python + dst_dir = /tmp + guest_script = cb.py + script_params_img_set = --set_image + script_params_img_save = -m + script_params_writef = -f + script_params_createf = -n + final_textfile = StringLengthTest.txt + final_image = PNGTest.png + image_tocopy_name = Image-small.png + final_image_bmp = BMPTest.bmp + image_tocopy_name_bmp = Image2.bmp + image_type = png + script_params = --set + script_params_clear = --clear + text_to_test = Testing_this_text_was_copied + - rv_input: rv_connect + type = rv_input + guest_script = key_event_form.py + - rv_logging: rv_connect + type = rv_logging + logtest = qxl + qxl_log = /var/log/Xorg.0.log + spice_log = /var/log/spice-vdagent.log + interpreter = python + dst_dir = /tmp + guest_script = cb.py + script_params = --set + text_to_test = Testing_this_text_was_copied + - rv_vmshutdown: rv_connect + type = rv_vmshutdown + cmd_cli_shutdown = "shutdown -h now" + cmd_qemu_shutdown = "system_powerdown" + - client_guest_shutdown: + type = client_guest_shutdown + shutdown_method = shell + kill_vm = yes + kill_vm_gracefully = no + + - rv_gui: + type = rv_gui + - qxl_test: + type = qxl_test + + variants: + #variant for a RHEL client and a RHEL guest + -rr: + #variant for a RHEL client and a Windows guest + -rw: + pssword = 1q2w3eP + password_vm2 = 123456 + display_vm2 = vnc + os_type_vm2 = linux + shell_prompt_vm2 = ^\[.*\][\#\$]\s*$ + shell_client_vm2 = ssh + username_vm2 = root + shell_port_vm2 = 22 + status_test_command_vm2 = echo $? + + #variant for a Windows client and a RHEL guest + -wr: + #variant for a Windows client and a Windows guest + -ww: + diff --git a/shared/cfg/guest-os/Linux/RHEL/6.devel.i386.cfg b/shared/cfg/guest-os/Linux/RHEL/6.devel.i386.cfg index e084c1ad3..e0a14f728 100644 --- a/shared/cfg/guest-os/Linux/RHEL/6.devel.i386.cfg +++ b/shared/cfg/guest-os/Linux/RHEL/6.devel.i386.cfg @@ -14,4 +14,4 @@ initrd = images/rhel6devel-32/initrd.img syslog_server_proto = udp unattended_install.cdrom: - cdrom_cd1 = RHEL6-devel-i386.iso + cdrom_cd1 = isos/linux/RHEL6-devel-i386.iso diff --git a/shared/cfg/guest-os/Linux/RHEL/6.devel.x86_64.cfg b/shared/cfg/guest-os/Linux/RHEL/6.devel.x86_64.cfg index 05a620e41..f53975c16 100644 --- a/shared/cfg/guest-os/Linux/RHEL/6.devel.x86_64.cfg +++ b/shared/cfg/guest-os/Linux/RHEL/6.devel.x86_64.cfg @@ -15,4 +15,4 @@ initrd = images/rhel6devel-64/initrd.img syslog_server_proto = udp unattended_install.cdrom: - cdrom_cd1 = RHEL6-devel-x86_64.iso + cdrom_cd1 = isos/linux/RHEL6-devel-x86_64.iso diff --git a/shared/unattended/RHEL-6.3.ks b/shared/unattended/RHEL-6.3.ks index 53f638e29..576f27cf9 100644 --- a/shared/unattended/RHEL-6.3.ks +++ b/shared/unattended/RHEL-6.3.ks @@ -6,13 +6,15 @@ lang en_US.UTF-8 keyboard us key --skip network --bootproto dhcp -rootpw 123456 +rootpw --plaintext 123456 +user --name=test --password=123456 --plaintext firewall --enabled --ssh selinux --enforcing timezone --utc America/New_York firstboot --disable bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr +xconfig --startxonboot clearpart --all --initlabel autopart poweroff @@ -37,8 +39,9 @@ virt-viewer spice-vdagent usbredir SDL +%end -%post --interpreter /usr/bin/python +%post --nochroot --interpreter /usr/bin/python import os os.system('grubby --remove-args="rhgb quiet" --update-kernel=$(grubby --default-kernel)') os.system('dhclient') @@ -47,3 +50,8 @@ os.system('iptables -F') os.system('echo 0 > /selinux/enforce') os.system('echo Post set up finished > /dev/ttyS0') os.system('echo Post set up finished > /dev/hvc0') +f = open('/mnt/sysimage/etc/gdm/custom.conf','w') +f.write('[daemon]\n' + 'AutomaticLogin=test\n' + 'AutomaticLoginEnable=True\n') +%end diff --git a/tests/client_guest_shutdown.py b/tests/client_guest_shutdown.py new file mode 100644 index 000000000..f3723710b --- /dev/null +++ b/tests/client_guest_shutdown.py @@ -0,0 +1,49 @@ +import time +from autotest.client.shared import error +from virttest import utils_misc + + +@error.context_aware +def run_client_guest_shutdown(test, params, env): + """ + KVM shutdown test: + For a test with two VMs: client & guest + 1) Log into the VMS(guests) that represent the client &guest + 2) Send a shutdown command to the guest, or issue a system_powerdown + monitor command (depending on the value of shutdown_method) + 3) Wait until the guest is down + + @param test: kvm test object + @param params: Dictionary with the test parameters + @param env: Dictionary with test environment + """ + client_vm = env.get_vm(params["client_vm"]) + client_vm.verify_alive() + guest_vm = env.get_vm(params["guest_vm"]) + guest_vm.verify_alive() + + timeout = int(params.get("login_timeout", 360)) + + #shutdown both of the sessions + for vm in [client_vm, guest_vm]: + vm_session = vm.wait_for_login(timeout=timeout, username="root", + password="123456") + try: + error.base_context("shutting down the VM") + if params.get("shutdown_method") == "shell": + # Send a shutdown command to the guest's shell + vm_session.sendline(vm.get_params().get("shutdown_command")) + error.context("waiting VM to go down (shutdown shell cmd)") + elif params.get("shutdown_method") == "system_powerdown": + # Sleep for a while -- give the guest a chance to finish booting + time.sleep(float(params.get("sleep_before_powerdown", 10))) + # Send a system_powerdown monitor command + vm.monitor.cmd("system_powerdown") + error.context("waiting VM to go down " + "(system_powerdown monitor cmd)") + + if not utils_misc.wait_for(vm.is_dead, 240, 0, 1): + raise error.TestFail("Guest refuses to go down") + + finally: + vm_session.close() diff --git a/tests/fullscreen_setup.py b/tests/fullscreen_setup.py index 7c1c21042..bc0d0d284 100644 --- a/tests/fullscreen_setup.py +++ b/tests/fullscreen_setup.py @@ -29,9 +29,10 @@ def run_fullscreen_setup(test, params, env): guest_session = guest_vm.wait_for_login( timeout=int(params.get("login_timeout", 360))) + utils_spice.wait_timeout(10) + logging.debug("Exporting guest display") guest_session.cmd("export DISPLAY=:0.0") - utils_spice.launch_startx(guest_vm) # Get the min, current, and max resolution on the guest output = guest_session.cmd("xrandr | grep Screen") diff --git a/tests/qxl_test.py b/tests/qxl_test.py new file mode 100644 index 000000000..a4ae874ec --- /dev/null +++ b/tests/qxl_test.py @@ -0,0 +1,47 @@ +from autotest.client.shared import error + +def install_rendercheck(vm, path): + + + session = vm.wait_for_login(username = "root", + password = "123456") + try: + session.cmd("rpm -q rendercheck") + except: + pass + else: + return + if not path: + raise error.TestFail("Path to rendercheck rpm not defined. " + "Make sure to set \"rendercheck_path\" in your cfg file.") + try: + session.cmd("yum -y localinstall %s" % path) + except: + raise error.TestFail("Installation of rendercheck failed.") + +def run_qxl_test(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))) + + client_vm = env.get_vm(params["client_vm"]) + client_vm.verify_alive() + client_session = client_vm.wait_for_login( + timeout=int(params.get("login_timeout", 360))) + + install_rendercheck( + env.get_vm(params["guest_vm"]), + params.get("rendercheck_path")) + + try: + guest_session.cmd( + "rendercheck -d :0.0 -v -t fill,dcoords,scoords,mcoords,tscoords," + "tmcoords,blend,composite,cacomposite,gradients,repeat,triangles,bug7366 " + "-f a8r8g8b8,x8r8g8b8,a8 > renderchecklog",timeout = 7200) + except: + renderlog = open("rendercheck.log", "w") + renderlog.write( + guest_session.cmd_output("grep -A 6 error renderchecklog")) + raise error.TestFail("Rendercheck failed; logs of failing tests retrieved") + \ No newline at end of file diff --git a/tests/rv_connect.py b/tests/rv_connect.py index 92d1b08ee..0bc371e62 100644 --- a/tests/rv_connect.py +++ b/tests/rv_connect.py @@ -6,15 +6,10 @@ """ import logging, os -from virttest.aexpect import ShellCmdError, ShellStatusError -from virttest.aexpect import ShellTimeoutError, ShellProcessTerminatedError +from virttest.aexpect import ShellStatusError +from virttest.aexpect import ShellProcessTerminatedError from virttest import utils_net, utils_spice, remote - - -class RVConnectError(Exception): - """Exception raised in case that remote-viewer fails to connect""" - pass - +from autotest.client.shared import error def send_ticket(client_vm, ticket): """ @@ -29,35 +24,6 @@ def send_ticket(client_vm, ticket): client_vm.send_key("kp_enter") # send enter -def verify_established(client_vm, host, port, rv_binary): - """ - Parses netstat output for established connection on host:port - @param client_session - vm.wait_for_login() - @param host - host ip addr - @param port - port for client to connect - @param rv_binary - remote-viewer binary - """ - rv_binary = rv_binary.split(os.path.sep)[-1] - - client_session = client_vm.wait_for_login(timeout=60) - - # !!! -n means do not resolve port names - cmd = '(netstat -pn 2>&1| grep "^tcp.*:.*%s:%s.*ESTABLISHED.*%s.*") \ - > /dev/null' % (host, str(port), rv_binary) - try: - netstat_out = client_session.cmd(cmd) - logging.info("netstat output: %s", netstat_out) - - except ShellCmdError: - logging.error("Failed to get established connection from netstat") - raise RVConnectError() - - else: - logging.info("%s connection to %s:%s successful.", - rv_binary, host, port) - client_session.close() - - def print_rv_version(client_session, rv_binary): """ prints remote-viewer and spice-gtk version available inside client_session @@ -92,11 +58,20 @@ def launch_rv(client_vm, guest_vm, params): """ rv_binary = params.get("rv_binary", "remote-viewer") host_ip = utils_net.get_host_ip_address(params) + test_type = params.get("test_type") host_port = None full_screen = params.get("full_screen") display = params.get("display") cmd = rv_binary + " --display=:0.0" ticket = None + ticket_send = params.get("spice_password_send") + qemu_ticket = params.get("qemu_password") + + #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) client_session = client_vm.wait_for_login( timeout=int(params.get("login_timeout", 360))) @@ -105,7 +80,8 @@ def launch_rv(client_vm, guest_vm, params): ticket = guest_vm.get_spice_var("spice_password") if guest_vm.get_spice_var("spice_ssl") == "yes": - host_port = guest_vm.get_spice_var("spice_tls_port") + host_tls_port = guest_vm.get_spice_var("spice_tls_port") + host_port = guest_vm.get_spice_var("spice_port") cacert = "%s/%s" % (guest_vm.get_spice_var("spice_x509_prefix"), guest_vm.get_spice_var("spice_x509_cacert_file")) #cacert subj is in format for create certificate(with '/' delimiter) @@ -114,7 +90,8 @@ def launch_rv(client_vm, guest_vm, params): host_subj = guest_vm.get_spice_var("spice_x509_server_subj") host_subj = host_subj.replace('/', ',')[1:] - cmd += " spice://%s?tls-port=%s" % (host_ip, host_port) + cmd += " spice://%s?tls-port=%s\&port=%s" % (host_ip, host_tls_port, + host_port) cmd += " --spice-ca-file=%s" % cacert if params.get("spice_client_host_subject") == "yes": @@ -148,8 +125,6 @@ def launch_rv(client_vm, guest_vm, params): cmd = "nohup " + cmd + " &> /dev/null &" # Launch it on background # Launching the actual set of commands - utils_spice.launch_startx(client_vm) - try: print_rv_version(client_session, rv_binary) except ShellStatusError, ShellProcessTerminatedError: @@ -166,12 +141,25 @@ def launch_rv(client_vm, guest_vm, params): "remote-viewer later") # client waits for user entry (authentication) if spice_password is set - if ticket: + # 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) + send_ticket(client_vm, qemu_ticket) + elif ticket: + if ticket_send: + ticket = ticket_send + utils_spice.wait_timeout(5) # Wait for remote-viewer to launch send_ticket(client_vm, ticket) - utils_spice.wait_timeout(5) # Wait for conncetion to establish - verify_established(client_vm, host_ip, host_port, rv_binary) + try: + utils_spice.verify_established(client_vm, host_ip, host_port, rv_binary) + except utils_spice.RVConnectError: + if test_type == "negative": + logging.info("remote-viewer connection failed as expected") + else: + raise error.TestFail("remote-viewer connection failed") #prevent from kill remote-viewer after test finish cmd = "disown -ar" @@ -200,6 +188,8 @@ 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) + launch_rv(client_vm, guest_vm, params) client_session.close() diff --git a/tests/rv_copyandpaste.py b/tests/rv_copyandpaste.py index 4e560d477..b556b7d8a 100644 --- a/tests/rv_copyandpaste.py +++ b/tests/rv_copyandpaste.py @@ -456,8 +456,6 @@ def copy_and_paste_pos(session_to_copy_from, session_to_paste_to, # Before doing the copy and paste, verify vdagent is # installed and the daemon is running on the guest utils_spice.verify_vdagent(guest_session, test_timeout) - # Start vdagent daemon - utils_spice.start_vdagent(guest_session, test_timeout) # Make sure virtio driver is running utils_spice.verify_virtio(guest_session, test_timeout) # Command to copy text and put it in the keyboard, copy on the client @@ -492,8 +490,6 @@ def restart_cppaste(session_to_copy_from, session_to_paste_to, # Before doing the copy and paste, verify vdagent is # installed and the daemon is running on the guest utils_spice.verify_vdagent(guest_session, test_timeout) - # start vdagent daemon - utils_spice.start_vdagent(guest_session, test_timeout) # Make sure virtio driver is running utils_spice.verify_virtio(guest_session, test_timeout) # Command to copy text and put it in the keyboard, copy on the client @@ -545,8 +541,6 @@ def copy_and_paste_cpdisabled_neg(session_to_copy_from, session_to_paste_to, # Before doing the copy and paste, verify vdagent is installed and the # daemon is running on the guest utils_spice.verify_vdagent(guest_session, test_timeout) - # Start vdagent for this negative test - utils_spice.start_vdagent(guest_session, test_timeout) # Make sure virtio driver is running utils_spice.verify_virtio(guest_session, test_timeout) # Command to copy text and put it in the keyboard, copy on the client @@ -584,8 +578,6 @@ def copy_and_paste_largetext(session_to_copy_from, session_to_paste_to, # Before doing the copy and paste, verify vdagent is # installed and the daemon is running on the guest utils_spice.verify_vdagent(guest_session, test_timeout) - # Start vdagent - utils_spice.start_vdagent(guest_session, test_timeout) # Make sure virtio driver is running utils_spice.verify_virtio(guest_session, test_timeout) @@ -627,8 +619,6 @@ def restart_cppaste_lrgtext(session_to_copy_from, session_to_paste_to, # Before doing the copy and paste, verify vdagent is # installed and the daemon is running on the guest utils_spice.verify_vdagent(guest_session, test_timeout) - # Start vdagent - utils_spice.start_vdagent(guest_session, test_timeout) # Make sure virtio driver is running utils_spice.verify_virtio(guest_session, test_timeout) @@ -691,8 +681,6 @@ def copy_and_paste_image_pos(session_to_copy_from, session_to_paste_to, # Before doing the copy and paste, verify vdagent is # installed and the daemon is running on the guest utils_spice.verify_vdagent(guest_session, test_timeout) - # Start vdagent for this negative test - utils_spice.start_vdagent(guest_session, test_timeout) # Make sure virtio driver is running utils_spice.verify_virtio(guest_session, test_timeout) @@ -760,8 +748,6 @@ def restart_cppaste_image(session_to_copy_from, session_to_paste_to, # Before doing the copy and paste, verify vdagent is # installed and the daemon is running on the guest utils_spice.verify_vdagent(guest_session, test_timeout) - # Start vdagent - utils_spice.start_vdagent(guest_session, test_timeout) # Make sure virtio driver is running utils_spice.verify_virtio(guest_session, test_timeout) @@ -909,8 +895,6 @@ def copyandpasteimg_cpdisabled_neg(session_to_copy_from, session_to_paste_to, # Before doing the copy and paste, verify vdagent is # installed and the daemon is running on the guest utils_spice.verify_vdagent(guest_session, test_timeout) - # Start vdagent for this negative test - utils_spice.start_vdagent(guest_session, test_timeout) # Make sure virtio driver is running utils_spice.verify_virtio(guest_session, test_timeout) # Command to copy text and put it in the keyboard, copy on the client @@ -961,6 +945,9 @@ def run_rv_copyandpaste(test, params, env): guest_vm = env.get_vm(params["guest_vm"]) 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") logging.info("Get PID of remote-viewer") client_session.cmd("pgrep remote-viewer") @@ -1014,11 +1001,14 @@ def run_rv_copyandpaste(test, params, env): client_session.cmd("export DISPLAY=:0.0") - utils_spice.launch_startx(guest_vm) + # Verify that gnome is now running on the guest + try: + guest_session.cmd("ps aux | grep -v grep | grep gnome-session") + except aexpect.ShellCmdError: + raise error.TestWarn("gnome-session was probably not correctly started") guest_session.cmd("export DISPLAY=:0.0") - # Verify that gnome is now running on the guest - guest_session.cmd("ps aux | grep -v grep | grep gnome-session") + # Make sure the clipboards are clear before starting the test clear_cb(guest_session, params) @@ -1034,23 +1024,23 @@ def run_rv_copyandpaste(test, params, env): logging.info("Negative Test Case: Copy/Paste Disabled, Copying" "Image from the Client to Guest Should Not Work\n") copyandpasteimg_cpdisabled_neg(client_session, guest_session, - guest_session, params) + guest_root_session, params) else: logging.info("Negative Test Case: Copy/Paste Disabled, Copying" " from the Client to Guest Should Not Work\n") copy_and_paste_cpdisabled_neg(client_session, guest_session, - guest_session, params) + guest_root_session, params) if "guest_to_client" in test_type: if "image" in test_type: logging.info("Negative Test Case: Copy/Paste Disabled, Copying" "Image from the Guest to Client Should Not Work\n") copyandpasteimg_cpdisabled_neg(guest_session, client_session, - guest_session, params) + guest_root_session, params) else: logging.info("Negative Test Case: Copy/Paste Disabled, Copying" " from the Guest to Client Should Not Work\n") copy_and_paste_cpdisabled_neg(guest_session, client_session, - guest_session, params) + guest_root_session, params) elif "positive" in test_type: # These are positive tests, where the clipboards are synced because @@ -1060,61 +1050,61 @@ def run_rv_copyandpaste(test, params, env): if "restart" in test_type: logging.info("Restart Vdagent, Cp Img Client to Guest") restart_cppaste_image(client_session, guest_session, - guest_session, params) + guest_root_session, params) else: logging.info("Copying an Image from the Client to Guest") copy_and_paste_image_pos(client_session, guest_session, - guest_session, params) + guest_root_session, params) elif testing_text.isdigit(): if "restart" in test_type: logging.info("Restart Vdagent, Copying a String of size " + testing_text + " from the Client to Guest") restart_cppaste_lrgtext(client_session, guest_session, - guest_session, params) + guest_root_session, params) else: logging.info("Copying a String of size " + testing_text + " from the Client to Guest") copy_and_paste_largetext(client_session, guest_session, - guest_session, params) + guest_root_session, params) else: if "restart" in test_type: logging.info("Restart Vdagent, Copying from Client to Guest\n") restart_cppaste(client_session, guest_session, - guest_session, params) + guest_root_session, params) else: logging.info("Copying from the Client to Guest\n") copy_and_paste_pos(client_session, guest_session, - guest_session, params) + guest_root_session, params) if "guest_to_client" in test_type: if "image" in test_type: if "restart" in test_type: logging.info("Restart Vdagent, Copy Img Guest to Client") restart_cppaste_image(guest_session, client_session, - guest_session, params) + guest_root_session, params) else: logging.info("Copying an Image from the Guest to Client") copy_and_paste_image_pos(guest_session, client_session, - guest_session, params) + guest_root_session, params) elif testing_text.isdigit(): if "restart" in test_type: logging.info("Restart Vdagent, Copying a String of size " + testing_text + " from the Guest to Client") restart_cppaste_lrgtext(guest_session, client_session, - guest_session, params) + guest_root_session, params) else: logging.info("Copying a String of size " + testing_text + " from the Guest to Client") copy_and_paste_largetext(guest_session, client_session, - guest_session, params) + guest_root_session, params) else: if "restart" in test_type: logging.info("Restart Vdagent, Copying: Client to Guest\n") restart_cppaste(guest_session, client_session, - guest_session, params) + guest_root_session, params) else: logging.info("Copying from the Guest to Client\n") copy_and_paste_pos(guest_session, client_session, - guest_session, params) + guest_root_session, params) elif "negative" in test_type: # These are negative tests, where the clipboards are not synced because # the spice-vdagent service will not be running on the guest. @@ -1123,23 +1113,23 @@ def run_rv_copyandpaste(test, params, env): logging.info("Negative Test Case: Copying an Image from the " "Client to Guest") copy_and_paste_image_neg(client_session, guest_session, - guest_session, params) + guest_root_session, params) else: logging.info("Negative Test Case: Copying from the Client to" "Guest Should Not Work\n") copy_and_paste_neg(client_session, guest_session, - guest_session, params) + guest_root_session, params) if "guest_to_client" in test_type: if "image" in test_type: logging.info("Negative Test Case: Copying an Image from the " "Guest to Client") copy_and_paste_image_neg(guest_session, client_session, - guest_session, params) + guest_root_session, params) else: logging.info("Negative Test Case: Copying from the Guest to" " Client Should Not Work\n") copy_and_paste_neg(guest_session, client_session, - guest_session, params) + guest_root_session, params) else: # The test is not supported, verify what is a supported test. raise error.TestFail("Couldn't Find the Correct Test To Run") diff --git a/tests/rv_input.py b/tests/rv_input.py index 3dfaf5ef5..a68e724cd 100644 --- a/tests/rv_input.py +++ b/tests/rv_input.py @@ -8,7 +8,7 @@ import logging, os from autotest.client.shared import error -from virttest.aexpect import ShellCmdError, ShellStatusError, ShellTimeoutError +from virttest.aexpect import ShellCmdError from virttest import utils_misc, utils_spice def deploy_epel_repo(guest_session, params): @@ -25,18 +25,23 @@ def deploy_epel_repo(guest_session, params): 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 = ("rpm -ivh http://download.fedoraproject.org/pub/epel/5/" - "`arch`/epel-release-5-4.noarch.rpm 2>&1") + 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=60) + guest_session.cmd(cmd, print_func=logging.info, timeout=90) elif "release 6" in guest_session.cmd("cat /etc/redhat-release"): - cmd = ("rpm -ivh http://download.fedoraproject.org/pub/epel/6/" - "`arch`/epel-release-6-8.noarch.rpm 2>&1") + 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=60) + guest_session.cmd(cmd, print_func=logging.info, timeout=90) else: raise Exception("Unsupported RHEL guest") @@ -53,7 +58,7 @@ def install_wxpython(guest_session, params): try: guest_session.cmd(cmd) except ShellCmdError: - cmd = "yum -y install wxPython > /dev/null" + cmd = "yum -y install wxPython --nogpgcheck > /dev/null" logging.info("Installing wxPython package to %s", params.get("guest_vm")) guest_session.cmd(cmd, timeout=60) @@ -217,6 +222,7 @@ def test_leds_migration(client_vm, guest_vm, guest_session, params): for key in test_keys: client_vm.send_key(key) utils_spice.wait_timeout(0.3) + utils_spice.wait_timeout(30) def analyze_results(file_path, test_type): """ @@ -279,19 +285,25 @@ 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_session, params) + deploy_epel_repo(guest_root_session, params) - utils_spice.launch_startx(guest_vm) + #utils_spice.launch_startx(guest_vm) - guest_session.cmd("export DISPLAY=:0.0") - utils_spice.wait_timeout(3) # Verify that gnome is now running on the guest - guest_session.cmd("ps aux | grep -v grep | grep gnome-session") + try: + guest_session.cmd("ps aux | grep -v grep | grep gnome-session") + except aexpect.ShellCmdError: + raise error.TestWarn("gnome-session was probably not corretly started") + + guest_session.cmd("export DISPLAY=:0.0") - install_wxpython(guest_session, params) + install_wxpython(guest_root_session, params) deploy_test_form(test, guest_vm, params) diff --git a/tests/rv_logging.py b/tests/rv_logging.py index 97fc27d01..12cab6c96 100644 --- a/tests/rv_logging.py +++ b/tests/rv_logging.py @@ -7,7 +7,6 @@ """ import logging, os -from virttest.aexpect import ShellCmdError, ShellStatusError, ShellTimeoutError from autotest.client.shared import error from virttest import utils_misc, utils_spice @@ -36,6 +35,9 @@ def run_rv_logging(test, params, env): guest_vm.verify_alive() 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") scriptdir = os.path.join("scripts", script) script_path = utils_misc.get_path(test.virtdir, scriptdir) @@ -49,35 +51,34 @@ def run_rv_logging(test, params, env): # Some logging tests need the full desktop environment guest_session.cmd("export DISPLAY=:0.0") - utils_spice.launch_startx(guest_vm) - # Logging test for the qxl driver if(log_test == 'qxl'): logging.info("Running the logging test for the qxl driver") - guest_session.cmd("grep -i qxl " + qxl_logfile) + guest_root_session.cmd("grep -i qxl " + qxl_logfile) # Logging test for spice-vdagent elif(log_test == 'spice-vdagent'): logging.info("Running the logging test for spice-vdagent daemon") - utils_spice.start_vdagent(guest_session, test_timeout=15) + utils_spice.start_vdagent(guest_root_session, test_timeout=15) # Testing the log after stopping spice-vdagentd - utils_spice.stop_vdagent(guest_session, test_timeout=15) - output = guest_session.cmd("tail -n 3 " + spicevdagent_logfile + + utils_spice.stop_vdagent(guest_root_session, test_timeout=15) + output = guest_root_session.cmd("tail -n 3 " + spicevdagent_logfile + " | grep 'vdagentd quiting'") # Testing the log after starting spice-vdagentd - utils_spice.start_vdagent(guest_session, test_timeout=15) - output = guest_session.cmd("tail -n 2 " + spicevdagent_logfile + + utils_spice.start_vdagent(guest_root_session, test_timeout=15) + output = guest_root_session.cmd("tail -n 2 " + spicevdagent_logfile + " | grep 'opening vdagent virtio channel'") # Testing the log after restart spice-vdagentd - utils_spice.restart_vdagent(guest_session, test_timeout=10) - output = guest_session.cmd("tail -n 2 " + spicevdagent_logfile + + utils_spice.restart_vdagent(guest_root_session, test_timeout=10) + output = guest_root_session.cmd("tail -n 2 " + spicevdagent_logfile + " | grep 'opening vdagent virtio channel'") - cmd = "echo \"SPICE_VDAGENTD_EXTRA_ARGS=-dd\"> /etc/sysconfig/spice-vdagentd" - guest_session.cmd(cmd) - utils_spice.restart_vdagent(guest_session, test_timeout=10) + cmd = ("echo \"SPICE_VDAGENTD_EXTRA_ARGS=-dd\">" + "/etc/sysconfig/spice-vdagentd") + guest_root_session.cmd(cmd) + utils_spice.restart_vdagent(guest_root_session, test_timeout=10) # Finally test copying text within the guest cmd = "%s %s %s %s" % (interpreter, script_call, @@ -101,12 +102,13 @@ def run_rv_logging(test, params, env): logging.debug("------------ End of script output of the Copying" " Session ------------") - output = guest_session.cmd("tail -n 3 " + spicevdagent_logfile + + output = guest_root_session.cmd("tail -n 3 " + spicevdagent_logfile + " | grep 'clipboard grab'") else: # Couldn't find the right test to run guest_session.close() + guest_root_session.close() raise error.TestFail("Couldn't find the right test to run," + " check cfg files.") guest_session.close() diff --git a/tests/rv_vmshutdown.py b/tests/rv_vmshutdown.py new file mode 100644 index 000000000..a5ba1c966 --- /dev/null +++ b/tests/rv_vmshutdown.py @@ -0,0 +1,104 @@ +""" +rv_vmshutdown.py - shutdown the guest and verify it is a clean exit. + +Requires: connected binaries remote-viewer, Xorg, gnome session + +""" +import logging +from virttest.virt_vm import VMDeadError +from autotest.client.shared import error +from virttest.aexpect import ShellCmdError +from virttest import utils_spice +from virttest import utils_misc +from virttest import utils_net + + +def run_rv_vmshutdown(test, params, env): + """ + Tests clean exit after shutting down the VM. + Covers two cases: + (1)Shutdown from the command line of the guest. + (2)Shutdown from the qemu monitor. + + Verify after the shutdown: + (1)Verifying the guest is down + (2)Verify the spice connection to the guest is no longer established + (3)Verify the remote-viewer process is not running + + @param test: QEMU test object. + @param params: Dictionary with the test parameters. + @param env: Dictionary with test environment. + """ + + #Get the required variables + rv_binary = params.get("rv_binary", "remote-viewer") + host_ip = utils_net.get_host_ip_address(params) + shutdownfrom = params.get("shutdownfrom") + cmd_cli_shutdown = params.get("cmd_cli_shutdown") + cmd_qemu_shutdown = params.get("cmd_qemu_shutdown") + host_port = None + + 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)), + username="root", password="123456") + + client_vm = env.get_vm(params["client_vm"]) + client_vm.verify_alive() + client_session = client_vm.wait_for_login( + timeout=int(params.get("login_timeout", 360)), + username="root", password="123456") + + if guest_vm.get_spice_var("spice_ssl") == "yes": + host_port = guest_vm.get_spice_var("spice_tls_port") + else: + host_port = guest_vm.get_spice_var("spice_port") + + #Determine if the test is to shutdown from cli or qemu monitor + if shutdownfrom == "cmd": + logging.info("Shutting down guest from command line:" + " %s\n" % cmd_cli_shutdown) + output = guest_session.cmd(cmd_cli_shutdown) + logging.debug("Guest is being shutdown: %s" % output) + elif shutdownfrom == "qemu_monitor": + logging.info("Shutting down guest from qemu monitor\n") + output = guest_vm.monitor.cmd(cmd_qemu_shutdown) + logging.debug("Output of %s: %s" % (cmd_qemu_shutdown, output)) + else: + raise error.TestFail("shutdownfrom var not set, valid values are" + " cmd or qemu_monitor") + + #wait for the guest vm to be shutoff + logging.info("Waiting for the guest VM to be shutoff") + utils_misc.wait_for(guest_vm.is_dead, 70, 30, 1, "waiting...") + logging.info("Guest VM is now shutoff") + + #Verify there was a clean exit by + #(1)Verifying the guest is down + #(2)Verify the spice connection to the guest is no longer established + #(3)Verify the remote-viewer process is not running + try: + guest_vm.verify_alive() + raise error.TestFail("Guest VM is still alive, shutdown failed.") + except VMDeadError: + logging.info("Guest VM is verified to be shutdown") + + try: + utils_spice.verify_established(client_vm, host_ip, host_port, rv_binary) + raise error.TestFail("Remote-Viewer connection to guest" + "is still established.") + except utils_spice.RVConnectError: + logging.info("There is no remote-viewer connection as expected") + else: + raise error.TestFail("Unexpected error while trying to see if there" + " was no spice connection to the guest") + + #Verify the remote-viewer process is not running + logging.info("Checking to see if remote-viewer process is still running on" + " client after VM has been shutdown") + try: + pidoutput = str(client_session.cmd("pgrep remote-viewer")) + raise error.TestFail("Remote-viewer is still running on the client.") + except ShellCmdError: + logging.info("Remote-viewer process is not running as expected.") diff --git a/virttest/utils_spice.py b/virttest/utils_spice.py index eb02b61eb..d113165d2 100644 --- a/virttest/utils_spice.py +++ b/virttest/utils_spice.py @@ -2,10 +2,13 @@ Common spice test utility functions. """ -import logging, time +import os, logging, time from autotest.client.shared import error from aexpect import ShellCmdError, ShellStatusError, ShellTimeoutError +class RVConnectError(Exception): + """Exception raised in case that remote-viewer fails to connect""" + pass def wait_timeout(timeout=10): """ @@ -16,6 +19,34 @@ def wait_timeout(timeout=10): logging.debug("Waiting (timeout=%ss)", timeout) time.sleep(timeout) +def verify_established(client_vm, host, port, rv_binary): + """ + Parses netstat output for established connection on host:port + @param client_session - vm.wait_for_login() + @param host - host ip addr + @param port - port for client to connect + @param rv_binary - remote-viewer binary + """ + rv_binary = rv_binary.split(os.path.sep)[-1] + + client_session = client_vm.wait_for_login(timeout=60) + + # !!! -n means do not resolve port names + cmd = '(netstat -pn 2>&1| grep "^tcp.*:.*%s:%s.*ESTABLISHED.*%s.*") \ + > /dev/null' % (host, str(port), rv_binary) + try: + netstat_out = client_session.cmd(cmd) + logging.info("netstat output: %s", netstat_out) + + except ShellCmdError: + logging.error("Failed to get established connection from netstat") + raise RVConnectError() + + else: + logging.info("%s connection to %s:%s successful.", + rv_binary, host, port) + client_session.close() + def start_vdagent(guest_session, test_timeout): """ @@ -116,20 +147,3 @@ def verify_virtio(guest_session, test_timeout): logging.debug("------------ End of guest check of the Virtio-Serial" " Driver------------") wait_timeout(3) - -def launch_startx(vm): - """ - Run startx on the VM - - @param guest_session: ssh session of the VM - """ - vm_session = vm.wait_for_login(timeout=60) - - try: - logging.info("Starting X server on the VM"); - vm_session.cmd("startx &", timeout=15) - except (ShellCmdError, ShellStatusError, ShellTimeoutError): - logging.debug("Ignoring an Exception that Occurs from calling startx") - - wait_timeout(15) - vm_session.close()