提交 82f4c664 编写于 作者: S Swapna Krishnan 提交者: Lucas Meneghel Rodrigues

Adding tests to build spice-gtk, spice-vdagent and qxl

Signed-off-by: NSwapna Krishnan <skrishna@redhat.com>
上级 94ad1cc6
......@@ -21,6 +21,7 @@ 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
#rv_ld_library_path = /usr/local/lib
spice_info = None
listening_addr = None
certdb=None
......@@ -207,7 +208,7 @@ variants:
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.default_sc
only unattended_install.cdrom.extra_cdrom_ks
only unattended_install.cdrom.extra_cdrom_ks.default_install.aio_native
# Runs qemu-kvm Windows guest install
- @qemu_kvm_windows_install_guest:
......@@ -219,7 +220,7 @@ variants:
- qemu_kvm_rhel6devel_install_guest:
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 unattended_install.cdrom.extra_cdrom_ks
only unattended_install.cdrom.extra_cdrom_ks.default_install.aio_native
- @remote_viewer_rhel6develssl:
only os.RHEL
......@@ -236,6 +237,11 @@ variants:
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.rr.client_guest_shutdown.RHEL.6.devel.x86_64
- @remote_viewer_rhel6devel_build_install:
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_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 spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.no_ssl.no_password.dcp_off.1monitor.default_sc
......@@ -335,6 +341,28 @@ variants:
only qemu_kvm_rhel6devel_install_guest, qemu_kvm_rhel6devel_install_client
- install_win_guest:
only qemu_kvm_windows_install_guest
- build_install_qxl:
build_install_pkg = xf86-video-qxl
vm_name = guest
dst_dir = /tmp
libpciaccess_devel_url = path_to_libpciaccess_rpm
xorg_x11_server_devel_url = path_to_xorgx11server_rpm
xorg_x11_util_macros_url = path_to_xorgx11utilmacros_rpm
only remote_viewer_rhel6devel_build_install
- build_install_vdagent:
build_install_pkg = spice-vd-agent
vm_name = guest
dst_dir = /tmp
libpciaccess_devel_url = path_to_libpciaccess_rpm
only remote_viewer_rhel6devel_build_install
- build_install_spicegtk:
build_install_pkg = spice-gtk
vm_name = client
dst_dir = /tmp
celt051_devel_url = path_to_libpciaccess_rpm
libogg_devel_url = path_to_libogg_rpm
libcacard_devel_url = path_to_libcacard_rpm
only remote_viewer_rhel6devel_build_install
- negative_qemu_spice_launch_badport:
only spice.default_ipv.default_pc.default_sv.default_zlib_wc.default_jpeg_wc.default_ic.bad_port.no_password.dcp_off.1monitor.default_sc
only spice_negative_rhel6devel
......@@ -632,3 +660,6 @@ only create_vms, negative_qemu_spice_launch_badport, negative_qemu_spice_launch_
#Running all Windows Client, Windows Guest Spice Tests
#to be added
# Building qxl, spice-vdagent & spice-gtk install
#only build_install_qxl, build_install_spicegtk, build_install_vdagent
......@@ -27,6 +27,9 @@
type = smartcard_setup
- rv_connect:
type = rv_connect
- rv_build_install: rv_connect
type = rv_build_install
script = build_install.py
- rv_video:
type = rv_video
video_binary = totem
......
"""
rv_build_install.py - Builds and installs packages specified
using the build_install.py script
Requires: connected binaries remote-viewer, Xorg, gnome session, git
"""
import logging
import os
import time
import re
from autotest.client.shared import error
from virttest import utils_misc
from qemu.tests import rv_clearx, rv_input
def connect_to_vm(vm_name, env, params):
"""
Connects to VM and powers it on and gets session information
:param vm_name: name of VM to connect to
:param params: Dictionary with test parameters.
:param env: Test environment.
"""
vm = env.get_vm(params[vm_name + "_vm"])
vm.verify_alive()
vm_root_session = vm.wait_for_login(
timeout=int(params.get("login_timeout", 360)),
username="root", password="123456")
logging.info("VM %s is up and running" % vm_name)
return (vm, vm_root_session)
def install_rpms(rpms_to_install, vm_root_session):
"""
Fetches rpm and installs it
:params rpms_to_install: List of rpms to install
:params vm_root_session: Session object of VM
"""
for rpm in rpms_to_install:
logging.info("Installing %s" % rpm)
ret, output = vm_root_session.cmd_status_output("wget %s" % rpm)
if ret != 0:
logging.debug(output)
ret, output = vm_root_session.cmd_status_output("rpm -i %s" % rpm.split("/")[-1])
if ret != 0:
logging.debug(output)
def check_for_required_pkgs(pkgsRequired, vm_root_session, params):
"""
Checks to see if packages are installed and if not, gets the url to install them
:params rpms_to_install: List of packages to check
:params vm_root_session: Session object of VM
:param params: Dictionary with test parameters.
"""
rpms_to_install = []
for pkgName in pkgsRequired:
ret, output = vm_root_session.cmd_status_output("rpm -q %s" % pkgName)
if ret != 0:
logging.debug(output)
rpms_to_install.append(params.get(re.sub("-", "_", pkgName) + "_url"))
return rpms_to_install
def build_install_qxl(vm_root_session, vm_script_path, params):
"""
Build and install QXL in the VM
:param vm_root_session: VM Session object.
:param vm_script_path: path where to find build_install.py script
:param params: Dictionary with test parameters.
"""
# Remove older versions of qxl driver if they exist
output = vm_root_session.cmd("rm -rf /var/lib/xorg/modules/drivers/qxl_drv.so")
if output:
logging.debug(output)
# Checking to see if required rpms exist and if not, install them
pkgsRequired = ["libpciaccess-devel", "xorg-x11-util-macros", "xorg-x11-server-devel"]
rpms_to_install = check_for_required_pkgs(pkgsRequired, vm_root_session, params)
install_rpms(rpms_to_install, vm_root_session)
# latest spice-protocol is required to build qxl
output = vm_root_session.cmd("%s -p spice-protocol" % (vm_script_path))
logging.info(output)
if re.search("Return code", output):
raise error.TestFail("spice-protocol was not installed properly")
ret, output = vm_root_session.cmd_status_output("%s -p xf86-video-qxl" % (vm_script_path))
logging.info(ret)
logging.info(output)
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
:param vm_root_session: VM Session object.
:param vm_script_path: path where to find build_install.py script
:param params: Dictionary with test parameters.
"""
# Get version of spice-gtk before install
ret, output = vm_root_session.cmd_status_output("LD_LIBRARY_PATH=/usr/local/lib remote-viewer --spice-gtk-version")
if ret != 0:
logging.error(output)
else:
logging.info(output)
pkgsRequired = ["libogg-devel", "celt051-devel", "libcacard-devel"]
rpms_to_install = check_for_required_pkgs(pkgsRequired, vm_root_session, params)
install_rpms(rpms_to_install, vm_root_session)
rv_input.deploy_epel_repo(vm_root_session, params)
ret, output = vm_root_session.cmd_status_output("yum -y install perl-Text-CSV pyparsing", timeout=300)
logging.info(output)
# latest spice-protocol is required to build qxl
output = vm_root_session.cmd("%s -p spice-protocol" % (vm_script_path))
logging.info(output)
if re.search("Return code", output):
raise error.TestFail("spice-protocol was not installed properly")
ret, output = vm_root_session.cmd_status_output("%s -p spice-gtk" % (vm_script_path), timeout=300)
logging.info(ret)
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
ret, output = vm_root_session.cmd_status_output("LD_LIBRARY_PATH=/usr/local/lib remote-viewer --spice-gtk-version")
if ret != 0:
logging.error(output)
else:
logging.info(output)
def build_install_vdagent(vm_root_session, vm_script_path, params):
"""
Build and install spice-vdagent in the VM
:param vm_root_session: VM Session object.
:param vm_script_path: path where to find build_install.py script
:param params: Dictionary with test parameters.
"""
# Get current version of spice-vdagent
output = vm_root_session.cmd_output("spice-vdagent -h")
logging.info(output)
pkgsRequired = ["libpciaccess-devel"]
rpms_to_install = check_for_required_pkgs(pkgsRequired, vm_root_session, params)
install_rpms(rpms_to_install, vm_root_session)
# latest spice-protocol is required to build vdagent
output = vm_root_session.cmd("%s -p spice-protocol" % (vm_script_path))
logging.info(output)
if re.search("Return code", output):
raise error.TestFail("spice-protocol was not installed properly")
output = vm_root_session.cmd("%s -p spice-vd-agent" % (vm_script_path))
logging.info(output)
if re.search("Return code", output):
raise error.TestFail("spice-vd-agent was not installed properly")
# Restart vdagent
output = vm_root_session.cmd("service spice-vdagentd restart")
logging.info(output)
if re.search("fail", output, re.IGNORECASE):
raise error.TestFail("spice-vd-agent was not started properly")
# Get version number of spice-vdagent
output = vm_root_session.cmd_output("spice-vdagent -h")
logging.info(output)
def run_rv_build_install(test, params, env):
"""
Build and install packages from git on the client or guest VM
Supported configurations:
build_install_pkg: name of the package to get from git, build and install
:param test: QEMU test object.
:param params: Dictionary with the test parameters.
:param env: Dictionary with test environment.
"""
# Collect test parameters
pkgName = params.get("build_install_pkg")
script = params.get("script")
vm_name = params.get("vm_name")
dst_dir = params.get("dst_dir")
# Path of the script on the VM
vm_script_path = os.path.join(dst_dir, script)
# Get root session for the VM
(vm, vm_root_session) = connect_to_vm(vm_name, env, params)
# The following is to copy build_install.py script to the VM and do the test
scriptdir = os.path.join("deps", script)
# location of the script on the host
host_script_path = utils_misc.get_path(test.virtdir, scriptdir)
logging.info("Transferring the script to %s,"
"destination directory: %s, source script location: %s",
vm_name, vm_script_path, host_script_path)
vm.copy_files_to(host_script_path, vm_script_path, timeout=60)
time.sleep(5)
# Run build_install.py script
if pkgName == "xf86-video-qxl":
build_install_qxl(vm_root_session, vm_script_path, params)
elif pkgName == "spice-vd-agent":
build_install_vdagent(vm_root_session, vm_script_path, params)
elif pkgName == "spice-gtk":
build_install_spicegtk(vm_root_session, vm_script_path, params)
else:
logging.info("Not supported right now")
raise error.TestFail("Incorrect Test_Setup")
rv_clearx.run_rv_clearx(test, params, env)
......@@ -58,6 +58,7 @@ def launch_rv(client_vm, guest_vm, params):
:param params
"""
rv_binary = params.get("rv_binary", "remote-viewer")
rv_ld_library_path = params.get("rv_ld_library_path")
host_ip = utils_net.get_host_ip_address(params)
if guest_vm.get_spice_var("listening_addr") == "ipv6":
host_ip = "[" + utils_misc.convert_ipv4_to_ipv6(host_ip) + "]"
......@@ -174,11 +175,20 @@ def launch_rv(client_vm, guest_vm, params):
gencerts)
cmd += " --spice-smartcard-certificates " + gencerts
cmd = "nohup " + cmd + " &> /dev/null &" # Launch it on background
if rv_ld_library_path:
cmd = "export LD_LIBRARY_PATH=" + rv_ld_library_path + "; nohup " + cmd + " &> /dev/null &" # Launch it on background
else:
cmd = "nohup " + cmd + " &> /dev/null &" # Launch it on background
# Launching the actual set of commands
try:
print_rv_version(client_session, rv_binary)
if rv_ld_library_path:
print_rv_version(client_session, "LD_LIBRARY_PATH=/usr/local/lib " + rv_binary)
else:
print_rv_version(client_session, rv_binary)
except ShellStatusError, ShellProcessTerminatedError:
# Sometimes It fails with Status error, ingore it and continue.
# It's not that important to have printed versions in the log.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册