From ca93b45dfc4b015a3e4d2012502f7f3ec658baeb Mon Sep 17 00:00:00 2001 From: Dmitry Rozenshtein Date: Wed, 21 Sep 2011 11:33:30 +0300 Subject: [PATCH] Changes: Fix performance tests RevBy: Nimika Keshri --- debian/changelog | 2 +- debian/control | 6 ++--- tests/common/testapps/pixelchanged/main.c | 3 ++- tests/harmattan/testscripts/test-perf.rb | 31 ++++++++++++++++++++--- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 598a52a..6c3e43e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ applauncherd (2.0.1) unstable; urgency=low - * + * Changes: Fix performance tests -- Olli Leppanen Thu, 15 Sep 2011 16:05:02 +0300 diff --git a/debian/control b/debian/control index 2ee2851..43472e0 100644 --- a/debian/control +++ b/debian/control @@ -138,7 +138,7 @@ Description: Tests related to bugs and new features for applauncherd Package: applauncherd-libmeegotouch-perf-tests Priority: extra Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts +Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts, sysstat XB-Maemo-CI-Packages: applauncherd XB-Maemo-CI-Stage: fast Description: applauncherd performance tests for libmeegotouch applications @@ -146,7 +146,7 @@ Description: applauncherd performance tests for libmeegotouch applications Package: applauncherd-qml-perf-tests Priority: extra Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts +Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts, sysstat XB-Maemo-CI-Packages: applauncherd XB-Maemo-CI-Stage: fast Description: applauncherd performance tests for qml applications @@ -154,7 +154,7 @@ Description: applauncherd performance tests for qml applications Package: applauncherd-reference-perf-tests Priority: extra Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts +Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts, sysstat XB-Maemo-CI-Packages: applauncherd XB-Maemo-CI-Stage: fast Description: applauncherd performance tests for libmeegotouch applications without launcher diff --git a/tests/common/testapps/pixelchanged/main.c b/tests/common/testapps/pixelchanged/main.c index e5abe66..17a0ec1 100644 --- a/tests/common/testapps/pixelchanged/main.c +++ b/tests/common/testapps/pixelchanged/main.c @@ -256,7 +256,8 @@ int main(int argc, char **argv) int repeat = 1; while (repeat) { - usleep(50000); + //usleep(50000); + usleep(5000); image = XGetImage(dpy, rootw, pixel_x, pixel_y, 1, 1, AllPlanes, ZPixmap); pixel = XGetPixel(image, 0, 0); diff --git a/tests/harmattan/testscripts/test-perf.rb b/tests/harmattan/testscripts/test-perf.rb index e697d6a..55edc71 100755 --- a/tests/harmattan/testscripts/test-perf.rb +++ b/tests/harmattan/testscripts/test-perf.rb @@ -50,6 +50,23 @@ class TC_PerformanceTests < Test::Unit::TestCase puts message end + def waitload(treshold) + pLoad = 100; + counter = 1; + print_debug("Wait system load < #{treshold}") + pLoad_part = [] + #if system is loaded during long time then this loop iterates forever and the whole testcase will be stoped by testrunner on timeout + while (pLoad > treshold) + for i in 0..4 + pLoad_part.push( (100 - %x[sar -u 1 1|grep Average:|awk '{print $8}'].to_f)/100 ) #since in per cent + end + pLoad = pLoad_part.max + print_debug("#{counter} Pload: #{pLoad}") + counter = counter + 1 + pLoad_part.clear + end + end + def get_pid(app) pid = `pgrep #{app}`.split(/\s/).collect { |x| x.strip() }.delete_if { |x| x.empty? } print_debug("The Pid of #{app} is #{pid}") @@ -263,23 +280,27 @@ class TC_PerformanceTests < Test::Unit::TestCase if @options[:command] != nil # Check that the average system load is under 0.3 - print_debug("Check the avarage system load is under 0.3") - system "/usr/bin/waitloadavg.rb -l 0.3 -p 1.0 -t 100 -d" + #print_debug("Check the avarage system load is under 0.3") + #system "/usr/bin/waitloadavg.rb -l 0.3 -p 1.0 -t 100" start_command ="`#{PIXELCHANGED_BINARY} -t 101x4 -t 845x473 -q >> #{PIXELCHANGED_LOG} &`; #{FALA_GETTIME_BINARY} \"Started from command line\" >> #{PIXELCHANGED_LOG}; #{@options[:command]} &" print_debug ("start command: #{start_command}") + #Check the system load is under 0.1 + waitload(0.1) system start_command sleep (4) else + #Check the system load is under 0.1 + waitload(0.1) @pos = `#{GET_COORDINATES_SCRIPT} -a #{@options[:application]}` @pos = @pos.split("\n")[-1] print_debug ("Co-ordinates: #{@pos}") x_val = Integer(@pos.split("x")[0]) y_val = Integer(@pos.split("x")[1]) - print_debug("Check the avarage system load is under 0.3") - system "/usr/bin/waitloadavg.rb -l 0.3 -p 1.0 -t 50 -d" + #print_debug("Check the avarage system load is under 0.3") + #system "/usr/bin/waitloadavg.rb -l 0.3 -p 1.0 -t 100" cmd = 0 if (x_val >= 0 && x_val <= 420) if (y_val >= 240 && y_val <= 480) @@ -296,6 +317,8 @@ class TC_PerformanceTests < Test::Unit::TestCase end print_debug("pixel changed command is : #{cmd}") + #Check the system load is under 0.1 + waitload(0.1) system cmd sleep (4) # Raise meegotouchhome to the top.