From eb3c79455122918a6970bf001711d663b4b0b2dc Mon Sep 17 00:00:00 2001 From: Nimika Keshri Date: Mon, 23 May 2011 10:52:45 +0300 Subject: [PATCH] Changes: Fixing tests failures RevBy: TrustMe --- tests/harmattan/testscripts/tc_splash.rb | 27 ++++++++++--------- tests/harmattan/testscripts/test-boot-mode.py | 15 +++++------ tests/harmattan/testscripts/test-core-dump.py | 2 +- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/tests/harmattan/testscripts/tc_splash.rb b/tests/harmattan/testscripts/tc_splash.rb index 33c59f9..dd01344 100755 --- a/tests/harmattan/testscripts/tc_splash.rb +++ b/tests/harmattan/testscripts/tc_splash.rb @@ -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}'` diff --git a/tests/harmattan/testscripts/test-boot-mode.py b/tests/harmattan/testscripts/test-boot-mode.py index dd379a3..cef834f 100644 --- a/tests/harmattan/testscripts/test-boot-mode.py +++ b/tests/harmattan/testscripts/test-boot-mode.py @@ -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) diff --git a/tests/harmattan/testscripts/test-core-dump.py b/tests/harmattan/testscripts/test-core-dump.py index 69ae08e..6a9c5ac 100644 --- a/tests/harmattan/testscripts/test-core-dump.py +++ b/tests/harmattan/testscripts/test-core-dump.py @@ -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]