Changes:Modified test-perf-rb to support command line starting and

parameters.

RevBy:TrustMe
pull/1/head
Olli Leppanen 15 years ago
parent e0e3c2f4e8
commit 35128d4df1

@ -15,6 +15,7 @@ usr/bin/fala_wl.launch
usr/bin/fala_wol
usr/bin/fala_wol.sh
usr/bin/fala_gettime
usr/bin/fala_gettime_ms
usr/bin/fala_pixelchanged
usr/share/dbus-1/services/com.nokia.fala_testapp.service
usr/share/dbus-1/services/com.nokia.fala_wl.service

@ -4,6 +4,7 @@ usr/share/applauncherd-testscripts/check_pipes.py
usr/share/applauncherd-testscripts/test-perf-mbooster.py
usr/share/applauncherd-testscripts/tc_theming.rb
usr/share/applauncherd-testscripts/test-perf.rb
usr/share/applauncherd-testscripts/get-coordinates.rb
usr/share/applauncherd-testscripts/utils.py
usr/share/applauncherd-testscripts/test-security.py
usr/share/applauncherd-testscripts/fala_wid

2
debian/changelog vendored

@ -1,6 +1,8 @@
applauncherd (0.15.2) unstable; urgency=low
* Fixes: NB#205006 - Redundant(?) booster-monitor processes takes a lot of memory
* Changed: Modified startup time tests to support command line starting and
parameters
-- Alexey Shilov <alexey.shilov@nokia.com> Tue, 23 Nov 2010 17:10:56 +0200

@ -46,6 +46,9 @@ add_subdirectory(Common/TestApps/themetest)
# Sub build: Common/TestApps/fala_gettime
add_subdirectory(Common/TestApps/fala_gettime)
# Sub build: Common/TestApps/fala_gettime_ms
add_subdirectory(Common/TestApps/fala_gettime_ms)
# Sub build: Common/TestApps/helloworld
add_subdirectory(Common/TestApps/helloworld)

@ -0,0 +1,13 @@
# Set sources
set(SRC fala_gettime_ms.cpp)
set(CMAKE_CXX_FLAGS "-O3")
# Link statically to minimize startup time.
set(CMAKE_EXE_LINKER_FLAGS "-static")
add_executable(fala_gettime_ms ${SRC})
# Install
install(PROGRAMS fala_gettime_ms DESTINATION /usr/bin/)

@ -0,0 +1,18 @@
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
timeval tim;
gettimeofday(&tim, NULL);
if (argc > 0) {
printf("%d%03d %s\n",
static_cast<int>(tim.tv_sec), static_cast<int>(tim.tv_usec/1000), argv[1]);
} else {
printf("%d%03d\n",
static_cast<int>(tim.tv_sec), static_cast<int>(tim.tv_usec/1000));
}
return true;
}

@ -9,6 +9,7 @@ install(FILES
install(PROGRAMS
ts_prestartapp.rb
tc_theming.rb
get-coordinates.rb
test-perf.rb
fala_wid
fala_xres_wl

@ -0,0 +1,106 @@
#!/usr/bin/ruby
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# Contact: Nokia Corporation (directui@nokia.com)
#
# This file is part of applauncherd.
#
# If you have questions regarding the use of this file, please contact
# Nokia at directui@nokia.com.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation
# and appearing in the file LICENSE.LGPL included in the packaging
# of this file.
#
# * Description: Performance Test for applauncherd
#
# * Objectives: test the startup time for applications
#
require 'tdriver'
require 'date'
require 'optparse'
include TDriverVerify
options = {}
optparse = OptionParser.new do|opts|
# Set a banner, displayed at the top
# of the help screen.
opts.banner = "Usage: get-coordinates.rb [options] "
options[:application] = nil
opts.on( '-a', '--application APP', 'Application name in application grid' ) do|app|
options[:application] = app
end
options[:grid] = false
opts.on( '-g', '--grid_only', 'Only make application grid visible, not find any coordinates ' ) do
options[:grid] = true
end
# This displays the help screen, all programs are
# assumed to have this option.
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit 0
end
end
optparse.parse!
if options[:application] == nil && !(options[:grid])
puts "Application name not defined!"
exit 1
end
pos = 0
appName=options[:application]
sut = TDriver.sut(:Id=> 'sut_qt_maemo')
appOnTop = sut.application()
while appOnTop.attribute('objectName') != 'meegotouchhome'
fullName = appOnTop.attribute('FullName')
# puts "Now killing #{fullName} from the top"
system "pkill #{fullName}"
appOnTop = sut.application()
end
# Application grid should be now visible
if options[:grid]
exit 0;
end
@meegoHome = sut.application(:name => 'meegotouchhome')
sleep(2)
if @meegoHome.test_object_exists?("LauncherButton", :text => appName)
icon = @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName)
while icon.attribute('visibleOnScreen') == 'false' || @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName).attribute('y').to_i > 400
@meegoHome.Launcher.MPannableViewport( :name => 'SwipePage' ).MWidget( :name => 'glass' ).gesture(:Up, 1, 300)
sleep(0.2)
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}"
print @pos
exit 0
else
#icon does not
#raise error and exit
raise "Application not found in Application grid"
exit 1
end

@ -19,161 +19,185 @@
# * Objectives: test the startup time for applications
#
require 'tdriver'
#require 'tdriver'
require 'date'
require 'test/unit'
include TDriverVerify
require 'optparse'
class TC_PerformanceTests < Test::Unit::TestCase
COUNT = 3
APP_WITH_LAUNCHER = 'fala_wl'
APP_WITHOUT_LAUNCHER = 'fala_wol'
PIXELCHANGED_BINARY= '/usr/bin/fala_pixelchanged'
TEST_SCRIPT_LOCATION = '/usr/share/applauncherd-testscripts'
PIXELCHANGED_LOG = '/tmp/fala_pixelchanged.log'
@start_time = 0
@end_time = 0
@pos = 0
$path = string = `echo $PATH `
# method called before any test case
def setup
COUNT = 3
PIXELCHANGED_BINARY= '/usr/bin/fala_pixelchanged'
TEST_SCRIPT_LOCATION = '/usr/share/applauncherd-testscripts'
GET_COORDINATES_SCRIPT="#{TEST_SCRIPT_LOCATION}/get-coordinates.rb"
PIXELCHANGED_LOG = '/tmp/fala_pixelchanged.log'
FALA_GETTIME_BINARY = '/usr/bin/fala_gettime_ms'
@start_time = 0
@end_time = 0
@pos = 0
@options = {}
@sut = TDriver.sut(:Id=> 'sut_qt_maemo')
if $path.include?("scratchbox")
puts "Inside SB, Do Nothing to unlock"
else
system "mcetool --set-tklock-mode=unlocked"
$path = string = `echo $PATH `
# method called before any test case
def setup
optparse = OptionParser.new do|opts|
options = {}
# Set a banner, displayed at the top
# of the help screen.
opts.banner = "Usage: get-coordinates.rb [options] "
options[:application] = nil
opts.on( '-a', '--application APP', 'Application name in application grid' ) do|app|
options[:application] = app
end
# restart duihome so that qttasserver notices it
# NOTE: Remove the cludge after duihome -> meegotouchhome renaming is complete
if not system("/sbin/initctl restart xsession/duihome")
system("/sbin/initctl restart xsession/mthome")
end
options[:command] = nil
opts.on( '-c', '--command_line COMMAND', 'Start application from witc COMMAND from command line instead of grid.' ) do|command|
options[:command] = command
end
system("initctl stop xsession/sysuid")
system("initctl stop xsession/applifed")
options[:limit] = nil
opts.on( '-l', '--limit MILLISECONDS', 'Time limit in milliseconds. Slower startup will make test to fail.' ) do|milliseconds|
options[:limit] = milliseconds.to_i
end
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit 0
end
@options=options
end
end
optparse.parse!
if @options[:application] == nil && @options[:command] == nil
puts "Application not defined!"
exit 1
end
# method called after any test case for cleanup purposes
def teardown
puts "exit from teardown"
system("initctl start xsession/sysuid")
system("initctl start xsession/applifed")
if @options[:command] != nil
puts "#{@options[:command]}"
end
def open_Apps(appName)
#Remove the Log file if it exists
if FileTest.exists?(PIXELCHANGED_LOG)
system "rm #{PIXELCHANGED_LOG}"
end
appOnTop = @sut.application()
while appOnTop.attribute('objectName') != 'meegotouchhome'
fullName = appOnTop.attribute('FullName')
puts "Now killing #{fullName} from the top"
system "pkill #{fullName}"
appOnTop = @sut.application()
end
#Open the Application from the application grid
begin
@meegoHome = @sut.application(:name => 'duihome')
rescue MobyBase::TestObjectNotFoundError
@meegoHome = @sut.application(:name => 'meegotouchhome')
end
sleep(2)
if @meegoHome.test_object_exists?("LauncherButton", :text => appName)
icon = @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName)
while icon.attribute('visibleOnScreen') == 'false'
@meegoHome.Launcher.MPannableViewport( :name => 'SwipePage' ).MWidget( :name => 'glass' ).gesture(:Up, 1, 300)
sleep(0.2)
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}"
puts @pos
sleep (2)
system "#{PIXELCHANGED_BINARY} -c #{@pos} -f #{PIXELCHANGED_LOG} -q"
sleep (4)
system "pkill #{appName}"
else
#icon does not
#raise error and exit
raise "Application not found in Application grid"
exit 1
end
if $path.include?("scratchbox")
puts "Inside SB, Do Nothing to unlock"
else
system "mcetool --set-tklock-mode=unlocked"
end
#restart duihome so that qttasserver notices it
#NOTE: Remove the cludge after duihome -> meegotouchhome renaming is complete
if not system("/sbin/initctl restart xsession/duihome")
system("/sbin/initctl restart xsession/mthome")
end
def read_file(appName)
#Reading the log file to get the time
lines = File.open(PIXELCHANGED_LOG).readlines().collect { |x| x.split(" ")[0].to_i }
system("initctl stop xsession/sysuid")
system("initctl stop xsession/applifed")
system("initctl stop xsession/search")
system("mv /usr/lib/qt4/plugins/testability/libtestability.so /tmp/.")
# system("pkill call-history")
sleep(4)
end
# First line tells when the button is released
@start_time = lines[0]
puts "Line1: #{lines[0]}"
# Second one when the first pixel has changed its color
@end_time = lines[1]
puts "Line2: #{lines[1]}"
# method called after any test case for cleanup purposes
def teardown
puts "exit from teardown"
system("initctl start xsession/sysuid")
system("initctl start xsession/applifed")
system("initctl start xsession/search")
system("mv /tmp/libtestability.so /usr/lib/qt4/plugins/testability/libtestability.so")
end
def open_Apps(appName)
#Remove the Log file if it exists
if FileTest.exists?(PIXELCHANGED_LOG)
system "rm #{PIXELCHANGED_LOG}"
end
def measure_time
#Measuring the Startup Time for applications
app_t = @end_time - @start_time
return app_t
sleep(2)
if @options[:command] != nil
puts "#{GET_COORDINATES_SCRIPT} -g"
system "#{GET_COORDINATES_SCRIPT} -g"
# system "ls -l -s -R /usr/share/applications"
start_command ="`#{PIXELCHANGED_BINARY} -q >> #{PIXELCHANGED_LOG} &`; #{FALA_GETTIME_BINARY} \"Started from command line\" >> #{PIXELCHANGED_LOG}; #{@options[:command]} &"
puts "start command: #{start_command}"
system "#{start_command}"
sleep (4)
puts "pkill \"#{@options[:command]}\""
system "pkill \"#{@options[:command]}\""
else
@pos = `#{GET_COORDINATES_SCRIPT} -a #{@options[:application]}`
puts @pos
sleep (2)
system "#{PIXELCHANGED_BINARY} -c #{@pos} -f #{PIXELCHANGED_LOG} -q"
sleep (4)
system "pkill #{appName}"
end
def test_performance
wL = []
woL = []
wLsum = 0
woLsum = 0
#Run Application with invoker
for i in 1..COUNT
print "Now Launching #{APP_WITH_LAUNCHER} %d times\n" %i
open_Apps(APP_WITH_LAUNCHER)
sleep (5)
read_file(APP_WITH_LAUNCHER)
wL.push(measure_time)
end
#Run Application without invoker
for i in 1..COUNT
print "Now Launching #{APP_WITHOUT_LAUNCHER} %d times\n" %i
open_Apps(APP_WITHOUT_LAUNCHER)
sleep (5)
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
for i in 0..COUNT-1
print "%d \t\t\t %d\n" %[wL[i],woL[i]]
wLsum = wLsum + wL[i]
woLsum = woLsum + woL[i]
end
print "\nAverage Values \n"
print "%d \t\t\t %d\n\n" %[wLsum/COUNT, woLsum/COUNT]
end
def read_file(appName)
#Reading the log file to get the time
lines = File.open(PIXELCHANGED_LOG).readlines().collect { |x| x.split(" ")[0].to_i }
# First line tells when the button is released
@start_time = lines[0]
puts "Clicked: #{lines[0]}"
# Second one when the first pixel has changed its color
@end_time = lines[1]
puts "Pixel changed: #{lines[1]}"
end
def measure_time
#Measuring the Startup Time for applications
app_t = @end_time - @start_time
return app_t
end
def test_performance
wL = []
wLsum = 0
#Run Application with invoker
for i in 1..COUNT
print "Now Launching #{@options[:application]} %d times\n" %i
open_Apps(@options[:application])
sleep (5)
read_file(@options[:application])
wL.push(measure_time)
end
print "\n\nStartup time in milliseconds\n"
print "Application: #{@options[:application]} \n"
if @options[:limit] != nil
print "Time limit: #{@options[:limit]} \n"
end
#Printing the data
for i in 0..COUNT-1
print "%d \n" %[wL[i]]
wLsum = wLsum + wL[i]
end
print "\nAverage: \n"
print "%d\n" %[wLsum/COUNT]
if @options[:limit] != nil
assert((wLsum/COUNT) < @options[:limit], "Application: #{@options[:application]} avarage startup was slower than #{@options[:limit]} ms")
end
end
end

@ -5,7 +5,7 @@
<!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
<suite name="applauncherd-performance-tests" domain="Application framework">
<set name="test-commandline" description="applauncherd application startup time from command line" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<set name="test-commandline" description="Applauncherd application startup time from command line with Python" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
@ -24,13 +24,41 @@
</get>
</set>
<set name="test-applicationGrid" description="applauncherd application startup time from application grid" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<set name="test-applicationGrid" description="Application startup time from application grid" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="Perf-Test" type="Performance" description="Measure startup time of the application using launcher" timeout="360" level="System" insignificant="true">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance &gt; /tmp/launcher_perf_new.txt</step>
<case name="Perf-Test-Grid-launcher" type="Performance" description="Measure startup time of the application using launcher" timeout="360" level="System" insignificant="true">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -a fala_wl &gt; /tmp/perf_grid_with_launcher.txt</step>
</case>
<case name="Perf-Test-Grid-plain" type="Performance" description="Measure startup time of the application without launcher" timeout="360" level="System" insignificant="true">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -a fala_wol &gt; /tmp/perf_grid_without_launcher.txt</step>
</case>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
</environments>
<get>
<file>/tmp/perf_grid_with_launcher.txt</file>
<file>/tmp/perf_grid_without_launcher.txt</file>
</get>
</set>
<set name="test-command-line" description="Application startup time from command line" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="Perf-Test-Command-launcher" type="Performance" description="Measure startup time of the application using launcher" timeout="360" level="System" insignificant="true">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -c /usr/bin/fala_wl &gt; /tmp/perf_commandline_with_launcher.txt</step>
</case>
<case name="Perf-Test-Command-plain" type="Performance" description="Measure startup time of the application using launcher" timeout="360" level="System" insignificant="true">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -c /usr/bin/fala_wol &gt; /tmp/perf_commandline_without_launcher.txt</step>
</case>
<environments>
<scratchbox>false</scratchbox>
@ -38,7 +66,8 @@
</environments>
<get>
<file>/tmp/launcher_perf_new.txt</file>
<file>/tmp/perf_commandline_with_launcher.txt</file>
<file>/tmp/perf_commandline_without_launcher.txt</file>
</get>
</set>

Loading…
Cancel
Save