Changes: Refactored the performance test to use xresponse for startup times

RevBy: TrustMe
pull/1/head
Nimika Keshri 15 years ago
parent 3b703d091e
commit 39405e3533

@ -6,4 +6,7 @@ usr/share/applauncherd-testscripts/tc_theming.rb
usr/share/applauncherd-testscripts/test-perf.rb
usr/share/applauncherd-testscripts/utils.py
usr/share/applauncherd-testscripts/test-security.py
usr/share/applauncherd-testscripts/fala_wid
usr/share/applauncherd-testscripts/fala_xres_wl
usr/share/applauncherd-testscripts/fala_xres_wol
usr/share/applauncherd-testscripts/signal-forward/*

2
debian/control vendored

@ -65,7 +65,7 @@ Description: applauncherd unit tests
Package: applauncherd-testscripts
Priority: extra
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, testrunner-lite, applauncherd, ci-testing, testability-driver, libcreds2 [arm armel], libcreds2-tools [arm armel], meego-env, mcetools (>= 1.10.40), rdoc, python, ruby
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, testrunner-lite, applauncherd, ci-testing, testability-driver, libcreds2 [arm armel], libcreds2-tools [arm armel], meego-env, mcetools (>= 1.10.40), rdoc, python, ruby, xresponse
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, staging, acceptance, validation
Description: applauncherd testscripts

@ -10,6 +10,9 @@ install(PROGRAMS
ts_prestartapp.rb
tc_theming.rb
test-perf.rb
fala_wid
fala_xres_wl
fala_xres_wol
DESTINATION /usr/share/applauncherd-testscripts)
add_subdirectory (signal-forward)

@ -0,0 +1,2 @@
#!/bin/sh
for wid in $(xwininfo -root -tree| awk '/864x480\+0\+0/{print $1}'); do echo $wid $(xprop -id $wid | awk '/_NET_WM_PID/{print $3}') | awk -v BOOSTERPID=$(pidof booster-m) '{if (BOOSTERPID == $2) print $1}'; done

@ -0,0 +1,5 @@
#!/bin/sh
x=`sh /usr/bin/fala_wid`
xresponse -a 'duihome' -w 0 -id $x -c $1 -u > /tmp/app_xresponse.log&
echo $x

@ -0,0 +1,3 @@
#!/bin/sh
xresponse -a 'duihome' -w 0 -a 'fala_wol' -c $1 -u > /tmp/app_xresponse.log&

@ -26,9 +26,12 @@ include TDriverVerify
class TC_PerformanceTests < Test::Unit::TestCase
COUNT = 5
COUNT = 3
APP_WITH_LAUNCHER = 'fala_wl'
APP_WITHOUT_LAUNCHER = 'fala_wol'
@start_time = 0
@end_time = 0
@pos = 0
$path = string = `echo $PATH `
@ -56,30 +59,37 @@ class TC_PerformanceTests < Test::Unit::TestCase
def open_Apps(appName)
#Remove the Log file if it exists
if FileTest.exists?("/tmp/testapp.log")
system "rm /tmp/testapp.log"
if FileTest.exists?("/tmp/app_xresponse.log")
system "rm /tmp/app_xresponse.log"
end
count = 0
#Open the Application from the application grid
@meegoHome = @sut.application(:name => 'duihome')
@meegoHome.MButton(:name => "ToggleLauncherButton").tap
sleep(2)
if @meegoHome.test_object_exists?("LauncherButton", :text => appName)
icon = @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName)
totalPages = @meegoHome.children(:type => 'LauncherPage').length
while icon.attribute('visibleOnScreen') == 'false' and count < totalPages
@meegoHome.PagedViewport(:name => 'LauncherPagedViewport').MWidget(:name => 'glass').gesture(:Left, 1, 800)
while icon.attribute('visibleOnScreen') == 'false'
@meegoHome.Launcher.MPannableViewport( :name => 'SwipePage' ).MWidget( :name => 'glass' ).gesture(:Up, 1, 300)
sleep(0.2)
count = count +1
icon.refresh
end
xpos = @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName).attribute('x')
ypos = @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName).attribute('y')
@pos = "#{xpos}x#{ypos}"
if appName == APP_WITH_LAUNCHER
@winId = `sh /usr/bin/fala_xres_wl #{@pos}`
@winId = @winId.split("\n")[0]
else
system "sh /usr/bin/fala_xres_wol #{@pos}"
end
@meegoHome.LauncherButton(:name => "LauncherButton", :text => appName).tap
sleep (2)
@app = @sut.application(:name => appName)
sleep (2)
@app.MEscapeButtonPanel.MButton( :name => 'CloseButton' ).tap
system "pkill xresponse"
else
#icon does not
#raise error and exit
@ -88,18 +98,37 @@ class TC_PerformanceTests < Test::Unit::TestCase
end
end
def read_file
#Reading the log file to get the time
file_name="/tmp/testapp.log"
last_line = `tail -n 2 #{file_name}`
@start_time = `head -n 1 #{file_name}`
@end_time = last_line.split(" ")[0]
def read_file(appName)
#Reading the log file to get the time
file_name="/tmp/app_xresponse.log"
search_str1 = "Button 1 pressed at #{@pos}"
x = check_file('/tmp/app_xresponse.log', search_str1)
@start_time = x.split(':')[0].split('ms')[0]
if appName == APP_WITH_LAUNCHER
search_str2 = "Got damage event 864x480+0+0 from #{@winId}"
y = check_file('/tmp/app_xresponse.log', search_str2)
@end_time = y.split(':')[0].split('ms')[0]
else
search_wId = check_file('/tmp/app_xresponse.log',APP_WITHOUT_LAUNCHER )
@winId = search_wId.split(" ")[6]
search_str2 = "Got damage event 864x480+0+0 from #{@winId}"
y = check_file('/tmp/app_xresponse.log', search_str2)
@end_time = y.split(':')[0].split('ms')[0]
end
end
def check_file( file, string )
File.open( file ) do |io|
io.each {|line| line.chomp! ;
return line if line.include? string}
end
nil
end
def measure_time
#Measuring the Startup Time for applications
start_t = "%10.6f" % @start_time.to_f
app_t = Float(@end_time) - Float(start_t)
app_t = @end_time.to_i - @start_time.to_i
return app_t
end
@ -111,22 +140,23 @@ class TC_PerformanceTests < Test::Unit::TestCase
#Run Application with invoker
for i in 1..COUNT
open_Apps("fala_wl")
print "Now Launching fala_wl %d times\n" %i
print "Now Launching APP_WITH_LAUNCHER %d times\n" %i
open_Apps(APP_WITH_LAUNCHER)
sleep (5)
read_file
read_file(APP_WITH_LAUNCHER)
wL.push(measure_time)
end
#Run Application without invoker
for i in 1..COUNT
open_Apps("fala_wol")
print "Now Launching fala_wol %d times\n" %i
print "Now Launching APP_WITHOUT_LAUNCHER %d times\n" %i
open_Apps(APP_WITHOUT_LAUNCHER)
sleep (5)
read_file
read_file(APP_WITHOUT_LAUNCHER)
woL.push(measure_time)
end
print "Startup time in milliseconds\n"
print "With Launcher \t\t Without Launcher\n"
#Printing the data
@ -137,6 +167,7 @@ class TC_PerformanceTests < Test::Unit::TestCase
end
print "\nAverage Values \n"
print "%.2f \t\t\t %.2f\n\n" %[wLsum/COUNT, woLsum/COUNT]
end
end

Loading…
Cancel
Save