Changes: Fixing tests failures

RevBy: TrustMe
pull/1/head
Nimika Keshri 15 years ago
parent e595c7a269
commit eb3c794551

@ -72,22 +72,25 @@ class TC_Splash < Test::Unit::TestCase
return pid
end
def wait_for_app(app, timeout = 20, wait = 1)
pid = `pgrep #{app}`
print_debug("The Pid of #{app} is #{pid}")
len = pid.split(/\n/).length()
pid = get_pid(app)
start = Time.now
while pid == nil and Time.now < start + timeout
print_debug("Waiting for 1 sec")
sleep(wait)
pid = get_pid(app)
end
len = pid.length()
while len > 1 and Time.now < start + timeout
print_debug("Waiting for 1 sec")
sleep(wait)
pid = `pgrep #{app}`
print_debug("The Pid of #{app} is #{pid}")
len = pid.split(/\n/).length()
pid = get_pid(app)
len = pid.length()
if len == 1
break
end
end
return pid
end
def test_splash
@ -98,7 +101,7 @@ class TC_Splash < Test::Unit::TestCase
system "invoker --splash #{PortraitImg} --type=m #{TestApp} &"
sleep(2)
p = get_pid(TestApp)
p = wait_for_app(TestApp)
w = get_compositor_wid
prop1 = `xprop -id #{w} | awk '/_MEEGO_SPLASH_SCREEN/ {print $3}'`
@ -127,7 +130,7 @@ class TC_Splash < Test::Unit::TestCase
system "invoker --splash #{PortraitImg} --splash-landscape #{LandscapeImg} --type=m #{TestApp} &"
sleep(2)
p = get_pid(TestApp)
p = wait_for_app(TestApp)
w = get_compositor_wid
prop1 = `xprop -id #{w} | awk '/_MEEGO_SPLASH_SCREEN/ {print $3}'`
@ -154,13 +157,11 @@ class TC_Splash < Test::Unit::TestCase
launched without using splash
"""
system "invoker --splash #{PortraitImg} --splash-landscape #{LandscapeImg} --type=m #{TestApp} &"
wait_for_app(TestApp)
p = get_pid(TestApp)
p = wait_for_app(TestApp)
system "kill -15 #{p}"
sleep(2)
system "invoker --type=m #{No_Splash_App} &"
wait_for_app(No_Splash_App)
pid = get_pid(No_Splash_App)
pid = wait_for_app(No_Splash_App)
w = get_compositor_wid
prop1 = `xprop -id #{w} | awk '/_MEEGO_SPLASH_SCREEN/ {print $3}'`

@ -131,22 +131,19 @@ class BootModeTests(unittest.TestCase):
# check that launching works and the apps are there
for i in range(n):
run_cmd_as_user('/usr/bin/invoker -n -r 2 --type=m fala_multi-instance %d' % i)
time.sleep(4)
# give the applications time to really start
wait_for_app('fala_multi-instance')
time.sleep(2 * n + 5)
pids = get_pid('fala_multi-instance')
pids = pids.split()
# check that windows are there
st, op = commands.getstatusoutput('xwininfo -root -tree')
op = op.splitlines()
wids = []
for line in op:
if line.find('fala_multi-instance') != -1 and line.find('1x1+0+0') == -1:
print line
wids.append(line.split()[0])
st, op = commands.getstatusoutput("xwininfo -root -tree| grep 854x480+0+0 |awk '/fala_multi-instance/ {print $1}'")
wids = op.splitlines()
debug("The windows is %s " %wids)
# terminate apps
kill_process('fala_multi-instance', signum=15)

@ -81,7 +81,7 @@ class CoreDumpTests(unittest.TestCase):
time.sleep(3)
pid = get_pid(APP)
pid = wait_for_app(APP)
self.assert_(pid != None, APP + " is not running!")
pid = pid.splitlines()[0]

Loading…
Cancel
Save