diff --git a/tests/Harmattan/TestScripts/get-coordinates.rb b/tests/Harmattan/TestScripts/get-coordinates.rb index a51b900..ec1ad79 100755 --- a/tests/Harmattan/TestScripts/get-coordinates.rb +++ b/tests/Harmattan/TestScripts/get-coordinates.rb @@ -70,10 +70,13 @@ appOnTop = sut.application() system("initctl stop xsession/mprogressindicator") while appOnTop.attribute('objectName') != 'meegotouchhome' - fullName = appOnTop.attribute('FullName') - + # Killing the topmost application with xkill + system "DISPLAY=:0 xkill &" + sleep(0.5) + sut.tap_screen(50, 50) +# fullName = appOnTop.attribute('FullName') # puts "Now killing #{fullName} from the top" - system "pkill #{fullName}" +# system "pkill #{fullName}" appOnTop = sut.application() end @@ -97,7 +100,7 @@ if @meegoHome.test_object_exists?("LauncherButton", :text => appName) ypos = @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName).attribute('y') @pos = "#{xpos}x#{ypos}" - print @pos + puts @pos exit 0 else #icon does not diff --git a/tests/Harmattan/TestScripts/test-perf.rb b/tests/Harmattan/TestScripts/test-perf.rb index f562b04..35f5936 100755 --- a/tests/Harmattan/TestScripts/test-perf.rb +++ b/tests/Harmattan/TestScripts/test-perf.rb @@ -53,6 +53,11 @@ class TC_PerformanceTests < Test::Unit::TestCase options[:application] = app end + options[:binary] = nil + opts.on( '-b', '--binary BINARY', 'Name of the application binary which is used when killing the application' ) do|binary| + options[:binary] = binary + 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 @@ -62,6 +67,11 @@ class TC_PerformanceTests < Test::Unit::TestCase opts.on( '-l', '--limit MILLISECONDS', 'Time limit in milliseconds. Slower startup will make test to fail.' ) do|milliseconds| options[:limit] = milliseconds.to_i end + + options[:pre_step] = nil + opts.on( '-p', '--pre_step PRE_STEP', 'Command to be executed everytime before starting the application' ) do|pre_step| + options[:pre_step] = pre_step + end opts.on( '-h', '--help', 'Display this screen' ) do puts opts @@ -79,10 +89,20 @@ class TC_PerformanceTests < Test::Unit::TestCase exit 1 end + if @options[:binary] == nil + puts "Binary of the application not defined!" + exit 1 + end + + if @options[:command] != nil puts "#{@options[:command]}" end + if @options[:pre_step] != nil + puts "#{@options[:pre_step]}" + end + if $path.include?("scratchbox") puts "Inside SB, Do Nothing to unlock" else @@ -113,6 +133,7 @@ class TC_PerformanceTests < Test::Unit::TestCase end def open_Apps(appName) + #Remove the Log file if it exists if FileTest.exists?(PIXELCHANGED_LOG) system "rm #{PIXELCHANGED_LOG}" @@ -122,6 +143,14 @@ class TC_PerformanceTests < Test::Unit::TestCase if @options[:command] != nil puts "#{GET_COORDINATES_SCRIPT} -g" system "#{GET_COORDINATES_SCRIPT} -g" + sleep (1) + # execute the optional command if available + if @options[:pre_step] != nil + puts "pre_step: #{@options[:pre_step]}" + system "#{@options[:pre_step]}" + end + + # Check the avarage system load is under 0.3 system "/usr/bin/waitloadavg.rb -l 0.3 -p 1.0 -t 120 -d" @@ -129,19 +158,30 @@ class TC_PerformanceTests < Test::Unit::TestCase puts "start command: #{start_command}" system "#{start_command}" sleep (4) - puts "pkill \"#{@options[:command]}\"" - system "pkill \"#{@options[:command]}\"" + puts "pkill \"#{@options[:binary]}\"" + system "pkill \"#{@options[:binary]}\"" else @pos = `#{GET_COORDINATES_SCRIPT} -a #{@options[:application]}` + puts "original: #{@pos}" + @pos = @pos.split("\n")[-1] + puts "current: #{@pos}" + # execute the optional command if available + if @options[:pre_step] != nil + puts "pre_step: #{@options[:pre_step]}" + system "#{@options[:pre_step]}" + end puts @pos sleep (2) system "/usr/bin/waitloadavg.rb -l 0.3 -p 1.0 -t 120 -d" + puts "#{PIXELCHANGED_BINARY} -c #{@pos} -f #{PIXELCHANGED_LOG} -q" system "#{PIXELCHANGED_BINARY} -c #{@pos} -f #{PIXELCHANGED_LOG} -q" sleep (4) - system "pkill #{appName}" + # Kill the application from the top +# system "#{GET_COORDINATES_SCRIPT} -g" + system "pkill #{@options[:binary]}" end end diff --git a/tests/Harmattan/perftests/tests.xml b/tests/Harmattan/perftests/tests.xml index 3ddcad7..b209ae9 100644 --- a/tests/Harmattan/perftests/tests.xml +++ b/tests/Harmattan/perftests/tests.xml @@ -29,14 +29,16 @@ /usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120 - - source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -a fala_wl > /tmp/perf_grid_with_launcher.txt + + source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -a fala_wol -b "fala_wol" > /tmp/perf_grid_without_launcher.txt - - source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -a fala_wol > /tmp/perf_grid_without_launcher.txt + + + source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -a fala_wl -b "fala_wl" > /tmp/perf_grid_with_launcher.txt + false true @@ -55,10 +57,10 @@ - source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -c /usr/bin/fala_wl > /tmp/perf_commandline_with_launcher.txt + source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -c /usr/bin/fala_wl -b "fala_wl" > /tmp/perf_commandline_with_launcher.txt - source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -c /usr/bin/fala_wol > /tmp/perf_commandline_without_launcher.txt + source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -c /usr/bin/fala_wol -b "fala_wol" > /tmp/perf_commandline_without_launcher.txt false