88
99import logging , os
1010from autotest .client .shared import error
11- from virttest .aexpect import ShellCmdError , ShellStatusError , ShellTimeoutError
11+ from virttest .aexpect import ShellCmdError
1212from virttest import utils_misc , utils_spice
1313
1414def deploy_epel_repo (guest_session , params ):
@@ -25,18 +25,23 @@ def deploy_epel_repo(guest_session, params):
2525 output = guest_session .cmd (cmd , timeout = 10 )
2626 #Install epel repository If needed
2727 if "NeedsInstall" in output :
28+ arch = guest_session .cmd ("arch" )
29+ if "i686" in arch :
30+ arch = "i386"
31+ else :
32+ arch = arch [:- 1 ]
2833 if "release 5" in guest_session .cmd ("cat /etc/redhat-release" ):
29- cmd = ("rpm -ivh http://download.fedoraproject.org/pub/epel/5 /"
30- "`arch` /epel-release-5-4.noarch.rpm 2>&1" )
34+ cmd = ("yum -y localinstall http://download.fedoraproject.org/"
35+ "pub /epel/5/%s/epel -release-5-4.noarch.rpm 2>&1" % arch )
3136 logging .info ("Installing epel repository to %s" ,
3237 params .get ("guest_vm" ))
33- guest_session .cmd (cmd , print_func = logging .info , timeout = 60 )
38+ guest_session .cmd (cmd , print_func = logging .info , timeout = 90 )
3439 elif "release 6" in guest_session .cmd ("cat /etc/redhat-release" ):
35- cmd = ("rpm -ivh http://download.fedoraproject.org/pub/epel/6 /"
36- "`arch` /epel-release-6-8.noarch.rpm 2>&1" )
40+ cmd = ("yum -y localinstall http://download.fedoraproject.org/"
41+ "pub /epel/6/%s/epel -release-6-8.noarch.rpm 2>&1" % arch )
3742 logging .info ("Installing epel repository to %s" ,
3843 params .get ("guest_vm" ))
39- guest_session .cmd (cmd , print_func = logging .info , timeout = 60 )
44+ guest_session .cmd (cmd , print_func = logging .info , timeout = 90 )
4045 else :
4146 raise Exception ("Unsupported RHEL guest" )
4247
@@ -53,7 +58,7 @@ def install_wxpython(guest_session, params):
5358 try :
5459 guest_session .cmd (cmd )
5560 except ShellCmdError :
56- cmd = "yum -y install wxPython > /dev/null"
61+ cmd = "yum -y install wxPython --nogpgcheck > /dev/null"
5762 logging .info ("Installing wxPython package to %s" ,
5863 params .get ("guest_vm" ))
5964 guest_session .cmd (cmd , timeout = 60 )
@@ -217,6 +222,7 @@ def test_leds_migration(client_vm, guest_vm, guest_session, params):
217222 for key in test_keys :
218223 client_vm .send_key (key )
219224 utils_spice .wait_timeout (0.3 )
225+ utils_spice .wait_timeout (30 )
220226
221227def analyze_results (file_path , test_type ):
222228 """
@@ -279,19 +285,25 @@ def run_rv_input(test, params, env):
279285
280286 guest_session = guest_vm .wait_for_login (
281287 timeout = int (params .get ("login_timeout" , 360 )))
288+ guest_root_session = guest_vm .wait_for_login (
289+ timeout = int (params .get ("login_timeout" , 360 )),
290+ username = "root" , password = "123456" )
282291 try :
283292 guest_session .cmd ("! test -e /etc/redhat-release" )
284293 except ShellCmdError :
285- deploy_epel_repo (guest_session , params )
294+ deploy_epel_repo (guest_root_session , params )
286295
287- utils_spice .launch_startx (guest_vm )
296+ # utils_spice.launch_startx(guest_vm)
288297
289- guest_session .cmd ("export DISPLAY=:0.0" )
290- utils_spice .wait_timeout (3 )
291298 # Verify that gnome is now running on the guest
292- guest_session .cmd ("ps aux | grep -v grep | grep gnome-session" )
299+ try :
300+ guest_session .cmd ("ps aux | grep -v grep | grep gnome-session" )
301+ except aexpect .ShellCmdError :
302+ raise error .TestWarn ("gnome-session was probably not corretly started" )
303+
304+ guest_session .cmd ("export DISPLAY=:0.0" )
293305
294- install_wxpython (guest_session , params )
306+ install_wxpython (guest_root_session , params )
295307
296308 deploy_test_form (test , guest_vm , params )
297309
0 commit comments