[meego-commits] 11058: Changes to devel:qt-mtf/meegotouch-applifed
nkeshri
no_reply at build.meego.com
Mon Dec 20 10:38:08 UTC 2010
Hi,
I have made the following changes to meegotouch-applifed in project devel:qt-mtf. Please review and accept ASAP.
Thank You,
nkeshri
[This message was auto-generated]
---
Request #11058:
submit: home:nkeshri:branches:devel:qt-mtf/meegotouch-applifed(r27)(update) -> devel:qt-mtf/meegotouch-applifed
Message:
updating upstream version 0.20.9 with bugfix (BCM#11552)
State: new 2010-12-20T02:38:06 nkeshri
Comment: None
changes files:
--------------
--- meegotouch-applifed.changes
+++ meegotouch-applifed.changes
@@ -0,0 +1,4 @@
+* Mon Dec 20 2010 Nimika Keshri <nimika.1.keshri at nokia.com> - 0.20.9
+- BCM#11552 - meegotouch-applifed outdated in MeeGo
+- Remove obsolete patch 0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
+
@@ -2,6 +6,6 @@
-- Update to 0.20.0 (BMC#7062)
-- Add tests package
-- Move testing related binaries from /usr/share to /usr/lib
-- Fix dependency to /usr/bin/ruby1.8
-- Ship empty configuration file on MeeGo
-- Install .desktop file in /etc/xdg/autostart to start applifed in UI session
+- Updated upstream version.
+- Packaged tests.
+- Moved testing related binaries from /usr/share to /usr/lib.
+- Fix dependence to /usr/bin/ruby1.8.
+- Ship empty configuration file on MeeGo.
+- Install .desktop file in /etc/xdg/autostart to start applifed in UI session.
old:
----
0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
meegotouch-applifed-0.20.0.tar.bz2
new:
----
meegotouch-applifed-0.20.9.tar.bz2
spec files:
-----------
--- meegotouch-applifed.spec
+++ meegotouch-applifed.spec
@@ -1,22 +1,21 @@
#
# Do NOT Edit the Auto-generated Part!
-# Generated by: spectacle version 0.20
+# Generated by: spectacle version 0.21
#
# >> macros
# << macros
Name: meegotouch-applifed
Summary: Application life cycle daemon
-Version: 0.20.0
+Version: 0.20.9
Release: 1
Group: System/Daemons
License: LGPLv2+
URL: http://meego.gitorious.com/meegotouch/meegotouch-applifed
Source0: %{name}-%{version}.tar.bz2
Source100: meegotouch-applifed.yaml
-Patch0: 0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
-Patch1: 0002-Ship-empty-conf-file-in-MeeGo.patch
-Patch2: 0003-Install-.desktop-file-on-MeeGo.patch
+Patch0: 0002-Ship-empty-conf-file-in-MeeGo.patch
+Patch1: 0003-Install-.desktop-file-on-MeeGo.patch
BuildRequires: pkgconfig(QtGui)
BuildRequires: pkgconfig(contextprovider-1.0)
BuildRequires: pkgconfig(meegotouch)
@@ -42,12 +41,10 @@
%prep
%setup -q -n %{name}-%{version}
-# 0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
-%patch0 -p1
# 0002-Ship-empty-conf-file-in-MeeGo.patch
-%patch1 -p1
+%patch0 -p1
# 0003-Install-.desktop-file-on-MeeGo.patch
-%patch2 -p1
+%patch1 -p1
# >> setup
# << setup
@@ -98,6 +95,8 @@
%{_bindir}/applifed
%{_bindir}/close-event
%{_bindir}/fali_hello
+%{_bindir}/fali_hello1
+%{_bindir}/fali_close
%{_bindir}/fali_multiapp
%{_bindir}/fali_mw1
%{_bindir}/fali_mw2
@@ -106,41 +105,46 @@
%{_bindir}/fali_toc
%{_bindir}/memoryhog
%{_datadir}/applications/fali_hello.desktop
+%{_datadir}/applications/fali_hello1.desktop
+%{_datadir}/applications/fali_close.desktop
%{_datadir}/applications/fali_toc.desktop
-%{_datadir}/applifed-art-tests/tests.xml
-%{_datadir}/applifed-bug-tests/tests.xml
-%{_datadir}/applifed-functional-tests/tests.xml
-%{_datadir}/applifed-performance-tests/tests.xml
+%{_datadir}/applifed-M-art-tests/tests.xml
+%{_datadir}/applifed-M-bug-tests/tests.xml
+%{_datadir}/applifed-M-functional-tests/tests.xml
+%{_datadir}/applifed-M-performance-tests/tests.xml
%{_datadir}/applifed-tests
-%{_libdir}/applifed-tests/tests.xml
+%{_datadir}/applifed-M-tests/tests.xml
%{_libdir}/applifed-tests/ut_configdata
%{_libdir}/applifed-tests/ut_cpuload
%{_libdir}/applifed-tests/ut_prestartapp
%{_libdir}/applifed-tests/ut_prestarter
-%{_datadir}/applifed-testscripts/cp-service.rb
-%{_datadir}/applifed-testscripts/cpu_load/cpu_load.conf
-%{_datadir}/applifed-testscripts/cpu_load/cpu_load_high.drive
-%{_datadir}/applifed-testscripts/cpu_load/cpu_load_low.drive
-%{_datadir}/applifed-testscripts/cpu_load/tc_cpu_load.rb
-%{_datadir}/applifed-testscripts/fautils.rb
-%{_datadir}/applifed-testscripts/functest_applifed.conf
-%{_datadir}/applifed-testscripts/functional.drive
-%{_datadir}/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.conf
-%{_datadir}/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.drive
-%{_datadir}/applifed-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb
-%{_datadir}/applifed-testscripts/prevent.conf
-%{_datadir}/applifed-testscripts/prevent.drive
+%{_datadir}/applifed-M-testscripts/cp-service.rb
+%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load.conf
+%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load_high.drive
+%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load_low.drive
+%{_datadir}/applifed-M-testscripts/cpu_load/tc_cpu_load.rb
+%{_datadir}/applifed-M-testscripts/fautils.rb
+%{_datadir}/applifed-M-testscripts/functest_applifed.conf
+%{_datadir}/applifed-M-testscripts/functional.drive
+%{_datadir}/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.conf
+%{_datadir}/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.drive
+%{_datadir}/applifed-M-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+%{_datadir}/applifed-M-testscripts/prevent.conf
+%{_datadir}/applifed-M-testscripts/prevent.drive
%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_hello.service.sb
%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_toc.service.sb
-%{_datadir}/applifed-testscripts/tc_applifed_one_instance.rb
-%{_datadir}/applifed-testscripts/tc_daemonize.rb
-%{_datadir}/applifed-testscripts/tc_prestart_preventing.rb
-%{_datadir}/applifed-testscripts/test-perf-prestart.py
-%{_datadir}/applifed-testscripts/test-perf-prestart.pyc
-%{_datadir}/applifed-testscripts/test-perf-prestart.pyo
-%{_datadir}/applifed-testscripts/ts_mwtests.rb
-%{_datadir}/applifed-testscripts/ts_prestart.rb
+%{_datadir}/applifed-M-testscripts/tc_applifed_one_instance.rb
+%{_datadir}/applifed-M-testscripts/tc_daemonize.rb
+%{_datadir}/applifed-M-testscripts/tc_prestart_preventing.rb
+%{_datadir}/applifed-M-testscripts/test-perf-prestart.py
+%{_datadir}/applifed-M-testscripts/test-perf.rb
+%exclude %{_datadir}/applifed-M-testscripts/test-perf-prestart.pyc
+%exclude %{_datadir}/applifed-M-testscripts/test-perf-prestart.pyo
+%{_datadir}/applifed-M-testscripts/ts_mwtests.rb
+%{_datadir}/applifed-M-testscripts/ts_prestart.rb
%{_datadir}/dbus-1/services/com.nokia.fali_hello.service
+%{_datadir}/dbus-1/services/com.nokia.fali_hello1.service
+%{_datadir}/dbus-1/services/com.nokia.fali_close.service
%{_datadir}/dbus-1/services/com.nokia.fali_mw1.service
%{_datadir}/dbus-1/services/com.nokia.fali_mw2.service
%{_datadir}/dbus-1/services/com.nokia.fali_mw3.service
other changes:
--------------
++++++ meegotouch-applifed-0.20.0.tar.bz2 -> meegotouch-applifed-0.20.9.tar.bz2
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -5,7 +5,6 @@
set(CMAKE_VERBOSE_MAKEFILE ON)
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -g -Wno-long-long -O2 -Wextra -Wpointer-arith -Wwrite-strings -Wold-style-cast -Woverloaded-virtual -Wundef")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -g -O2")
# Find Qt4
@@ -34,19 +33,11 @@
# Build tests if BUILD_TESTS environment variable is set
if ($ENV{BUILD_TESTS})
# Sub build: tests
- add_subdirectory(tests/functests)
+ add_subdirectory(tests/Common)
# Sub build: tests
- add_subdirectory(tests/perftests)
+ add_subdirectory(tests/Harmattan)
# Sub build: tests
- add_subdirectory(tests/unittests)
- # Sub build: tests
- add_subdirectory(tests/TestApps)
- # Sub build: tests
- add_subdirectory(tests/TestScripts)
- # Sub build: tests
- add_subdirectory(tests/art-tests)
- # Sub build: tests
- add_subdirectory(tests/bug-tests)
+ add_subdirectory(tests/Meego)
endif ($ENV{BUILD_TESTS})
# Install configuration file here
--- README
+++ README
@@ -23,6 +23,67 @@
the applications to be prestarted during boot. This file is part of the platform
configuration and cannot be modified by applications.
+ Structure of the config file:
+
+ <?xml version="1.0"?>
+ <applifed [ATTRIBUTES]>
+
+ <!-- Prestarts inited by applifed -->
+ <application [ATTRIBUTES]/>
+ ...
+ <application [ATTRIBUTES]/>
+
+ <!-- White list for lazily shutdowned applications not managed
+ by applifed -->
+ <allow_lazy_shutdown [ATTRIBUTES]/>
+ ...
+ <allow_lazy_shutdown [ATTRIBUTES]/>
+
+ </applifed>
+
+
+ Attributes in <applifed> element explained:
+
+ Purpose of this element is to provide some global settings.
+
+ default_cpu_load_threshold : Start prestart actions when cpu load drops below this
+ percentage (1..100) by default.
+
+ default_re-prestart_trigger : Perform a forced re-prestart when application's release count
+ exceeds this value by default.
+
+ cpu_load_polling_delay : Poll CPU load from /proc/stat periodically using this delay
+ when there's something to prestart. In seconds.
+
+ re-prestart_delay : Delay to wait after screen goes blank before starting
+ possible forced re-prestarts. In seconds.
+
+
+ Attributes in <application> element explained:
+
+ Purpose of this element is to add a prestartable service.
+
+ name : Application name (used only for logging).
+
+ service : D-Bus service to be prestarted.
+
+ priority : Priority in the prestart queue. Smaller value means greater priority.
+
+ cpu_load_threshold : Override global default_cpu_load_threshold.
+
+ re-prestart_trigger : Override global default_re-prestart_trigger.
+
+ forced_re-prestart_not_allowed : Never perform forced re-prestart for this application.
+
+
+ Attributes in <allow_lazy_shutdown> element explained:
+
+ Purpose of this element is to white-list lazily shutdownable applications not managed by
+ applifed. Applications added with <application> are automatically white-listed.
+
+ binary_path : Don't kill lazily shutdowned external application if its binary path matches this.
+
+
Example configuration file:
<?xml version="1.0"?>
@@ -39,6 +100,7 @@
<allow_lazy_shutdown binary_path="/usr/bin/application1"/>
<allow_lazy_shutdown binary_path="/usr/bin/application2"/>
</applifed>
+
How does it work
----------------
--- debian/api
+++ debian/api
@@ -1,6 +1,7 @@
subsystem: Direct UI Framework
src-pkg: applifed
interface: applifed.conf
+scope: Internal
type: file
files: /etc/prestart/nokia.conf
state: unstable
--- debian/applifed-testapps.install
+++ debian/applifed-testapps.install
@@ -1,7 +1,13 @@
# Helloworld test app
usr/share/applications/fali_hello.desktop
+usr/share/applications/fali_hello1.desktop
+usr/share/applications/fali_close.desktop
usr/share/dbus-1/services/com.nokia.fali_hello.service
+usr/share/dbus-1/services/com.nokia.fali_hello1.service
+usr/share/dbus-1/services/com.nokia.fali_close.service
+usr/bin/fali_hello1
usr/bin/fali_hello
+usr/bin/fali_close
# TerminateOnClose test app
usr/bin/fali_toc
--- debian/changelog
+++ debian/changelog
@@ -1,3 +1,71 @@
+applifed (0.20.9) stable; urgency=low
+
+ * Fixes: NB#212832 - X Error: BadWindow when application is terminated
+ * Changes: Kill prestarted applications when applifed terminates. One new unit test.
+ * Changes: Refactor lock check so that it works also for --fork.
+
+ -- Jussi Lind <jussi.lind at nokia.com> Mon, 13 Dec 2010 12:58:13 +0200
+
+applifed (0.20.8) stable; urgency=low
+
+ * Changes: Added the new startup time tests
+ * Implemented: SWP#DUI-4283
+ * Fixes: NB#211151 - Contacts application not prestarted
+
+ -- Olli Leppanen <olli.leppanen at nokia.com> Thu, 26 Nov 2010 13:54:34 +0200
+
+applifed (0.20.7) stable; urgency=low
+
+ * Changes: scope field added to the api file
+ * Changes: testapps page title set as the application name
+
+ -- Nimika Keshri <nimika.1.keshri at nokia.com> Thu, 04 Nov 2010 09:54:34 +0200
+
+applifed (0.20.6) stable; urgency=low
+
+ * Changes: acceptance and validation tags removed for tests packages
+
+ -- Nimika Keshri <nimika.1.keshri at nokia.com> Tue, 02 Nov 2010 12:03:58 +0200
+
+applifed (0.20.5) stable; urgency=low
+
+ * Tests fixes
+
+ -- Nimika Keshri <nimika.1.keshri at nokia.com> Mon, 01 Nov 2010 11:33:41 +0200
+
+applifed (0.20.4) stable; urgency=low
+
+ * Changes: Test package dependency for python and ruby added
+
+ -- Nimika Keshri <nimika.1.keshri at nokia.com> Tue, 12 Oct 2010 15:32:54 +0300
+
+applifed (0.20.3) stable; urgency=low
+
+ * Changes: Package dependency changed from testrunner -> testrunner-lite
+
+ -- Nimika Keshri <nimika.1.keshri at nokia.com> Tue, 12 Oct 2010 11:58:16 +0300
+
+applifed (0.20.2) stable; urgency=low
+ * Fixes: NB#196398
+ * Removed -Wno-psabi from CXX_FLAGS.
+
+ -- Juha Lintula <juha.lintula at nokia.com> Wed, 06 Oct 2010 13:25:05 +0300
+
+applifed (0.20.1) stable; urgency=low
+
+ * Fixes: NB#194059
+ * Added -Wno-psabi to CXX_FLAGS in order to suppress va_list mangling warnings originating from Qt.
+ * Code cleanup done for tests scripts
+ * Fixed crashing multiwindow testapps
+ * ruby1.8 changed to ruby in the tests scripts
+ * Few minor modifications done to new perf test and added the test criteria of 0.75sec
+ * Stopping applifed before performance test run
+ * Performance test application's visibility signal is based on the visibility of the window, not of the page.
+ * Documentation of the config file improved in README.
+ * Performance test script stops the applifed during test run.
+
+ -- Nimika Keshri <nimika.1.keshri at nokia.com> Mon, 06 Sep 2010 10:44:04 +0300
+
applifed (0.20.0) stable; urgency=low
* Matti renamed to TDriver
--- debian/control
+++ debian/control
@@ -14,27 +14,23 @@
Package: applifed-tests
Section: extra
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libmeegotouchcore0, libmeegotouchviews0, libmeegotouchextensions0, libmeegotouchsettings0, testrunner, applifed, ci-testing
+Depends: ${shlibs:Depends}, ${misc:Depends}, libmeegotouchcore0, libmeegotouchviews0, libmeegotouchextensions0, libmeegotouchsettings0, testrunner-lite, applifed, ci-testing
XB-Maemo-CI-Packages: applifed
-XB-Maemo-CI-Stage: fast, staging, acceptance, validation
+XB-Maemo-CI-Stage: fast, staging
Description: applifed unit tests
Unit testing binaries and shellscripts for testing applifed.
Package: applifed-testapps
Section: extra
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libmeegotouchcore0, libmeegotouchviews0, libmeegotouchextensions0, libmeegotouchsettings0, testrunner, applifed
-XB-Maemo-CI-Packages: applifed
-XB-Maemo-CI-Stage: fast, staging, acceptance, validation
+Depends: ${shlibs:Depends}, ${misc:Depends}, libmeegotouchcore0, libmeegotouchviews0, libmeegotouchextensions0, libmeegotouchsettings0, testrunner-lite, applifed
Description: applifed testapps
Test applications for testing applifed.
Package: applifed-testscripts
Section: extra
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, testrunner, applifed-testapps, ci-testing, testability-driver, meego-env, mcetools (>= 1.10.40)
-XB-Maemo-CI-Packages: applifed
-XB-Maemo-CI-Stage: fast, staging, acceptance, validation
+Depends: ${shlibs:Depends}, ${misc:Depends}, testrunner-lite, applifed-testapps, ci-testing, testability-driver, meego-env, mcetools (>= 1.10.40), python, ruby
Description: applifed testscripts
Test scripts for testing applifed.
@@ -43,7 +39,7 @@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applifed-testapps, applifed-testscripts
XB-Maemo-CI-Packages: applifed
-XB-Maemo-CI-Stage: fast, staging, acceptance, validation
+XB-Maemo-CI-Stage: fast, staging
Description: applifed functional tests
Functional tests for testing applifed.
@@ -52,7 +48,7 @@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applifed-testapps, applifed-testscripts
XB-Maemo-CI-Packages: applifed
-XB-Maemo-CI-Stage: fast, staging, acceptance, validation
+XB-Maemo-CI-Stage: acceptance, validation
Description: applifed ART tests
ART tests for testing applifed.
@@ -61,16 +57,16 @@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applifed-testapps, applifed-testscripts
XB-Maemo-CI-Packages: applifed
-XB-Maemo-CI-Stage: fast, staging, acceptance, validation
+XB-Maemo-CI-Stage: fast, staging
Description: applifed bug tests
Tests related to some bugs for testing applifed.
Package: applifed-performance-tests
Section: extra
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, applifed-testapps, applifed-testscripts
+Depends: ${shlibs:Depends}, ${misc:Depends}, applifed-testapps, applifed-testscripts, applauncherd-testscripts (>=0.15.3), applauncherd-testapps (>=0.15.3)
XB-Maemo-CI-Packages: applifed
-XB-Maemo-CI-Stage: fast, acceptance, validation
+XB-Maemo-CI-Stage: fast, staging
Description: applifed performance tests
Performance tests for testing applifed.
--- debian/rules
+++ debian/rules
@@ -7,7 +7,7 @@
configure-stamp:
dh_testdir
# Configure Applifed to be build with tests
- BUILD_TESTS=1 ./configure
+ BUILD_TESTS=1 HARMATTAN=1 ./configure
touch configure-stamp
--- meego/README
+++ meego/README
@@ -1,4 +1,5 @@
-These files are for packaging applifed for MeeGo. In order to generate
-the RPM .spec file you need to have the spectacle package installed,
-and then run "specify ./meegotouch-applifed.yaml". Remember to update
-meegotouch-applifed.changes before you submit a package.
+This directory contains the packaging materials needed for packaging
+applifed for MeeGo. The files needed for packaging specific
+releases are contained in the corresponding directories. The script
+create-tarball.sh pulls a tar ball from a git repository, and the
+rest of the files are ready to be submitted to build.meego.com.
--- meego/applifed-0.20.0
+++ meego/applifed-0.20.0
+(directory)
--- meego/applifed-0.20.0/0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
+++ meego/applifed-0.20.0/0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
+From 94a83e0fdf4c73d642eebaa0428fac9250117353 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pertti=20Kellom=C3=A4ki?= <pertti.kellomaki at nokia.com>
+Date: Fri, 3 Sep 2010 15:10:48 +0300
+Subject: [PATCH] Use /usr/bin/ruby instead of /usr/bin/ruby1.8
+
+---
+ tests/TestScripts/cp-service.rb | 2 +-
+ tests/TestScripts/cpu_load/tc_cpu_load.rb | 2 +-
+ tests/TestScripts/fautils.rb | 2 +-
+ .../ts_periodic_re_prestart.rb | 2 +-
+ tests/TestScripts/tc_applifed_one_instance.rb | 2 +-
+ tests/TestScripts/tc_daemonize.rb | 2 +-
+ tests/TestScripts/tc_prestart_preventing.rb | 2 +-
+ tests/TestScripts/ts_mwtests.rb | 2 +-
+ tests/TestScripts/ts_prestart.rb | 2 +-
+ 9 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/tests/TestScripts/cp-service.rb b/tests/TestScripts/cp-service.rb
+index 861a7aa..f89a565 100755
+--- a/tests/TestScripts/cp-service.rb
++++ b/tests/TestScripts/cp-service.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/cpu_load/tc_cpu_load.rb b/tests/TestScripts/cpu_load/tc_cpu_load.rb
+index 9edc147..46e38a9 100755
+--- a/tests/TestScripts/cpu_load/tc_cpu_load.rb
++++ b/tests/TestScripts/cpu_load/tc_cpu_load.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/fautils.rb b/tests/TestScripts/fautils.rb
+index c435561..b5accd1 100644
+--- a/tests/TestScripts/fautils.rb
++++ b/tests/TestScripts/fautils.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb b/tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+index a8959df..7f3b75c 100755
+--- a/tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
++++ b/tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/tc_applifed_one_instance.rb b/tests/TestScripts/tc_applifed_one_instance.rb
+index d7b384a..4733623 100755
+--- a/tests/TestScripts/tc_applifed_one_instance.rb
++++ b/tests/TestScripts/tc_applifed_one_instance.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/tc_daemonize.rb b/tests/TestScripts/tc_daemonize.rb
+index e005246..f2af2d9 100644
+--- a/tests/TestScripts/tc_daemonize.rb
++++ b/tests/TestScripts/tc_daemonize.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/tc_prestart_preventing.rb b/tests/TestScripts/tc_prestart_preventing.rb
+index e8eb0ce..5d40fce 100755
+--- a/tests/TestScripts/tc_prestart_preventing.rb
++++ b/tests/TestScripts/tc_prestart_preventing.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/ts_mwtests.rb b/tests/TestScripts/ts_mwtests.rb
+index 772c225..baf1a84 100755
+--- a/tests/TestScripts/ts_mwtests.rb
++++ b/tests/TestScripts/ts_mwtests.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/ts_prestart.rb b/tests/TestScripts/ts_prestart.rb
+index 42a4b32..281d446 100755
+--- a/tests/TestScripts/ts_prestart.rb
++++ b/tests/TestScripts/ts_prestart.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+--
+1.7.0.4
+
--- meego/applifed-0.20.0/0002-Ship-empty-conf-file-in-MeeGo.patch
+++ meego/applifed-0.20.0/0002-Ship-empty-conf-file-in-MeeGo.patch
+From e841fb7d8a62098d28c792e06f78f6a747575b83 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pertti=20Kellom=C3=A4ki?= <pertti.kellomaki at nokia.com>
+Date: Tue, 7 Sep 2010 11:19:27 +0300
+Subject: [PATCH] Ship empty conf file in MeeGo.
+
+---
+ CMakeLists.txt | 8 ++++++--
+ prestart/empty.conf | 15 +++++++++++++++
+ 2 files changed, 21 insertions(+), 2 deletions(-)
+ create mode 100644 prestart/empty.conf
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f360a25..f279246 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -49,5 +49,9 @@ if ($ENV{BUILD_TESTS})
+ add_subdirectory(tests/bug-tests)
+ endif ($ENV{BUILD_TESTS})
+
+-# Install configuration file here
+-install(FILES prestart/nokia.conf DESTINATION /etc/prestart)
++# Install configuration file. On MeeGo, just ship an empty conf.
++if ($ENV{MEEGO})
++ install(FILES prestart/empty.conf DESTINATION /etc/prestart RENAME nokia.conf)
++else (NOT $ENV{MEEGO})
++ install(FILES prestart/nokia.conf DESTINATION /etc/prestart)
++endif ($ENV{MEEGO})
+diff --git a/prestart/empty.conf b/prestart/empty.conf
+new file mode 100644
+index 0000000..65af7e8
+--- /dev/null
++++ b/prestart/empty.conf
+@@ -0,0 +1,15 @@
++<?xml version="1.0"?>
++<applifed default_cpu_load_threshold="25" cpu_load_polling_delay="1" re-prestart_delay="3600" default_re-prestart_trigger="5">
++
++ <!-- Services prestarted by applifed -->
++
++ <!-- Allow lazy shutdown for these applications not managed
++ by applifed -->
++ <allow_lazy_shutdown binary_path="/usr/bin/devicelockd"/>
++ <allow_lazy_shutdown binary_path="/usr/bin/celluid"/>
++ <allow_lazy_shutdown binary_path="/usr/bin/sysuid"/>
++ <allow_lazy_shutdown binary_path="/usr/bin/mstartup"/>
++ <allow_lazy_shutdown binary_path="/usr/bin/duihome"/>
++
++</applifed>
++
+--
+1.7.0.4
+
--- meego/applifed-0.20.0/0003-Install-.desktop-file-on-MeeGo.patch
+++ meego/applifed-0.20.0/0003-Install-.desktop-file-on-MeeGo.patch
+From a90fb16d27d979125998294fa3d2d87c1e5ad115 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pertti=20Kellom=C3=A4ki?= <pertti.kellomaki at nokia.com>
+Date: Fri, 17 Sep 2010 14:57:16 +0300
+Subject: [PATCH] Install .desktop file on MeeGo.
+
+---
+ CMakeLists.txt | 5 +++++
+ meego/applifed.desktop | 4 ++++
+ 2 files changed, 9 insertions(+), 0 deletions(-)
+ create mode 100644 meego/applifed.desktop
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f279246..586387f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -55,3 +55,8 @@ if ($ENV{MEEGO})
+ else (NOT $ENV{MEEGO})
+ install(FILES prestart/nokia.conf DESTINATION /etc/prestart)
+ endif ($ENV{MEEGO})
++
++# On MeeGo, install a .desktop file to autostart applifed.
++if ($ENV{MEEGO})
++ install(FILES meego/applifed.desktop DESTINATION /etc/xdg/autostart)
++endif ($ENV{MEEGO})
+diff --git a/meego/applifed.desktop b/meego/applifed.desktop
+new file mode 100644
+index 0000000..eb31be8
+--- /dev/null
++++ b/meego/applifed.desktop
+@@ -0,0 +1,4 @@
++[Desktop Entry]
++Exec=/usr/bin/applifed
++X-Moblin-Priority=High
++OnlyShowIn=X-MEEGO-HS;
+--
+1.7.0.4
+
--- meego/applifed-0.20.0/create-tarball.sh
+++ meego/applifed-0.20.0/create-tarball.sh
+#!/bin/sh
+if test -n "$1"
+then
+ git archive --format tar --remote=$1 --output=meegotouch-applifed-0.20.0.tar --prefix meegotouch-applifed-0.20.0/ released/0.20.0
+ bzip2 meegotouch-applifed-0.20.0.tar
+else
+ echo "Usage: create-tarball.sh <repo>"
+ echo " where <repo> is suitable for git archive --remote=<repo>"
+fi
--- meego/applifed-0.20.0/meegotouch-applifed.changes
+++ meego/applifed-0.20.0/meegotouch-applifed.changes
+* Fri Sep 17 2010 Pertti Kellomäki <pertti.kellomaki at nokia.com> - 0.20.0
+- Updated upstream version.
+- Packaged tests.
+- Moved testing related binaries from /usr/share to /usr/lib.
+- Fix dependence to /usr/bin/ruby1.8.
+- Ship empty configuration file on MeeGo.
+- Install .desktop file in /etc/xdg/autostart to start applifed in UI session.
+
+* Mon Jul 12 2010 Pertti Kellomäki <pertti.kellomaki at nokia.com> - 0.17.0
+- Initial packaging.
--- meego/applifed-0.20.0/meegotouch-applifed.spec
+++ meego/applifed-0.20.0/meegotouch-applifed.spec
+#
+# Do NOT Edit the Auto-generated Part!
+# Generated by: spectacle version 0.20
+#
+# >> macros
+# << macros
+
+Name: meegotouch-applifed
+Summary: Application life cycle daemon
+Version: 0.20.0
+Release: 1
+Group: System/Daemons
+License: LGPLv2+
+URL: http://meego.gitorious.com/meegotouch/meegotouch-applifed
+Source0: %{name}-%{version}.tar.bz2
+Source100: meegotouch-applifed.yaml
+Patch0: 0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
+Patch1: 0002-Ship-empty-conf-file-in-MeeGo.patch
+Patch2: 0003-Install-.desktop-file-on-MeeGo.patch
+BuildRequires: pkgconfig(QtGui)
+BuildRequires: pkgconfig(contextprovider-1.0)
+BuildRequires: pkgconfig(meegotouch)
+BuildRequires: pkgconfig(x11)
+BuildRequires: cmake
+
+
+%description
+applifed is an application life cycle daemon. It manages prestarted applications.
+
+
+%package tests
+Summary: Tests for meegotouch-applifed
+Group: Development/Tools
+Requires: %{name} = %{version}-%{release}
+BuildRequires: desktop-file-utils
+
+%description tests
+Testing related files for meegotouch-applifed.
+
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+# 0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
+%patch0 -p1
+# 0002-Ship-empty-conf-file-in-MeeGo.patch
+%patch1 -p1
+# 0003-Install-.desktop-file-on-MeeGo.patch
+%patch2 -p1
+# >> setup
+# << setup
+
+%build
+# >> build pre
+export BUILD_TESTS=1
+export MEEGO=1
+# << build pre
+
+%configure --disable-static
+make %{?jobs:-j%jobs}
+
+# >> build post
+# << build post
+%install
+rm -rf %{buildroot}
+# >> install pre
+# << install pre
+%make_install
+
+# >> install post
+# rpmlint complains about installing binaries in /usr/share, so
+# move them elsewhere and leave a symlink in place.
+mkdir -p %{buildroot}/usr/lib
+mv %{buildroot}/usr/share/applifed-tests %{buildroot}/usr/lib
+(cd %{buildroot}/usr/share; ln -s ../lib/applifed-tests)
+# << install post
+
+
+
+
+
+
+
+
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/applifed
+%config %{_sysconfdir}/prestart/nokia.conf
+%config %{_sysconfdir}/xdg/autostart/applifed.desktop
+# >> files
+# << files
+
+
+%files tests
+%defattr(-,root,root,-)
+%{_bindir}/applifed
+%{_bindir}/close-event
+%{_bindir}/fali_hello
+%{_bindir}/fali_multiapp
+%{_bindir}/fali_mw1
+%{_bindir}/fali_mw2
+%{_bindir}/fali_mw3
+%{_bindir}/fali_perf
+%{_bindir}/fali_toc
+%{_bindir}/memoryhog
+%{_datadir}/applications/fali_hello.desktop
+%{_datadir}/applications/fali_toc.desktop
+%{_datadir}/applifed-art-tests/tests.xml
+%{_datadir}/applifed-bug-tests/tests.xml
+%{_datadir}/applifed-functional-tests/tests.xml
+%{_datadir}/applifed-performance-tests/tests.xml
+%{_datadir}/applifed-tests
+%{_libdir}/applifed-tests/tests.xml
+%{_libdir}/applifed-tests/ut_configdata
+%{_libdir}/applifed-tests/ut_cpuload
+%{_libdir}/applifed-tests/ut_prestartapp
+%{_libdir}/applifed-tests/ut_prestarter
+%{_datadir}/applifed-testscripts/cp-service.rb
+%{_datadir}/applifed-testscripts/cpu_load/cpu_load.conf
+%{_datadir}/applifed-testscripts/cpu_load/cpu_load_high.drive
+%{_datadir}/applifed-testscripts/cpu_load/cpu_load_low.drive
+%{_datadir}/applifed-testscripts/cpu_load/tc_cpu_load.rb
+%{_datadir}/applifed-testscripts/fautils.rb
+%{_datadir}/applifed-testscripts/functest_applifed.conf
+%{_datadir}/applifed-testscripts/functional.drive
+%{_datadir}/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.conf
+%{_datadir}/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.drive
+%{_datadir}/applifed-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+%{_datadir}/applifed-testscripts/prevent.conf
+%{_datadir}/applifed-testscripts/prevent.drive
+%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_hello.service.sb
+%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_toc.service.sb
+%{_datadir}/applifed-testscripts/tc_applifed_one_instance.rb
+%{_datadir}/applifed-testscripts/tc_daemonize.rb
+%{_datadir}/applifed-testscripts/tc_prestart_preventing.rb
+%{_datadir}/applifed-testscripts/test-perf-prestart.py
+%{_datadir}/applifed-testscripts/test-perf-prestart.pyc
+%{_datadir}/applifed-testscripts/test-perf-prestart.pyo
+%{_datadir}/applifed-testscripts/ts_mwtests.rb
+%{_datadir}/applifed-testscripts/ts_prestart.rb
+%{_datadir}/dbus-1/services/com.nokia.fali_hello.service
+%{_datadir}/dbus-1/services/com.nokia.fali_mw1.service
+%{_datadir}/dbus-1/services/com.nokia.fali_mw2.service
+%{_datadir}/dbus-1/services/com.nokia.fali_mw3.service
+%{_datadir}/dbus-1/services/com.nokia.fali_perf.service
+%{_datadir}/dbus-1/services/com.nokia.fali_toc.service
+# >> files tests
+# << files tests
+
--- meego/applifed-0.20.0/meegotouch-applifed.yaml
+++ meego/applifed-0.20.0/meegotouch-applifed.yaml
+Name: meegotouch-applifed
+Summary: Application life cycle daemon
+Version: 0.20.0
+Release: 1
+Group: System/Daemons
+License: LGPLv2+
+URL: http://meego.gitorious.com/meegotouch/meegotouch-applifed
+Sources:
+ - "%{name}-%{version}.tar.bz2"
+Patches:
+ - "0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch"
+ - "0002-Ship-empty-conf-file-in-MeeGo.patch"
+ - "0003-Install-.desktop-file-on-MeeGo.patch"
+Description: applifed is an application life cycle daemon. It manages prestarted applications.
+PkgConfigBR:
+ - QtGui
+ - contextprovider-1.0
+ - meegotouch
+ - x11
+PkgBR:
+ - cmake
+Builder: make
+Files:
+ - "%{_bindir}/applifed"
+ - "%config %{_sysconfdir}/prestart/nokia.conf"
+ - "%config %{_sysconfdir}/xdg/autostart/applifed.desktop"
+SubPackages:
+ - Name: tests
+ Group: Development/Tools
+ Summary: Tests for meegotouch-applifed
+ Description: |
+ Testing related files for meegotouch-applifed.
+ Files:
+ - "%{_bindir}/applifed"
+ - "%{_bindir}/close-event"
+ - "%{_bindir}/fali_hello"
+ - "%{_bindir}/fali_multiapp"
+ - "%{_bindir}/fali_mw1"
+ - "%{_bindir}/fali_mw2"
+ - "%{_bindir}/fali_mw3"
+ - "%{_bindir}/fali_perf"
+ - "%{_bindir}/fali_toc"
+ - "%{_bindir}/memoryhog"
+ - "%{_datadir}/applications/fali_hello.desktop"
+ - "%{_datadir}/applications/fali_toc.desktop"
+ - "%{_datadir}/applifed-art-tests/tests.xml"
+ - "%{_datadir}/applifed-bug-tests/tests.xml"
+ - "%{_datadir}/applifed-functional-tests/tests.xml"
+ - "%{_datadir}/applifed-performance-tests/tests.xml"
+ - "%{_datadir}/applifed-tests"
+ - "%{_libdir}/applifed-tests/tests.xml"
+ - "%{_libdir}/applifed-tests/ut_configdata"
+ - "%{_libdir}/applifed-tests/ut_cpuload"
+ - "%{_libdir}/applifed-tests/ut_prestartapp"
+ - "%{_libdir}/applifed-tests/ut_prestarter"
+ - "%{_datadir}/applifed-testscripts/cp-service.rb"
+ - "%{_datadir}/applifed-testscripts/cpu_load/cpu_load.conf"
+ - "%{_datadir}/applifed-testscripts/cpu_load/cpu_load_high.drive"
+ - "%{_datadir}/applifed-testscripts/cpu_load/cpu_load_low.drive"
+ - "%{_datadir}/applifed-testscripts/cpu_load/tc_cpu_load.rb"
+ - "%{_datadir}/applifed-testscripts/fautils.rb"
+ - "%{_datadir}/applifed-testscripts/functest_applifed.conf"
+ - "%{_datadir}/applifed-testscripts/functional.drive"
+ - "%{_datadir}/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.conf"
+ - "%{_datadir}/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.drive"
+ - "%{_datadir}/applifed-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb"
+ - "%{_datadir}/applifed-testscripts/prevent.conf"
+ - "%{_datadir}/applifed-testscripts/prevent.drive"
+ - "%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_hello.service.sb"
+ - "%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_toc.service.sb"
+ - "%{_datadir}/applifed-testscripts/tc_applifed_one_instance.rb"
+ - "%{_datadir}/applifed-testscripts/tc_daemonize.rb"
+ - "%{_datadir}/applifed-testscripts/tc_prestart_preventing.rb"
+ - "%{_datadir}/applifed-testscripts/test-perf-prestart.py"
+ - "%{_datadir}/applifed-testscripts/test-perf-prestart.pyc"
+ - "%{_datadir}/applifed-testscripts/test-perf-prestart.pyo"
+ - "%{_datadir}/applifed-testscripts/ts_mwtests.rb"
+ - "%{_datadir}/applifed-testscripts/ts_prestart.rb"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_hello.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_mw1.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_mw2.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_mw3.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_perf.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_toc.service"
--- meego/applifed-0.20.9
+++ meego/applifed-0.20.9
+(directory)
--- meego/applifed-0.20.9/0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
+++ meego/applifed-0.20.9/0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
+From 94a83e0fdf4c73d642eebaa0428fac9250117353 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pertti=20Kellom=C3=A4ki?= <pertti.kellomaki at nokia.com>
+Date: Fri, 3 Sep 2010 15:10:48 +0300
+Subject: [PATCH] Use /usr/bin/ruby instead of /usr/bin/ruby1.8
+
+---
+ tests/TestScripts/cp-service.rb | 2 +-
+ tests/TestScripts/cpu_load/tc_cpu_load.rb | 2 +-
+ tests/TestScripts/fautils.rb | 2 +-
+ .../ts_periodic_re_prestart.rb | 2 +-
+ tests/TestScripts/tc_applifed_one_instance.rb | 2 +-
+ tests/TestScripts/tc_daemonize.rb | 2 +-
+ tests/TestScripts/tc_prestart_preventing.rb | 2 +-
+ tests/TestScripts/ts_mwtests.rb | 2 +-
+ tests/TestScripts/ts_prestart.rb | 2 +-
+ 9 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/tests/TestScripts/cp-service.rb b/tests/TestScripts/cp-service.rb
+index 861a7aa..f89a565 100755
+--- a/tests/TestScripts/cp-service.rb
++++ b/tests/TestScripts/cp-service.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/cpu_load/tc_cpu_load.rb b/tests/TestScripts/cpu_load/tc_cpu_load.rb
+index 9edc147..46e38a9 100755
+--- a/tests/TestScripts/cpu_load/tc_cpu_load.rb
++++ b/tests/TestScripts/cpu_load/tc_cpu_load.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/fautils.rb b/tests/TestScripts/fautils.rb
+index c435561..b5accd1 100644
+--- a/tests/TestScripts/fautils.rb
++++ b/tests/TestScripts/fautils.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb b/tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+index a8959df..7f3b75c 100755
+--- a/tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
++++ b/tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/tc_applifed_one_instance.rb b/tests/TestScripts/tc_applifed_one_instance.rb
+index d7b384a..4733623 100755
+--- a/tests/TestScripts/tc_applifed_one_instance.rb
++++ b/tests/TestScripts/tc_applifed_one_instance.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/tc_daemonize.rb b/tests/TestScripts/tc_daemonize.rb
+index e005246..f2af2d9 100644
+--- a/tests/TestScripts/tc_daemonize.rb
++++ b/tests/TestScripts/tc_daemonize.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/tc_prestart_preventing.rb b/tests/TestScripts/tc_prestart_preventing.rb
+index e8eb0ce..5d40fce 100755
+--- a/tests/TestScripts/tc_prestart_preventing.rb
++++ b/tests/TestScripts/tc_prestart_preventing.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/ts_mwtests.rb b/tests/TestScripts/ts_mwtests.rb
+index 772c225..baf1a84 100755
+--- a/tests/TestScripts/ts_mwtests.rb
++++ b/tests/TestScripts/ts_mwtests.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+diff --git a/tests/TestScripts/ts_prestart.rb b/tests/TestScripts/ts_prestart.rb
+index 42a4b32..281d446 100755
+--- a/tests/TestScripts/ts_prestart.rb
++++ b/tests/TestScripts/ts_prestart.rb
+@@ -1,4 +1,4 @@
+-#!/usr/bin/ruby1.8
++#!/usr/bin/ruby
+ #
+ # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ # All rights reserved.
+--
+1.7.0.4
+
--- meego/applifed-0.20.9/0002-Ship-empty-conf-file-in-MeeGo.patch
+++ meego/applifed-0.20.9/0002-Ship-empty-conf-file-in-MeeGo.patch
+From e841fb7d8a62098d28c792e06f78f6a747575b83 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pertti=20Kellom=C3=A4ki?= <pertti.kellomaki at nokia.com>
+Date: Tue, 7 Sep 2010 11:19:27 +0300
+Subject: [PATCH] Ship empty conf file in MeeGo.
+
+---
+ CMakeLists.txt | 8 ++++++--
+ prestart/empty.conf | 15 +++++++++++++++
+ 2 files changed, 21 insertions(+), 2 deletions(-)
+ create mode 100644 prestart/empty.conf
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f360a25..f279246 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -49,5 +49,9 @@ if ($ENV{BUILD_TESTS})
+ add_subdirectory(tests/bug-tests)
+ endif ($ENV{BUILD_TESTS})
+
+-# Install configuration file here
+-install(FILES prestart/nokia.conf DESTINATION /etc/prestart)
++# Install configuration file. On MeeGo, just ship an empty conf.
++if ($ENV{MEEGO})
++ install(FILES prestart/empty.conf DESTINATION /etc/prestart RENAME nokia.conf)
++else (NOT $ENV{MEEGO})
++ install(FILES prestart/nokia.conf DESTINATION /etc/prestart)
++endif ($ENV{MEEGO})
+diff --git a/prestart/empty.conf b/prestart/empty.conf
+new file mode 100644
+index 0000000..65af7e8
+--- /dev/null
++++ b/prestart/empty.conf
+@@ -0,0 +1,15 @@
++<?xml version="1.0"?>
++<applifed default_cpu_load_threshold="25" cpu_load_polling_delay="1" re-prestart_delay="3600" default_re-prestart_trigger="5">
++
++ <!-- Services prestarted by applifed -->
++
++ <!-- Allow lazy shutdown for these applications not managed
++ by applifed -->
++ <allow_lazy_shutdown binary_path="/usr/bin/devicelockd"/>
++ <allow_lazy_shutdown binary_path="/usr/bin/celluid"/>
++ <allow_lazy_shutdown binary_path="/usr/bin/sysuid"/>
++ <allow_lazy_shutdown binary_path="/usr/bin/mstartup"/>
++ <allow_lazy_shutdown binary_path="/usr/bin/duihome"/>
++
++</applifed>
++
+--
+1.7.0.4
+
--- meego/applifed-0.20.9/0003-Install-.desktop-file-on-MeeGo.patch
+++ meego/applifed-0.20.9/0003-Install-.desktop-file-on-MeeGo.patch
+From a90fb16d27d979125998294fa3d2d87c1e5ad115 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pertti=20Kellom=C3=A4ki?= <pertti.kellomaki at nokia.com>
+Date: Fri, 17 Sep 2010 14:57:16 +0300
+Subject: [PATCH] Install .desktop file on MeeGo.
+
+---
+ CMakeLists.txt | 5 +++++
+ meego/applifed.desktop | 4 ++++
+ 2 files changed, 9 insertions(+), 0 deletions(-)
+ create mode 100644 meego/applifed.desktop
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f279246..586387f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -55,3 +55,8 @@ if ($ENV{MEEGO})
+ else (NOT $ENV{MEEGO})
+ install(FILES prestart/nokia.conf DESTINATION /etc/prestart)
+ endif ($ENV{MEEGO})
++
++# On MeeGo, install a .desktop file to autostart applifed.
++if ($ENV{MEEGO})
++ install(FILES meego/applifed.desktop DESTINATION /etc/xdg/autostart)
++endif ($ENV{MEEGO})
+diff --git a/meego/applifed.desktop b/meego/applifed.desktop
+new file mode 100644
+index 0000000..eb31be8
+--- /dev/null
++++ b/meego/applifed.desktop
+@@ -0,0 +1,4 @@
++[Desktop Entry]
++Exec=/usr/bin/applifed
++X-Moblin-Priority=High
++OnlyShowIn=X-MEEGO-HS;
+--
+1.7.0.4
+
--- meego/applifed-0.20.9/create-tarball.sh
+++ meego/applifed-0.20.9/create-tarball.sh
+#!/bin/sh
+if test -n "$1"
+then
+ git archive --format tar --remote=$1 --output=meegotouch-applifed-0.20.9.tar --prefix meegotouch-applifed-0.20.9/ released/0.20.9
+ bzip2 meegotouch-applifed-0.20.9.tar
+else
+ echo "Usage: create-tarball.sh <repo>"
+ echo " where <repo> is suitable for git archive --remote=<repo>"
+fi
--- meego/applifed-0.20.9/meegotouch-applifed.changes
+++ meego/applifed-0.20.9/meegotouch-applifed.changes
+* Mon Dec 20 2010 Nimika Keshri <nimika.1.keshri at nokia.com> - 0.20.9
+- BCM#11552 - meegotouch-applifed outdated in MeeGo
+- Remove obsolete patch 0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
+
+* Fri Sep 17 2010 Pertti Kellomäki <pertti.kellomaki at nokia.com> - 0.20.0
+- Updated upstream version.
+- Packaged tests.
+- Moved testing related binaries from /usr/share to /usr/lib.
+- Fix dependence to /usr/bin/ruby1.8.
+- Ship empty configuration file on MeeGo.
+- Install .desktop file in /etc/xdg/autostart to start applifed in UI session.
+
+* Mon Jul 12 2010 Pertti Kellomäki <pertti.kellomaki at nokia.com> - 0.17.0
+- Initial packaging.
--- meego/applifed-0.20.9/meegotouch-applifed.spec
+++ meego/applifed-0.20.9/meegotouch-applifed.spec
+#
+# Do NOT Edit the Auto-generated Part!
+# Generated by: spectacle version 0.21
+#
+# >> macros
+# << macros
+
+Name: meegotouch-applifed
+Summary: Application life cycle daemon
+Version: 0.20.9
+Release: 1
+Group: System/Daemons
+License: LGPLv2+
+URL: http://meego.gitorious.com/meegotouch/meegotouch-applifed
+Source0: %{name}-%{version}.tar.bz2
+Source100: meegotouch-applifed.yaml
+Patch0: 0002-Ship-empty-conf-file-in-MeeGo.patch
+Patch1: 0003-Install-.desktop-file-on-MeeGo.patch
+BuildRequires: pkgconfig(QtGui)
+BuildRequires: pkgconfig(contextprovider-1.0)
+BuildRequires: pkgconfig(meegotouch)
+BuildRequires: pkgconfig(x11)
+BuildRequires: cmake
+
+
+%description
+applifed is an application life cycle daemon. It manages prestarted applications.
+
+
+%package tests
+Summary: Tests for meegotouch-applifed
+Group: Development/Tools
+Requires: %{name} = %{version}-%{release}
+BuildRequires: desktop-file-utils
+
+%description tests
+Testing related files for meegotouch-applifed.
+
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+# 0002-Ship-empty-conf-file-in-MeeGo.patch
+%patch0 -p1
+# 0003-Install-.desktop-file-on-MeeGo.patch
+%patch1 -p1
+# >> setup
+# << setup
+
+%build
+# >> build pre
+export BUILD_TESTS=1
+export MEEGO=1
+# << build pre
+
+%configure --disable-static
+make %{?jobs:-j%jobs}
+
+# >> build post
+# << build post
+%install
+rm -rf %{buildroot}
+# >> install pre
+# << install pre
+%make_install
+
+# >> install post
+# rpmlint complains about installing binaries in /usr/share, so
+# move them elsewhere and leave a symlink in place.
+mkdir -p %{buildroot}/usr/lib
+mv %{buildroot}/usr/share/applifed-tests %{buildroot}/usr/lib
+(cd %{buildroot}/usr/share; ln -s ../lib/applifed-tests)
+# << install post
+
+
+
+
+
+
+
+
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/applifed
+%config %{_sysconfdir}/prestart/nokia.conf
+%config %{_sysconfdir}/xdg/autostart/applifed.desktop
+# >> files
+# << files
+
+
+%files tests
+%defattr(-,root,root,-)
+%{_bindir}/applifed
+%{_bindir}/close-event
+%{_bindir}/fali_hello
+%{_bindir}/fali_hello1
+%{_bindir}/fali_close
+%{_bindir}/fali_multiapp
+%{_bindir}/fali_mw1
+%{_bindir}/fali_mw2
+%{_bindir}/fali_mw3
+%{_bindir}/fali_perf
+%{_bindir}/fali_toc
+%{_bindir}/memoryhog
+%{_datadir}/applications/fali_hello.desktop
+%{_datadir}/applications/fali_hello1.desktop
+%{_datadir}/applications/fali_close.desktop
+%{_datadir}/applications/fali_toc.desktop
+%{_datadir}/applifed-M-art-tests/tests.xml
+%{_datadir}/applifed-M-bug-tests/tests.xml
+%{_datadir}/applifed-M-functional-tests/tests.xml
+%{_datadir}/applifed-M-performance-tests/tests.xml
+%{_datadir}/applifed-tests
+%{_datadir}/applifed-M-tests/tests.xml
+%{_libdir}/applifed-tests/ut_configdata
+%{_libdir}/applifed-tests/ut_cpuload
+%{_libdir}/applifed-tests/ut_prestartapp
+%{_libdir}/applifed-tests/ut_prestarter
+%{_datadir}/applifed-M-testscripts/cp-service.rb
+%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load.conf
+%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load_high.drive
+%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load_low.drive
+%{_datadir}/applifed-M-testscripts/cpu_load/tc_cpu_load.rb
+%{_datadir}/applifed-M-testscripts/fautils.rb
+%{_datadir}/applifed-M-testscripts/functest_applifed.conf
+%{_datadir}/applifed-M-testscripts/functional.drive
+%{_datadir}/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.conf
+%{_datadir}/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.drive
+%{_datadir}/applifed-M-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+%{_datadir}/applifed-M-testscripts/prevent.conf
+%{_datadir}/applifed-M-testscripts/prevent.drive
+%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_hello.service.sb
+%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_toc.service.sb
+%{_datadir}/applifed-M-testscripts/tc_applifed_one_instance.rb
+%{_datadir}/applifed-M-testscripts/tc_daemonize.rb
+%{_datadir}/applifed-M-testscripts/tc_prestart_preventing.rb
+%{_datadir}/applifed-M-testscripts/test-perf-prestart.py
+%{_datadir}/applifed-M-testscripts/test-perf.rb
+%exclude %{_datadir}/applifed-M-testscripts/test-perf-prestart.pyc
+%exclude %{_datadir}/applifed-M-testscripts/test-perf-prestart.pyo
+%{_datadir}/applifed-M-testscripts/ts_mwtests.rb
+%{_datadir}/applifed-M-testscripts/ts_prestart.rb
+%{_datadir}/dbus-1/services/com.nokia.fali_hello.service
+%{_datadir}/dbus-1/services/com.nokia.fali_hello1.service
+%{_datadir}/dbus-1/services/com.nokia.fali_close.service
+%{_datadir}/dbus-1/services/com.nokia.fali_mw1.service
+%{_datadir}/dbus-1/services/com.nokia.fali_mw2.service
+%{_datadir}/dbus-1/services/com.nokia.fali_mw3.service
+%{_datadir}/dbus-1/services/com.nokia.fali_perf.service
+%{_datadir}/dbus-1/services/com.nokia.fali_toc.service
+# >> files tests
+# << files tests
+
--- meego/applifed-0.20.9/meegotouch-applifed.yaml
+++ meego/applifed-0.20.9/meegotouch-applifed.yaml
+Name: meegotouch-applifed
+Summary: Application life cycle daemon
+Version: 0.20.9
+Release: 1
+Group: System/Daemons
+License: LGPLv2+
+URL: http://meego.gitorious.com/meegotouch/meegotouch-applifed
+Sources:
+ - "%{name}-%{version}.tar.bz2"
+Patches:
+ - "0002-Ship-empty-conf-file-in-MeeGo.patch"
+ - "0003-Install-.desktop-file-on-MeeGo.patch"
+Description: applifed is an application life cycle daemon. It manages prestarted applications.
+PkgConfigBR:
+ - QtGui
+ - contextprovider-1.0
+ - meegotouch
+ - x11
+PkgBR:
+ - cmake
+Builder: make
+Files:
+ - "%{_bindir}/applifed"
+ - "%config %{_sysconfdir}/prestart/nokia.conf"
+ - "%config %{_sysconfdir}/xdg/autostart/applifed.desktop"
+SubPackages:
+ - Name: tests
+ Group: Development/Tools
+ Summary: Tests for meegotouch-applifed
+ Description: |
+ Testing related files for meegotouch-applifed.
+ Files:
+ - "%{_bindir}/applifed"
+ - "%{_bindir}/close-event"
+ - "%{_bindir}/fali_hello"
+ - "%{_bindir}/fali_hello1"
+ - "%{_bindir}/fali_close"
+ - "%{_bindir}/fali_multiapp"
+ - "%{_bindir}/fali_mw1"
+ - "%{_bindir}/fali_mw2"
+ - "%{_bindir}/fali_mw3"
+ - "%{_bindir}/fali_perf"
+ - "%{_bindir}/fali_toc"
+ - "%{_bindir}/memoryhog"
+ - "%{_datadir}/applications/fali_hello.desktop"
+ - "%{_datadir}/applications/fali_hello1.desktop"
+ - "%{_datadir}/applications/fali_close.desktop"
+ - "%{_datadir}/applications/fali_toc.desktop"
+ - "%{_datadir}/applifed-M-art-tests/tests.xml"
+ - "%{_datadir}/applifed-M-bug-tests/tests.xml"
+ - "%{_datadir}/applifed-M-functional-tests/tests.xml"
+ - "%{_datadir}/applifed-M-performance-tests/tests.xml"
+ - "%{_datadir}/applifed-tests"
+ - "%{_datadir}/applifed-M-tests/tests.xml"
+ - "%{_libdir}/applifed-tests/ut_configdata"
+ - "%{_libdir}/applifed-tests/ut_cpuload"
+ - "%{_libdir}/applifed-tests/ut_prestartapp"
+ - "%{_libdir}/applifed-tests/ut_prestarter"
+ - "%{_datadir}/applifed-M-testscripts/cp-service.rb"
+ - "%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load.conf"
+ - "%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load_high.drive"
+ - "%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load_low.drive"
+ - "%{_datadir}/applifed-M-testscripts/cpu_load/tc_cpu_load.rb"
+ - "%{_datadir}/applifed-M-testscripts/fautils.rb"
+ - "%{_datadir}/applifed-M-testscripts/functest_applifed.conf"
+ - "%{_datadir}/applifed-M-testscripts/functional.drive"
+ - "%{_datadir}/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.conf"
+ - "%{_datadir}/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.drive"
+ - "%{_datadir}/applifed-M-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb"
+ - "%{_datadir}/applifed-M-testscripts/prevent.conf"
+ - "%{_datadir}/applifed-M-testscripts/prevent.drive"
+ - "%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_hello.service.sb"
+ - "%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_toc.service.sb"
+ - "%{_datadir}/applifed-M-testscripts/tc_applifed_one_instance.rb"
+ - "%{_datadir}/applifed-M-testscripts/tc_daemonize.rb"
+ - "%{_datadir}/applifed-M-testscripts/tc_prestart_preventing.rb"
+ - "%{_datadir}/applifed-M-testscripts/test-perf-prestart.py"
+ - "%{_datadir}/applifed-M-testscripts/test-perf.rb"
+ - "%exclude %{_datadir}/applifed-M-testscripts/test-perf-prestart.pyc"
+ - "%exclude %{_datadir}/applifed-M-testscripts/test-perf-prestart.pyo"
+ - "%{_datadir}/applifed-M-testscripts/ts_mwtests.rb"
+ - "%{_datadir}/applifed-M-testscripts/ts_prestart.rb"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_hello.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_hello1.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_close.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_mw1.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_mw2.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_mw3.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_perf.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_toc.service"
--- meego/meegotouch-prestartd.changes
+++ meego/meegotouch-prestartd.changes
-* Tue Aug 25 2010 Pertti Kellomäki <pertti.kellomaki at nokia.com> - 0.19.0
-- Initial packaging of applifed as prestartd.
--- meego/meegotouch-prestartd.spec
+++ meego/meegotouch-prestartd.spec
-#
-# Do not Edit! Generated by:
-# spectacle version 0.18
-#
-# >> macros
-# << macros
-
-Name: meegotouch-prestartd
-Summary: Application life cycle daemon
-Version: 0.19.0
-Release: 1
-Group: System/Daemons
-License: LGPLv2+
-URL: http://meego.gitorious.com/meegotouch/meegotouch-applifed
-Source0: %{name}-%{version}.tar.bz2
-Source100: meegotouch-prestartd.yaml
-BuildRequires: pkgconfig(x11)
-BuildRequires: cmake
-BuildRequires: libqt-devel
-
-
-%description
-prestartd is an application life cycle daemon. It manages prestarted applications.
-
-
-
-%prep
-%setup -q -n %{name}-%{version}
-
-# >> setup
-# << setup
-
-%build
-# >> build pre
-# << build pre
-
-%configure --disable-static
-make %{?jobs:-j%jobs}
-
-# >> build post
-# << build post
-%install
-rm -rf %{buildroot}
-# >> install pre
-# << install pre
-%make_install
-
-# >> install post
-mv %{buildroot}/usr/bin/applifed %{buildroot}/usr/bin/prestartd
-# << install post
-
-
-
-
-
-
-%files
-%defattr(-,root,root,-)
-%{_bindir}/prestartd
-%config %{_sysconfdir}/prestart/nokia.conf
-# >> files
-# << files
-
-
--- meego/meegotouch-prestartd.yaml
+++ meego/meegotouch-prestartd.yaml
-Name: meegotouch-prestartd
-Summary: Application life cycle daemon
-Version: 0.19.0
-Release: 1
-Group: System/Daemons
-License: LGPLv2+
-URL: http://meego.gitorious.com/meegotouch/meegotouch-applifed
-Sources:
- - "%{name}-%{version}.tar.bz2"
-Description: prestartd is an application life cycle daemon. It manages prestarted applications.
-PkgConfigBR:
- - x11
-PkgBR:
- - cmake
- - libqt-devel
-Builder: make
-Files:
- - "%{_bindir}/prestartd"
- - "%config %{_sysconfdir}/prestart/nokia.conf"
-
--- prestart/nokia.conf
+++ prestart/nokia.conf
@@ -2,10 +2,11 @@
<applifed default_cpu_load_threshold="25" cpu_load_polling_delay="1" re-prestart_delay="3600" default_re-prestart_trigger="5">
<!-- Services prestarted by applifed -->
- <application name="call-ui" service="Com.Nokia.Telephony.CallUi" priority="1"/>
+ <application name="call-ui" service="Com.Nokia.Telephony.CallUi" priority="1"/>
<application name="call-history" service="com.nokia.telephony.callhistory" priority="1"/>
- <application name="messaging-ui" service="com.nokia.Messaging" priority="2"/>
- <application name="camera-ui" service="com.nokia.maemo.CameraService" priority="3"/>
+ <application name="messaging-ui" service="com.nokia.Messaging" priority="2"/>
+ <application name="camera-ui" service="com.nokia.maemo.CameraService" priority="3"/>
+ <application name="contacts" service="com.nokia.contacts" priority="2"/>
<!-- Allow lazy shutdown for these applications not managed
by applifed -->
@@ -13,7 +14,7 @@
<allow_lazy_shutdown binary_path="/usr/bin/celluid"/>
<allow_lazy_shutdown binary_path="/usr/bin/sysuid"/>
<allow_lazy_shutdown binary_path="/usr/bin/mstartup"/>
- <allow_lazy_shutdown binary_path="/usr/bin/duihome"/>
+ <allow_lazy_shutdown binary_path="/usr/bin/meegotouchhome"/>
</applifed>
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -1,18 +1,23 @@
# Set sources
set(SRC configdata.cpp configparser.cpp cpuload.cpp
daemon.cpp
- global.cpp
logger.cpp
main.cpp
prestartapp.cpp prestarter.cpp systemstate.cpp
x11util.cpp)
-# Set applifed's config file path
+# Set program name
add_definitions(-DPROG_NAME="applifed")
-add_definitions(-DAPPLIFED_CONFIG_FILE="/etc/prestart/nokia.conf")
-# Set debug logging
-add_definitions(-D_DEBUG)
+# Set config file path
+add_definitions(-DCONFIG_FILE="/etc/prestart/nokia.conf")
+
+# Set default log file path
+# This can be overridden with --log
+add_definitions(-DDEFAULT_LOG_FILE="/tmp/applifed.log")
+
+# Set lock file (prevents running more than one instances of applifed)
+add_definitions(-DLOCK_FILE="/tmp/applifed.lock")
# Set moc headers
set(MOC_HDRS daemon.h prestarter.h systemstate.h)
--- src/daemon.cpp
+++ src/daemon.cpp
@@ -22,27 +22,22 @@
#include <cerrno>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/socket.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
-#include "global.h"
-#include "daemon.h"
-#include "logger.h"
+#include <QSocketNotifier>
+
#include "prestarter.h"
#include "systemstate.h"
+#include "daemon.h"
#include "x11util.h"
Daemon * Daemon::m_instance = NULL;
-int Daemon::m_lockFd = -1;
-
-namespace
-{
- // This can be overridden with --log
- const QString DEFAULT_LOG_FILE = "/tmp/applifed.log";
- const QString LOCK_FILE = "/tmp/applifed.lock";
-}
+int Daemon::m_lockFd = -1;
+int Daemon::m_sigtermFd[2];
Daemon::Daemon(int & argc, char * argv[], bool testMode, QString logFile) :
QApplication(argc, argv),
@@ -88,12 +83,45 @@
{
Logger::logWarning("Cannot open display!");
}
+
+ // Create socket pair for SIGTERM
+ if (::socketpair(AF_UNIX, SOCK_STREAM, 0, m_sigtermFd))
+ {
+ Logger::logError("Couldn't create TERM socketpair");
+ ::exit(EXIT_FAILURE);
+ }
+
+ // Install a socket notifier on the socket
+ m_snTerm.reset(new QSocketNotifier(m_sigtermFd[1], QSocketNotifier::Read, this));
+ connect(m_snTerm.get(), SIGNAL(activated(int)), this, SLOT(handleSigTerm()));
+}
+
+//
+// All this signal handling code is taken from Qt's Best Practices:
+// http://doc.qt.nokia.com/latest/unix-signals.html
+//
+
+void Daemon::termSignalHandler(int)
+{
+ char a = 1;
+ ::write(m_sigtermFd[0], &a, sizeof(a));
+}
+
+void Daemon::handleSigTerm()
+{
+ m_snTerm->setEnabled(false);
+
+ char tmp;
+ ::read(m_sigtermFd[1], &tmp, sizeof(tmp));
+
+ Daemon::terminate();
+
+ m_snTerm->setEnabled(true);
}
void Daemon::terminate()
{
- // TODO
- Logger::logNotice("Terminating due to SIG_TERM..");
+ m_prestarter->killPrestartedApplications();
QApplication::quit();
}
@@ -107,14 +135,10 @@
{
if (xEvent->type == MapNotify)
{
- XMapEvent * event = reinterpret_cast<XMapEvent*>(xEvent);
- const int pid = X11Util::windowPid(event->window);
- if (pid != -1)
- {
- // Notify Prestarter about application possibly being released
- // from the prestarted state. Prestarter verifies the pid.
- m_prestarter->releasedPrestart(pid);
- }
+ // We handle MapNotify's to track applications that have been
+ // released from the prestarted state.
+
+ handleXMapEvent(reinterpret_cast<XMapEvent*>(xEvent));
// Event handled
return true;
@@ -126,78 +150,92 @@
// of a service have been closed, the service is considered to
// restore the prestarted state.
- XUnmapEvent * event = reinterpret_cast<XUnmapEvent*>(xEvent);
+ handleXUnmapEvent(reinterpret_cast<XUnmapEvent*>(xEvent));
+
+ // Event handled
+ return true;
+ }
+
+ // Event not handled
+ return false;
+}
- // Find out pid assigned to the window
- const int pid = X11Util::windowPid(event->window);
- if (pid != -1)
+void Daemon::handleXMapEvent(XMapEvent * event)
+{
+ const int pid = X11Util::windowPid(event->window);
+ if (pid != -1)
+ {
+ // Notify Prestarter about application possibly being released
+ // from the prestarted state. Prestarter verifies the pid.
+ m_prestarter->releasedPrestart(pid);
+ }
+}
+
+void Daemon::handleXUnmapEvent(XUnmapEvent * event)
+{
+ // Find out pid assigned to the window
+ const int pid = X11Util::windowPid(event->window);
+ if (pid != -1)
+ {
+ // Check already here that this pid is assigned to some
+ // prestarted application
+ if (m_prestarter->findAppWithPid(pid))
{
- // Check already here that this pid is assigned to some
- // prestarted application
- if (m_prestarter->findAppWithPid(pid))
+ // Hidden windows are not included in the client list.
+ // We can then just check that there are no windows for
+ // this pid mapped.
+ if (X11Util::windowsForPid(pid).isEmpty())
{
- // Hidden windows are not included in the client list.
- // We can then just check that there are no windows for
- // this pid mapped.
- if (X11Util::windowsForPid(pid).isEmpty())
- {
- // Notify Prestarter about application being restored to
- // the prestarted state. Prestarter verifies the pid.
- m_prestarter->restoredPrestart(pid);
- }
+ // Notify Prestarter about application being restored to
+ // the prestarted state. Prestarter verifies the pid.
+ m_prestarter->restoredPrestart(pid);
}
- else
- {
- // Here we handle applications that are obviously not prestarted by
- // applifed. The MeeGo Touch FW sets _MEEGOTOUCH_PRESTARTED flag to
- // windows that have gone to the prestarted state. We check this and
- // get the application binary path responsible for the UnmapNotify.
+ }
+ else
+ {
+ // Here we handle applications that are obviously not prestarted by
+ // applifed. The MeeGo Touch FW sets _MEEGOTOUCH_PRESTARTED flag to
+ // windows that have gone to the prestarted state. We check this and
+ // get the application binary path responsible for the UnmapNotify.
- if (X11Util::isPrestarted(event->window))
+ if (X11Util::isPrestarted(event->window))
+ {
+ const QString appName = X11Util::applicationName(event->window);
+ if (!m_prestarter->isLazyShutdownAllowed(appName))
{
- const QString appName = X11Util::applicationName(event->window);
- if (!m_prestarter->isLazyShutdownAllowed(appName))
+ const int pid = X11Util::windowPid(event->window);
+ Logger::logNotice("External app '%s' (%d) performed an unauthorized lazy shutdown: will be killed",
+ appName.toAscii().data(), pid);
+ if (pid != -1)
{
- const int pid = X11Util::windowPid(event->window);
- Logger::logNotice("External app '%s' (%d) performed an unauthorized lazy shutdown: will be killed",
- appName.toAscii().data(), pid);
- if (pid != -1)
+ if (kill(pid, SIGKILL) != -1)
+ {
+ Logger::logNotice("'%s' (%d) killed", appName.toAscii().data(), pid);
+ }
+ else
{
- if (kill(pid, SIGKILL) != -1)
+ if (errno == EPERM)
{
- Logger::logNotice("'%s' (%d) killed", appName.toAscii().data(), pid);
+ Logger::logError("No permissions to kill %d", pid);
}
- else
+ else if (errno == ESRCH)
{
- if (errno == EPERM)
- {
- Logger::logError("No permissions to kill %d", pid);
- }
- else if (errno == ESRCH)
- {
- Logger::logError("Pid %d doesn't exist or may be a zombie", pid);
- }
+ Logger::logError("Pid %d doesn't exist or may be a zombie", pid);
}
}
}
- else
- {
- Logger::logNotice("External application '%s' returned to prestarted state",
- appName.toAscii().data());
- }
+ }
+ else
+ {
+ Logger::logNotice("External application '%s' returned to prestarted state",
+ appName.toAscii().data());
}
}
}
-
- // Event handled
- return true;
}
-
- // Event not handled
- return false;
}
-void Daemon::daemonize()
+void Daemon::daemonize(bool testMode)
{
// Our process ID and Session ID
pid_t pid, sid;
@@ -206,7 +244,7 @@
pid = fork();
if (pid < 0)
{
- Logger::logError("Unable to fork daemon, code %d (%s)", errno, strerror(errno));
+ std::cerr << "Unable to fork daemon: " << strerror(errno) << std::endl;
::exit(EXIT_FAILURE);
}
@@ -220,7 +258,7 @@
pid = fork();
if (pid < 0)
{
- Logger::logError("Unable to fork daemon, code %d (%s)", errno, strerror(errno));
+ std::cerr << "Unable to fork daemon: " << strerror(errno) << std::endl;
::exit(EXIT_FAILURE);
}
@@ -230,6 +268,9 @@
::exit(EXIT_SUCCESS);
}
+ // Check that the lock is free
+ checkForLock(testMode);
+
// Change the file mode mask
umask(0);
@@ -239,14 +280,14 @@
sid = setsid();
if (sid < 0)
{
- Logger::logError("Unable to create a new session, code %d (%s)", errno, strerror(errno));
+ std::cerr << "Unable to create a new session: " << strerror(errno) << std::endl;
::exit(EXIT_FAILURE);
}
// Change the current working directory
if ((chdir("/")) < 0)
{
- Logger::logError("Unable to change directory to %s, code %d (%s)", "/", errno, strerror(errno));
+ std::cerr << "Unable to change directory to '/': " << strerror(errno) << std::endl;
::exit(EXIT_FAILURE);
}
@@ -271,7 +312,7 @@
// Prestart applications if not in test mode
if (!m_testMode)
{
- runPrestarts(APPLIFED_CONFIG_FILE);
+ runPrestarts(CONFIG_FILE);
}
// Start Qt mainloop
@@ -310,7 +351,7 @@
fl.l_start = 0;
fl.l_len = 1;
- if((m_lockFd = open(LOCK_FILE.toStdString().c_str(), O_WRONLY | O_CREAT, 0666)) == -1)
+ if((m_lockFd = open(LOCK_FILE, O_WRONLY | O_CREAT, 0666)) == -1)
return false;
if(fcntl(m_lockFd, F_SETLK, &fl) == -1)
@@ -319,6 +360,17 @@
return true;
}
+void Daemon::checkForLock(bool testMode)
+{
+ if(!testMode && !Daemon::lock())
+ {
+ std::cerr << "Only one instance of " << PROG_NAME <<
+ " can be running" << std::endl;
+
+ ::exit(EXIT_FAILURE);
+ }
+}
+
Daemon::~Daemon()
{
// Close the log
--- src/daemon.h
+++ src/daemon.h
@@ -32,8 +32,13 @@
using std::vector;
-class Prestarter;
+#include "logger.h"
+
+#include <X11/Xlib.h>
+
class SystemState;
+class Prestarter;
+class QSocketNotifier;
/*!
* \class Daemon main class
@@ -57,7 +62,7 @@
virtual ~Daemon();
/*!
- * \brief Run everything.
+ * \brief Start the daemon.
* \return Exit code
*/
int run();
@@ -71,11 +76,20 @@
//! Return current Daemon instance
static Daemon * instance();
- //! Lock file to prevent launch of second instance
+ /*! \brief Acquire lock file to prevent launch of second instance.
+ * \return True if succeeds.
+ */
static bool lock();
+ //! Check that lock is free. Do nothing if ok,
+ //! otherwise print error to stderr and ::exit().
+ static void checkForLock(bool testMode);
+
//! Fork to a daemon
- static void daemonize();
+ static void daemonize(bool testMode);
+
+ //! UNIX signal handler for SIGTERM
+ static void termSignalHandler(int unused);
private:
@@ -88,6 +102,13 @@
//! \reimp
virtual bool x11EventFilter(XEvent *event);
+ //! Handler for XMapEvent
+ void handleXMapEvent(XMapEvent * event);
+
+ //! Handler for XUnmapEvent
+ void handleXUnmapEvent(XUnmapEvent * event);
+
+ //! Singleton daemon instance
static Daemon * m_instance;
//! Test mode flag
@@ -105,11 +126,17 @@
//! File descriptor for the lock file
static int m_lockFd;
- //! White list to define prestarted application names that should not be killed
- QStringList prestartWhiteList;
+ //! Socket pair used to get SIGTERM
+ static int m_sigtermFd[2];
+
+ //! Socket notifier used for m_sigtermFd
+ shared_ptr<QSocketNotifier> m_snTerm;
private slots:
+ //! Qt signal handler for SIGTERM.
+ void handleSigTerm();
+
/*! Prestart applications
* \param prestartPath Path to search .prestart files in
*/
--- src/global.cpp
+++ src/global.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of applifed.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at 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.
-**
-****************************************************************************/
-
-#include "global.h"
--- src/global.h
+++ src/global.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of applifed.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at 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.
-**
-****************************************************************************/
-
-#ifndef GLOBAL_H
-#define GLOBAL_H
-
-#include <string>
-
-/*! Some global strings. Standard string is used here because QString's
- * implicit sharing causes problems with e.g. syslog who wants to use
- * a pointer to constant data.
- */
-class Global
-{
-public:
-};
-
-#endif // GLOBAL_H
--- src/logger.cpp
+++ src/logger.cpp
@@ -25,7 +25,8 @@
#include <QDir>
#include <QString>
-namespace {
+namespace
+{
const QString dateFormat("yyyy-MM-dd hh:mm:ss.zzz");
}
@@ -38,13 +39,23 @@
void Logger::openLog(const char * progName, const char * fileName)
{
- if (!Logger::m_isOpened) {
- if (!m_useSyslog) {
+ // Check that log is not already opened
+ if (!Logger::m_isOpened)
+ {
+ // Log to file if syslog is not wanted
+ if (!m_useSyslog)
+ {
+ // Open log file as a QTextStream
m_logFile.setFileName(fileName);
- if (m_logFile.open(QIODevice::WriteOnly)) {
+ if (m_logFile.open(QIODevice::WriteOnly))
+ {
Logger::m_logStream.setDevice(&m_logFile);
}
- } else {
+ }
+ // Log to syslog
+ else
+ {
+ // Open syslog
openlog(progName, LOG_PID, LOG_DAEMON);
}
@@ -54,35 +65,55 @@
void Logger::closeLog()
{
- if (Logger::m_isOpened) {
- if (m_useSyslog) {
+ // Check that log is opened
+ if (Logger::m_isOpened)
+ {
+ // Close syslog
+ if (m_useSyslog)
+ {
closelog();
}
- else {
+ // Close log file
+ else
+ {
m_logFile.close();
}
+
Logger::m_isOpened = false;
}
}
-void Logger::writeLog(const int priority, const char * format, va_list ap)
+void Logger::writeLog(const int priority, const char * format, va_list ap)
{
- if (Logger::m_isOpened) {
- if (m_echoMode) {
+ // Check that log is opened
+ if (Logger::m_isOpened)
+ {
+ // In echo mode always print everything to stdout
+ if (m_echoMode)
+ {
vprintf(format, ap);
printf("\n");
}
- if (m_useSyslog) {
+ // Log to syslog if used
+ if (m_useSyslog)
+ {
vsyslog(priority, format, ap);
}
- else {
+ // Log to file
+ else
+ {
+ // Create a QString from the (const char *) message
QString msg;
msg.vsprintf(format, ap);
+
+ // Send current date and time to the stream
m_logStream <<
QDateTime::currentDateTime().toString(dateFormat);
- switch (priority) {
+ // Send correct prefix to the stream
+ switch (priority)
+ {
case LOG_NOTICE:
m_logStream << " [NOTICE] ";
break;
@@ -100,16 +131,18 @@
break;
}
+ // Send message to the stream
m_logStream << msg << "\n";
+
+ // Flush the stream
m_logStream.flush();
}
}
}
-
void Logger::logNotice(const char * format, ...)
{
-#ifdef _DEBUG
+#ifndef DEBUG_LOGGING_DISABLED
va_list(ap);
va_start(ap, format);
writeLog(LOG_NOTICE, format, ap);
@@ -129,7 +162,7 @@
void Logger::logWarning(const char * format, ...)
{
-#ifdef _DEBUG
+#ifndef DEBUG_LOGGING_DISABLED
va_list(ap);
va_start(ap, format);
writeLog(LOG_WARNING, format, ap);
@@ -141,7 +174,7 @@
void Logger::logInfo(const char * format, ...)
{
-#ifdef _DEBUG
+#ifndef DEBUG_LOGGING_DISABLED
va_list(ap);
va_start(ap, format);
writeLog(LOG_INFO, format, ap);
--- src/logger.h
+++ src/logger.h
@@ -25,8 +25,9 @@
/*!
* \class Logger
- * \brief Logging utility class
+ * \brief Logging utility class.
*
+ * Debug messages can be disabled by defining DEBUG_LOGGING_DISABLED.
*/
class Logger
{
--- src/main.cpp
+++ src/main.cpp
@@ -27,17 +27,9 @@
#include <iostream>
#include "daemon.h"
-#include "global.h"
#include "logger.h"
-//! Signal handler for SIG_TERM
-void sigTerm(int)
-{
- if (Daemon::instance())
- Daemon::instance()->terminate();
-}
-
-void usage()
+static void usage()
{
std::cout << "Usage: " << PROG_NAME << " [options]\n"
<< "\n"
@@ -52,7 +44,7 @@
//! Parse arguments
typedef vector<QString> ArgVect;
-void parseArgs(const ArgVect & args, bool * daemonize, bool * testMode, QString * logFile)
+static void parseArgs(const ArgVect & args, bool * daemonize, bool * testMode, QString * logFile)
{
for (ArgVect::const_iterator i(args.begin());
i != args.end(); i++)
@@ -81,6 +73,22 @@
}
}
+static bool setupUnixSignalHandlers()
+{
+ struct sigaction term;
+
+ term.sa_handler = Daemon::termSignalHandler;
+ sigemptyset(&term.sa_mask);
+ term.sa_flags |= SA_RESTART;
+
+ if (sigaction(SIGTERM, &term, 0) > 0)
+ {
+ return false;
+ }
+
+ return true;
+}
+
//! Main function
int main(int argc, char * argv[])
{
@@ -91,32 +99,27 @@
// Parse arguments
parseArgs(ArgVect(argv, argv + argc), &daemonize, &testMode, &logFile);
- if (!testMode)
+ // Install Unix signal handler for SIGTERM
+ if (!setupUnixSignalHandlers())
{
- // Check that an instance of applifed is not already running if we are
- // not in test mode
- if(!Daemon::lock())
- {
- std::cerr << "Only one instance of " << PROG_NAME <<
- " can be running" << std::endl;
-
- ::exit(EXIT_FAILURE);
- }
+ std::cerr << "Failed to install Unix signal handlers" << std::endl;
+ ::exit(EXIT_FAILURE);
}
+ // Check that an instance of applifed is not already running if we are
+ // not in test mode
+ Daemon::checkForLock(testMode);
+
// Daemonize (Note: this must take place before Daemon is created, because
// it's a QApplication)
if (daemonize)
{
- Daemon::daemonize();
+ Daemon::daemonize(testMode);
}
// Main daemon object
Daemon myDaemon(argc, argv, testMode, logFile);
- // Install signal handlers
- signal(SIGTERM, sigTerm);
-
// Run the main loop
return myDaemon.run();
}
--- src/prestarter.cpp
+++ src/prestarter.cpp
@@ -481,7 +481,7 @@
void Prestarter::killApp(PrestartApp * p)
{
- int signal;
+ int signal = 0;
// Check if SIGTERM was already tried
if (!p->sigTermSent())
@@ -495,14 +495,15 @@
p->setSigKillSent(true);
}
- Logger::logNotice("Sending signal %d to application '%s', pid %d..",
- signal,
- p->service().toAscii().data(),
- p->pid());
-
- // Call kill and handle errors
+ // Call kill and handle errors. Zero pid's are discarded mainly
+ // for unit testability.
if (p->pid())
{
+ Logger::logNotice("Sending signal %d to application '%s', pid %d..",
+ signal,
+ p->service().toAscii().data(),
+ p->pid());
+
if (kill(p->pid(), signal) == -1)
{
if (errno == EPERM)
@@ -567,6 +568,16 @@
}
}
+void Prestarter::killPrestartedApplications()
+{
+ // Try to find prestared application with the given PID
+ Q_FOREACH(PrestartApp * p, m_vectApps)
+ {
+ p->setRePrestarting(false);
+ killApp(p);
+ }
+}
+
Prestarter::~Prestarter()
{
// Delete the apps since they are not needed anymore
--- src/prestarter.h
+++ src/prestarter.h
@@ -148,6 +148,9 @@
//! Handle blanked / unblanked screen. Starts forced re-prestarts.
void handleScreenBlanked(bool state);
+ //! Permanently terminate prestarted applications (both released and not-released).
+ void killPrestartedApplications();
+
private Q_SLOTS:
//! Start re-prestarting apps that are scheduled for forced re-prestart
--- src/systemstate.cpp
+++ src/systemstate.cpp
@@ -111,8 +111,8 @@
m_screenBlankWithDelayTimer->start();
}
}
- // Send the free memory signal
- else if (line == "FREE_MEMORY")
+ // Send the memory low
+ else if (line == "MEMORY_LOW")
{
emit systemMemoryLow();
}
--- src/systemstate.h
+++ src/systemstate.h
@@ -98,6 +98,7 @@
//! ContextProperty("Session.State") value changed (Screen blanked / unblanked)
void screenStateChanged();
+
private:
Q_DISABLE_COPY(SystemState)
--- src/x11util.cpp
+++ src/x11util.cpp
@@ -19,8 +19,15 @@
#include "x11util.h"
+static int handleXError(Display *, XErrorEvent *)
+{
+ return 0;
+}
+
int X11Util::windowPid(Window window)
{
+ int pid = -1;
+
Display * dpy = QX11Info::display();
if (dpy)
{
@@ -31,6 +38,9 @@
unsigned long bytesAfter;
unsigned char *propPID = 0;
+ int (*previousHandler)(Display *, XErrorEvent *);
+ previousHandler = XSetErrorHandler(handleXError);
+
// Get the PID of the window
if(XGetWindowProperty(dpy, window, pidAtom, 0, 1, False, XA_CARDINAL,
&type, &format, &nItems, &bytesAfter, &propPID) == Success)
@@ -38,14 +48,15 @@
if(propPID != 0)
{
// If the PID matches, add this window to the result set.
- int pid = *(reinterpret_cast<int *>(propPID));
+ pid = *(reinterpret_cast<int *>(propPID));
XFree(propPID);
- return pid;
}
}
+
+ XSetErrorHandler(previousHandler);
}
- return -1;
+ return pid;
}
QString X11Util::applicationName(Window window)
@@ -58,8 +69,10 @@
char **argv_return = 0;
int argc_return = 0;
- int result = XGetCommand(dpy, window, &argv_return, &argc_return);
+ int (*previousHandler)(Display *, XErrorEvent *);
+ previousHandler = XSetErrorHandler(handleXError);
+ int result = XGetCommand(dpy, window, &argv_return, &argc_return);
if (result >= Success && argc_return && *argv_return)
{
ret = QString(*argv_return);
@@ -69,6 +82,8 @@
{
XFreeStringList(argv_return);
}
+
+ XSetErrorHandler(previousHandler);
}
return ret;
@@ -88,6 +103,9 @@
unsigned long bytesAfter;
unsigned char *prestarted = 0;
+ int (*previousHandler)(Display *, XErrorEvent *);
+ previousHandler = XSetErrorHandler(handleXError);
+
if(XGetWindowProperty(dpy, window, prestartAtom, 0, 1, False, XA_CARDINAL,
&type, &format, &nItems, &bytesAfter, &prestarted) == Success)
{
@@ -97,6 +115,8 @@
XFree(prestarted);
}
}
+
+ XSetErrorHandler(previousHandler);
}
return ret;
@@ -132,6 +152,9 @@
unsigned long bytesLeft;
unsigned char * windowData = NULL;
+ int (*previousHandler)(Display *, XErrorEvent *);
+ previousHandler = XSetErrorHandler(handleXError);
+
int result = XGetWindowProperty(dpy, DefaultRootWindow(dpy),
clientListAtom, 0, 0x7fffffff,
False, XA_WINDOW,
@@ -161,6 +184,8 @@
XFree(wins);
}
}
+
+ XSetErrorHandler(previousHandler);
}
return clients;
--- tests/Common
+++ tests/Common
+(directory)
--- tests/Common/CMakeLists.txt
+++ tests/Common/CMakeLists.txt
+# Sub build: TestApps
+add_subdirectory(TestApps)
+
+# Sub build: unittests
+add_subdirectory(unittests)
+
--- tests/Common/TestApps
+++ tests/Common/TestApps
+(directory)
--- tests/Common/TestApps/CMakeLists.txt
+++ tests/Common/TestApps/CMakeLists.txt
+# Find MeeGo Touch libraries for the test programs using pkg-config
+include(FindPkgConfig)
+pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MEEGOTOUCH_INCLUDE_DIRS})
+
+# Sub build: fali_multiapp
+add_subdirectory(fali_multiapp)
+
+# Sub build: fali_hello
+add_subdirectory(fali_hello)
+
+# Sub build: fali_toc
+add_subdirectory(fali_toc)
+
+# Sub build: fali_close
+add_subdirectory(fali_close)
+
+# Sub build: multiwindow_apps
+add_subdirectory(multiwindow_apps)
+
+# Sub build: memoryhog
+add_subdirectory(memoryhog)
+
--- tests/Common/TestApps/fali_close
+++ tests/Common/TestApps/fali_close
+(directory)
--- tests/Common/TestApps/fali_close/CMakeLists.txt
+++ tests/Common/TestApps/fali_close/CMakeLists.txt
+project(fali_close)
+
+# Set sources
+set(fali_closeSRC main.cpp )
+link_libraries(${MEEGOTOUCH_LIBRARIES})
+
+# Enable Qt-support
+include(${QT_USE_FILE})
+
+add_executable(fali_close ${fali_closeSRC})
+
+# Install
+install(PROGRAMS fali_close DESTINATION /usr/bin)
+install(FILES com.nokia.fali_close.service DESTINATION /usr/share/dbus-1/services/)
+install(FILES fali_close.desktop DESTINATION /usr/share/applications/)
+
--- tests/Common/TestApps/fali_close/com.nokia.fali_close.service
+++ tests/Common/TestApps/fali_close/com.nokia.fali_close.service
+[D-BUS Service]
+Name=com.nokia.fali_close
+Exec=/usr/bin/fali_close -prestart
--- tests/Common/TestApps/fali_close/fali_close.desktop
+++ tests/Common/TestApps/fali_close/fali_close.desktop
+[Desktop Entry]
+Type=Application
+Name=fali_close
+Icon=icon-l-video
+Exec=fali_close
+X-Maemo-Service=com.nokia.fali_close
+Categories=X-MeeGo;Demos;
+OnlyShowIn=X-MeeGo;
--- tests/Common/TestApps/fali_close/main.cpp
+++ tests/Common/TestApps/fali_close/main.cpp
+#include <MApplication>
+#include <MApplicationWindow>
+#include <MApplicationPage>
+#include <MButton>
+#include <MDebug>
+
+int main(int argc, char **argv)
+{
+ MApplication app(argc, argv);
+ MApplication::setPrestartMode(M::LazyShutdown);
+
+ MApplicationWindow *window = new MApplicationWindow;
+ MApplicationPage *page = new MApplicationPage();
+ page->setTitle("fali_close");
+
+ MButton *button = new MButton("close");
+ QObject::connect(button, SIGNAL(clicked()), window, SLOT(close()));
+ page->setCentralWidget(button);
+ page->appear();
+ window->show();
+
+ return app.exec();
+}
--- tests/Common/TestApps/fali_hello
+++ tests/Common/TestApps/fali_hello
+(directory)
--- tests/Common/TestApps/fali_hello/CMakeLists.txt
+++ tests/Common/TestApps/fali_hello/CMakeLists.txt
+include(FindPkgConfig)
+pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MEEGOTOUCH_INCLUDE_DIRS})
+
+project(HelloWorld)
+
+# Set sources
+set(HelloWorldSRC fali_hello.cpp)
+
+# Set moc headers
+#set(HelloWorld_MOC_HDRS)
+# Run moc
+#qt4_wrap_cpp(HelloWorld_MOC_SRC ${HelloWorld_MOC_HDRS})
+
+link_libraries(${MEEGOTOUCH_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY})
+
+include(${QT_USE_FILE})
+
+add_executable(fali_hello ${HelloWorldSRC} ${HelloWorld_MOC_SRC})
+
+
+# Install
+install(PROGRAMS fali_hello DESTINATION /usr/bin/)
+install(PROGRAMS fali_hello DESTINATION /usr/bin/ RENAME fali_hello1)
+install(PROGRAMS fali_hello DESTINATION /usr/bin/ RENAME fali_perf)
+
+install(FILES com.nokia.fali_hello.service DESTINATION /usr/share/dbus-1/services/)
+install(FILES com.nokia.fali_hello1.service DESTINATION /usr/share/dbus-1/services/)
+install(FILES com.nokia.fali_perf.service DESTINATION /usr/share/dbus-1/services/)
+install(FILES com.nokia.fali_hello.service.sb DESTINATION /usr/share/applifed-testscripts/sbservice/)
+install(FILES fali_hello.desktop DESTINATION /usr/share/applications/)
+install(FILES fali_hello1.desktop DESTINATION /usr/share/applications/)
+
--- tests/Common/TestApps/fali_hello/com.nokia.fali_hello.service
+++ tests/Common/TestApps/fali_hello/com.nokia.fali_hello.service
(renamed from tests/TestApps/fali_hello/com.nokia.fali_hello.service)
--- tests/Common/TestApps/fali_hello/com.nokia.fali_hello.service.sb
+++ tests/Common/TestApps/fali_hello/com.nokia.fali_hello.service.sb
(renamed from tests/TestApps/fali_hello/com.nokia.fali_hello.service.sb)
--- tests/Common/TestApps/fali_hello/com.nokia.fali_hello1.service
+++ tests/Common/TestApps/fali_hello/com.nokia.fali_hello1.service
+[D-BUS Service]
+Name=com.nokia.fali_hello1
+Exec=/usr/bin/fali_hello1
--- tests/Common/TestApps/fali_hello/com.nokia.fali_perf.service
+++ tests/Common/TestApps/fali_hello/com.nokia.fali_perf.service
+[D-BUS Service]
+Name=com.nokia.fali_perf
+Exec=/usr/bin/fali_perf -prestart
+
--- tests/Common/TestApps/fali_hello/fali_hello.cpp
+++ tests/Common/TestApps/fali_hello/fali_hello.cpp
+#include <MApplication>
+#include <MApplicationService>
+#include <MApplicationWindow>
+#include <MApplicationPage>
+#include <QDebug>
+#include <QString>
+#include <QFile>
+#include <sys/time.h>
+#include <vector>
+
+
+void FANGORNLOG(const char* s)
+{
+ QFile f("/tmp/applifed_perftest.log");
+ f.open(QIODevice::Append);
+ f.write(s, qstrlen(s));
+ f.write("\n", 1);
+ f.close();
+}
+
+void timestamp(const char *s)
+{
+ timeval tim;
+ char msg[80];
+ gettimeofday(&tim, NULL);
+ snprintf(msg, 80, "%d.%06d %s\n",
+ static_cast<int>(tim.tv_sec), static_cast<int>(tim.tv_usec), s);
+ FANGORNLOG(msg);
+}
+
+
+class MyApplicationWindow: public MApplicationWindow
+{
+public:
+ MyApplicationWindow() :
+ MApplicationWindow()
+ {
+ }
+
+ virtual ~MyApplicationWindow()
+ {
+ }
+
+ void enterDisplayEvent()
+ {
+ timestamp("MyApplicationWindow::enterDisplayEvent()");
+ }
+};
+
+int main(int argc, char ** argv)
+{
+ timestamp("main()");
+ QString appName(argv[0]);
+
+ MApplication app(argc, argv);
+ MApplication::setPrestartMode(M::LazyShutdown);
+
+ MyApplicationWindow window;
+ MApplicationPage mainPage;
+ window.show();
+ if (appName.endsWith("fali_hello"))
+ {
+ mainPage.setTitle("fali_hello");
+ }
+ else if (appName.endsWith("fali_perf"))
+ {
+ mainPage.setTitle("fali_perf");
+ }
+ mainPage.appear();
+
+ return app.exec();
+}
--- tests/Common/TestApps/fali_hello/fali_hello.desktop
+++ tests/Common/TestApps/fali_hello/fali_hello.desktop
+[Desktop Entry]
+Type=Application
+Name=fali_hello
+Icon=icon-l-video
+Exec=fali_hello
+X-Maemo-Service=com.nokia.fali_hello
+Categories=X-MeeGo;Demos;
+OnlyShowIn=X-MeeGo;
--- tests/Common/TestApps/fali_hello/fali_hello1.desktop
+++ tests/Common/TestApps/fali_hello/fali_hello1.desktop
+[Desktop Entry]
+Type=Application
+Name=fali_hello1
+Icon=icon-l-video
+Exec=fali_hello1
+X-Maemo-Service=com.nokia.fali_hello1
+Categories=X-MeeGo;Demos;
+OnlyShowIn=X-MeeGo;
--- tests/Common/TestApps/fali_hello/helloworld.pro
+++ tests/Common/TestApps/fali_hello/helloworld.pro
(renamed from tests/TestApps/fali_hello/helloworld.pro)
--- tests/Common/TestApps/fali_multiapp
+++ tests/Common/TestApps/fali_multiapp
+(directory)
--- tests/Common/TestApps/fali_multiapp/CMakeLists.txt
+++ tests/Common/TestApps/fali_multiapp/CMakeLists.txt
(renamed from tests/TestApps/fali_multiapp/CMakeLists.txt)
--- tests/Common/TestApps/fali_multiapp/fali_multiapp.cpp
+++ tests/Common/TestApps/fali_multiapp/fali_multiapp.cpp
(renamed from tests/TestApps/fali_multiapp/fali_multiapp.cpp)
--- tests/Common/TestApps/fali_toc
+++ tests/Common/TestApps/fali_toc
+(directory)
--- tests/Common/TestApps/fali_toc/CMakeLists.txt
+++ tests/Common/TestApps/fali_toc/CMakeLists.txt
(renamed from tests/TestApps/fali_toc/CMakeLists.txt)
--- tests/Common/TestApps/fali_toc/com.nokia.fali_toc.service
+++ tests/Common/TestApps/fali_toc/com.nokia.fali_toc.service
(renamed from tests/TestApps/fali_toc/com.nokia.fali_toc.service)
--- tests/Common/TestApps/fali_toc/com.nokia.fali_toc.service.sb
+++ tests/Common/TestApps/fali_toc/com.nokia.fali_toc.service.sb
(renamed from tests/TestApps/fali_toc/com.nokia.fali_toc.service.sb)
--- tests/Common/TestApps/fali_toc/fali_toc.cpp
+++ tests/Common/TestApps/fali_toc/fali_toc.cpp
+#include <MApplication>
+#include <MApplicationWindow>
+#include <MApplicationPage>
+#include <MApplicationService>
+
+int main(int argc, char ** argv)
+{
+ MApplication app(argc, argv, "fali_toc", new MApplicationService ("com.nokia.fali_toc") );
+ MApplicationPage mainPage;
+ MApplicationWindow window;
+
+ MApplication::setPrestartMode(M::TerminateOnClose);
+
+ sleep(4);
+
+ window.show();
+
+ mainPage.setTitle("fali_toc");
+ mainPage.appear();
+
+ return app.exec();
+}
--- tests/Common/TestApps/fali_toc/fali_toc.desktop
+++ tests/Common/TestApps/fali_toc/fali_toc.desktop
(renamed from tests/TestApps/fali_toc/fali_toc.desktop)
--- tests/Common/TestApps/fali_toc/fali_toc.pro
+++ tests/Common/TestApps/fali_toc/fali_toc.pro
(renamed from tests/TestApps/fali_toc/fali_toc.pro)
--- tests/Common/TestApps/memoryhog
+++ tests/Common/TestApps/memoryhog
+(directory)
--- tests/Common/TestApps/memoryhog/CMakeLists.txt
+++ tests/Common/TestApps/memoryhog/CMakeLists.txt
(renamed from tests/TestApps/memoryhog/CMakeLists.txt)
--- tests/Common/TestApps/memoryhog/memoryhog.c
+++ tests/Common/TestApps/memoryhog/memoryhog.c
(renamed from tests/TestApps/memoryhog/memoryhog.c)
--- tests/Common/TestApps/memoryhog/memoryhog.pro
+++ tests/Common/TestApps/memoryhog/memoryhog.pro
(renamed from tests/TestApps/memoryhog/memoryhog.pro)
--- tests/Common/TestApps/multiwindow_apps
+++ tests/Common/TestApps/multiwindow_apps
+(directory)
--- tests/Common/TestApps/multiwindow_apps/CMakeLists.txt
+++ tests/Common/TestApps/multiwindow_apps/CMakeLists.txt
(renamed from tests/TestApps/multiwindow_apps/CMakeLists.txt)
--- tests/Common/TestApps/multiwindow_apps/close-event
+++ tests/Common/TestApps/multiwindow_apps/close-event
+(directory)
--- tests/Common/TestApps/multiwindow_apps/close-event/CMakeLists.txt
+++ tests/Common/TestApps/multiwindow_apps/close-event/CMakeLists.txt
(renamed from tests/TestApps/multiwindow_apps/close-event/CMakeLists.txt)
--- tests/Common/TestApps/multiwindow_apps/close-event/close-event.pro
+++ tests/Common/TestApps/multiwindow_apps/close-event/close-event.pro
(renamed from tests/TestApps/multiwindow_apps/close-event/close-event.pro)
--- tests/Common/TestApps/multiwindow_apps/close-event/main.cpp
+++ tests/Common/TestApps/multiwindow_apps/close-event/main.cpp
+#include <MApplication>
+#include <MApplicationWindow>
+#include <MApplicationPage>
+#include <MComboBox>
+#include <MDebug>
+#include <QStringList>
+
+class MyWindow : public MApplicationWindow
+{
+public:
+ MyWindow();
+ void createPage();
+
+protected:
+ //! \reimp
+ virtual void closeEvent(QCloseEvent *event);
+
+private:
+ MComboBox *comboBox;
+};
+
+
+MyWindow::MyWindow()
+{
+}
+
+void MyWindow::createPage()
+{
+ MApplicationPage *page=new MApplicationPage();
+ page->setTitle("close-event");
+
+ comboBox = new MComboBox();
+ comboBox->setTitle("What should closeEvent do?");
+ QStringList stringList;
+ stringList << "Ignore closeEvent" << "Hide window (Lazy Shutdown)" << "Really close window";
+ comboBox->addItems(stringList);
+ page->setCentralWidget(comboBox);
+ page->appear();
+}
+
+void MyWindow::closeEvent(QCloseEvent *event)
+{
+ switch (comboBox->currentIndex()) {
+ case 0:
+ mDebug("MyWindow") << "Ignore closeEvent(). Window is not closed.";
+ event->ignore();
+ break;
+ case 1:
+ mDebug("MyWindow") << "Lazy shutdown - hide window";
+ setCloseOnLazyShutdown(false);
+ event->accept();
+ break;
+ case 2:
+ default:
+ mDebug("MyWindow") << "Really close window";
+ setCloseOnLazyShutdown(true);
+ event->accept();
+ break;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ MApplication app(argc, argv);
+ MApplication::setPrestartMode(M::LazyShutdown);
+
+ MyWindow *window = new MyWindow();
+ window->show();
+ window->createPage();
+
+ return app.exec();
+}
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1
+(directory)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/CMakeLists.txt
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/CMakeLists.txt
(renamed from tests/TestApps/multiwindow_apps/multiplewindows1/CMakeLists.txt)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/README
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/README
+README
+------
+
+Multiwindow test application that supports prestarting.
+
+Prestart support is implemented using the inheritance approach (custom application
+inherited from MApplication). Used mode is M::LazyShutdownMultiWindow, so the
+application never *really* exits. Only the windows are hidden and reset.
+
+Command to launch application using specific window (the last paramater is the
+window id to show):
+
+dbus-send --dest=com.nokia.MultiWindow1 --type="method_call" / com.nokia.MultipleWindowsIf.launchWindow int32:"2"
+
+Application supports 3 window id's: 1, 2 and 3.
+
+Application can be started with the switch "-output-level debug" to get information what happens inside it.
+
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw1.service
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw1.service
(renamed from tests/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw1.service)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw2.service
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw2.service
(renamed from tests/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw2.service)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/main.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/main.cpp
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of applifed.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at 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.
+**
+****************************************************************************/
+
+#include "multiwindowapplication.h"
+#include <MApplication>
+
+int main(int argc, char **argv)
+{
+ QString appName(argv[0]);
+ int retval = 1;
+
+ if (appName.endsWith("fali_mw1"))
+ {
+ MultiWindowApplication app(argc, argv, "com.nokia.fali_mw1");
+ MApplication::setPrestartMode(M::LazyShutdownMultiWindow);
+ app.createWindows();
+ retval = app.exec();
+ }
+ else if (appName.endsWith("fali_mw2"))
+ {
+ MultiWindowApplication app(argc, argv, "com.nokia.fali_mw2");
+ MApplication::setPrestartMode(M::TerminateOnCloseMultiWindow);
+ app.createWindows();
+ retval = app.exec();
+ }
+ else
+ {
+ qWarning("Unrecognized executable name!");
+ }
+
+ return retval;
+}
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/mainpage.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/mainpage.cpp
(renamed from tests/TestApps/multiwindow_apps/multiplewindows1/mainpage.cpp)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/mainpage.h
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/mainpage.h
(renamed from tests/TestApps/multiwindow_apps/multiplewindows1/mainpage.h)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindows.xml
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindows.xml
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindows.xml)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindows1.pro
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindows1.pro
(renamed from tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindows1.pro)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.cpp
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.cpp)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.h
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.h
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.h)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowapplication.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowapplication.cpp
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of applifed.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at 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.
+**
+****************************************************************************/
+
+#include "multiwindowapplication.h"
+#include "multiwindowservice.h"
+#include "mainpage.h"
+
+#include <MDebug>
+
+MultiWindowApplication::MultiWindowApplication(int argc, char ** argv,
+ const QString &serviceName) :
+ MApplication(argc, argv),
+ m_service(new MultiWindowService(this, serviceName))
+{
+}
+
+void MultiWindowApplication::createWindows()
+{
+ // Create windows
+ for (int i = 0; i < NUM_WINDOWS; i++) {
+ m_window[i] = new MApplicationWindow;
+ m_window[i]->setWindowTitle(QString("Window %1").arg(i + 1));
+ m_window[i]->setObjectName(QString("Window %1").arg(i + 1));
+ }
+
+ // Create pages
+ for (int i = 0; i < NUM_WINDOWS; i++)
+ m_mainPage[i] = new MainPage(QString("Window %1").arg(i + 1));
+}
+
+void MultiWindowApplication::activateWindow(int index)
+{
+ index--;
+ if (index >= 0 && index < NUM_WINDOWS) {
+
+ // Force release from prestart if in prestarted state.
+ // This is important.
+ if (isPrestarted()) {
+ setPrestarted(false);
+ }
+
+ // Show the desired window
+ m_window[index]->show();
+ m_window[index]->activateWindow();
+ m_window[index]->raise();
+
+ // Show the page and activate it. Note: we have to specify on
+ // what window the page is to appear. Apparently there's something
+ // funny going on somewhere far far away, because the window
+ // we think is active might really not be active at this point of time.
+ // So if the window is not specified, the page might actually
+ // end up in the previous window.
+ m_mainPage[index]->appear(m_window[index]);
+ m_mainPage[index]->activateWidgets();
+ }
+}
+
+void MultiWindowApplication::releasePrestart()
+{
+ mDebug("MultiWindowApplication") << "Prestart released";
+}
+
+void MultiWindowApplication::restorePrestart()
+{
+ resetAndStopWidgets();
+
+ mDebug("MultiWindowApplication") << "Prestart restored";
+}
+
+void MultiWindowApplication::resetAndStopWidgets()
+{
+ // Reset and stop all widgets of all pages here
+ for (int i = 0; i < NUM_WINDOWS; i++)
+ m_mainPage[i]->stopAndResetWidgets();
+}
+
+MultiWindowApplication::~MultiWindowApplication()
+{}
+
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowapplication.h
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowapplication.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of applifed.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at 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.
+**
+****************************************************************************/
+
+#ifndef MULTIWINDOWAPPLICATION_H
+#define MULTIWINDOWAPPLICATION_H
+
+#include <MApplication>
+#include <MApplicationWindow>
+
+#include <QSharedPointer>
+
+#include "mainpage.h"
+#include "multiwindowservice.h"
+
+class MultiWindowApplication : public MApplication
+{
+public:
+ static const int NUM_WINDOWS = 3;
+
+ MultiWindowApplication(int argc, char ** argv,
+ const QString &serviceName);
+ virtual ~MultiWindowApplication();
+ void activateWindow(int index);
+
+ void createWindows();
+
+protected:
+
+ //! \reimp
+ virtual void releasePrestart();
+
+ //! \reimp
+ virtual void restorePrestart();
+
+private:
+ void resetAndStopWidgets();
+
+ MApplicationWindow *m_window[NUM_WINDOWS];
+ MainPage *m_mainPage[NUM_WINDOWS];
+
+ // D-Bus service to show a specific window. Showing a window also causes the
+ // application to get released from the prestarted state.
+ MultiWindowService *m_service;
+};
+
+#endif // MULTIWINDOWAPPLICATION_H
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.cpp
(renamed from tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.cpp)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.h
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.h
(renamed from tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.h)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3
+(directory)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/CMakeLists.txt
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/CMakeLists.txt
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/CMakeLists.txt)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/README
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/README
+README
+------
+
+Multiwindow test application that supports prestarting.
+
+Command to launch application using specific window (the last paramater is
+the window id to show):
+
+dbus-send --dest=com.nokia.MultiWindow3 --type="method_call" / com.nokia.MultipleWindowsIf.launchWindow int32:"2"
+
+Application supports 3 window id's: 1, 2 and 3.
+
+Window 3 is inherited from the MApplication window and it shows an example how to override QWidget::closeEvent().
+
+Application could be started with the switch "-output-level debug" to get information what happens inside it.
+
+
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/com.nokia.fali_mw3.service
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/com.nokia.fali_mw3.service
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/com.nokia.fali_mw3.service)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/main.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/main.cpp
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/main.cpp)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/mainpage.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/mainpage.cpp
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/mainpage.cpp)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/mainpage.h
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/mainpage.h
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/mainpage.h)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi1.desktop
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi1.desktop
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multi1.desktop)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi2.desktop
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi2.desktop
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multi2.desktop)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi3.desktop
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi3.desktop
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multi3.desktop)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindows.xml
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindows.xml
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="com.nokia.MultipleWindowsIf">
+
+ <method name="launchWindow">
+ <arg name="windowId" type="i" direction="in"/>
+ </method>
+
+ </interface>
+</node>
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindows3.pro
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindows3.pro
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindows3.pro)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.cpp
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of applifed.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at 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.
+**
+****************************************************************************/
+
+#include "multiplewindowsifadaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class MultipleWindowsIfAdaptor
+ */
+
+MultipleWindowsIfAdaptor::MultipleWindowsIfAdaptor(QObject *parent)
+ : QDBusAbstractAdaptor(parent)
+{
+ // constructor
+ setAutoRelaySignals(true);
+}
+
+MultipleWindowsIfAdaptor::~MultipleWindowsIfAdaptor()
+{
+ // destructor
+}
+
+void MultipleWindowsIfAdaptor::launchWindow(int windowId)
+{
+ // handle method call com.nokia.MultipleWindowsIf.launchWindow
+ QMetaObject::invokeMethod(parent(), "launchWindow", Q_ARG(int, windowId));
+}
+
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.h
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of applifed.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at 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.
+**
+****************************************************************************/
+
+#ifndef MULTIPLEWINDOWSIFADAPTOR_H_1268830284
+#define MULTIPLEWINDOWSIFADAPTOR_H_1268830284
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+
+/*
+ * Adaptor class for interface com.nokia.MultipleWindowsIf
+ */
+class MultipleWindowsIfAdaptor: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.nokia.MultipleWindowsIf")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"com.nokia.MultipleWindowsIf\">\n"
+" <method name=\"launchWindow\">\n"
+" <arg direction=\"in\" type=\"i\" name=\"windowId\"/>\n"
+" </method>\n"
+" </interface>\n"
+ "")
+public:
+ MultipleWindowsIfAdaptor(QObject *parent);
+ virtual ~MultipleWindowsIfAdaptor();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+ void launchWindow(int windowId);
+Q_SIGNALS: // SIGNALS
+};
+
+#endif
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.cpp
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.cpp)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.h
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.h
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.h)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/mywindow.cpp
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/mywindow.cpp
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/mywindow.cpp)
--- tests/Common/TestApps/multiwindow_apps/multiplewindows3/mywindow.h
+++ tests/Common/TestApps/multiwindow_apps/multiplewindows3/mywindow.h
(renamed from tests/TestApps/multiwindow_apps/multiplewindows3/mywindow.h)
--- tests/Common/unittests
+++ tests/Common/unittests
+(directory)
--- tests/Common/unittests/CMakeLists.txt
+++ tests/Common/unittests/CMakeLists.txt
+add_subdirectory(ut_configdata)
+
+add_subdirectory(ut_cpuload)
+
+add_subdirectory(ut_prestarter)
+
+add_subdirectory(ut_prestartapp)
+
+#add_subdirectory(ut_prestartparser)
+
--- tests/Common/unittests/common.pri
+++ tests/Common/unittests/common.pri
(renamed from tests/unittests/common.pri)
--- tests/Common/unittests/ut_configdata
+++ tests/Common/unittests/ut_configdata
+(directory)
--- tests/Common/unittests/ut_configdata/CMakeLists.txt
+++ tests/Common/unittests/ut_configdata/CMakeLists.txt
(renamed from tests/unittests/ut_configdata/CMakeLists.txt)
--- tests/Common/unittests/ut_configdata/ut_configdata.cpp
+++ tests/Common/unittests/ut_configdata/ut_configdata.cpp
(renamed from tests/unittests/ut_configdata/ut_configdata.cpp)
--- tests/Common/unittests/ut_configdata/ut_configdata.h
+++ tests/Common/unittests/ut_configdata/ut_configdata.h
(renamed from tests/unittests/ut_configdata/ut_configdata.h)
--- tests/Common/unittests/ut_cpuload
+++ tests/Common/unittests/ut_cpuload
+(directory)
--- tests/Common/unittests/ut_cpuload/CMakeLists.txt
+++ tests/Common/unittests/ut_cpuload/CMakeLists.txt
(renamed from tests/unittests/ut_cpuload/CMakeLists.txt)
--- tests/Common/unittests/ut_cpuload/ut_cpuload.cpp
+++ tests/Common/unittests/ut_cpuload/ut_cpuload.cpp
(renamed from tests/unittests/ut_cpuload/ut_cpuload.cpp)
--- tests/Common/unittests/ut_cpuload/ut_cpuload.h
+++ tests/Common/unittests/ut_cpuload/ut_cpuload.h
(renamed from tests/unittests/ut_cpuload/ut_cpuload.h)
--- tests/Common/unittests/ut_prestartapp
+++ tests/Common/unittests/ut_prestartapp
+(directory)
--- tests/Common/unittests/ut_prestartapp/CMakeLists.txt
+++ tests/Common/unittests/ut_prestartapp/CMakeLists.txt
(renamed from tests/unittests/ut_prestartapp/CMakeLists.txt)
--- tests/Common/unittests/ut_prestartapp/ut_prestartapp.cpp
+++ tests/Common/unittests/ut_prestartapp/ut_prestartapp.cpp
(renamed from tests/unittests/ut_prestartapp/ut_prestartapp.cpp)
--- tests/Common/unittests/ut_prestartapp/ut_prestartapp.h
+++ tests/Common/unittests/ut_prestartapp/ut_prestartapp.h
(renamed from tests/unittests/ut_prestartapp/ut_prestartapp.h)
--- tests/Common/unittests/ut_prestarter
+++ tests/Common/unittests/ut_prestarter
+(directory)
--- tests/Common/unittests/ut_prestarter/CMakeLists.txt
+++ tests/Common/unittests/ut_prestarter/CMakeLists.txt
(renamed from tests/unittests/ut_prestarter/CMakeLists.txt)
--- tests/Common/unittests/ut_prestarter/ut_prestarter.cpp
+++ tests/Common/unittests/ut_prestarter/ut_prestarter.cpp
+#include "ut_prestarter.h"
+
+Ut_Prestarter::Ut_Prestarter()
+{}
+
+Ut_Prestarter::~Ut_Prestarter()
+{}
+
+void Ut_Prestarter::initTestCase()
+{}
+
+void Ut_Prestarter::cleanupTestCase()
+{
+ m_subject.reset();
+}
+
+void Ut_Prestarter::testAddPrestartApp()
+{
+ m_subject.reset(new Prestarter());
+ PrestartApp * foo = new PrestartApp("foo1", "com.nokia.foo1", 0);
+
+ m_subject->addPrestartApp(foo);
+
+ QVERIFY( m_subject->findAppWithService(foo->service()));
+ QVERIFY(!m_subject->findAppWithService("com.nokia.dummy12345"));
+
+ QVERIFY(m_subject->m_vectApps.size() == 1);
+
+ // Test that the same application is not added to the list multiple times
+ int sizeBeforeSameAdd = m_subject->m_vectApps.size();
+ m_subject->addPrestartApp(foo);
+
+ QVERIFY(m_subject->m_vectApps.size() == sizeBeforeSameAdd);
+}
+
+void Ut_Prestarter::testReleasedPrestart()
+{
+ m_subject.reset(new Prestarter());
+ m_subject->addPrestartApp(new PrestartApp("foo1", "com.nokia.foo1", 0));
+ m_subject->addPrestartApp(new PrestartApp("foo2", "com.nokia.foo2", 0));
+
+ foreach (PrestartApp * p, m_subject->m_vectApps)
+ p->setReleased(false);
+
+ m_subject->releasedPrestart(0);
+
+ foreach (PrestartApp * p, m_subject->m_vectApps)
+ QVERIFY(p->released());
+}
+
+// Test that Prestarter sets PrestartApp::released() correctly
+void Ut_Prestarter::testRestoredPrestart()
+{
+ // Add some apps
+ m_subject.reset(new Prestarter());
+ m_subject->addPrestartApp(new PrestartApp("foo1", "com.nokia.foo1", 0));
+ m_subject->addPrestartApp(new PrestartApp("foo2", "com.nokia.foo2", 0));
+
+ // Set apps released
+ foreach (PrestartApp * p, m_subject->m_vectApps)
+ p->setReleased(true);
+
+ // Tell Prestarter that all apps returned to the prestarted state
+ m_subject->restoredPrestart(0);
+
+ foreach (PrestartApp * p, m_subject->m_vectApps)
+ QVERIFY(!p->released());
+}
+
+// Test that apps won't get re-prestarted if count is too low
+void Ut_Prestarter::testRePrestart2Neg()
+{
+ m_subject.reset(new Prestarter());
+
+ // Add some apps
+ m_subject->addPrestartApp(new PrestartApp("foo1", "com.nokia.foo1", 0));
+ m_subject->addPrestartApp(new PrestartApp("foo2", "com.nokia.foo2", 0));
+
+ // Toggle setReleased to increase release count
+ foreach (PrestartApp * p, m_subject->m_vectApps)
+ {
+ p->setRePrestartTrigger(1);
+ p->setReleased(false);
+ p->setReleased(true);
+ }
+
+ // Tell Prestarter that all apps returned to the prestarted state
+ m_subject->restoredPrestart(0);
+
+ foreach (PrestartApp * p, m_subject->m_vectApps)
+ {
+ QVERIFY(!p->released());
+ QVERIFY(!p->rePrestarting());
+ }
+}
+
+// Test that apps will get re-prestarted if count is high enough
+// Test also that SIGTERM and SIGKILL gets send.
+void Ut_Prestarter::testRePrestart2Pos()
+{
+ m_subject.reset(new Prestarter());
+
+ // Add app
+ PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0, true);
+ m_subject->addPrestartApp(p);
+
+ // Toggle setReleased to increase release count
+ p->setRePrestartTrigger(1);
+ p->setReleased(false);
+ p->setReleased(true);
+ p->setReleased(false);
+ p->setReleased(true);
+
+ // Tell Prestarter that all apps returned to the prestarted state
+ m_subject->restoredPrestart(0);
+
+ QVERIFY(!p->released());
+ QVERIFY(!p->sigTermSent());
+ QVERIFY(p->rePrestarting());
+}
+
+// Test that apps won't get re-prestarted if denied
+void Ut_Prestarter::testRePrestart3()
+{
+ m_subject.reset(new Prestarter());
+
+ // Add app
+ PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0);
+ m_subject->addPrestartApp(p);
+
+ // Toggle setReleased to increase release count
+ p->setForcedRePrestartNotAllowed(true);
+ p->setRePrestartTrigger(1);
+ p->setReleased(false);
+ p->setReleased(true);
+ p->setReleased(false);
+ p->setReleased(true);
+ p->setReleased(false);
+ p->setReleased(true);
+
+ // Tell Prestarter that all apps returned to the prestarted state
+ m_subject->restoredPrestart(0);
+
+ QVERIFY(!p->released());
+ QVERIFY(!p->rePrestarting());
+}
+
+// Test that app get SIGTERM and SIGKILL
+void Ut_Prestarter::testRePrestartSig1()
+{
+ m_subject.reset(new Prestarter());
+
+ // Add app
+ PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0);
+ m_subject->addPrestartApp(p);
+
+ p->setRePrestarting(true);
+
+ QVERIFY(!p->sigTermSent());
+ QVERIFY(!p->sigKillSent());
+
+ m_subject->triggerForcedRePrestarts();
+
+ QVERIFY(p->sigTermSent());
+ QVERIFY(!p->sigKillSent());
+
+ m_subject->triggerForcedRePrestarts();
+
+ QVERIFY(p->sigTermSent());
+ QVERIFY(p->sigKillSent());
+}
+
+// Test that app get SIGTERM, but not SIGKILL
+void Ut_Prestarter::testRePrestartSig2()
+{
+ m_subject.reset(new Prestarter());
+
+ // Add app
+ PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0);
+ m_subject->addPrestartApp(p);
+
+ p->setRePrestarting(true);
+
+ QVERIFY(!p->sigTermSent());
+ QVERIFY(!p->sigKillSent());
+
+ m_subject->triggerForcedRePrestarts();
+
+ QVERIFY(p->sigTermSent());
+ QVERIFY(!p->sigKillSent());
+
+ p->setRePrestarting(false);
+
+ m_subject->triggerForcedRePrestarts();
+
+ QVERIFY(!p->sigTermSent());
+ QVERIFY(!p->sigKillSent());
+}
+
+// Test that no signals are sent if app gets released from the prestarted state
+void Ut_Prestarter::testRePrestartSig3()
+{
+ m_subject.reset(new Prestarter());
+
+ // Add app
+ PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0);
+ m_subject->addPrestartApp(p);
+
+ p->setRePrestarting(true);
+
+ QVERIFY(!p->sigTermSent());
+ QVERIFY(!p->sigKillSent());
+
+ p->setReleased(true);
+
+ m_subject->triggerForcedRePrestarts();
+
+ QVERIFY(!p->sigTermSent());
+ QVERIFY(!p->sigKillSent());
+}
+
+void Ut_Prestarter::testSomethingToRePrestart()
+{
+ m_subject.reset(new Prestarter());
+
+ QVERIFY(!m_subject->somethingToRePrestart());
+
+ PrestartApp * app = new PrestartApp("foo1", "com.nokia.foo1", 0);
+ m_subject->addPrestartApp(app);
+
+ QVERIFY(!m_subject->somethingToRePrestart());
+
+ app->setRePrestarting(true);
+
+ QVERIFY(m_subject->somethingToRePrestart());
+}
+
+void Ut_Prestarter::testDoReadConfigurationGlobals()
+{
+ m_subject.reset(new Prestarter());
+
+ QString data("<?xml version=\"1.0\"?> \
+ <applifed default_cpu_load_threshold=\"50\" \
+ cpu_load_polling_delay=\"2\" \
+ re-prestart_delay=\"3600\" \
+ default_re-prestart_trigger=\"5\"> \
+ </applifed>");
+
+ QXmlInputSource input;
+ input.setData(data);
+ m_subject->doReadConfiguration(input);
+
+ // Test that global default settings are correct
+ QVERIFY(m_subject->m_cpuLoadPollingDelay == 2);
+ QVERIFY(m_subject->m_rePrestartDelay == 3600);
+
+ data = "<?xml version=\"1.0\"?> \
+ <applifed default_cpu_load_threshold=\"51\" \
+ cpu_load_polling_delay=\"3\" \
+ re-prestart_delay=\"3601\" \
+ default_re-prestart_trigger=\"6\"> \
+ </applifed>";
+
+ input.setData(data);
+
+ m_subject->doReadConfiguration(input);
+
+ // Test that global default settings are correct
+ QVERIFY(m_subject->m_cpuLoadPollingDelay == 3);
+ QVERIFY(m_subject->m_rePrestartDelay == 3601);
+}
+
+void Ut_Prestarter::testDoReadConfigurationApplications()
+{
+ m_subject.reset(new Prestarter());
+
+ QString data("<?xml version=\"1.0\"?> \
+ <applifed> \
+ <application name=\"bar1\" service=\"com.foo.bar1\" priority=\"4\"/> \
+ <application name=\"bar2\" service=\"com.foo.bar2\" priority=\"3\"/> \
+ <application name=\"bar3\" service=\"com.foo.bar3\" priority=\"2\"/> \
+ <application name=\"bar4\" service=\"com.foo.bar4\" priority=\"1\"/> \
+ </applifed>");
+
+ QXmlInputSource input;
+ input.setData(data);
+ m_subject->doReadConfiguration(input);
+
+ // Test that added apps are there
+ QVERIFY(m_subject->m_vectApps.size() == 4);
+
+ PrestartApp * app = m_subject->findAppWithService("com.foo.bar1");
+ QVERIFY(app);
+
+ app = m_subject->findAppWithService("com.foo.bar2");
+ QVERIFY(app);
+
+ app = m_subject->findAppWithService("com.foo.bar3");
+ QVERIFY(app);
+
+ app = m_subject->findAppWithService("com.foo.bar4");
+ QVERIFY(app);
+
+ // This should not be there
+ app = m_subject->findAppWithService("com.foo.bar5");
+ QVERIFY(!app);
+}
+
+void Ut_Prestarter::testDoReadConfigurationApplicationParams1()
+{
+ m_subject.reset(new Prestarter());
+
+ QString data("<?xml version=\"1.0\"?> \
+ <applifed> \
+ <application name=\"bar1\" service=\"com.foo.bar1\" \
+ priority=\"4\" \
+ cpu_load_threshold=\"10\" \
+ forced_re-prestart_not_allowed=\"1\" \
+ re-prestart_trigger=\"3\" \
+ /> \
+ <application name=\"bar2\" service=\"com.foo.bar2\" \
+ priority=\"5\" \
+ cpu_load_threshold=\"11\" \
+ forced_re-prestart_not_allowed=\"0\" \
+ re-prestart_trigger=\"4\" \
+ /> \
+ </applifed>");
+
+ QXmlInputSource input;
+ input.setData(data);
+ m_subject->doReadConfiguration(input);
+
+ // Test that params are correctly set
+ PrestartApp * app = m_subject->findAppWithService("com.foo.bar1");
+ QVERIFY(app);
+ QVERIFY(app->name() == "bar1");
+ QVERIFY(app->priority() == 4);
+ QVERIFY(app->cpuLoadThreshold() == 10);
+ QVERIFY(app->forcedRePrestartNotAllowed() == true);
+ QVERIFY(app->rePrestartTrigger() == 3);
+
+ app = m_subject->findAppWithService("com.foo.bar2");
+ QVERIFY(app);
+ QVERIFY(app->name() == "bar2");
+ QVERIFY(app->priority() == 5);
+ QVERIFY(app->cpuLoadThreshold() == 11);
+ QVERIFY(app->forcedRePrestartNotAllowed() == false);
+ QVERIFY(app->rePrestartTrigger() == 4);
+}
+
+void Ut_Prestarter::testDoReadConfigurationApplicationParams2()
+{
+ m_subject.reset(new Prestarter());
+
+ QString data("<?xml version=\"1.0\"?> \
+ <applifed \
+ default_cpu_load_threshold=\"51\" \
+ default_re-prestart_trigger=\"6\"> \
+ <application name=\"bar1\" service=\"com.foo.bar1\" \
+ cpu_load_threshold=\"10\" \
+ re-prestart_trigger=\"3\"/> \
+ <application name=\"bar2\" service=\"com.foo.bar2\"/> \
+ </applifed>");
+
+ QXmlInputSource input;
+ input.setData(data);
+ m_subject->doReadConfiguration(input);
+
+ // Test that default settings are used correctly
+ PrestartApp * app = m_subject->findAppWithService("com.foo.bar1");
+ QVERIFY(app);
+ QVERIFY(app->cpuLoadThreshold() == 10);
+ QVERIFY(app->rePrestartTrigger() == 3);
+
+ app = m_subject->findAppWithService("com.foo.bar2");
+ QVERIFY(app);
+ QVERIFY(app->cpuLoadThreshold() == 51);
+ QVERIFY(app->rePrestartTrigger() == 6);
+}
+
+void Ut_Prestarter::testDoReadConfigurationAllowLazyShutdown()
+{
+ m_subject.reset(new Prestarter());
+
+ QString data("<?xml version=\"1.0\"?> \
+ <applifed> \
+ <allow_lazy_shutdown binary_path=\"/usr/bin/foo1\"/> \
+ <allow_lazy_shutdown binary_path=\"/usr/bin/foo2\"/> \
+ </applifed>");
+
+ QXmlInputSource input;
+ input.setData(data);
+ m_subject->doReadConfiguration(input);
+
+ QVERIFY(m_subject->isLazyShutdownAllowed("/usr/bin/foo1"));
+ QVERIFY(m_subject->isLazyShutdownAllowed("/usr/bin/foo2"));
+ QVERIFY(!m_subject->isLazyShutdownAllowed("/usr/bin/foo3"));
+}
+
+void Ut_Prestarter::testKillPrestartedApplications()
+{
+ m_subject.reset(new Prestarter());
+
+ // Add apps
+ PrestartApp * p1 = new PrestartApp("foo1", "com.nokia.foo1", 0);
+ m_subject->addPrestartApp(p1);
+
+ PrestartApp * p2 = new PrestartApp("foo1", "com.nokia.foo2", 0);
+ m_subject->addPrestartApp(p2);
+
+ QVERIFY(!p1->sigTermSent());
+ QVERIFY(!p1->sigKillSent());
+ QVERIFY(!p2->sigTermSent());
+ QVERIFY(!p2->sigKillSent());
+
+ // Set only p1 released
+ p1->setReleased(true);
+
+ m_subject->killPrestartedApplications();
+
+ QVERIFY(p1->sigTermSent());
+ QVERIFY(!p1->sigKillSent());
+ QVERIFY(p2->sigTermSent());
+ QVERIFY(!p2->sigKillSent());
+}
+
+QTEST_MAIN(Ut_Prestarter);
--- tests/Common/unittests/ut_prestarter/ut_prestarter.h
+++ tests/Common/unittests/ut_prestarter/ut_prestarter.h
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+#include <QtCore/QCoreApplication>
+
+#define UNIT_TEST
+
+#include "prestarter.h"
+#include "prestartapp.h"
+
+#include <tr1/memory>
+
+using std::tr1::shared_ptr;
+
+class Ut_Prestarter : public QObject
+{
+ Q_OBJECT
+
+public:
+ Ut_Prestarter();
+ virtual ~Ut_Prestarter();
+
+private Q_SLOTS:
+ void initTestCase();
+ void cleanupTestCase();
+ void testAddPrestartApp();
+ void testRestoredPrestart();
+ void testRePrestart2Neg();
+ void testRePrestart2Pos();
+ void testRePrestart3();
+ void testRePrestartSig1();
+ void testRePrestartSig2();
+ void testRePrestartSig3();
+ void testReleasedPrestart();
+ void testSomethingToRePrestart();
+ void testDoReadConfigurationGlobals();
+ void testDoReadConfigurationApplications();
+ void testDoReadConfigurationApplicationParams1();
+ void testDoReadConfigurationApplicationParams2();
+ void testDoReadConfigurationAllowLazyShutdown();
+ void testKillPrestartedApplications();
+
+private:
+ shared_ptr<Prestarter> m_subject;
+};
--- tests/Harmattan
+++ tests/Harmattan
+(directory)
--- tests/Harmattan/CMakeLists.txt
+++ tests/Harmattan/CMakeLists.txt
+# Sub build: art-tests
+add_subdirectory(art-tests)
+
+# Sub build: bug-tests
+add_subdirectory(bug-tests)
+
+# Sub build:functests
+add_subdirectory(functests)
+
+# Sub build: perftests
+add_subdirectory(perftests)
+
+# Sub build: TestScripts
+add_subdirectory(TestScripts)
+
+# Sub build: unit-tests
+add_subdirectory(unit-tests)
--- tests/Harmattan/TestScripts
+++ tests/Harmattan/TestScripts
+(directory)
--- tests/Harmattan/TestScripts/CMakeLists.txt
+++ tests/Harmattan/TestScripts/CMakeLists.txt
+# Find MeeGo Touch libraries for the test programs using pkg-config
+if ($ENV{MEEGO})
+ # Do nothing
+endif ($ENV{MEEGO})
+
+if ($ENV{HARMATTAN})
+ include(FindPkgConfig)
+ pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MEEGOTOUCH_INCLUDE_DIRS})
+
+ add_subdirectory(cpu_load)
+
+ install(FILES functional.drive fautils.rb test-perf-prestart.py
+ DESTINATION /usr/share/applifed-testscripts)
+
+ install(PROGRAMS tc_applifed_one_instance.rb cp-service.rb ts_prestart.rb
+ ts_multi_instance.rb tc_daemonize.rb
+ test-perf.rb ts_prestart_prevent.rb
+ DESTINATION /usr/share/applifed-testscripts)
+
+ install(FILES
+ functest_applifed.conf
+ DESTINATION /usr/share/applifed-testscripts)
+endif ($ENV{HARMATTAN})
--- tests/Harmattan/TestScripts/cp-service.rb
+++ tests/Harmattan/TestScripts/cp-service.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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.
+#
+
+$path = string = `echo $PATH `
+if $path.include?("scratchbox")
+ system("cp /usr/share/applifed-testscript/sbservice/com.nokia.fali_hello.service.sb /usr/share/dbus-1/services/com.nokia.fali_hello.service")
+ system("cp /usr/share/applifed-testscript/sbservice/com.nokia.fali_toc.service.sb /usr/share/dbus-1/services/com.nokia.fali_toc.service")
+end
--- tests/Harmattan/TestScripts/cpu_load
+++ tests/Harmattan/TestScripts/cpu_load
+(directory)
--- tests/Harmattan/TestScripts/cpu_load/CMakeLists.txt
+++ tests/Harmattan/TestScripts/cpu_load/CMakeLists.txt
+if ($ENV{MEEGO})
+ # Do nothing
+endif ($ENV{MEEGO})
+
+if ($ENV{HARMATTAN})
+ install(FILES cpu_load_high.drive cpu_load_low.drive DESTINATION /usr/share/applifed-testscripts/cpu_load)
+ install(PROGRAMS tc_cpu_load.rb DESTINATION /usr/share/applifed-testscripts/cpu_load)
+ install(FILES cpu_load.conf DESTINATION /usr/share/applifed-testscripts/cpu_load)
+endif ($ENV{HARMATTAN})
+
--- tests/Harmattan/TestScripts/cpu_load/cpu_load.conf
+++ tests/Harmattan/TestScripts/cpu_load/cpu_load.conf
(renamed from tests/TestScripts/cpu_load/cpu_load.conf)
--- tests/Harmattan/TestScripts/cpu_load/cpu_load_high.drive
+++ tests/Harmattan/TestScripts/cpu_load/cpu_load_high.drive
(renamed from tests/TestScripts/cpu_load/cpu_load_high.drive)
--- tests/Harmattan/TestScripts/cpu_load/cpu_load_low.drive
+++ tests/Harmattan/TestScripts/cpu_load/cpu_load_low.drive
(renamed from tests/TestScripts/cpu_load/cpu_load_low.drive)
--- tests/Harmattan/TestScripts/cpu_load/tc_cpu_load.rb
+++ tests/Harmattan/TestScripts/cpu_load/tc_cpu_load.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the prestart functionality
+#
+# * Objectives: To test that applications are prestarted based
+# on the cpu load.
+#
+
+require 'tdriver'
+require 'test/unit'
+include TDriverVerify
+
+ADDITIONAL_PATH=File.join("/usr/share/applifed-testscripts")
+$LOAD_PATH << ADDITIONAL_PATH
+require 'fautils'
+
+class TC_CpuLoadTests < Test::Unit::TestCase
+
+ $path = string = `echo $PATH `
+ # method called before any test case
+ def setup
+ @tc = Fali_utils.new
+ @tc.get_pids('applifed')
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ @mydisplay = 1
+ else
+ @mydisplay = 0
+ system "mcetool --set-tklock-mode=unlocked"
+ end
+ apps = ['fali_hello',
+ 'fali_mw2',
+ 'fali_toc']
+
+ for app in apps
+ if system("pgrep #{app}") == true
+ @tc.print_debug("Killing #{app}")
+ system("kill -9 `pgrep #{app}`")
+ end
+ end
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ @tc.get_pids('applifed')
+ end
+
+ # Test that a applications are prestarted when the cpu
+ # load is lower than threshold value
+ def test_cpu_load_low
+ if FileTest.exists?("/tmp/cpuload_low.log")
+ system "rm /tmp/cpuload_low.log"
+ end
+
+ @tc.run_system_command(:cmd => "source /tmp/session_bus_address.user;" +
+ "DISPLAY=:#{@mydisplay}; applifed --test --log /tmp/cpuload_low.log" +
+ "< /usr/share/applifed-testscripts/cpu_load/cpu_load_low.drive &", \
+ :failmsg => "unable to start applifed in test mode with cpu load low", \
+ :docheck => true, :sleep => 6, \
+ :logmsg => "start applifed with low cpu load")
+ @tc.print_debug("Check that fali_toc prestarted with Priority 1")
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_toc', priority=1\" /tmp/cpuload_low.log"}
+
+ @tc.print_debug("Check that fali_hello got registered")
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"'com.nokia.fali_hello' got registered\" /tmp/cpuload_low.log"}
+
+ @tc.print_debug("Check that fali_mw2 prestarted with priority 2")
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_mw2', priority=2\" /tmp/cpuload_low.log"}
+
+ @tc.print_debug("Check that fali_toc got registered")
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"'com.nokia.fali_toc' got registered\" /tmp/cpuload_low.log"}
+
+ @tc.print_debug("Check that fali_hello prestarted with priority 3")
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_hello', priority=3\" /tmp/cpuload_low.log"}
+
+ @tc.print_debug("Check that fali_mw2 got registered")
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"'com.nokia.fali_mw2' got registered\" /tmp/cpuload_low.log"}
+ end
+
+ # Test that applications are not prestarted when the cpu
+ # load is higher than threshold value
+ def test_cpu_load_high
+ if FileTest.exists?("/tmp/cpuload_high.log")
+ system "rm /tmp/cpuload_high.log"
+ end
+
+ @tc.run_system_command(:cmd => "source /tmp/session_bus_address.user;" +
+ "DISPLAY=:#{@mydisplay}; applifed --test --log /tmp/cpuload_high.log" +
+ "< /usr/share/applifed-testscripts/cpu_load/cpu_load_high.drive &", \
+ :failmsg => "unable to start applifed in test mode with cpu load high", \
+ :docheck => true, :sleep => 6, \
+ :logmsg => "start applifed with high cpu load")
+ sleep 6
+
+ @tc.print_debug("Check that fali_hello prestarted with priority 3")
+ verify_equal(false,2,"Application is prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_hello', priority=3\" /tmp/cpuload_high.log"}
+
+ @tc.print_debug("Check that fali_toc prestarted with Priority 1")
+ verify_equal(false,2,"Application is prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_toc', priority=1\" /tmp/cpuload_high.log"}
+
+ @tc.print_debug("Check that fali_mw2 prestarted with priority 2")
+ verify_equal(false,2,"Application is prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_mw2', priority=2\" /tmp/cpuload_high.log"}
+ end
+
+end
--- tests/Harmattan/TestScripts/fautils.rb
+++ tests/Harmattan/TestScripts/fautils.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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.
+#
+require "tdriver"
+include TDriverVerify
+include Test::Unit::Assertions
+
+class Fali_utils
+ def failure(msg)
+ xx = "#########\nFailure:\n#{msg}\n#########"
+ return xx
+ end
+ def print_debug(msg)
+ message = "[INFO] #{msg}\n"
+ puts message
+ end
+
+ def get_pids(app)
+ pids = `pgrep #{app}`.split(/\s/).collect { |x| x.strip() }.delete_if { |x| x.empty? }
+ print_debug("The pids of #{app} is : #{pids.join(' ')}")
+ pids = nil if pids.empty?
+ return pids
+ end
+
+ # Returns the pid of an application or nil if it wasn't running.
+ def get_pid(app)
+ print_debug("get the pids of #{app}")
+ pids = get_pids(app)
+
+ if not pids.nil? and pids.length >= 1
+ print_debug("The pids of #{app} is : #{pids.join(' ')}")
+ return pids[0]
+ end
+
+ return nil
+ end
+
+ # Kill an application. Returns true if killed, false otherwise.
+ def kill(app)
+ system("pkill -9 #{app}")
+ end
+
+ # Returns true is at least one instance of application is running
+ def running?(app)
+ not get_pid(app).empty?
+ end
+
+ def run_system_command(ahash = {})
+ if ahash[:logmsg]
+ print_debug(ahash[:logmsg])
+ end
+ myretval = system(ahash[:cmd])
+ if ahash[:sleep]
+ print_debug("sleeping for #{ahash[:sleep]} seconds")
+ sleep(ahash[:sleep])
+ print_debug("wake up now")
+ end
+ if ahash[:docheck]
+ assert_equal(true, myretval, ahash[:failmsg])
+ end
+ if ahash[:ret_cmd_val]
+ return myretval
+ end
+ end
+
+ def kill_unwanted_apps
+ @sut = TDriver.sut(:Id => 'sut_qt_maemo')
+ begin
+ @app = @sut.application
+ @exePath = @app.attribute('exepath')
+ print_debug("The exepath of on-top application is :#{@exePath}")
+ if @exePath == "/usr/bin/applauncherd.bin"
+ @appName = @app.name
+ print_debug("The application on-top is :#{@exePath}")
+ else
+ @appName = File.basename(@exePath)
+ print_debug("The application on-top is :#{@appName}")
+ end
+ end
+
+ while @appName != "meegotouchhome"
+ system("pkill #{@appName}")
+ @app = @sut.application
+ @exePath = @app.attribute('exepath')
+ print_debug("The exepath of on-top application is :#{@exePath}")
+ if @exePath == "/usr/bin/applauncherd.bin"
+ @appName = @app.name
+ print_debug("The application on-top is :#{@exePath}")
+ else
+ @appName = File.basename(@exePath)
+ print_debug("The application on-top is :#{@appName}")
+ end
+ end
+ print_debug("Now meegotouchhome is on-top")
+
+ end
+ def open_Apps_from_grid(appName)
+ #Open the Application from the application grid
+ print_debug("searching for application #{appName} in appGrid...")
+ @meegoHome = @sut.application(:name => 'meegotouchhome')
+ if @meegoHome.test_object_exists?("LauncherButton", :text => appName)
+ icon = @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName)
+
+ grid = nil
+ if @meegoHome.test_object_exists?("Launcher" )
+ grid = @meegoHome.Launcher
+ elsif @meegoHome.test_object_exists?("SwipeLauncher" )
+ grid = @meegoHome.SwipeLauncher
+ else
+ raise "Launcher not found!"
+ exit 1
+ end
+
+ while icon.attribute('visibleOnScreen') == 'false' || icon.attribute('y').to_i > 400
+ grid.MPannableViewport( :name => 'SwipePage' ).MWidget( :name => 'glass' ).gesture(:Up, 1, 300)
+ sleep(0.2)
+ icon.refresh
+ end
+ print_debug("Application #{appName} found : now tapping on it")
+ @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName).tap
+ else
+ #icon does not
+ #raise error and exit
+ raise "Application not found in Application grid"
+ exit 1
+ end
+ end
+end
--- tests/Harmattan/TestScripts/functest_applifed.conf
+++ tests/Harmattan/TestScripts/functest_applifed.conf
(renamed from tests/TestScripts/functest_applifed.conf)
--- tests/Harmattan/TestScripts/functional.drive
+++ tests/Harmattan/TestScripts/functional.drive
(renamed from tests/TestScripts/functional.drive)
--- tests/Harmattan/TestScripts/tc_applifed_one_instance.rb
+++ tests/Harmattan/TestScripts/tc_applifed_one_instance.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the prestart functionality
+#
+# * Objectives: test the functionality of applifed from
+# the prestart point of view
+#
+
+require 'tdriver'
+require 'date'
+require 'test/unit'
+
+include TDriverVerify
+ADDITIONAL_PATH=File.join("/usr/share/applifed-testscripts")
+$LOAD_PATH << ADDITIONAL_PATH
+
+require 'fautils'
+
+class TC_OnlyOneApplifed < Test::Unit::TestCase
+ # Check that only one instance of applifed is running
+ def setup
+ @tc = Fali_utils.new
+ @tc.print_debug("Entering the setup")
+ end
+
+ def teardown
+ @tc.print_debug("Exiting teardown")
+ end
+
+ def test_only_one_applifed
+ pids = @tc.get_pids('applifed')
+
+ if not pids.nil?
+ puts "pids: #{pids.join(' ')}"
+ else
+ verify_true(0, "Applifed is not running") { false }
+ end
+
+ verify_true(0, "Multiple instances of applifed running") {
+ pids.length == 1
+ }
+ end
+
+ def test_lock()
+ verify_true(5, "applifed not running") {
+ system("pgrep applifed")
+ }
+
+ verify_false(5, "only one instance should be allowed to run") {
+ system("applifed --fork")
+ }
+ end
+end
+
--- tests/Harmattan/TestScripts/tc_daemonize.rb
+++ tests/Harmattan/TestScripts/tc_daemonize.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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.
+
+require 'date'
+require 'test/unit'
+
+ADDITIONAL_PATH=File.join("/usr/share/applifed-testscripts")
+$LOAD_PATH << ADDITIONAL_PATH
+
+require 'fautils'
+
+class TC_Daemonize < Test::Unit::TestCase
+ $path = string = `echo $PATH `
+ LAUNCH_APPLIFED_COUNT = 5
+ def setup
+ @tc = Fali_utils.new
+ @tc.get_pids('applifed')
+ if $path.include?("scratchbox")
+ system("pkill applifed")
+ system("rm /tmp/applifed*")
+ end
+ system("initctl stop xsession/applifed")
+ end
+
+ def teardown
+ if $path.include?("scratchbox")
+ system("applifed --fork")
+ else
+ system("rm /tmp/applifed*")
+ system("pkill applifed")
+ system("initctl start xsession/applifed")
+ end
+ @tc.get_pids('applifed')
+ end
+ def test_daemonize()
+ @sut = TDriver.sut(:Id => 'sut_qt_maemo')
+ @tc.run_system_command(:cmd => "applifed --fork", \
+ :failmsg => "error while daemonizing", \
+ :docheck => true, :sleep => 5, \
+ :logmsg => "starting applifed daemonized")
+
+ @tc.run_system_command(:cmd => "pgrep applifed", \
+ :failmsg => "applifed was not started", \
+ :docheck => true, :sleep => 1, \
+ :logmsg => "checking for applifed")
+
+ pids = @tc.get_pids('applifed')
+ if not pids.nil?
+ @tc.print_debug("pids: #{pids.join(' ')}")
+ else
+ verify_true(0, "Applifed is not running") { false }
+ end
+
+ verify_true(0, "Multiple instances of applifed running") {
+ pids.length == 1}
+
+ @tc.run_system_command(:cmd => "dbus-send --dest=com.nokia.fali_hello"+\
+ " --type=method_call /org/maemo/m com.nokia.MApplicationIf.ping", \
+ :failmsg => "unable to prestart application", \
+ :docheck => true, :sleep => 1, \
+ :logmsg => "prestarting fali_hello")
+
+ @tc.run_system_command(:cmd => "dbus-send --dest=com.nokia.fali_hello"+\
+ " --type=method_call /org/maemo/m com.nokia.MApplicationIf.launch", \
+ :failmsg => "unable to launch application", \
+ :docheck => true, :sleep => 5, \
+ :logmsg => "starting fali_hello")
+
+ @tc.run_system_command(:cmd => "pgrep fali_hello", \
+ :failmsg => "fali_hello was not started", \
+ :docheck => true, :sleep => 1, \
+ :logmsg => "checking for fali_hello")
+
+ @tc.run_system_command(:cmd => "pkill applifed", \
+ :failmsg => "unable to kill applifed", \
+ :docheck => true, :sleep => 1, \
+ :logmsg => "kill applifed now")
+
+ @tc.run_system_command(:cmd => "pkill fali_hello", \
+ :failmsg => "unable to kill fali_hello", \
+ :docheck => true, :sleep => 1, \
+ :logmsg => "kill fali_hello now")
+ end
+
+ def test_fork_one_instance
+ for i in 1..LAUNCH_APPLIFED_COUNT
+ @tc.run_system_command(:cmd => "applifed --fork", \
+ :failmsg => "error while forking", \
+ :sleep => 1, \
+ :logmsg => "Forking applifed #{i} times")
+ end
+ pids = @tc.get_pids('applifed')
+ if not pids.nil?
+ @tc.print_debug("pids: #{pids.join(' ')}")
+ else
+ verify_true(0, "Applifed is not running") { false }
+ end
+
+ verify_true(0, "Multiple instances of applifed running") {
+ pids.length == 1}
+ end
+end
+
+
--- tests/Harmattan/TestScripts/test-perf-prestart.py
+++ tests/Harmattan/TestScripts/test-perf-prestart.py
+#!/usr/bin/env python
+"""
+This program tests the startup time of the given application with and
+without prestarting.
+
+Requirements:
+1. DISPLAY environment variable must be set correctly.
+2. DBus session bus must be running.
+3. DBus session bus address must be stored in /tmp/session_bus_address.user.
+4. Given application supports prestarting with -prestart commandline argument.
+
+Usage: test-perf-prestart <prestartable application>
+
+Example: test-perf-prestart /usr/bin/camera-ui
+
+Authors: antti.kervinen at nokia.com, juha.lintula at nokia.com
+"""
+import os
+import subprocess
+import commands
+import time
+import sys
+from optparse import OptionParser
+import unittest
+
+MEMORYHOG = '/usr/bin/memoryhog'
+DEV_NULL = file("/dev/null","w")
+LOG_FILE = '/tmp/applifed_perftest.log'
+
+_timer_pipe = None
+_start_time = 0
+_memory_stats = []
+
+
+appname = None
+test_mode = None
+
+def parseCommandLineOptions():
+ global appname, test_mode
+ my_parser = OptionParser()
+ my_parser.add_option("-a", "--app", dest="app", help="path of the application you want to test", action="store")
+ my_parser.add_option("-s", "--swap", dest="swap", help="Flag for swap mode of testing, if not used, test_mode = Regular", action="store_true", default=False)
+ options, arguments = my_parser.parse_args()
+ if not options.app:
+ print "you must specify the application you want to test"
+ sys.exit(1)
+ else:
+ assert (os.path.exists(options.app)), "The application %s does not exist" % options.app
+ appname = options.app
+ if options.swap:
+ test_mode = 'Swap'
+ else:
+ test_mode = 'Regular'
+
+def debug(*msg):
+ sys.stderr.write('[DEBUG %s] %s\n' % (time.time(), ' '.join([str(s) for s in msg]),))
+
+def error(*msg):
+ sys.stderr.write('ERROR %s\n' % (' '.join([str(s) for s in msg]),))
+ sys.exit(1)
+
+def basename(appname):
+ return appname.split('/')[-1]
+
+def is_executable_file(filename):
+ return os.path.isfile(filename) and os.access(filename, os.X_OK)
+
+def check_prerequisites(appname):
+ if os.getenv('DISPLAY') == None:
+ error("DISPLAY is not set. Check the requirements.")
+
+ if os.getenv('DBUS_SESSION_BUS_ADDRESS') == None:
+ error("DBUS_SESSION_BUS_ADDRESS is not set.\n" +
+ "You probably want to source /tmp/session_bus_address.user")
+
+ if not is_executable_file(appname):
+ error("'%s' is not an executable file\n" % (appname,) +
+ "(should be an application that supports prestarting)")
+
+class applifed_perf_tests(unittest.TestCase):
+ def setUp(self):
+ self.tcname = self.id().split('.')[-1]
+ debug("Stopping applifed")
+ os.system("initctl stop xsession/applifed")
+
+ def tearDown(self):
+ os.system("initctl start xsession/applifed")
+ st, pid = commands.getstatusoutput("pgrep applifed")
+ debug("applifed started again with pid : %s" %pid)
+ pass
+ #print "End %s" % self.tcname
+
+ def start_timer(self):
+ # call measure_time after calling this...
+ global _start_time
+ _start_time = time.time()
+
+ def measure_time(self):
+ global _end_time
+ fh = open(LOG_FILE, "r")
+ lines = fh.readlines()
+ lastline = lines[len(lines)-2]
+ _end_time = lastline.split()[0]
+ debug("End Time :%f" %float(_end_time))
+ _app_start_time = float(_end_time) - float(_start_time)
+ return _app_start_time
+
+ def save_memory_usage(self, process_handle):
+ global _memory_stats
+ rss, private_dirty = 0, 0
+ if process_handle:
+ # calculate process memory usage
+ # resident size in memory and private dirty
+ smaps_lines = file("/proc/%s/smaps" % (process_handle.pid,)).readlines()
+ for line in smaps_lines:
+ if line.startswith("Rss:"):
+ rss += int(line.split()[1])
+ elif line.startswith("Private_Dirty:"):
+ private_dirty += int(line.split()[1])
+ # find out free system memory
+ meminfo_lines = file("/proc/meminfo").readlines()
+ for line in meminfo_lines:
+ if line.startswith("MemFree:"):
+ memfree = int(line.split()[1])
+ elif line.startswith("Buffers:"):
+ memfree += int(line.split()[1])
+ elif line.startswith("Cached:"):
+ memfree += int(line.split()[1])
+ _memory_stats.append({'rss':rss,
+ 'private_dirty': private_dirty,
+ 'memfree': memfree})
+
+ def eat_memory(self):
+ debug("Running memoryhog...")
+
+ p = subprocess.Popen(MEMORYHOG,
+ stdout=subprocess.PIPE)
+ # Memoryhog is ready when we are able to read 3 lines from it.
+ debug ("Memoryhog: %s"%p.stdout.readline())
+ debug ("Memoryhog: %s"%p.stdout.readline())
+ debug ("Memoryhog: %s"%p.stdout.readline())
+ return
+
+ def run_without_prestarting(self, appname, test_mode):
+ """returns process handle with pid attribute and terminate function"""
+ os.system ('mcetool --set-tklock-mode=unlocked')
+ if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
+ os.system('rm %s' %LOG_FILE)
+ if (test_mode == "Swap"):
+ self.eat_memory()
+
+ self.start_timer()
+ p = subprocess.Popen(appname,
+ shell=False,
+ stdout=DEV_NULL, stderr=DEV_NULL)
+ debug("app", appname, "started")
+ return p
+
+ def run_without_prestarting_without_meegotouchhome(self, appname, test_mode):
+ """returns process handle with pid attribute and terminate function"""
+ os.system ('mcetool --set-tklock-mode=unlocked')
+ if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
+ os.system('rm %s' %LOG_FILE)
+ if (test_mode == "Swap"):
+ self.eat_memory()
+ os.system('pkill -STOP meegotouchhome')
+ self.start_timer()
+ p = subprocess.Popen(appname,
+ shell=False,
+ stdout=DEV_NULL, stderr=DEV_NULL)
+ debug("app", appname, "started without meegotouchhome")
+ os.system('pkill -CONT meegotouchhome')
+ return p
+
+ def run_with_prestarting(self, appname, test_mode):
+ """returns process handle with pid attribute and terminate function"""
+ # for lifecycle application, for instance, run
+ # dbus-send --dest=com.nokia.lifecycle \
+ # --type="method_call" \
+ # /org/maemo/m com.nokia.MApplicationIf.launch
+ os.system ('mcetool --set-tklock-mode=unlocked')
+ global _start_time
+ if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
+ os.system('rm %s' %LOG_FILE)
+ time.sleep(1)
+ output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
+ ' --type="method_call" /org/maemo/m ' +
+ 'com.nokia.MApplicationIf.ping')
+ debug("app prestarted, waiting for it to stabilize...")
+ time.sleep(3)
+ class p: pass
+ p.pid = commands.getoutput('pgrep ' + basename(appname)[:15])
+ # Make sure the application is prestarted and ready to receive the
+ # launch signal. Hypothesis: if the application has not been
+ # scheduled within the second, it is ready for launching
+
+ #Commented, needs investigation why this waits when meegotouchhome stopped
+ """switches = 0
+ last_switches = -100
+ counter = 0
+ while (switches - last_switches) > 0 and counter < 20:
+ debug("still waiting, switches, last_switches:...", switches, last_switches)
+ time.sleep(1)
+ counter = counter +1
+ last_switches = switches
+ switches = int(commands.getoutput("grep nr_switches /proc/%s/sched" %
+ (p.pid,)).split()[2])"""
+ self.save_memory_usage(p)
+
+ # If we testing the the worst case, make sure that the prestarted is swapped off
+ if (test_mode == "Swap"):
+ self.eat_memory()
+
+ # Launch the prestarted application and quit immediately so that
+ # the time can be measured
+ self.start_timer()
+ debug("start time : %f"% _start_time)
+ output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
+ ' --type="method_call" /org/maemo/m ' +
+ 'com.nokia.MApplicationIf.launch')
+ return p
+
+ def run_with_prestarting_without_meegotouchhome(self, appname, test_mode):
+ """returns process handle with pid attribute and terminate function"""
+ # for lifecycle application, for instance, run
+ # dbus-send --dest=com.nokia.lifecycle \
+ # --type="method_call" \
+ # /org/maemo/m com.nokia.MApplicationIf.launch
+ os.system ('mcetool --set-tklock-mode=unlocked')
+ global _start_time
+ if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
+ os.system('rm %s' %LOG_FILE)
+ time.sleep(1)
+ output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
+ ' --type="method_call" /org/maemo/m ' +
+ 'com.nokia.MApplicationIf.ping')
+ debug("app prestarted, waiting for it to stabilize...")
+ time.sleep(3)
+ class p: pass
+ p.pid = commands.getoutput('pgrep ' + basename(appname)[:15])
+ # Make sure the application is prestarted and ready to receive the
+ # launch signal. Hypothesis: if the application has not been
+ # scheduled within the second, it is ready for launching
+ switches = 0
+ last_switches = -100
+ counter = 0
+ #Commented, needs investigation why this waits when meegotouchhome stopped
+ """while (switches - last_switches) > 0 and counter < 30:
+ debug("still waiting, switches, last_switches:...", switches, last_switches)
+ time.sleep(1)
+ counter = counter +1
+ last_switches = switches
+ switches = int(commands.getoutput("grep nr_switches /proc/%s/sched" %
+ (p.pid,)).split()[2])"""
+ self.save_memory_usage(p)
+
+ # If we testing the the worst case, make sure that the prestarted is swapped off
+ if (test_mode == "Swap"):
+ self.eat_memory()
+
+ # Launch the prestarted application and quit immediately so that
+ # the time can be measured
+ os.system('pkill -STOP meegotouchhome')
+ self.start_timer()
+ debug("start time : %f"% _start_time)
+ output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
+ ' --type="method_call" /org/maemo/m ' +
+ 'com.nokia.MApplicationIf.launch')
+ debug("prestarted app launched without meegotouchhome")
+ os.system('pkill -CONT meegotouchhome')
+ return p
+
+
+ def kill_process(self, process_handle, appname):
+ return commands.getoutput("pkill -9 %s" % (basename(appname)[:15],))
+
+ def perftest_with_prestart(self, appname, test_mode):
+ debug("run app with prestarting with meegotouchhome")
+ self.save_memory_usage(None) # record free system memory
+ p = self.run_with_prestarting(appname, test_mode)
+ time.sleep(2)
+ time_with_prestart = self.measure_time()
+ time.sleep(2)
+ self.save_memory_usage(p)
+ self.kill_process(p, appname)
+ if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
+ debug("got time:", time_with_prestart)
+ time.sleep(2)
+
+ debug("run app with prestarting without meegotouchhome ")
+ self.save_memory_usage(None) # record free system memory
+ p = self.run_with_prestarting_without_meegotouchhome(appname, test_mode)
+ time.sleep(2)
+ time_with_prestart_without_meegotouchhome = self.measure_time()
+ time.sleep(2)
+ self.save_memory_usage(p)
+ self.kill_process(p, appname)
+ if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
+ debug("got time:", time_with_prestart_without_meegotouchhome)
+ time.sleep(2)
+ return time_with_prestart, time_with_prestart_without_meegotouchhome
+
+ def perftest_without_prestart(self, appname, test_mode):
+ debug("run app without prestarting with meegotouchhome")
+ self.save_memory_usage(None) # record free system memory
+ p = self.run_without_prestarting(appname, test_mode)
+ time.sleep(4)
+ time_without_prestart = self.measure_time()
+ self.save_memory_usage(p)
+ time.sleep(4)
+ self.kill_process(p, appname)
+ if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
+ debug("got time:", time_without_prestart)
+ time.sleep(2)
+
+ debug("run app without prestarting without meegotouchhome")
+ self.save_memory_usage(None) # record free system memory
+ p = self.run_without_prestarting_without_meegotouchhome(appname, test_mode)
+ time.sleep(4)
+ time_without_prestart_without_meegotouchhome = self.measure_time()
+ self.save_memory_usage(p)
+ time.sleep(4)
+ self.kill_process(p, appname)
+ if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
+ debug("got time:", time_without_prestart_without_meegotouchhome)
+ time.sleep(2)
+
+ return time_without_prestart, time_without_prestart_without_meegotouchhome
+
+ def print_test_report(self, with_without_times, fileobj):
+ """
+ with_without_times is a list of pairs:
+ (with_prestarting_startup_time,
+ without_prestarting_startup_time)
+ """
+ global _memory_stats
+ def writeline(*msg):
+ fileobj.write("%s\n" % ' '.join([str(s) for s in msg]))
+ def fmtfloat(f):
+ return "%.2f" % (f,)
+ def filterstats(data, field):
+ return tuple([d[field] for d in data])
+
+ if with_without_times == []: return
+
+ writeline("")
+ writeline('Memory consumptions [kB]:')
+ memrowformat = "%10s %10s %10s %10s %10s %10s"
+ while _memory_stats:
+ oneround = _memory_stats[:5]
+ _memory_stats = _memory_stats[5:]
+
+ writeline(memrowformat %
+ ('', 'before', 'before', 'after', 'before', 'after'))
+ writeline(memrowformat %
+ ('', 'prestart', 'launch', 'launch', 'normal', 'normal'))
+ writeline(memrowformat %
+ (('privdirt',) + filterstats(oneround, 'private_dirty')))
+ writeline(memrowformat %
+ (('rss',) + filterstats(oneround, 'rss')))
+ writeline(memrowformat %
+ (('free',) + filterstats(oneround, 'memfree')))
+ writeline("")
+
+ writeline("")
+ rowformat = "%12s %12s %12s %12s"
+ writeline('Startup times [s]:')
+ writeline(rowformat % ('prestarted-Yes', 'prestarted-Yes', 'prestarted-No', 'prestarted-No'))
+ writeline(rowformat % ('meegotouchhome-Yes ', 'meegotouchhome-No ', 'meegotouchhome-Yes ', 'meegotouchhome-No '))
+
+ t1,t2,t3,t4 = [], [], [], []
+ for wop_wd, wop_wod, wp_wd, wp_wod in with_without_times:
+ t1.append(wop_wd)
+ t2.append(wop_wod)
+ t3.append(wp_wd)
+ t4.append(wp_wod)
+ writeline(rowformat % (fmtfloat(wop_wd), fmtfloat(wop_wod),
+ fmtfloat(wp_wd), fmtfloat(wp_wod)))
+
+ writeline('Average times:')
+ writeline(rowformat % (fmtfloat(sum(t1)/len(t1)),fmtfloat(sum(t2)/len(t2)),
+ fmtfloat(sum(t3)/len(t3)),fmtfloat(sum(t4)/len(t4))))
+ return fmtfloat(sum(t1)/len(t1))
+
+ def test_001(self):
+ times = []
+ times1, times2 = [], []
+
+ for i in xrange(3):
+ times1.append(self.perftest_with_prestart(appname, test_mode))
+ for i in xrange(3):
+ times2.append(self.perftest_without_prestart(appname, test_mode))
+
+ times = [[t1[0], t1[1], times2[i][0], times2[i][1]] for i, t1 in enumerate(times1)]
+ avg_with_prestart = self.print_test_report(times, sys.stdout)
+ self.assert_(float(avg_with_prestart) < float(0.75), "prestarted application takes more than 0.75 sec")
+
+
+# main
+if __name__ == '__main__':
+ parseCommandLineOptions()
+ print sys.argv
+ sys.argv = sys.argv[0:1]
+ print sys.argv
+ check_prerequisites(appname)
+ unittest.main()
+
--- tests/Harmattan/TestScripts/test-perf.rb
+++ tests/Harmattan/TestScripts/test-perf.rb
+#!/usr/bin/ruby
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applauncherd.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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 'test/unit'
+require 'test/unit/assertions'
+include Test::Unit::Assertions
+include TDriverVerify
+
+
+class TC_PerformanceTests < Test::Unit::TestCase
+ COUNT = 5
+ @start_time = 0
+ @end_time = 0
+
+ $path = string = `echo $PATH `
+
+ # method called before any test case
+ def setup
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ @daemon_running = system('pkill applifed')
+ if system("pgrep fali_hello") == true
+ system("kill -9 `pgrep fali_hello`")
+ end
+ sleep (1)
+ system "/usr/bin/fali_hello -prestart &"
+ else
+ system "mcetool --set-tklock-mode=unlocked"
+ # restart mthome so that qttasserver notices it
+ verify {
+ system("/sbin/initctl restart xsession/mthome")
+ }
+ @daemon_running = system('initctl stop xsession/applifed')
+ if system("pgrep fali_hello") == true
+ system("kill -9 `pgrep fali_hello`")
+ end
+ sleep (1)
+ system "/usr/bin/fali_hello -prestart &"
+ sleep (3)
+ end
+ @sut = TDriver.sut(:Id=> 'sut_qt_maemo')
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ puts "exit from teardown"
+ if @daemon_running
+ if $path.include?("scratchbox")
+ system('applifed &')
+ else
+ system('initctl start xsession/applifed')
+ end
+ end
+ end
+
+ def open_Apps(appName)
+ #Remove the Log file if it exists
+ if FileTest.exists?("/tmp/applifed_perftest.log")
+ system "rm /tmp/applifed_perftest.log"
+ end
+
+ count = 0
+
+ #Open the Application from the application grid
+ @meegoHome = @sut.application(:name => 'meegotouchhome')
+ @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)
+ sleep(0.2)
+ count = count +1
+ icon.refresh
+ end
+ @start_time = Time.now
+ @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName).tap
+ sleep (2)
+ @app = @sut.application(:name => appName)
+ sleep (2)
+ @app.MEscapeButtonPanel.MButton( :name => 'CloseButton' ).tap
+ else
+ #icon does not
+ #raise error and exit
+ raise "Application not found in Application grid"
+ exit 1
+ end
+ end
+
+ def read_file
+ #Reading the log file to get the time
+ file_name="/tmp/applifed_perftest.log"
+ last_line = `tail -n 2 #{file_name}`
+ @end_time = last_line.split(" ")[0]
+ 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)
+ return app_t
+ end
+
+ def test_performance
+ wP = []
+ woP = []
+ wPsum = 0.0
+ woPsum = 0.0
+
+ #Run Application with invoker
+ for i in 1..COUNT
+ open_Apps("fali_hello")
+ print "Now Launching fali_hello %d times\n" %i
+ sleep (5)
+ read_file
+ wP.push(measure_time)
+ end
+
+ #Run Application without invoker
+ for i in 1..COUNT
+ open_Apps("fali_hello1")
+ print "Now Launching fali_hello1 %d times\n" %i
+ sleep (5)
+ read_file
+ woP.push(measure_time)
+ end
+
+ print "With Prestart \t\t Without Prestart\n"
+
+ #Printing the data
+ for i in 0..COUNT-1
+ print "%.2f \t\t\t %.2f\n" %[wP[i],woP[i]]
+ wPsum = wPsum + wP[i]
+ woPsum = woPsum + woP[i]
+ end
+ print "\nAverage Values \n"
+ print "%.2f \t\t\t %.2f\n\n" %[wPsum/COUNT, woPsum/COUNT]
+ assert(wPsum/COUNT <= 0.75, "Application takes longer time to launch")
+
+ end
+end
--- tests/Harmattan/TestScripts/ts_multi_instance.rb
+++ tests/Harmattan/TestScripts/ts_multi_instance.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the prestart functionality
+#
+# * Objectives: test the functionality of applifed from
+# the prestart point of view for multiwindows
+#
+
+require 'tdriver'
+require 'date'
+require 'test/unit'
+include TDriverVerify
+ADDITIONAL_PATH=File.join("/usr/share/applifed-testscripts")
+$LOAD_PATH << ADDITIONAL_PATH
+
+require 'fautils'
+
+class TC_MWTESTS < Test::Unit::TestCase
+
+ MULTI_APP_PRESTART_TIME = 20
+ $path = string = `echo $PATH `
+
+ # method called before any test case
+ def setup
+ @tc = Fali_utils.new
+ @tc.print_debug("Enter setup")
+ @tc.get_pids('applifed')
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ @tc.run_system_command(:cmd => "pkill #{@appname}", \
+ :failmsg => "Failed to kill #{@appname}", \
+ :docheck => true, :sleep => 0.2, \
+ :logmsg => "killing #{@appname}")
+ @tc.get_pids('applifed')
+ @tc.print_debug("exit from teardown")
+ end
+
+
+ def test_multi_instance_prestart
+ #Test to prestart n number of applications at the same time
+ @appname = 'fali_multiapp'
+ for i in 1..MULTI_APP_PRESTART_TIME
+ if $path.include?("scratchbox")
+ @tc.run_system_command(:cmd => "#{@appname} #{i} -prestart -software&", \
+ :failmsg => "Failed to prestart #{@appname} #{i} ", \
+ :docheck => true, :sleep => 0.2, \
+ :logmsg => "prestarting #{@appname} #{i} ")
+
+ else
+ @tc.run_system_command(:cmd => "#{@appname} #{i} -prestart &", \
+ :failmsg => "Failed to prestart #{@appname} #{i} ", \
+ :docheck => true, :sleep => 0.2, \
+ :logmsg => "prestarting #{@appname} #{i} ")
+
+ end
+ sleep 2
+ end
+ pids = @tc.get_pids("#{@appname}")
+ assert_equal(MULTI_APP_PRESTART_TIME,pids.length , "All applications were not prestarted")
+
+ end
+
+end
--- tests/Harmattan/TestScripts/ts_prestart.rb
+++ tests/Harmattan/TestScripts/ts_prestart.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the prestart functionality
+#
+# * Objectives: test the functionality of applifed from
+# the prestart point of view
+#
+
+require 'tdriver'
+require 'date'
+require 'test/unit'
+include TDriverVerify
+
+ADDITIONAL_PATH=File.join("/usr/share/applifed-testscripts")
+$LOAD_PATH << ADDITIONAL_PATH
+require 'fautils'
+
+class TC_PrestartTDriverTests < Test::Unit::TestCase
+
+ #Get the uname to find where are the tests running
+ $path = string = `echo $PATH `
+
+ # method called before any test case
+ def setup
+ #make sure that log file does not exist before the test run
+ @tc = Fali_utils.new
+ @tc.get_pids('applifed')
+ if FileTest.exists?("/tmp/applifed-test.log")
+ system "rm /tmp/applifed-test.log"
+ end
+ #kill applications that are already running
+ apps = ['fali_hello',
+ 'fali_toc']
+ for app in apps
+ if system("pgrep #{app}") == true
+ system("kill -9 `pgrep #{app}`")
+ sleep 1
+ system("kill -9 `pgrep #{app}`")
+ end
+ end
+
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ @daemon_running = system('pkill applifed')
+ mydisplay = 1
+ else
+ system "mcetool --set-tklock-mode=unlocked"
+ @daemon_running = system('initctl stop xsession/applifed')
+ mydisplay = 0
+ end
+ @tc.run_system_command(:cmd => "source /tmp/session_bus_address.user;" + \
+ "DISPLAY=:#{mydisplay}; applifed --test --log /tmp/applifed-test.log" + \
+ " < /usr/share/applifed-testscripts/functional.drive &", \
+ :failmsg => "unable to start applifed in test mode", \
+ :docheck => true, :sleep => 5, \
+ :logmsg => "start applifed in test mode")
+ @sut = TDriver.sut(:Id=>ARGV[0] || 'sut_qt_maemo')
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ if @daemon_running
+ if $path.include?("scratchbox")
+ system('applifed &')
+ else
+ system('initctl start xsession/applifed')
+ end
+ end
+ @tc.get_pids('applifed')
+ end
+
+ #To test that the application is re-prestarted by applifed after they are killed
+ def test_kill_re_prestart
+ #verify_equal(true,30,"Applifed not running"){system "pgrep applifed"}
+ @tc.run_system_command(:cmd => "pgrep applifed", \
+ :failmsg => "applifed not running", \
+ :docheck => true, :sleep => 1, \
+ :logmsg => "checking for applifed")
+ @tc.print_debug("checking for fali_toc registered to applifed")
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"com.nokia.fali_toc' got registered\" /tmp/applifed-test.log"}
+
+ @tc.print_debug("checking for fali_hello registered to applifed")
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"com.nokia.fali_hello' got registered\" /tmp/applifed-test.log"}
+
+ @tc.run_system_command(:cmd => "dbus-send --dest=com.nokia.fali_toc " + \
+ "--type=\"method_call\" /org/maemo/m com.nokia.MApplicationIf.launch", \
+ :failmsg => "unable to start fali_toc", \
+ :docheck => true, :sleep => 2, \
+ :logmsg => "starting fali_toc")
+
+ @tc.run_system_command(:cmd => "dbus-send --dest=com.nokia.fali_hello " + \
+ "--type=\"method_call\" /org/maemo/m com.nokia.MApplicationIf.launch", \
+ :failmsg => "unable to start fali_hello", \
+ :docheck => true, :sleep => 2, \
+ :logmsg => "starting fali_hello")
+
+ @tc.print_debug("checking for fali_toc release from prestarted state")
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"Application 'com.nokia.fali_toc' released from prestarted state\" /tmp/applifed-test.log"}
+
+ @tc.print_debug("checking for fali_hello release from prestarted state")
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"Application 'com.nokia.fali_hello' released from prestarted state\" /tmp/applifed-test.log"}
+
+ pid_toc = @tc.get_pids("fali_toc")
+ pid_ah = @tc.get_pids("fali_hello")
+
+ @tc.print_debug("kill fali_toc")
+ verify_equal(true,30,"fali_toc not killed"){system "pkill fali_toc"}
+
+ @tc.print_debug("kill fali_hello")
+ verify_equal(true,30,"fali_hello not killed"){system "pkill fali_hello"}
+ sleep(4)
+
+ @tc.print_debug("Checking that fali_toc got unregistered")
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"'com.nokia.fali_toc' got unregistered..\" /tmp/applifed-test.log"}
+
+ @tc.print_debug("Checking that fali_toc was re-prestarted")
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"Re-prestarting 'com.nokia.fali_toc\" /tmp/applifed-test.log"}
+
+ @tc.print_debug("Checking that fali_hello got unregistered")
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"'com.nokia.fali_hello' got unregistered..\" /tmp/applifed-test.log"}
+
+ @tc.print_debug("Checking that fali_hello was re-prestarted")
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"Re-prestarting 'com.nokia.fali_hello'\" /tmp/applifed-test.log"}
+
+ pid_toc_n = @tc.get_pids("fali_toc")
+ pid_ah_n = @tc.get_pids("fali_hello")
+
+ @tc.print_debug("Checking that fali_toc was registered with new pid")
+ verify_equal(true, 30, "fali_toc was not re-prestarted"){
+ pid_toc != pid_toc_n}
+
+ @tc.print_debug("Checking that fali_hello was registered with new pid")
+ verify_equal(true, 30, "fali_toc was not re-prestarted"){
+ pid_ah != pid_ah_n}
+ end
+end
--- tests/Harmattan/TestScripts/ts_prestart_prevent.rb
+++ tests/Harmattan/TestScripts/ts_prestart_prevent.rb
+#!/usr/bin/ruby
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Prestart preventing test for applifed
+#
+# * Objectives: test the prestart preventing feature for applifed
+#
+
+require 'tdriver'
+require 'date'
+require 'test/unit'
+require 'test/unit/assertions'
+include Test::Unit::Assertions
+include TDriverVerify
+
+ADDITIONAL_PATH=File.join("/usr/share/applifed-testscripts")
+$LOAD_PATH << ADDITIONAL_PATH
+require 'fautils'
+
+class TC_Prestart_Prevent < Test::Unit::TestCase
+
+ $path = string = `echo $PATH `
+ # method called before any test case
+ def setup
+ @tc.get_pids('applifed')
+ @appName = "fali_close"
+ @tc = Fali_utils.new
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ if system("pgrep #{@appName}") == true
+ system("kill -9 `pgrep #{@appName}`")
+ end
+ else
+ system("mcetool --set-tklock-mode=unlocked")
+ system("initctl restart xsession/mthome")
+ sleep (5)
+ if system("pgrep #{@appName}") == true
+ system("kill -9 `pgrep #{@appName}`")
+ end
+ end
+ @sut = TDriver.sut(:Id=> 'sut_qt_maemo')
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ @tc.get_pids('applifed')
+ puts "exit from teardown"
+ end
+
+ def read_file
+ #Reading the log file to get the time
+ file_name="/tmp/applifed_perftest.log"
+ last_line = `tail -n 2 #{file_name}`
+ @end_time = last_line.split(" ")[0]
+ end
+
+ def test_grid_prestart_prevent
+ @tc.kill_unwanted_apps
+ @tc.open_Apps_from_grid(@appName)
+ @app = @sut.application(:name => @appName)
+ pid = @tc.get_pids(@appName)
+ verify_true(2, "The Application was not launched"){
+ @app.test_object_exists?("MButton",{:text => 'close'})}
+ @app.MButton( :text => 'close' ).tap
+ sleep(2)
+ newpid = @tc.get_pids(@appName)
+ assert(newpid == nil, "#{@appName} was not killed")
+ end
+
+ def test_cmdlile_prestart_prevent
+ @tc.kill_unwanted_apps
+ system("su - user -c 'fali_close -prestart'&")
+ sleep(2)
+ system("#{@appName}&")
+ @tc.print_debug("launching #{@appName}")
+ @app = @sut.application(:name => @appName)
+ pid = @tc.get_pids(@appName)
+ verify_true(2, "The Application was not launched"){
+ @app.test_object_exists?("MButton",{:text => 'close'})}
+ @app.MButton( :text => 'close' ).tap
+ sleep(2)
+ newpid = @tc.get_pids(@appName)
+ assert(newpid == nil, "#{@appName} was not killed")
+ end
+end
--- tests/Harmattan/art-tests
+++ tests/Harmattan/art-tests
+(directory)
--- tests/Harmattan/art-tests/CMakeLists.txt
+++ tests/Harmattan/art-tests/CMakeLists.txt
+if ($ENV{MEEGO})
+ # Do nothing
+endif ($ENV{MEEGO})
+
+if ($ENV{HARMATTAN})
+ install(FILES tests.xml DESTINATION /usr/share/applifed-art-tests)
+endif ($ENV{HARMATTAN})
+
--- tests/Harmattan/art-tests/tests.xml
+++ tests/Harmattan/art-tests/tests.xml
+
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-art-test" domain="Application framework">
+
+ <!-- At least one set per suite, name and description mandatory -->
+ <set name="Installation-tests" description="Installation-ok tests" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
+
+ <!-- Possibly some pre-steps to execute before running the test cases -->
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <!-- At least one case per set, name mandatory, description mandatory, other optional -->
+ <!-- At least one step per test, expected_result optional - tells which return code is considered passed -->
+
+ <case name="applifed2" type="Functional" description="Check that exactly one applifed is running" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_applifed_one_instance.rb --name test_only_one_applifed</step>
+ </case>
+
+ <!-- Environments optional - tells where the tests are run -->
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ </set>
+
+ <set name="Applifed-TDriver-Tests" description="Functional tests for applifed with TDriver tool" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+ <case name="Kill-Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed after they are killed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_kill_re_prestart</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <!--get>
+ <file> /tmp/applifed-test.log</file>
+ </get-->
+ </set>
+ </suite>
+</testdefinition>
+
+
--- tests/Harmattan/bug-tests
+++ tests/Harmattan/bug-tests
+(directory)
--- tests/Harmattan/bug-tests/CMakeLists.txt
+++ tests/Harmattan/bug-tests/CMakeLists.txt
+if ($ENV{MEEGO})
+ # Do nothing
+endif ($ENV{MEEGO})
+
+if ($ENV{HARMATTAN})
+ install(FILES tests.xml DESTINATION /usr/share/applifed-bug-tests)
+endif ($ENV{HARMATTAN})
+
--- tests/Harmattan/bug-tests/tests.xml
+++ tests/Harmattan/bug-tests/tests.xml
+
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-bug-tests" domain="Application framework">
+
+ <set name="Bug-Tests" description="Functional tests for applifed for multiwindow applications" feature="AF Application pre-starting enhancements" requirement="3O0137">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Multi-Instance-Prestart" type="Functional" description="To test that n number of application is prestarted by applifed" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_multi_instance.rb --name test_multi_instance_prestart</step>
+ </case>
+ <case name="grid_prestart_prevent" type="Functional" description="Test that external application is killed by applifed" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart_prevent.rb --name test_grid_prestart_prevent</step>
+ </case>
+ <case name="cmdline_prestart_prevent" type="Functional" description="Test that external application is killed by applifed" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart_prevent.rb --name test_cmdlile_prestart_prevent</step>
+ </case>
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/mw_applifed_result.txt</file>
+ </get>
+ </set>
+
+ </suite>
+</testdefinition>
+
+
--- tests/Harmattan/functests
+++ tests/Harmattan/functests
+(directory)
--- tests/Harmattan/functests/CMakeLists.txt
+++ tests/Harmattan/functests/CMakeLists.txt
+if ($ENV{MEEGO})
+ # Do nothing
+endif ($ENV{MEEGO})
+
+if ($ENV{HARMATTAN})
+ install(FILES tests.xml DESTINATION /usr/share/applifed-functional-tests)
+endif ($ENV{HARMATTAN})
--- tests/Harmattan/functests/tests.xml
+++ tests/Harmattan/functests/tests.xml
+
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-functioanl-tests" domain="Application framework">
+
+ <!-- At least one set per suite, name and description mandatory -->
+ <set name="Installation-tests" description="Installation-ok tests" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
+
+ <!-- Possibly some pre-steps to execute before running the test cases -->
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ <step>/usr/share/applifed-testscripts/cp-service.rb</step>
+ </pre_steps>
+
+ <!-- At least one case per set, name mandatory, description mandatory, other optional -->
+ <!-- At least one step per test, expected_result optional - tells which return code is considered passed -->
+
+ <case name="applifed2" type="Functional" description="Check that exactly one applifed is running" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_applifed_one_instance.rb</step>
+ </case>
+
+ <case name="applifed-daemonized" type="Functional" description="Check that fork parameter works" timeout="120" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_daemonize.rb --name test_daemonize</step>
+ </case>
+
+ <case name="applifed-fork_single_instance" type="Functional" description="Check that one instance of applifed is running when forked several times" timeout="120" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_daemonize.rb --name test_fork_one_instance</step>
+ </case>
+ <!-- Environments optional - tells where the tests are run -->
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ </set>
+
+ <set name="Applifed-TDriver-Tests" description="Functional tests for applifed with TDriver tool" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Kill-Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed after they are killed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_kill_re_prestart</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <!--get>
+ <file> /tmp/applifed-test.log</file>
+ </get-->
+ </set>
+
+ <set name="CPU_LOAD_TESTS" description="Functional tests for applifed for cpu load prestarting" feature="AF Application pre-starting enhancements" requirement="3O0137">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="LOW_CPULOAD" type="Functional" description="Test that a applications are prestarted when the cpu load is lower than threshold value" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/cpu_load/tc_cpu_load.rb --name test_cpu_load_low</step>
+ </case>
+ <case name="HIGH_CPULOAD" type="Functional" description="Test that applications are not prestarted when the cpu load is higher than threshold value" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/cpu_load/tc_cpu_load.rb --name test_cpu_load_high</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/cpuload_low.log</file>
+ <file> /tmp/cpuload_high.log</file>
+ </get>
+ </set>
+
+
+ </suite>
+</testdefinition>
+
+
--- tests/Harmattan/perftests
+++ tests/Harmattan/perftests
+(directory)
--- tests/Harmattan/perftests/CMakeLists.txt
+++ tests/Harmattan/perftests/CMakeLists.txt
+if ($ENV{MEEGO})
+ # Do nothing
+endif ($ENV{MEEGO})
+
+if ($ENV{HARMATTAN})
+ install(FILES tests.xml DESTINATION /usr/share/applifed-performance-tests)
+endif ($ENV{HARMATTAN})
--- tests/Harmattan/perftests/tests.xml
+++ tests/Harmattan/perftests/tests.xml
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-performance-tests" domain="Application framework">
+
+ <set name="commandline-startup" description="Applifed prestart performance tests" feature="AF Application prestarting functionality" requirement="300105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="PerfTest1" type="Performance" description="Measure prestart performance" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applifed-testscripts/test-perf-prestart.py -a /usr/bin/fali_perf > /tmp/prestart_perf.txt</step>
+ </case>
+
+ <!-- Swap tests commented off temporalily -->
+
+ <!-- <case name="SwapOn" type="Performance" description="Turn the swap on" timeout="360" level="System">
+ <step expected_result="0">modprobe mtdswap partitions=4</step>
+ <step expected_result="0">swapon /dev/mtdswap4</step>
+ <step expected_result="0">[ $(free |grep Swap | awk '{print $2}') -gt 256000 ]</step>
+ </case>
+
+ <case name="Prestart2" type="Performance" description="Measure prestart performance when everything is swapped" timeout="1200" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applifed-testscripts/test-perf-prestart.py -a /usr/bin/fali_perf -s > /tmp/prestart_perf_swap_on.txt</step>
+ </case> -->
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/prestart_perf.txt</file>
+ <!-- <file>/tmp/prestart_perf_swap_on.txt</file> -->
+ </get>
+ </set>
+
+ <set name="AppGrid-startup" description="Prestart startup time from application grid" feature="AF Application prestarting functionality" requirement="300105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Prestart_grid" type="Performance" description="Measure prestarted application startup application grid" timeout="500" 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 fali_hello1 -p "fali_hello1 -prestart &" -b "fali_hello1" > /tmp/perf_prestart_grid.txt</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/perf_prestart_grid.txt</file>
+ </get>
+ </set>
+
+ <set name="Commandline-startup" description="Prestart startup time from command line" feature="AF Application prestarting functionality" requirement="300105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Prestart_command_line" type="Performance" description="Measure prestarted application startup from command line" timeout="500" 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 "dbus-send --dest=com.nokia.fali_hello1 --type=\"method_call\" /org/maemo/m com.nokia.MApplicationIf.launch" -p "fali_hello1 -prestart &" -b "fali_hello1" > /tmp/perf_prestart_command_line.txt</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/perf_prestart_command_line.txt</file>
+ </get>
+ </set>
+
+ </suite>
+</testdefinition>
+
+
--- tests/Harmattan/unit-tests
+++ tests/Harmattan/unit-tests
+(directory)
--- tests/Harmattan/unit-tests/CMakeLists.txt
+++ tests/Harmattan/unit-tests/CMakeLists.txt
+#file(MAKE_DIRECTORY /usr/share/applifed-tests)
+if ($ENV{MEEGO})
+ # Do nothing
+endif ($ENV{MEEGO})
+
+if ($ENV{HARMATTAN})
+ install(FILES tests.xml DESTINATION /usr/share/applifed-tests)
+endif ($ENV{HARMATTAN})
+
--- tests/Harmattan/unit-tests/tests.xml
+++ tests/Harmattan/unit-tests/tests.xml
(renamed from tests/unittests/tests.xml)
--- tests/Meego
+++ tests/Meego
+(directory)
--- tests/Meego/CMakeLists.txt
+++ tests/Meego/CMakeLists.txt
+# Sub build: art-tests
+add_subdirectory(art-tests)
+
+# Sub build: bug-tests
+add_subdirectory(bug-tests)
+
+# Sub build:functests
+add_subdirectory(functests)
+
+# Sub build: perftests
+add_subdirectory(perftests)
+
+# Sub build: TestScripts
+add_subdirectory(TestScripts)
+
+# Sub build: unit-tests
+add_subdirectory(unit-tests)
--- tests/Meego/TestScripts
+++ tests/Meego/TestScripts
+(directory)
--- tests/Meego/TestScripts/CMakeLists.txt
+++ tests/Meego/TestScripts/CMakeLists.txt
+# Find MeeGo Touch libraries for the test programs using pkg-config
+include(FindPkgConfig)
+pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MEEGOTOUCH_INCLUDE_DIRS})
+
+add_subdirectory(cpu_load)
+add_subdirectory(periodic_re_prestart)
+
+install(FILES functional.drive fautils.rb test-perf-prestart.py
+ DESTINATION /usr/share/applifed-M-testscripts)
+
+install(PROGRAMS tc_applifed_one_instance.rb cp-service.rb ts_prestart.rb
+ ts_mwtests.rb tc_daemonize.rb
+ tc_prestart_preventing.rb
+ test-perf.rb
+ DESTINATION /usr/share/applifed-M-testscripts)
+
+install(FILES
+ functest_applifed.conf
+ prevent.conf
+ prevent.drive
+ DESTINATION /usr/share/applifed-M-testscripts)
--- tests/Meego/TestScripts/cp-service.rb
+++ tests/Meego/TestScripts/cp-service.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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.
+#
+
+$path = string = `echo $PATH `
+if $path.include?("scratchbox")
+ system("cp /usr/share/applifed-testscripts/sbservice/com.nokia.fali_hello.service.sb /usr/share/dbus-1/services/com.nokia.fali_hello.service")
+ system("cp /usr/share/applifed-testscripts/sbservice/com.nokia.fali_toc.service.sb /usr/share/dbus-1/services/com.nokia.fali_toc.service")
+end
--- tests/Meego/TestScripts/cpu_load
+++ tests/Meego/TestScripts/cpu_load
+(directory)
--- tests/Meego/TestScripts/cpu_load/CMakeLists.txt
+++ tests/Meego/TestScripts/cpu_load/CMakeLists.txt
+install(FILES cpu_load_high.drive cpu_load_low.drive DESTINATION /usr/share/applifed-M-testscripts/cpu_load)
+
+install(PROGRAMS tc_cpu_load.rb DESTINATION /usr/share/applifed-M-testscripts/cpu_load)
+
+install(FILES cpu_load.conf DESTINATION /usr/share/applifed-M-testscripts/cpu_load)
+
--- tests/Meego/TestScripts/cpu_load/cpu_load.conf
+++ tests/Meego/TestScripts/cpu_load/cpu_load.conf
+<?xml version="1.0"?>
+<applifed default_cpu_load_threshold="60" cpu_load_polling_delay="1">
+<application name="fali_hello" service="com.nokia.fali_hello" priority="3"/>
+<application name="fali_mw2" service="com.nokia.fali_mw2" priority="2"/>
+<application name="fali_toc" service="com.nokia.fali_toc" priority="1"/>
+</applifed>
+
--- tests/Meego/TestScripts/cpu_load/cpu_load_high.drive
+++ tests/Meego/TestScripts/cpu_load/cpu_load_high.drive
+CPU_LOAD=80
+PRESTART=/usr/share/applifed-M-testscripts/cpu_load/cpu_load.conf
+EXIT_WITH_DELAY=50
+
+
+
--- tests/Meego/TestScripts/cpu_load/cpu_load_low.drive
+++ tests/Meego/TestScripts/cpu_load/cpu_load_low.drive
+CPU_LOAD=40
+PRESTART=/usr/share/applifed-M-testscripts/cpu_load/cpu_load.conf
+EXIT_WITH_DELAY=50
+
+
+
--- tests/Meego/TestScripts/cpu_load/tc_cpu_load.rb
+++ tests/Meego/TestScripts/cpu_load/tc_cpu_load.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the prestart functionality
+#
+# * Objectives: To test that applications are prestarted based
+# on the cpu load.
+#
+
+require 'tdriver'
+require 'test/unit'
+include TDriverVerify
+
+
+class TC_CpuLoadTests < Test::Unit::TestCase
+
+ $path = string = `echo $PATH `
+ # method called before any test case
+ def setup
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ else
+ system "mcetool --set-tklock-mode=unlocked"
+ end
+ apps = ['fali_hello',
+ 'fali_mw2',
+ 'fali_toc']
+
+ for app in apps
+ if system("pgrep #{app}") == true
+ system("kill -9 `pgrep #{app}`")
+ sleep 1
+ system("kill -9 `pgrep #{app}`")
+ end
+ end
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ end
+
+ # Test that a applications are prestarted when the cpu
+ # load is lower than threshold value
+ def test_cpu_load_low
+ if FileTest.exists?("/tmp/cpuload_low.log")
+ system "rm /tmp/cpuload_low.log"
+ end
+
+ if $path.include?("scratchbox")
+ system("source /tmp/session_bus_address.user;" +
+ "DISPLAY=:1 applifed --test --log /tmp/cpuload_low.log" +
+ "< /usr/share/applifed-M-testscripts/cpu_load/cpu_load_low.drive &")
+ else
+ system("source /tmp/session_bus_address.user;" +
+ "DISPLAY=:0 applifed --test --log /tmp/cpuload_low.log" +
+ "< /usr/share/applifed-M-testscripts/cpu_load/cpu_load_low.drive &")
+ end
+ sleep 6
+
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_toc', priority=1\" /tmp/cpuload_low.log"}
+
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"'com.nokia.fali_hello' got registered\" /tmp/cpuload_low.log"}
+
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_mw2', priority=2\" /tmp/cpuload_low.log"}
+
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"'com.nokia.fali_toc' got registered\" /tmp/cpuload_low.log"}
+
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_hello', priority=3\" /tmp/cpuload_low.log"}
+
+ verify_equal(true,2,"Application not prestarted"){
+ system "grep \"'com.nokia.fali_mw2' got registered\" /tmp/cpuload_low.log"}
+ end
+
+ # Test that applications are not prestarted when the cpu
+ # load is higher than threshold value
+ def test_cpu_load_high
+ if FileTest.exists?("/tmp/cpuload_high.log")
+ system "rm /tmp/cpuload_high.log"
+ end
+
+ if $path.include?("scratchbox")
+ system("source /tmp/session_bus_address.user;" +
+ "DISPLAY=:1 applifed --test --log /tmp/cpuload_high.log" +
+ "< /usr/share/applifed-M-testscripts/cpu_load/cpu_load_high.drive &")
+ else
+ system("source /tmp/session_bus_address.user;" +
+ "DISPLAY=:0 applifed --test --log /tmp/cpuload_high.log" +
+ "< /usr/share/applifed-M-testscripts/cpu_load/cpu_load_high.drive &")
+ end
+ sleep 6
+
+ verify_equal(false,2,"Application is prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_hello', priority=3\" /tmp/cpuload_high.log"}
+
+ verify_equal(false,2,"Application is prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_toc', priority=1\" /tmp/cpuload_high.log"}
+
+ verify_equal(false,2,"Application is prestarted"){
+ system "grep \"Prestarting 'com.nokia.fali_mw2', priority=2\" /tmp/cpuload_high.log"}
+ end
+
+end
--- tests/Meego/TestScripts/fautils.rb
+++ tests/Meego/TestScripts/fautils.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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.
+#
+
+module FaUtils
+ # Returns a list of pids for an application.
+ # Returns nil if no application was found to be running.
+ def get_pids(app)
+ pids = `pgrep #{app}`.split(/\s/).collect { |x| x.strip() }.delete_if { |x| x.empty? }
+ pids = nil if pids.empty?
+ return pids
+ end
+
+ # Returns the pid of an application or nil if it wasn't running.
+ def get_pid(app)
+ pids = get_pids(app)
+
+ if not pids.nil? and pids.length >= 1
+ return pids[0]
+ end
+
+ return nil
+ end
+
+ # Kill an application. Returns true if killed, false otherwise.
+ def kill(app)
+ system("pkill -9 #{app}")
+ end
+
+ # Returns true is at least one instance of application is running
+ def running?(app)
+ not get_pid(app).empty?
+ end
+end
--- tests/Meego/TestScripts/functest_applifed.conf
+++ tests/Meego/TestScripts/functest_applifed.conf
+<?xml version="1.0"?>
+<applifed default_cpu_load_threshold="200" cpu_load_polling_delay="1">
+<application name="fali_hello" service="com.nokia.fali_hello" priority="1"/>
+<application name="fali_toc" service="com.nokia.fali_toc" priority="1"/>
+<application name="fali_mw2" service="com.nokia.fali_mw2" priority="1"/>
+</applifed>
+
--- tests/Meego/TestScripts/functional.drive
+++ tests/Meego/TestScripts/functional.drive
+PRESTART=/usr/share/applifed-M-testscripts/functest_applifed.conf
+EXIT_WITH_DELAY=120
+
+
+
--- tests/Meego/TestScripts/periodic_re_prestart
+++ tests/Meego/TestScripts/periodic_re_prestart
+(directory)
--- tests/Meego/TestScripts/periodic_re_prestart/CMakeLists.txt
+++ tests/Meego/TestScripts/periodic_re_prestart/CMakeLists.txt
+install(FILES periodic_re_prestart.conf periodic_re_prestart.drive
+ DESTINATION /usr/share/applifed-M-testscripts/periodic_re_prestart)
+
+install(PROGRAMS ts_periodic_re_prestart.rb
+ DESTINATION /usr/share/applifed-M-testscripts/periodic_re_prestart)
+
--- tests/Meego/TestScripts/periodic_re_prestart/periodic_re_prestart.conf
+++ tests/Meego/TestScripts/periodic_re_prestart/periodic_re_prestart.conf
(renamed from tests/TestScripts/periodic_re_prestart/periodic_re_prestart.conf)
--- tests/Meego/TestScripts/periodic_re_prestart/periodic_re_prestart.drive
+++ tests/Meego/TestScripts/periodic_re_prestart/periodic_re_prestart.drive
+PRESTART=/usr/share/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.conf
+SCREEN_BLANKED_WITH_DELAY=25
+EXIT_WITH_DELAY=50
--- tests/Meego/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+++ tests/Meego/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the periodic re-prestart functionality
+#
+# * Objectives: test the functionality of applifed from
+# the periodic re-prestart point of view
+#
+
+require 'tdriver'
+require 'date'
+require 'test/unit'
+include TDriverVerify
+
+
+class TC_PERIODICREPRESTART < Test::Unit::TestCase
+
+ TIMES_TO_BE_RESTARTED = 5
+
+ #Get the uname to find where are the tests running
+ $path = string = `echo $PATH `
+
+ # method called before any test case
+ def setup
+ #kill applications that are already running
+ app = 'fali_hello'
+ if system("pgrep #{app}") == true
+ system("kill -9 `pgrep #{app}`")
+ end
+
+ #make sure that log file does not exist before the test run
+ if FileTest.exists?("/tmp/periodic-re-prestart.log")
+ system "rm /tmp/periodic-re-prestart.log"
+ end
+
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ @daemon_running = system('pkill applifed')
+ #start applifed in test mode and prestart the listed applications
+ system("source /tmp/session_bus_address.user;" +
+ "DISPLAY=:1 applifed --test --log /tmp/periodic-re-prestart.log" +
+ "< /usr/share/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.drive &")
+ else
+ system "mcetool --set-tklock-mode=unlocked"
+ @daemon_running = system('initctl stop xsession/applifed')
+ #start applifed in test mode and prestart the listed applications
+ system("source /tmp/session_bus_address.user;" +
+ "DISPLAY=:0 applifed --test --log /tmp/periodic-re-prestart.log" +
+ "< /usr/share/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.drive &")
+ end
+ @sut = TDriver.sut(:Id=>ARGV[0] || 'sut_qt_maemo')
+ sleep 5
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ if @daemon_running
+ if $path.include?("scratchbox")
+ system('applifed &')
+ else
+ system('initctl start xsession/applifed')
+ end
+ end
+ end
+
+ #To test that the application is prestarted by applifed
+
+ def test_periodic_re_prestart
+ $pid = string = `pgrep fali_hello`
+ for i in 1..TIMES_TO_BE_RESTARTED
+ string = `dbus-send --dest=com.nokia.fali_hello --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
+ sleep(2)
+ @app = @sut.application(:name => 'fali_hello')
+ newpid = string = `pgrep fali_hello`
+ verify_true(30,"Application is not prestarted"){$pid == newpid}
+ @app.MButton( :name => 'CloseButton').tap
+ end
+ verify_equal(true,30,"Screen blanking did not happen"){
+ system "grep \"Application 'com.nokia.fali_hello' scheduled for re-prestart\" /tmp/periodic-re-prestart.log"}
+ sleep 6
+ newpid = string = `pgrep fali_hello`
+ puts newpid
+ verify_true(30,"Application is not prestarted"){$pid != newpid}
+ end
+end
--- tests/Meego/TestScripts/prevent.conf
+++ tests/Meego/TestScripts/prevent.conf
(renamed from tests/TestScripts/prevent.conf)
--- tests/Meego/TestScripts/prevent.drive
+++ tests/Meego/TestScripts/prevent.drive
+PRESTART=/usr/share/applifed-M-testscripts/prevent.conf
+EXIT_WITH_DELAY=30
+
+
+
--- tests/Meego/TestScripts/tc_applifed_one_instance.rb
+++ tests/Meego/TestScripts/tc_applifed_one_instance.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the prestart functionality
+#
+# * Objectives: test the functionality of applifed from
+# the prestart point of view
+#
+
+require 'tdriver'
+require 'date'
+require 'test/unit'
+
+include TDriverVerify
+
+class TC_OnlyOneApplifed < Test::Unit::TestCase
+ # Check that only one instance of applifed is running
+ def get_pids(app)
+ pids = `pgrep #{app}`.split(/\s/).collect { |x| x.strip() }.delete_if { |x| x.empty? }
+ pids = nil if pids.empty?
+ return pids
+ end
+
+ def test_only_one_applifed
+ pids = get_pids('applifed')
+
+ if not pids.nil?
+ puts "pids: #{pids.join(' ')}"
+ else
+ verify_true(0, "Applifed is not running") { false }
+ end
+
+ verify_true(0, "Multiple instances of applifed running") {
+ pids.length == 1
+ }
+ end
+
+ def test_lock()
+ verify_true(5, "applifed not running") {
+ system("pgrep applifed")
+ }
+
+ verify_false(5, "only one instance should be allowed to run") {
+ system("applifed --fork")
+ }
+ end
+end
+
--- tests/Meego/TestScripts/tc_daemonize.rb
+++ tests/Meego/TestScripts/tc_daemonize.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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.
+
+require 'date'
+require 'test/unit'
+require 'test/unit/testsuite'
+require 'test/unit/ui/console/testrunner'
+
+class TC_Daemonize < Test::Unit::TestCase
+ def test_daemonize()
+ puts "starting applifed daemonized"
+ assert(system("applifed --fork"), "error while daemonizing")
+
+ puts "sleeping ..."
+ sleep(5)
+
+ assert(system("pgrep applifed"), "applifed was not started")
+
+ puts "trying to start fali_hello ..."
+ system("dbus-send --dest=com.nokia.fali_hello --type=method_call " +
+ "/org/maemo/m com.nokia.MApplicationIf.launch")
+
+ puts "sleeping ..."
+ sleep(5)
+
+ assert(system("pgrep fali_hello"), "fali_hello was not started")
+
+ system("pkill applifed")
+ system("pkill fali_hello")
+
+ if system("pgrep applifed")
+ system("pkill -9 applifed")
+ flunk("applifed not terminated, sent SIGKILL")
+ end
+ end
+end
+
+scratchbox = false
+
+if ENV['PATH'].include?('scratchbox') then
+ scratchbox = true
+end
+
+if not scratchbox then
+ system("initctl stop xsession/applifed")
+end
+
+system("pkill applifed")
+system("rm /tmp/applifed*")
+
+Test::Unit::UI::Console::TestRunner.run(TC_Daemonize)
+
+if not scratchbox then
+ system("rm /tmp/applifed*")
+ system("initctl start xsession/applifed")
+else
+ system("applifed --fork")
+end
--- tests/Meego/TestScripts/tc_prestart_preventing.rb
+++ tests/Meego/TestScripts/tc_prestart_preventing.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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.
+
+# TODO: test that apps started by init system are not killed
+# when they go to prestarted state
+
+require 'tdriver'
+require 'test/unit'
+require 'test/unit/ui/console/testrunner'
+
+in_sb = false
+daemon_running_for = 50
+daemon_running = false
+
+class TC_PrestartPreventing < Test::Unit::TestCase
+
+ def setup()
+ @sut = TDriver.sut(:Id => ARGV[0] || 'sut_qt_maemo')
+
+ if ENV['PATH'].include?("scratchbox")
+ @in_sb = true
+ else
+ system("mcetool --set-tklock-mode=unlocked")
+ @in_sb = false
+ end
+
+ # check for how long the daemon is going to sleep, default to 50 secs
+ File.open('/usr/share/applifed-M-testscripts/prevent.drive') { |f|
+ f.readlines().each { |line|
+ if line =~ /^EXIT_WITH_DELAY=(\d+)/i
+ @daemon_running_for = $1.to_i()
+ break
+ end
+ }
+ }
+
+ puts("daemon is planning to sleep for #{@daemon_running_for} " +
+ "seconds ...")
+
+ # stop daemon if it's running on the system
+ if @in_sb
+ @daemon_running = system('pkill applifed')
+ else
+ @daemon_running = system('initctl stop xsession/applifed')
+ end
+
+ sleep(2)
+
+ # kill applications that are already running
+ system('pkill fali')
+
+ # start the daemon in test mode
+ system("source /tmp/session_bus_address.user; " +
+ "DISPLAY=#{ENV['DISPLAY']} " +
+ "applifed --test --log /tmp/prevent_prestart.log " +
+ "< /usr/share/applifed-M-testscripts/prevent.drive &")
+
+ @start_time = Time.now()
+
+ sleep(5)
+ end
+
+ def teardown()
+ # sleep so that the daemon has time to exit ...
+ sleep_time = @daemon_running_for - (Time.now() - @start_time) + 5
+ if sleep_time > 0
+ puts "sleeping for #{sleep_time} seconds ..."
+ sleep(sleep_time)
+ end
+
+ system('pkill fali')
+
+ # start the daemon again, if necessary
+ if @daemon_running
+ if @in_sb
+ system('applifed &')
+ else
+ system('initctl start xsession/applifed')
+ end
+ end
+ end
+
+ def test_prestart_preventing()
+ # prestart fali_perf
+ system('dbus-send --type=method_call --dest=com.nokia.fali_perf ' +
+ '/org/maemo/m com.nokia.MApplicationIf.ping')
+ sleep(2)
+
+ # show its window
+ system('dbus-send --type=method_call --dest=com.nokia.fali_perf ' +
+ '/org/maemo/m com.nokia.MApplicationIf.launch')
+ sleep(2)
+
+ # close the window
+ app = @sut.application(:name => 'fali_perf')
+ app.MButton(:name => 'CloseButton').tap()
+ sleep(5)
+
+ # verify that fali_perf was killed
+ assert(system('pgrep fali_perf') == false, 'fali_perf was not killed')
+ end
+
+ def test_whitelist()
+ # start an app that can lazy shutdown (and that is whitelisted ...)
+ system('/usr/bin/fali_mw1 -software -prestart &')
+ sleep(2)
+
+ # show a window
+ system('dbus-send --dest=com.nokia.fali_mw1 --type=method_call ' +
+ '/ com.nokia.MultipleWindowsIf.launchWindow int32:1')
+ sleep(2)
+
+ # close the window
+ app = @sut.application(:name => 'fali_mw1')
+ app.MButton(:name => 'CloseButton').tap()
+ sleep(4)
+
+ # verify that the app was not killed
+ assert(system('pgrep fali_mw1'), 'fali_mw1 was killed!')
+
+ system('pkill fali_mw1')
+ end
+end
+
--- tests/Meego/TestScripts/test-perf-prestart.py
+++ tests/Meego/TestScripts/test-perf-prestart.py
+#!/usr/bin/env python
+"""
+This program tests the startup time of the given application with and
+without prestarting.
+
+Requirements:
+1. DISPLAY environment variable must be set correctly.
+2. DBus session bus must be running.
+3. DBus session bus address must be stored in /tmp/session_bus_address.user.
+4. Given application supports prestarting with -prestart commandline argument.
+
+Usage: test-perf-prestart <prestartable application>
+
+Example: test-perf-prestart /usr/bin/camera-ui
+
+Authors: antti.kervinen at nokia.com, juha.lintula at nokia.com
+"""
+import os
+import subprocess
+import commands
+import time
+import sys
+from optparse import OptionParser
+import unittest
+
+MEMORYHOG = '/usr/bin/memoryhog'
+DEV_NULL = file("/dev/null","w")
+LOG_FILE = '/tmp/applifed_perftest.log'
+
+_timer_pipe = None
+_start_time = 0
+_memory_stats = []
+
+
+appname = None
+test_mode = None
+
+def parseCommandLineOptions():
+ global appname, test_mode
+ my_parser = OptionParser()
+ my_parser.add_option("-a", "--app", dest="app", help="path of the application you want to test", action="store")
+ my_parser.add_option("-s", "--swap", dest="swap", help="Flag for swap mode of testing, if not used, test_mode = Regular", action="store_true", default=False)
+ options, arguments = my_parser.parse_args()
+ if not options.app:
+ print "you must specify the application you want to test"
+ sys.exit(1)
+ else:
+ assert (os.path.exists(options.app)), "The application %s does not exist" % options.app
+ appname = options.app
+ if options.swap:
+ test_mode = 'Swap'
+ else:
+ test_mode = 'Regular'
+
+def debug(*msg):
+ sys.stderr.write('[DEBUG %s] %s\n' % (time.time(), ' '.join([str(s) for s in msg]),))
+
+def error(*msg):
+ sys.stderr.write('ERROR %s\n' % (' '.join([str(s) for s in msg]),))
+ sys.exit(1)
+
+def basename(appname):
+ return appname.split('/')[-1]
+
+def is_executable_file(filename):
+ return os.path.isfile(filename) and os.access(filename, os.X_OK)
+
+def check_prerequisites(appname):
+ if os.getenv('DISPLAY') == None:
+ error("DISPLAY is not set. Check the requirements.")
+
+ if os.getenv('DBUS_SESSION_BUS_ADDRESS') == None:
+ error("DBUS_SESSION_BUS_ADDRESS is not set.\n" +
+ "You probably want to source /tmp/session_bus_address.user")
+
+ if not is_executable_file(appname):
+ error("'%s' is not an executable file\n" % (appname,) +
+ "(should be an application that supports prestarting)")
+
+class applifed_perf_tests(unittest.TestCase):
+ def setUp(self):
+ self.tcname = self.id().split('.')[-1]
+ os.system("initctl stop xsession/applifed")
+
+ def tearDown(self):
+ os.system("initctl start xsession/applifed")
+ pass
+ #print "End %s" % self.tcname
+
+ def start_timer(self):
+ # call measure_time after calling this...
+ global _start_time
+ _start_time = time.time()
+
+ def measure_time(self):
+ global _end_time
+ fh = open(LOG_FILE, "r")
+ lines = fh.readlines()
+ lastline = lines[len(lines)-2]
+ _end_time = lastline.split()[0]
+ debug("End Time :%f" %float(_end_time))
+ _app_start_time = float(_end_time) - float(_start_time)
+ return _app_start_time
+
+ def save_memory_usage(self, process_handle):
+ global _memory_stats
+ rss, private_dirty = 0, 0
+ if process_handle:
+ # calculate process memory usage
+ # resident size in memory and private dirty
+ smaps_lines = file("/proc/%s/smaps" % (process_handle.pid,)).readlines()
+ for line in smaps_lines:
+ if line.startswith("Rss:"):
+ rss += int(line.split()[1])
+ elif line.startswith("Private_Dirty:"):
+ private_dirty += int(line.split()[1])
+ # find out free system memory
+ meminfo_lines = file("/proc/meminfo").readlines()
+ for line in meminfo_lines:
+ if line.startswith("MemFree:"):
+ memfree = int(line.split()[1])
+ elif line.startswith("Buffers:"):
+ memfree += int(line.split()[1])
+ elif line.startswith("Cached:"):
+ memfree += int(line.split()[1])
+ _memory_stats.append({'rss':rss,
+ 'private_dirty': private_dirty,
+ 'memfree': memfree})
+
+ def eat_memory(self):
+ debug("Running memoryhog...")
+
+ p = subprocess.Popen(MEMORYHOG,
+ stdout=subprocess.PIPE)
+ # Memoryhog is ready when we are able to read 3 lines from it.
+ debug ("Memoryhog: %s"%p.stdout.readline())
+ debug ("Memoryhog: %s"%p.stdout.readline())
+ debug ("Memoryhog: %s"%p.stdout.readline())
+ return
+
+ def run_without_prestarting(self, appname, test_mode):
+ """returns process handle with pid attribute and terminate function"""
+ os.system ('mcetool --set-tklock-mode=unlocked')
+ if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
+ os.system('rm %s' %LOG_FILE)
+ if (test_mode == "Swap"):
+ self.eat_memory()
+
+ self.start_timer()
+ p = subprocess.Popen(appname,
+ shell=False,
+ stdout=DEV_NULL, stderr=DEV_NULL)
+ debug("app", appname, "started")
+ return p
+
+ def run_without_prestarting_without_meegotouchhome(self, appname, test_mode):
+ """returns process handle with pid attribute and terminate function"""
+ os.system ('mcetool --set-tklock-mode=unlocked')
+ if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
+ os.system('rm %s' %LOG_FILE)
+ if (test_mode == "Swap"):
+ self.eat_memory()
+ os.system('pkill -STOP meegotouchhome')
+ self.start_timer()
+ p = subprocess.Popen(appname,
+ shell=False,
+ stdout=DEV_NULL, stderr=DEV_NULL)
+ debug("app", appname, "started without meegotouchhome")
+ os.system('pkill -CONT meegotouchhome')
+ return p
+
+ def run_with_prestarting(self, appname, test_mode):
+ """returns process handle with pid attribute and terminate function"""
+ # for lifecycle application, for instance, run
+ # dbus-send --dest=com.nokia.lifecycle \
+ # --type="method_call" \
+ # /org/maemo/m com.nokia.MApplicationIf.launch
+ os.system ('mcetool --set-tklock-mode=unlocked')
+ global _start_time
+ if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
+ os.system('rm %s' %LOG_FILE)
+ time.sleep(1)
+ output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
+ ' --type="method_call" /org/maemo/m ' +
+ 'com.nokia.MApplicationIf.ping')
+ debug("app prestarted, waiting for it to stabilize...")
+ time.sleep(3)
+ class p: pass
+ p.pid = commands.getoutput('pgrep ' + basename(appname)[:15])
+ # Make sure the application is prestarted and ready to receive the
+ # launch signal. Hypothesis: if the application has not been
+ # scheduled within the second, it is ready for launching
+
+ #Commented, needs investigation why this waits when meegotouchhome stopped
+ """switches = 0
+ last_switches = -100
+ counter = 0
+ while (switches - last_switches) > 0 and counter < 20:
+ debug("still waiting, switches, last_switches:...", switches, last_switches)
+ time.sleep(1)
+ counter = counter +1
+ last_switches = switches
+ switches = int(commands.getoutput("grep nr_switches /proc/%s/sched" %
+ (p.pid,)).split()[2])"""
+ self.save_memory_usage(p)
+
+ # If we testing the the worst case, make sure that the prestarted is swapped off
+ if (test_mode == "Swap"):
+ self.eat_memory()
+
+ # Launch the prestarted application and quit immediately so that
+ # the time can be measured
+ self.start_timer()
+ debug("start time : %f"% _start_time)
+ output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
+ ' --type="method_call" /org/maemo/m ' +
+ 'com.nokia.MApplicationIf.launch')
+ return p
+
+ def run_with_prestarting_without_meegotouchhome(self, appname, test_mode):
+ """returns process handle with pid attribute and terminate function"""
+ # for lifecycle application, for instance, run
+ # dbus-send --dest=com.nokia.lifecycle \
+ # --type="method_call" \
+ # /org/maemo/m com.nokia.MApplicationIf.launch
+ os.system ('mcetool --set-tklock-mode=unlocked')
+ global _start_time
+ if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
+ os.system('rm %s' %LOG_FILE)
+ time.sleep(1)
+ output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
+ ' --type="method_call" /org/maemo/m ' +
+ 'com.nokia.MApplicationIf.ping')
+ debug("app prestarted, waiting for it to stabilize...")
+ time.sleep(3)
+ class p: pass
+ p.pid = commands.getoutput('pgrep ' + basename(appname)[:15])
+ # Make sure the application is prestarted and ready to receive the
+ # launch signal. Hypothesis: if the application has not been
+ # scheduled within the second, it is ready for launching
+ switches = 0
+ last_switches = -100
+ counter = 0
+ #Commented, needs investigation why this waits when meegotouchhome stopped
+ """while (switches - last_switches) > 0 and counter < 30:
+ debug("still waiting, switches, last_switches:...", switches, last_switches)
+ time.sleep(1)
+ counter = counter +1
+ last_switches = switches
+ switches = int(commands.getoutput("grep nr_switches /proc/%s/sched" %
+ (p.pid,)).split()[2])"""
+ self.save_memory_usage(p)
+
+ # If we testing the the worst case, make sure that the prestarted is swapped off
+ if (test_mode == "Swap"):
+ self.eat_memory()
+
+ # Launch the prestarted application and quit immediately so that
+ # the time can be measured
+ os.system('pkill -STOP meegotouchhome')
+ self.start_timer()
+ debug("start time : %f"% _start_time)
+ output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
+ ' --type="method_call" /org/maemo/m ' +
+ 'com.nokia.MApplicationIf.launch')
+ debug("prestarted app launched without meegotouchhome")
+ os.system('pkill -CONT meegotouchhome')
+ return p
+
+
+ def kill_process(self, process_handle, appname):
+ return commands.getoutput("pkill -9 %s" % (basename(appname)[:15],))
+
+ def perftest_with_prestart(self, appname, test_mode):
+ debug("run app with prestarting with meegotouchhome")
+ self.save_memory_usage(None) # record free system memory
+ p = self.run_with_prestarting(appname, test_mode)
+ time.sleep(2)
+ time_with_prestart = self.measure_time()
+ time.sleep(2)
+ self.save_memory_usage(p)
+ self.kill_process(p, appname)
+ if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
+ debug("got time:", time_with_prestart)
+ time.sleep(2)
+
+ debug("run app with prestarting without meegotouchhome ")
+ self.save_memory_usage(None) # record free system memory
+ p = self.run_with_prestarting_without_meegotouchhome(appname, test_mode)
+ time.sleep(2)
+ time_with_prestart_without_meegotouchhome = self.measure_time()
+ time.sleep(2)
+ self.save_memory_usage(p)
+ self.kill_process(p, appname)
+ if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
+ debug("got time:", time_with_prestart_without_meegotouchhome)
+ time.sleep(2)
+ return time_with_prestart, time_with_prestart_without_meegotouchhome
+
+ def perftest_without_prestart(self, appname, test_mode):
+ debug("run app without prestarting with meegotouchhome")
+ self.save_memory_usage(None) # record free system memory
+ p = self.run_without_prestarting(appname, test_mode)
+ time.sleep(4)
+ time_without_prestart = self.measure_time()
+ self.save_memory_usage(p)
+ time.sleep(4)
+ self.kill_process(p, appname)
+ if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
+ debug("got time:", time_without_prestart)
+ time.sleep(2)
+
+ debug("run app without prestarting without meegotouchhome")
+ self.save_memory_usage(None) # record free system memory
+ p = self.run_without_prestarting_without_meegotouchhome(appname, test_mode)
+ time.sleep(4)
+ time_without_prestart_without_meegotouchhome = self.measure_time()
+ self.save_memory_usage(p)
+ time.sleep(4)
+ self.kill_process(p, appname)
+ if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
+ debug("got time:", time_without_prestart_without_meegotouchhome)
+ time.sleep(2)
+
+ return time_without_prestart, time_without_prestart_without_meegotouchhome
+
+ def print_test_report(self, with_without_times, fileobj):
+ """
+ with_without_times is a list of pairs:
+ (with_prestarting_startup_time,
+ without_prestarting_startup_time)
+ """
+ global _memory_stats
+ def writeline(*msg):
+ fileobj.write("%s\n" % ' '.join([str(s) for s in msg]))
+ def fmtfloat(f):
+ return "%.2f" % (f,)
+ def filterstats(data, field):
+ return tuple([d[field] for d in data])
+
+ if with_without_times == []: return
+
+ writeline("")
+ writeline('Memory consumptions [kB]:')
+ memrowformat = "%10s %10s %10s %10s %10s %10s"
+ while _memory_stats:
+ oneround = _memory_stats[:5]
+ _memory_stats = _memory_stats[5:]
+
+ writeline(memrowformat %
+ ('', 'before', 'before', 'after', 'before', 'after'))
+ writeline(memrowformat %
+ ('', 'prestart', 'launch', 'launch', 'normal', 'normal'))
+ writeline(memrowformat %
+ (('privdirt',) + filterstats(oneround, 'private_dirty')))
+ writeline(memrowformat %
+ (('rss',) + filterstats(oneround, 'rss')))
+ writeline(memrowformat %
+ (('free',) + filterstats(oneround, 'memfree')))
+ writeline("")
+
+ writeline("")
+ rowformat = "%12s %12s %12s %12s"
+ writeline('Startup times [s]:')
+ writeline(rowformat % ('prestarted-Yes', 'prestarted-Yes', 'prestarted-No', 'prestarted-No'))
+ writeline(rowformat % ('meegotouchhome-Yes ', 'meegotouchhome-No ', 'meegotouchhome-Yes ', 'meegotouchhome-No '))
+
+ t1,t2,t3,t4 = [], [], [], []
+ for wop_wd, wop_wod, wp_wd, wp_wod in with_without_times:
+ t1.append(wop_wd)
+ t2.append(wop_wod)
+ t3.append(wp_wd)
+ t4.append(wp_wod)
+ writeline(rowformat % (fmtfloat(wop_wd), fmtfloat(wop_wod),
+ fmtfloat(wp_wd), fmtfloat(wp_wod)))
+
+ writeline('Average times:')
+ writeline(rowformat % (fmtfloat(sum(t1)/len(t1)),fmtfloat(sum(t2)/len(t2)),
+ fmtfloat(sum(t3)/len(t3)),fmtfloat(sum(t4)/len(t4))))
+ return fmtfloat(sum(t1)/len(t1))
+
+ def test_001(self):
+ times = []
+ times1, times2 = [], []
+
+ for i in xrange(3):
+ times1.append(self.perftest_with_prestart(appname, test_mode))
+ for i in xrange(3):
+ times2.append(self.perftest_without_prestart(appname, test_mode))
+
+ times = [[t1[0], t1[1], times2[i][0], times2[i][1]] for i, t1 in enumerate(times1)]
+ avg_with_prestart = self.print_test_report(times, sys.stdout)
+ self.assert_(float(avg_with_prestart) < float(0.75), "prestarted application takes more than 0.75 sec")
+
+
+# main
+if __name__ == '__main__':
+ parseCommandLineOptions()
+ print sys.argv
+ sys.argv = sys.argv[0:1]
+ print sys.argv
+ check_prerequisites(appname)
+ unittest.main()
+
--- tests/Meego/TestScripts/test-perf.rb
+++ tests/Meego/TestScripts/test-perf.rb
+#!/usr/bin/ruby
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applauncherd.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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 'test/unit'
+require 'test/unit/assertions'
+include Test::Unit::Assertions
+include TDriverVerify
+
+
+class TC_PerformanceTests < Test::Unit::TestCase
+ COUNT = 5
+ @start_time = 0
+ @end_time = 0
+
+ $path = string = `echo $PATH `
+
+ # method called before any test case
+ def setup
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ @daemon_running = system('pkill applifed')
+ if system("pgrep fali_hello") == true
+ system("kill -9 `pgrep fali_hello`")
+ end
+ sleep (1)
+ system "/usr/bin/fali_hello -prestart &"
+ else
+ system "mcetool --set-tklock-mode=unlocked"
+ # restart mthome so that qttasserver notices it
+ verify {
+ system("/sbin/initctl restart xsession/mthome")
+ }
+ @daemon_running = system('initctl stop xsession/applifed')
+ if system("pgrep fali_hello") == true
+ system("kill -9 `pgrep fali_hello`")
+ end
+ sleep (1)
+ system "/usr/bin/fali_hello -prestart &"
+ sleep (3)
+ end
+ @sut = TDriver.sut(:Id=> 'sut_qt_maemo')
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ puts "exit from teardown"
+ if @daemon_running
+ if $path.include?("scratchbox")
+ system('applifed &')
+ else
+ system('initctl start xsession/applifed')
+ end
+ end
+ end
+
+ def open_Apps(appName)
+ #Remove the Log file if it exists
+ if FileTest.exists?("/tmp/applifed_perftest.log")
+ system "rm /tmp/applifed_perftest.log"
+ end
+
+ count = 0
+
+ #Open the Application from the application grid
+ @meegoHome = @sut.application(:name => 'meegotouchhome')
+ @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)
+ sleep(0.2)
+ count = count +1
+ icon.refresh
+ end
+ @start_time = Time.now
+ @meegoHome.LauncherButton(:name => "LauncherButton", :text => appName).tap
+ sleep (2)
+ @app = @sut.application(:name => appName)
+ sleep (2)
+ @app.MEscapeButtonPanel.MButton( :name => 'CloseButton' ).tap
+ else
+ #icon does not
+ #raise error and exit
+ raise "Application not found in Application grid"
+ exit 1
+ end
+ end
+
+ def read_file
+ #Reading the log file to get the time
+ file_name="/tmp/applifed_perftest.log"
+ last_line = `tail -n 2 #{file_name}`
+ @end_time = last_line.split(" ")[0]
+ 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)
+ return app_t
+ end
+
+ def test_performance
+ wP = []
+ woP = []
+ wPsum = 0.0
+ woPsum = 0.0
+
+ #Run Application with invoker
+ for i in 1..COUNT
+ open_Apps("fali_hello")
+ print "Now Launching fali_hello %d times\n" %i
+ sleep (5)
+ read_file
+ wP.push(measure_time)
+ end
+
+ #Run Application without invoker
+ for i in 1..COUNT
+ open_Apps("fali_hello1")
+ print "Now Launching fali_hello1 %d times\n" %i
+ sleep (5)
+ read_file
+ woP.push(measure_time)
+ end
+
+ print "With Prestart \t\t Without Prestart\n"
+
+ #Printing the data
+ for i in 0..COUNT-1
+ print "%.2f \t\t\t %.2f\n" %[wP[i],woP[i]]
+ wPsum = wPsum + wP[i]
+ woPsum = woPsum + woP[i]
+ end
+ print "\nAverage Values \n"
+ print "%.2f \t\t\t %.2f\n\n" %[wPsum/COUNT, woPsum/COUNT]
+ assert(wPsum/COUNT <= 0.75, "Application takes longer time to launch")
+
+ end
+end
--- tests/Meego/TestScripts/ts_mwtests.rb
+++ tests/Meego/TestScripts/ts_mwtests.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the prestart functionality
+#
+# * Objectives: test the functionality of applifed from
+# the prestart point of view for multiwindows
+#
+
+require 'tdriver'
+require 'date'
+require 'test/unit'
+include TDriverVerify
+
+class TC_MWTESTS < Test::Unit::TestCase
+
+ TIMES_TO_BE_RESTARTED = 5
+ $path = string = `echo $PATH `
+
+ # method called before any test case
+ def setup
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ else
+ system "mcetool --set-tklock-mode=unlocked"
+ # restart meegotouchhome so that qttasserver notices it
+ verify {
+ system("/sbin/initctl restart xsession/mthome")
+ }
+ end
+ @sut = TDriver.sut(:Id=>ARGV[0] || 'sut_qt_maemo')
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ kill_application()
+ @appname = nil
+ puts "exit from teardown"
+ end
+
+ def test_mw3_prestart
+ #Test for a multiwindow application inherited from MApplication and override windows CloseEvents tested
+ @appname = 'fali_mw3'
+
+ start_exec()
+ run_dbus_command_multiwindow('fali_mw3', '1')
+ run_dbus_command_multiwindow('fali_mw3', '2')
+ run_dbus_command_multiwindow('fali_mw3', '3')
+
+ pid = string = `pgrep #{@appname}`
+ @app = @sut.application(:name => @appname)
+ @app.MyWindow( :name => 'Window 3' ).MainPage.MPannableViewport.MLabel(:text => 'Modify content').tap
+ @app.MyWindow( :name => 'Window 3' ).MButton( :name => 'CloseButton' ).tap
+ @app.MyWindow( :name => 'Window 3' ).MButton( :name => 'MDialogButtonYes' ).tap
+
+ system "mcetool --set-tklock-mode=unlocked"
+ @app.MApplicationWindow( :name => 'Window 2' ).MLabel(:text => 'Modify content').tap
+ @app.MApplicationWindow( :name => 'Window 2' ).MButton( :name => 'CloseButton' ).tap
+ @app.MApplicationWindow( :name => 'Window 1' ).MLabel(:text => 'Modify content').tap
+ @app.MApplicationWindow( :name => 'Window 1' ).MButton( :name => 'CloseButton' ).tap
+
+ #verifies that the multiwindow application is lazy shutdown and has the same pid after it is closed
+ newid = string = `pgrep #{@appname}`
+ verify_true(30,"The application is not prestarted"){pid == newid}
+
+ run_dbus_command_multiwindow('fali_mw3', '3')
+ verify(){@app.MyWindow( :name => 'Window 3' ).MLabel(:text => 'Fresh Window 3')}
+
+ end
+
+ def test_mw3_switcher
+ #Test that all window of a multiwindow application exists in the switcher
+ @appname = 'fali_mw3'
+
+ start_exec()
+ run_dbus_command_multiwindow('fali_mw3', '1')
+ run_dbus_command_multiwindow('fali_mw3', '2')
+ run_dbus_command_multiwindow('fali_mw3', '3')
+
+ pid = string = `pgrep #{@appname}`
+ @app = @sut.application(:name => @appname)
+ @app.MyWindow( :name => 'Window 3' ).MHomeButtonPanel( :name => 'MHomeButtonPanel').MButton( :name => 'HomeButton').tap
+ @app_home = @sut.application(:name => 'meegotouchhome')
+
+ #verifies that all the three windows exist in the switcher
+ verify(){@app_home.SwitcherButton(:text => 'Window 1')}
+ verify(){@app_home.SwitcherButton(:text => 'Window 2')}
+ verify(){@app_home.SwitcherButton(:text => 'Window 3')}
+
+ end
+
+ def test_mw2_close
+ #Test for multiwindow re-prestart
+ @appname = 'fali_mw2'
+ if system("pgrep #{@appname}") == true
+ system("kill -9 `pgrep #{@appname}`")
+ end
+ if $path.include?("scratchbox")
+ system("source /tmp/session_bus_address.user;" +
+ "DISPLAY=:1 applifed --test --log /tmp/applifed-test.log" +
+ " < /usr/share/applifed-M-testscripts/functional.drive &")
+ else
+ system("source /tmp/session_bus_address.user;" +
+ "DISPLAY=:0 applifed --test --log /tmp/applifed-test.log" +
+ " < /usr/share/applifed-M-testscripts/functional.drive &")
+ end
+ sleep 10
+ run_dbus_command_multiwindow('fali_mw2', '1')
+ run_dbus_command_multiwindow('fali_mw2', '2')
+ run_dbus_command_multiwindow('fali_mw2', '3')
+
+ pid = string = `pgrep #{@appname}`
+ @app = @sut.application(:name => @appname)
+ @app.MApplicationWindow( :name => 'Window 3' ).MButton( :name => 'HomeButton' ).tap
+ @app_home = @sut.application(:name => 'meegotouchhome')
+
+ verify(){@app_home.SwitcherButton(:text => 'Window 1')}
+ verify(){@app_home.SwitcherButton(:text => 'Window 2')}
+ verify(){@app_home.SwitcherButton(:text => 'Window 3')}
+ system "mcetool --set-tklock-mode=unlocked"
+ @app_home.SwitcherButton(:text => 'Window 1').tap
+ @app.MApplicationWindow( :name => 'Window 1' ).MButton( :name => 'CloseButton' ).tap
+ @app_home.SwitcherButton(:text => 'Window 2').tap
+ @app.MApplicationWindow( :name => 'Window 2' ).MButton( :name => 'CloseButton' ).tap
+ @app_home.SwitcherButton(:text => 'Window 3').tap
+ @app.MApplicationWindow( :name => 'Window 3' ).MButton( :name => 'CloseButton' ).tap
+ sleep(6)
+
+ #verifies that multiwindow application is a terminate and close application and is re-prestarted with a new pid
+ newid = string = `pgrep #{@appname}`
+ verify_true(30,"The application is not prestarted"){pid != newid}
+ end
+
+
+ def test_mw1_close
+ #Test for multiwindow prestart and lazy shutdown
+ @appname = 'fali_mw1'
+
+ start_exec()
+ #runs the test in a loop
+ for i in 1..TIMES_TO_BE_RESTARTED
+ if $path.include?("scratchbox")
+ puts "Inside SB, Do Nothing to unlock"
+ else
+ system "mcetool --set-tklock-mode=unlocked"
+ end
+ run_dbus_command_multiwindow('fali_mw1', '1')
+ run_dbus_command_multiwindow('fali_mw1', '2')
+ run_dbus_command_multiwindow('fali_mw1', '3')
+
+ pid = string = `pgrep #{@appname}`
+ @app = @sut.application(:name => @appname)
+ @app.MApplicationWindow( :name => 'Window 3' ).MButton( :name => 'HomeButton' ).tap
+ @app_home = @sut.application(:name => 'meegotouchhome')
+
+ verify(){@app_home.SwitcherButton(:text => 'Window 1')}
+ verify(){@app_home.SwitcherButton(:text => 'Window 2')}
+ verify(){@app_home.SwitcherButton(:text => 'Window 3')}
+
+ @app_home.SwitcherButton(:text => 'Window 1').tap
+ @app.MApplicationWindow( :name => 'Window 1' ).MButton( :name => 'CloseButton' ).tap
+ sleep(1)
+ @app_home.SwitcherButton(:text => 'Window 2').tap
+ @app.MApplicationWindow( :name => 'Window 2' ).MButton( :name => 'CloseButton' ).tap
+ sleep(1)
+ @app_home.SwitcherButton(:text => 'Window 3').tap
+ @app.MApplicationWindow( :name => 'Window 3' ).MButton( :name => 'CloseButton' ).tap
+ sleep(1)
+
+ #verifies that the multiwindow application is a lazy-shudown application and has the same pid after it is closed
+ newid = string = `pgrep #{@appname}`
+ verify_true(30,"The application is not prestarted"){pid == newid}
+ end
+ end
+
+ def test_mw1_content
+ #To test that multiwindow gets the correct window content
+ @appname = 'fali_mw1'
+
+ start_exec()
+ run_dbus_command_multiwindow('fali_mw1', '1')
+ run_dbus_command_multiwindow('fali_mw1', '2')
+ run_dbus_command_multiwindow('fali_mw1', '3')
+
+ pid = string = `pgrep #{@appname}`
+ @app = @sut.application(:name => @appname)
+
+ assert_equal("Window 3", @app.MApplicationWindow( :name => 'Window 3' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
+ run_dbus_command_multiwindow('fali_mw1', '1')
+ assert_equal("Window 1", @app.MApplicationWindow( :name => 'Window 1' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
+ run_dbus_command_multiwindow('fali_mw1', '2')
+ assert_equal("Window 2", @app.MApplicationWindow( :name => 'Window 2' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
+ run_dbus_command_multiwindow('fali_mw1', '3')
+ assert_equal("Window 3", @app.MApplicationWindow( :name => 'Window 3' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
+ run_dbus_command_multiwindow('fali_mw1', '2')
+ assert_equal("Window 2", @app.MApplicationWindow( :name => 'Window 2' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
+
+ end
+
+ def test_close_event
+ #Test to hide and close a prestarted application
+ @appname = 'close-event'
+
+ start_exec()
+ run_dbus_command_closeevent
+
+ @app = @sut.application(:name => 'close-event')
+ @app.MComboBox.MLabel( :name => 'CommonTitle' ).tap
+ @app.MList.MLabel(:text => 'Ignore closeEvent').tap
+ sleep 2
+ @app.MButton( :name => 'CloseButton' ).tap
+
+ pid = string = `pgrep close-event`
+ @app.MComboBox.MLabel( :name => 'CommonTitle' ).tap
+ @app.MList.MLabel(:text => 'Hide window (Lazy Shutdown)').tap
+ sleep 2
+ @app.MButton( :name => 'CloseButton' ).tap
+
+ run_dbus_command_closeevent
+ newid = string = `pgrep close-event`
+ verify_true(30,"The application is not prestarted"){pid == newid}
+
+ @app.MComboBox.MLabel( :name => 'CommonTitle' ).tap
+ @app.MList.MLabel(:text => 'Really close window').tap
+ sleep 2
+ @app.MButton( :name => 'CloseButton' ).tap
+ assert_not_equal(true, @sut.application.test_object_exists?("MLabel", { :name => 'MComboBoxSubtitle'}), "Window still visible")
+ pid_now = string = `pgrep close-event`
+ verify_true(30,"The application is not prestarted"){newid == pid_now}
+ end
+
+ def test_multi_instance_prestart
+ #Test to prestart n number of applications at the same time
+ @appname = 'fali_multiapp'
+ for i in 1..MULTI_APP_PRESTART_TIME
+ if $path.include?("scratchbox")
+ system "#{@appname} #{i} -prestart -software&"
+ else
+ system "#{@appname} #{i} -prestart &"
+ end
+ sleep 2
+ end
+ pid = string = `pgrep #{@appname}`
+ pidlist = pid.split("\n")
+ no_of_app = pidlist.length
+ assert_equal(MULTI_APP_PRESTART_TIME, no_of_app, "All applications were not prestarted")
+ system "pkill #{@appname}"
+
+ end
+
+ def start_exec()
+ #function to prestart the applications
+ if $path.include?("scratchbox")
+ system "export DISPLAY=:1; source /tmp/session_bus_address.user; #{@appname} -prestart -software &"
+ else
+ system "export DISPLAY=:0; source /tmp/session_bus_address.user; #{@appname} -prestart &"
+ end
+ sleep 3
+ end
+
+ def run_dbus_command_multiwindow(ename, num)
+ #function that calls the dbus-send for each multiplewindow application
+ if $path.include?("scratchbox")
+ string = `export DISPLAY=:1; source /tmp/session_bus_address.user; dbus-send --dest=com.nokia.#{ename} --type="method_call" / com.nokia.MultipleWindowsIf.launchWindow int32:"#{num}"`
+ else
+ string = `export DISPLAY=:0; source /tmp/session_bus_address.user; dbus-send --dest=com.nokia.#{ename} --type="method_call" / com.nokia.MultipleWindowsIf.launchWindow int32:"#{num}"`
+ end
+ end
+
+ def run_dbus_command_closeevent()
+ #function that calls the dbus-send for close-event application
+ if $path.include?("scratchbox")
+ string = `export DISPLAY=:1; source /tmp/session_bus_address.user; dbus-send --dest=com.nokia.#{@appname} --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
+ else
+ string = `export DISPLAY=:0; source /tmp/session_bus_address.user; dbus-send --dest=com.nokia.#{@appname} --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
+ end
+ end
+
+ def kill_application()
+ #function to kill the running applications
+ puts "going to kill application #{@appname}"
+ system "kill -9 `pgrep #{@appname}`"
+ sleep 1
+ end
+end
--- tests/Meego/TestScripts/ts_prestart.rb
+++ tests/Meego/TestScripts/ts_prestart.rb
+#!/usr/bin/ruby
+#
+# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# Contact: Nokia Corporation (directui at nokia.com)
+#
+# This file is part of applifed.
+#
+# If you have questions regarding the use of this file, please contact
+# Nokia at directui at 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: Testcases for the prestart functionality
+#
+# * Objectives: test the functionality of applifed from
+# the prestart point of view
+#
+
+require 'tdriver'
+require 'date'
+require 'test/unit'
+include TDriverVerify
+
+
+class TC_PrestartTDriverTests < Test::Unit::TestCase
+
+ TIMES_TO_BE_RESTARTED = 3
+ MULTI_APP_PRESTART_TIME = 20
+
+ # method called before any test case
+ def setup
+ #make sure that log file does not exist before the test run
+ if FileTest.exists?("/tmp/applifed-test.log")
+ system "rm /tmp/applifed-test.log"
+ end
+ #kill applications that are already running
+ apps = ['fali_hello',
+ 'fali_toc']
+ for app in apps
+ if system("pgrep #{app}") == true
+ system("kill -9 `pgrep #{app}`")
+ sleep 1
+ system("kill -9 `pgrep #{app}`")
+ end
+ end
+
+ system "mcetool --set-tklock-mode=unlocked"
+ system "pkill -STOP applifed"
+ cmd = '"DISPLAY=:0 applifed --test --log /tmp/applifed-test.log < /usr/share/applifed-M-testscripts/functional.drive &"'
+ system "su - meego -c #{cmd}"
+ @sut = TDriver.sut(:Id=>ARGV[0] || 'sut_qt_maemo')
+
+ sleep 5
+ end
+
+ # method called after any test case for cleanup purposes
+ def teardown
+ system "pkill -CONT applifed"
+ end
+
+ #To test that the application is prestarted by applifed
+
+ def test_prestart
+ $pid = string = `pgrep fali_hello`
+ for i in 1..TIMES_TO_BE_RESTARTED
+ sleep(15)
+ cmd = '"dbus-send --dest=com.nokia.fali_hello --type=\"method_call\" /org/maemo/m com.nokia.MApplicationIf.launch"'
+ system "su - meego -c #{cmd}"
+ sleep(8)
+ @app = @sut.application(:name => 'fali_hello')
+ newpid = string = `pgrep fali_hello`
+ verify_true(30,"Application is not prestarted"){$pid == newpid}
+ @app.MStylableWidget.MButton.tap
+ end
+ end
+
+ #To test that the application is re-prestarted by applifed
+ def test_re_prestart
+ verify_equal(true,30,"Applifed not running"){system "pgrep applifed"}
+
+ pid = string = `pgrep fali_toc`
+
+ sleep(25)
+ cmd ='"dbus-send --dest=com.nokia.fali_toc --type=\"method_call\" /org/maemo/m com.nokia.MApplicationIf.launch"'
+ system "su - meego -c #{cmd}"
+ sleep(8)
+ @app = @sut.application(:name => 'fali_toc')
+
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"Application 'com.nokia.fali_toc' released from prestarted state\" /tmp/applifed-test.log"}
+
+ close_button = @app.MStylableWidget.MButton
+ close_button.tap
+ sleep(15)
+ newpid = string = `pgrep fali_toc`
+ verify_true(30,"Re-prestarting Not done"){pid != newpid}
+
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"Re-prestarting 'com.nokia.fali_toc\" /tmp/applifed-test.log"}
+ end
+
+ #To test that the application is re-prestarted by applifed after they are killed
+ def test_kill_re_prestart
+ verify_equal(true,30,"Applifed not running"){system "pgrep applifed"}
+
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"com.nokia.fali_toc' got registered\" /tmp/applifed-test.log"}
+
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"com.nokia.fali_hello' got registered\" /tmp/applifed-test.log"}
+
+ sleep(10)
+
+ cmd = '"dbus-send --dest=com.nokia.fali_toc --type=\"method_call\" /org/maemo/m com.nokia.MApplicationIf.launch"'
+ system "su - meego -c #{cmd}"
+ sleep (6)
+ cmd1 = '"dbus-send --dest=com.nokia.fali_hello --type=\"method_call\" /org/maemo/m com.nokia.MApplicationIf.launch"'
+ system "su - meego -c #{cmd1}"
+
+ sleep(8)
+
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"Application 'com.nokia.fali_toc' released from prestarted state\" /tmp/applifed-test.log"}
+
+ verify_equal(true,30,"Application not prestarted"){
+ system "grep \"Application 'com.nokia.fali_hello' released from prestarted state\" /tmp/applifed-test.log"}
+
+ pid_toc = string = `pgrep fali_toc`
+ pid_ah = string = `pgrep fali_hello`
+
+ verify_equal(true,30,"fali_toc not killed"){system "pkill fali_toc"}
+ verify_equal(true,30,"fali_hello not killed"){system "pkill fali_hello"}
+ sleep(5)
+
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"'com.nokia.fali_toc' got unregistered..\" /tmp/applifed-test.log"}
+
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"Re-prestarting 'com.nokia.fali_toc\" /tmp/applifed-test.log"}
+
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"'com.nokia.fali_hello' got unregistered..\" /tmp/applifed-test.log"}
+
+ verify_equal(true,30,"Application not Re-prestarted"){
+ system "grep \"Re-prestarting 'com.nokia.fali_hello'\" /tmp/applifed-test.log"}
+ end
+
+
+end
--- tests/Meego/art-tests
+++ tests/Meego/art-tests
+(directory)
--- tests/Meego/art-tests/CMakeLists.txt
+++ tests/Meego/art-tests/CMakeLists.txt
+install(FILES tests.xml DESTINATION /usr/share/applifed-M-art-tests)
+
--- tests/Meego/art-tests/tests.xml
+++ tests/Meego/art-tests/tests.xml
+
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-M-art-test" domain="Application framework">
+
+ <!-- At least one set per suite, name and description mandatory -->
+ <set name="Installation-tests" description="Installation-ok tests" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
+
+ <!-- Possibly some pre-steps to execute before running the test cases -->
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <!-- At least one case per set, name mandatory, description mandatory, other optional -->
+ <!-- At least one step per test, expected_result optional - tells which return code is considered passed -->
+
+ <case name="applifed2" type="Functional" description="Check that exactly one applifed is running" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/tc_applifed_one_instance.rb --name test_only_one_applifed</step>
+ </case>
+
+ <!-- Environments optional - tells where the tests are run -->
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ </set>
+
+ <set name="Applifed-TDriver-Tests" description="Functional tests for applifed with TDriver tool" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_prestart.rb --name test_re_prestart</step>
+ </case>
+ <case name="Prestart" type="Functional" description="To test that the application is prestarted by applifed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_prestart.rb --name test_prestart</step>
+ </case>
+ <case name="Kill-Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed after they are killed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_prestart.rb --name test_kill_re_prestart</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <!--get>
+ <file> /tmp/applifed-test.log</file>
+ </get-->
+ </set>
+ </suite>
+</testdefinition>
+
+
--- tests/Meego/bug-tests
+++ tests/Meego/bug-tests
+(directory)
--- tests/Meego/bug-tests/CMakeLists.txt
+++ tests/Meego/bug-tests/CMakeLists.txt
+install(FILES tests.xml DESTINATION /usr/share/applifed-M-bug-tests)
+
--- tests/Meego/bug-tests/tests.xml
+++ tests/Meego/bug-tests/tests.xml
+
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-M-bug-tests" domain="Application framework">
+
+ <set name="Bug-Tests" description="Functional tests for applifed for multiwindow applications" feature="AF Application pre-starting enhancements" requirement="3O0137">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Multi-Instance-Prestart" type="Functional" description="To test that n number of application is prestarted by applifed" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_prestart.rb --name test_multi_instance_prestart</step>
+ </case>
+ <case name="Periodic-Re-Prestart" type="Functional" description="To test the Periodic re-prestart feature for applifed" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb --name test_periodic_re_prestart</step>
+ </case>
+
+ <case name="Prestart-preventing" type="Functional" description="Test case for prestart preventing" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/tc_prestart_preventing.rb --name test_prestart_preventing</step>
+ </case>
+ <case name="test-whitelist" type="Functional" description="Test for whilelist" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/tc_prestart_preventing.rb --name test_whitelist</step>
+ </case>
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/mw_applifed_result.txt</file>
+ </get>
+ </set>
+
+ </suite>
+</testdefinition>
+
+
--- tests/Meego/functests
+++ tests/Meego/functests
+(directory)
--- tests/Meego/functests/CMakeLists.txt
+++ tests/Meego/functests/CMakeLists.txt
+install(FILES tests.xml DESTINATION /usr/share/applifed-M-functional-tests)
--- tests/Meego/functests/tests.xml
+++ tests/Meego/functests/tests.xml
+
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-M-functioanl-tests" domain="Application framework">
+
+ <!-- At least one set per suite, name and description mandatory -->
+ <set name="Installation-tests" description="Installation-ok tests" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
+
+ <!-- Possibly some pre-steps to execute before running the test cases -->
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ <step>/usr/share/applifed-M-testscripts/cp-service.rb</step>
+ </pre_steps>
+
+ <!-- At least one case per set, name mandatory, description mandatory, other optional -->
+ <!-- At least one step per test, expected_result optional - tells which return code is considered passed -->
+
+ <case name="applifed2" type="Functional" description="Check that exactly one applifed is running" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/tc_applifed_one_instance.rb</step>
+ </case>
+
+ <case name="applifed-daemonized" type="Functional" description="Check that fork parameter works" timeout="120" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/tc_daemonize.rb</step>
+ </case>
+
+ <!-- Environments optional - tells where the tests are run -->
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ </set>
+
+ <set name="Applifed-TDriver-Tests" description="Functional tests for applifed with TDriver tool" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_prestart.rb --name test_re_prestart</step>
+ </case>
+
+ <case name="Prestart" type="Functional" description="To test that the application is prestarted by applifed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_prestart.rb --name test_prestart</step>
+ </case>
+
+ <case name="Kill-Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed after they are killed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_prestart.rb --name test_kill_re_prestart</step>
+ </case>
+
+ <!--This test is diabled for the time being for further investigation.Before enabling it needs some modifications -->
+ <case name="Multi-Instance-Prestart" type="Functional" description="To test that n number of application is prestarted by applifed" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_prestart.rb --name test_multi_instance_prestart</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <!--get>
+ <file> /tmp/applifed-test.log</file>
+ </get-->
+ </set>
+
+ <set name="Multiwindow-Tests" description="Functional tests for applifed for multiwindow applications" feature="AF Application pre-starting enhancements" requirement="3O0137">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="MW3_Prestart" type="Functional" description="Test for a multiwindow application inherited from MApplication tested" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_mwtests.rb --name test_mw3_prestart</step>
+ </case>
+ <case name="MW3_Switcher" type="Functional" description="Test that all window of a multiwindow application exists in the switcher" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_mwtests.rb --name test_mw3_switcher</step>
+ </case>
+ <case name="MW2_Re_Prestart" type="Functional" description="Test for multiwindow re-prestart" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_mwtests.rb --name test_mw2_close</step>
+ </case>
+ <case name="MW1_Content" type="Functional" description="Test for multiwindow contents" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_mwtests.rb --name test_mw1_content</step>
+ </case>
+ <case name="MW1_Prestart" type="Functional" description="Test for multiwindow prestart and lazy shutdown" timeout="360" level="System" insignificant="true">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_mwtests.rb --name test_mw1_close</step>
+ </case>
+ <case name="CloseEvent_Prestart" type="Functional" description="Test to hide and close a prestarted application" timeout="360" level="System" insignificant="false">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/ts_mwtests.rb --name test_close_event</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/mw_applifed_result.txt</file>
+ </get>
+ </set>
+
+ <set name="CPU_LOAD_TESTS" description="Functional tests for applifed for cpu load prestarting" feature="AF Application pre-starting enhancements" requirement="3O0137">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="LOW_CPULOAD" type="Functional" description="Test that a applications are prestarted when the cpu load is lower than threshold value" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/cpu_load/tc_cpu_load.rb --name test_cpu_load_low</step>
+ </case>
+ <case name="HIGH_CPULOAD" type="Functional" description="Test that applications are not prestarted when the cpu load is higher than threshold value" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 ruby /usr/share/applifed-M-testscripts/cpu_load/tc_cpu_load.rb --name test_cpu_load_high</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/cpuload_low.log</file>
+ <file> /tmp/cpuload_high.log</file>
+ </get>
+ </set>
+
+
+ </suite>
+</testdefinition>
+
+
--- tests/Meego/perftests
+++ tests/Meego/perftests
+(directory)
--- tests/Meego/perftests/CMakeLists.txt
+++ tests/Meego/perftests/CMakeLists.txt
+install(FILES tests.xml DESTINATION /usr/share/applifed-M-performance-tests)
--- tests/Meego/perftests/tests.xml
+++ tests/Meego/perftests/tests.xml
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-M-performance-tests" domain="Application framework">
+
+ <set name="commandline-startup" description="Applifed prestart performance tests" feature="AF Application prestarting functionality" requirement="300105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="PerfTest1" type="Performance" description="Measure prestart performance" timeout="360" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applifed-M-testscripts/test-perf-prestart.py -a /usr/bin/fali_perf > /tmp/prestart_perf.txt</step>
+ </case>
+
+ <!-- Swap tests commented off temporalily -->
+
+ <!-- <case name="SwapOn" type="Performance" description="Turn the swap on" timeout="360" level="System">
+ <step expected_result="0">modprobe mtdswap partitions=4</step>
+ <step expected_result="0">swapon /dev/mtdswap4</step>
+ <step expected_result="0">[ $(free |grep Swap | awk '{print $2}') -gt 256000 ]</step>
+ </case>
+
+ <case name="Prestart2" type="Performance" description="Measure prestart performance when everything is swapped" timeout="1200" level="System">
+ <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applifed-M-testscripts/test-perf-prestart.py -a /usr/bin/fali_perf -s > /tmp/prestart_perf_swap_on.txt</step>
+ </case> -->
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/prestart_perf.txt</file>
+ <!-- <file>/tmp/prestart_perf_swap_on.txt</file> -->
+ </get>
+ </set>
+
+ <set name="AppGrid-startup" description="Prestart startup time from application grid" feature="AF Application prestarting functionality" requirement="300105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Prestart_grid" type="Performance" description="Measure prestarted application startup application grid" timeout="500" 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 fali_hello1 -p "fali_hello1 -prestart &" -b "fali_hello1" > /tmp/perf_prestart_grid.txt</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/perf_prestart_grid.txt</file>
+ </get>
+ </set>
+
+ <set name="Commandline-startup" description="Prestart startup time from command line" feature="AF Application prestarting functionality" requirement="300105">
+ <pre_steps>
+ <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
+ </pre_steps>
+
+ <case name="Prestart_command_line" type="Performance" description="Measure prestarted application startup from command line" timeout="500" 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 "dbus-send --dest=com.nokia.fali_hello1 --type=\"method_call\" /org/maemo/m com.nokia.MApplicationIf.launch" -p "fali_hello1 -prestart &" -b "fali_hello1" > /tmp/perf_prestart_command_line.txt</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ <get>
+ <file>/tmp/perf_prestart_command_line.txt</file>
+ </get>
+ </set>
+
+ </suite>
+</testdefinition>
+
+
--- tests/Meego/unit-tests
+++ tests/Meego/unit-tests
+(directory)
--- tests/Meego/unit-tests/CMakeLists.txt
+++ tests/Meego/unit-tests/CMakeLists.txt
+install(FILES tests.xml DESTINATION /usr/share/applifed-M-tests)
+
--- tests/Meego/unit-tests/tests.xml
+++ tests/Meego/unit-tests/tests.xml
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<testdefinition version="0.1">
+
+<!-- Test suite, name mandatory - the same as test package name -->
+ <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
+ <suite name="applifed-tests" domain="Application framework">
+
+ <!-- At least one set per suite, name and description mandatory -->
+ <set name="Unit-tests" description="Unit tests for applifed" feature="AF Application prestarting functionality (basic)" requirement="300105">
+
+ <!-- At least one case per set, name mandatory, description mandatory, other optional -->
+ <!-- At least one step per test, expected_result optional - tells which return code is considered passed -->
+
+ <case name="Prestarter" type="Functional" description="Unit tests for Prestarter class" level="Component" timeout="20">
+ <step expected_result="0">su - meego -c "source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-tests/ut_prestarter"</step>
+ </case>
+
+ <case name="PrestartApp" type="Functional" description="Unit tests for PrestartApp class" level="Component" timeout="20">
+ <step expected_result="0">su - meego -c "source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-tests/ut_prestartapp"</step>
+ </case>
+
+ <case name="ConfigData" type="Functional" description="Unit tests for ConfigData class" level="Component" timeout="20">
+ <step expected_result="0">su - meego -c "source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-tests/ut_configdata"</step>
+ </case>
+
+ <case name="CPULoad" type="Functional" description="Unit tests for CPULoad class" level="Component" timeout="20">
+ <step expected_result="0">su - meego -c "source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-tests/ut_cpuload"</step>
+ </case>
+
+ <!-- Environments optional - tells where the tests are run -->
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ </set>
+
+ <set name="Unit-tests_for_CPU_load" description="Unit tests for applifed CPU load feature" feature="AF Application pre-starting enhancements" requirement="300137">
+
+ <!-- At least one case per set, name mandatory, description mandatory, other optional -->
+ <!-- At least one step per test, expected_result optional - tells which return code is considered passed -->
+
+ <case name="ConfigData" type="Functional" description="Unit tests for ConfigData class" level="Component" timeout="20">
+ <step expected_result="0">su - meego -c "source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-tests/ut_configdata"</step>
+ </case>
+
+ <!-- Environments optional - tells where the tests are run -->
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ </set>
+
+ </suite>
+</testdefinition>
+
+
--- tests/TestApps
+++ tests/TestApps
-(directory)
--- tests/TestApps/CMakeLists.txt
+++ tests/TestApps/CMakeLists.txt
-# Find MeeGo Touch libraries for the test programs using pkg-config
-include(FindPkgConfig)
-pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MEEGOTOUCH_INCLUDE_DIRS})
-
-# Sub build: fali_multiapp
-add_subdirectory(fali_multiapp)
-
-# Sub build: fali_hello
-add_subdirectory(fali_hello)
-
-# Sub build: fali_toc
-add_subdirectory(fali_toc)
-
-# Sub build: multiwindow_apps
-add_subdirectory(multiwindow_apps)
-
-# Sub build: memoryhog
-add_subdirectory(memoryhog)
-
--- tests/TestApps/fali_hello
+++ tests/TestApps/fali_hello
-(directory)
--- tests/TestApps/fali_hello/CMakeLists.txt
+++ tests/TestApps/fali_hello/CMakeLists.txt
-include(FindPkgConfig)
-pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MEEGOTOUCH_INCLUDE_DIRS})
-
-project(HelloWorld)
-
-# Set sources
-set(HelloWorldSRC fali_hello.cpp)
-
-# Set moc headers
-#set(HelloWorld_MOC_HDRS)
-# Run moc
-#qt4_wrap_cpp(HelloWorld_MOC_SRC ${HelloWorld_MOC_HDRS})
-
-link_libraries(${MEEGOTOUCH_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY})
-
-include(${QT_USE_FILE})
-
-add_executable(fali_hello ${HelloWorldSRC} ${HelloWorld_MOC_SRC})
-add_executable(fali_perf ${HelloWorldSRC} ${HelloWorld_MOC_SRC})
-
-set_target_properties(fali_perf PROPERTIES COMPILE_DEFINITIONS PERF)
-
-# Install
-install(PROGRAMS fali_hello DESTINATION /usr/bin/)
-install(PROGRAMS fali_perf DESTINATION /usr/bin/)
-
-install(FILES com.nokia.fali_hello.service DESTINATION /usr/share/dbus-1/services/)
-install(FILES com.nokia.fali_hello.service.sb DESTINATION /usr/share/applifed-testscripts/sbservice/)
-install(FILES com.nokia.fali_perf.service DESTINATION /usr/share/dbus-1/services/)
-install(FILES fali_hello.desktop DESTINATION /usr/share/applications/)
-
--- tests/TestApps/fali_hello/com.nokia.fali_hello.service
+++ tests/TestApps/fali_hello/com.nokia.fali_hello.service
(renamed to tests/Common/TestApps/fali_hello/com.nokia.fali_hello.service)
--- tests/TestApps/fali_hello/com.nokia.fali_hello.service.sb
+++ tests/TestApps/fali_hello/com.nokia.fali_hello.service.sb
(renamed to tests/Common/TestApps/fali_hello/com.nokia.fali_hello.service.sb)
--- tests/TestApps/fali_hello/com.nokia.fali_perf.service
+++ tests/TestApps/fali_hello/com.nokia.fali_perf.service
-[D-BUS Service]
-Name=com.nokia.fali_perf
-Exec=/usr/bin/fali_perf -prestart
--- tests/TestApps/fali_hello/fali_hello.cpp
+++ tests/TestApps/fali_hello/fali_hello.cpp
-#include <MApplication>
-#include <MApplicationService>
-#include <MApplicationWindow>
-#include <MApplicationPage>
-#include <QDebug>
-#include <QString>
-#include <QFile>
-#include <sys/time.h>
-#include <vector>
-
-#ifdef PERF
-const char *serviceName = "com.nokia.fali_perf";
-const char *appName = "fali_perf";
-#else
-const char *serviceName = "com.nokia.fali_hello";
-const char *appName = "fali_hello";
-#endif
-
-void FANGORNLOG(const char* s)
-{
-#ifdef PERF
- QFile f("/tmp/applifed_perftest.log");
- f.open(QIODevice::Append);
- f.write(s, qstrlen(s));
- f.write("\n", 1);
- f.close();
-#endif
-}
-
-void timestamp(const char *s)
-{
-#ifdef PERF
- timeval tim;
- char msg[80];
- gettimeofday(&tim, NULL);
- snprintf(msg, 80, "%d.%06d %s\n",
- static_cast<int>(tim.tv_sec), static_cast<int>(tim.tv_usec), s);
- FANGORNLOG(msg);
-#endif
-}
-
-class MyApplicationService: public MApplicationService
-{
-public:
-
- MyApplicationService( QObject *parent=0 ) :
- MApplicationService( serviceName, parent )
- {}
-
- void handleServiceRegistrationFailure()
- {
- qDebug() << "MyApplicationService::handleServiceRegistrationFailure()";
-
- incrementAndRegister();
- }
-};
-
-class MyApplicationPage: public MApplicationPage
-{
-public:
- MyApplicationPage() :
- MApplicationPage()
- {
- }
-
- virtual ~MyApplicationPage()
- {
- }
-
- void enterDisplayEvent()
- {
- timestamp("MyApplicationPage::enterDisplayEvent()");
- }
-};
-
-int main(int argc, char ** argv)
-{
- timestamp("main()");
-
- MApplication app(argc, argv, appName, new MyApplicationService());
- MApplication::setPrestartMode(M::LazyShutdown);
-
- MApplicationWindow window;
- MyApplicationPage mainPage;
-
- window.show();
-
- mainPage.setTitle("Hello World! (Now supports prestarting)");
- mainPage.appear();
-
- return app.exec();
-}
--- tests/TestApps/fali_hello/fali_hello.desktop
+++ tests/TestApps/fali_hello/fali_hello.desktop
-[Desktop Entry]
-Type=Application
-Name=Applifed FT Helloworld
-Icon=icon-l-video
-Exec=fali_hello
-X-Maemo-Service=com.nokia.fali_hello
-Categories=X-MeeGo;Demos;
-OnlyShowIn=X-MeeGo;
--- tests/TestApps/fali_hello/helloworld.pro
+++ tests/TestApps/fali_hello/helloworld.pro
(renamed to tests/Common/TestApps/fali_hello/helloworld.pro)
--- tests/TestApps/fali_multiapp
+++ tests/TestApps/fali_multiapp
-(directory)
--- tests/TestApps/fali_multiapp/CMakeLists.txt
+++ tests/TestApps/fali_multiapp/CMakeLists.txt
(renamed to tests/Common/TestApps/fali_multiapp/CMakeLists.txt)
--- tests/TestApps/fali_multiapp/fali_multiapp.cpp
+++ tests/TestApps/fali_multiapp/fali_multiapp.cpp
(renamed to tests/Common/TestApps/fali_multiapp/fali_multiapp.cpp)
--- tests/TestApps/fali_toc
+++ tests/TestApps/fali_toc
-(directory)
--- tests/TestApps/fali_toc/CMakeLists.txt
+++ tests/TestApps/fali_toc/CMakeLists.txt
(renamed to tests/Common/TestApps/fali_toc/CMakeLists.txt)
--- tests/TestApps/fali_toc/com.nokia.fali_toc.service
+++ tests/TestApps/fali_toc/com.nokia.fali_toc.service
(renamed to tests/Common/TestApps/fali_toc/com.nokia.fali_toc.service)
--- tests/TestApps/fali_toc/com.nokia.fali_toc.service.sb
+++ tests/TestApps/fali_toc/com.nokia.fali_toc.service.sb
(renamed to tests/Common/TestApps/fali_toc/com.nokia.fali_toc.service.sb)
--- tests/TestApps/fali_toc/fali_toc.cpp
+++ tests/TestApps/fali_toc/fali_toc.cpp
-#include <MApplication>
-#include <MApplicationWindow>
-#include <MApplicationPage>
-#include <MApplicationService>
-
-int main(int argc, char ** argv)
-{
- MApplication app(argc, argv, "fali_toc", new MApplicationService ("com.nokia.fali_toc") );
- MApplicationPage mainPage;
- MApplicationWindow window;
-
- MApplication::setPrestartMode(M::TerminateOnClose);
-
- sleep(4);
-
- window.show();
-
- mainPage.setTitle("Terminate on close-app");
- mainPage.appear();
-
- return app.exec();
-}
--- tests/TestApps/fali_toc/fali_toc.desktop
+++ tests/TestApps/fali_toc/fali_toc.desktop
(renamed to tests/Common/TestApps/fali_toc/fali_toc.desktop)
--- tests/TestApps/fali_toc/fali_toc.pro
+++ tests/TestApps/fali_toc/fali_toc.pro
(renamed to tests/Common/TestApps/fali_toc/fali_toc.pro)
--- tests/TestApps/memoryhog
+++ tests/TestApps/memoryhog
-(directory)
--- tests/TestApps/memoryhog/CMakeLists.txt
+++ tests/TestApps/memoryhog/CMakeLists.txt
(renamed to tests/Common/TestApps/memoryhog/CMakeLists.txt)
--- tests/TestApps/memoryhog/memoryhog.c
+++ tests/TestApps/memoryhog/memoryhog.c
(renamed to tests/Common/TestApps/memoryhog/memoryhog.c)
--- tests/TestApps/memoryhog/memoryhog.pro
+++ tests/TestApps/memoryhog/memoryhog.pro
(renamed to tests/Common/TestApps/memoryhog/memoryhog.pro)
--- tests/TestApps/multiwindow_apps
+++ tests/TestApps/multiwindow_apps
-(directory)
--- tests/TestApps/multiwindow_apps/CMakeLists.txt
+++ tests/TestApps/multiwindow_apps/CMakeLists.txt
(renamed to tests/Common/TestApps/multiwindow_apps/CMakeLists.txt)
--- tests/TestApps/multiwindow_apps/close-event
+++ tests/TestApps/multiwindow_apps/close-event
-(directory)
--- tests/TestApps/multiwindow_apps/close-event/CMakeLists.txt
+++ tests/TestApps/multiwindow_apps/close-event/CMakeLists.txt
(renamed to tests/Common/TestApps/multiwindow_apps/close-event/CMakeLists.txt)
--- tests/TestApps/multiwindow_apps/close-event/close-event.pro
+++ tests/TestApps/multiwindow_apps/close-event/close-event.pro
(renamed to tests/Common/TestApps/multiwindow_apps/close-event/close-event.pro)
--- tests/TestApps/multiwindow_apps/close-event/main.cpp
+++ tests/TestApps/multiwindow_apps/close-event/main.cpp
-#include <MApplication>
-#include <MApplicationWindow>
-#include <MApplicationPage>
-#include <MComboBox>
-#include <MDebug>
-#include <QStringList>
-
-class MyWindow : public MApplicationWindow
-{
-public:
- MyWindow();
-
-protected:
- //! \reimp
- virtual void closeEvent(QCloseEvent *event);
-
-private:
- MApplicationPage *page;
- MComboBox *comboBox;
-};
-
-
-MyWindow::MyWindow()
-{
- page=new MApplicationPage();
- page->setTitle("closeEvent example app");
-
- comboBox = new MComboBox();
- comboBox->setTitle("What should closeEvent do?");
- QStringList stringList;
- stringList << "Ignore closeEvent" << "Hide window (Lazy Shutdown)" << "Really close window";
- comboBox->addItems(stringList);
- page->setCentralWidget(comboBox);
- page->appear();
-}
-
-void MyWindow::closeEvent(QCloseEvent *event)
-{
- switch (comboBox->currentIndex()) {
- case 0:
- mDebug("MyWindow") << "Ignore closeEvent(). Window is not closed.";
- event->ignore();
- break;
- case 1:
- mDebug("MyWindow") << "Lazy shutdown - hide window";
- setCloseOnLazyShutdown(false);
- event->accept();
- break;
- case 2:
- default:
- mDebug("MyWindow") << "Really close window";
- setCloseOnLazyShutdown(true);
- event->accept();
- break;
- }
-}
-
-int main(int argc, char **argv)
-{
- MApplication app(argc, argv);
- MApplication::setPrestartMode(M::LazyShutdown);
-
- MyWindow *window = new MyWindow();
- window->show();
-
- return app.exec();
-}
--- tests/TestApps/multiwindow_apps/multiplewindows1
+++ tests/TestApps/multiwindow_apps/multiplewindows1
-(directory)
--- tests/TestApps/multiwindow_apps/multiplewindows1/CMakeLists.txt
+++ tests/TestApps/multiwindow_apps/multiplewindows1/CMakeLists.txt
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/CMakeLists.txt)
--- tests/TestApps/multiwindow_apps/multiplewindows1/README.TXT
+++ tests/TestApps/multiwindow_apps/multiplewindows1/README.TXT
-README
-------
-
-Multiwindow test application that support also prestarting. Prestart support is implemented
-using the inheritance approach (custom application inherited from MApplication).
-Used mode is M::LazyShutdownMultiWindow, so the application never *really*
-exits. Only the windows are hidden and reseted.
-
-Build the target and installs all relevant files to system:
-
-qmake
-make
-make install
-
-Command to launch application to specific window, last paramater is the windowId to show:
-dbus-send --dest=com.nokia.MultiWindow1 --type="method_call" / com.nokia.MultipleWindowsIf.launchWindow int32:"2"
-
-Application supports 3 windowIds (1, 2 and 3).
-Application can be started with the switch "-output-level debug" to get information what happens inside it.
-
--- tests/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw1.service
+++ tests/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw1.service
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw1.service)
--- tests/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw2.service
+++ tests/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw2.service
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/com.nokia.fali_mw2.service)
--- tests/TestApps/multiwindow_apps/multiplewindows1/main.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows1/main.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of applifed.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at 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.
-**
-****************************************************************************/
-
-#include "multiwindowapplication.h"
-#include <MApplication>
-
-int main(int argc, char **argv)
-{
- QString appName(argv[0]);
- int retval = 1;
-
- if (appName.endsWith("fali_mw1"))
- {
- MultiWindowApplication app(argc, argv, "com.nokia.fali_mw1");
- MApplication::setPrestartMode(M::LazyShutdownMultiWindow);
- retval = app.exec();
- }
- else if (appName.endsWith("fali_mw2"))
- {
- MultiWindowApplication app(argc, argv, "com.nokia.fali_mw2");
- MApplication::setPrestartMode(M::TerminateOnCloseMultiWindow);
- retval = app.exec();
- }
- else
- {
- qWarning("Unrecognized executable name!");
- }
-
- return retval;
-}
--- tests/TestApps/multiwindow_apps/multiplewindows1/mainpage.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows1/mainpage.cpp
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/mainpage.cpp)
--- tests/TestApps/multiwindow_apps/multiplewindows1/mainpage.h
+++ tests/TestApps/multiwindow_apps/multiplewindows1/mainpage.h
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/mainpage.h)
--- tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindows.xml
+++ tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindows.xml
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="com.nokia.MultipleWindowsIf">
-
- <method name="launchWindow">
- <arg name="windowId" type="i" direction="in"/>
- </method>
-
- </interface>
-</node>
--- tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindows1.pro
+++ tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindows1.pro
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindows1.pro)
--- tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of applifed.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at 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.
-**
-****************************************************************************/
-
-#include "multiplewindowsifadaptor.h"
-#include <QtCore/QMetaObject>
-#include <QtCore/QByteArray>
-#include <QtCore/QList>
-#include <QtCore/QMap>
-#include <QtCore/QString>
-#include <QtCore/QStringList>
-#include <QtCore/QVariant>
-
-/*
- * Implementation of adaptor class MultipleWindowsIfAdaptor
- */
-
-MultipleWindowsIfAdaptor::MultipleWindowsIfAdaptor(QObject *parent)
- : QDBusAbstractAdaptor(parent)
-{
- // constructor
- setAutoRelaySignals(true);
-}
-
-MultipleWindowsIfAdaptor::~MultipleWindowsIfAdaptor()
-{
- // destructor
-}
-
-void MultipleWindowsIfAdaptor::launchWindow(int windowId)
-{
- // handle method call com.nokia.MultipleWindowsIf.launchWindow
- QMetaObject::invokeMethod(parent(), "launchWindow", Q_ARG(int, windowId));
-}
-
--- tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.h
+++ tests/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of applifed.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at 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.
-**
-****************************************************************************/
-
-#ifndef MULTIPLEWINDOWSIFADAPTOR_H_1268830284
-#define MULTIPLEWINDOWSIFADAPTOR_H_1268830284
-
-#include <QtCore/QObject>
-#include <QtDBus/QtDBus>
-class QByteArray;
-template<class T> class QList;
-template<class Key, class Value> class QMap;
-class QString;
-class QStringList;
-class QVariant;
-
-/*
- * Adaptor class for interface com.nokia.MultipleWindowsIf
- */
-class MultipleWindowsIfAdaptor: public QDBusAbstractAdaptor
-{
- Q_OBJECT
- Q_CLASSINFO("D-Bus Interface", "com.nokia.MultipleWindowsIf")
- Q_CLASSINFO("D-Bus Introspection", ""
-" <interface name=\"com.nokia.MultipleWindowsIf\">\n"
-" <method name=\"launchWindow\">\n"
-" <arg direction=\"in\" type=\"i\" name=\"windowId\"/>\n"
-" </method>\n"
-" </interface>\n"
- "")
-public:
- MultipleWindowsIfAdaptor(QObject *parent);
- virtual ~MultipleWindowsIfAdaptor();
-
-public: // PROPERTIES
-public Q_SLOTS: // METHODS
- void launchWindow(int windowId);
-Q_SIGNALS: // SIGNALS
-};
-
-#endif
--- tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowapplication.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowapplication.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of applifed.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at 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.
-**
-****************************************************************************/
-
-#include "multiwindowapplication.h"
-#include "multiwindowservice.h"
-#include "mainpage.h"
-
-#include <MDebug>
-
-MultiWindowApplication::MultiWindowApplication(int argc, char ** argv,
- const QString &serviceName) :
- MApplication(argc, argv),
- m_service(new MultiWindowService(this, serviceName))
-{
- // Create windows
- for (int i = 0; i < NUM_WINDOWS; i++) {
- m_window[i] = QSharedPointer<MApplicationWindow>(new MApplicationWindow);
- m_window[i].data()->setWindowTitle(QString("Window %1").arg(i + 1));
- m_window[i].data()->setObjectName(QString("Window %1").arg(i + 1));
- }
-
- // Create pages
- for (int i = 0; i < NUM_WINDOWS; i++)
- m_mainPage[i] = QSharedPointer<MainPage>(new MainPage(QString("Window %1").arg(i + 1)));
-}
-
-void MultiWindowApplication::activateWindow(int index)
-{
- index--;
- if (index >= 0 && index < NUM_WINDOWS) {
-
- // Force release from prestart if in prestarted state.
- // This is important.
- if (isPrestarted()) {
- setPrestarted(false);
- }
-
- // Show the desired window
- m_window[index]->show();
- m_window[index]->activateWindow();
- m_window[index]->raise();
-
- // Show the page and activate it. Note: we have to specify on
- // what window the page is to appear. Apparently there's something
- // funny going on somewhere far far away, because the window
- // we think is active might really not be active at this point of time.
- // So if the window is not specified, the page might actually
- // end up in the previous window.
- m_mainPage[index]->appear(m_window[index].data());
- m_mainPage[index]->activateWidgets();
- }
-}
-
-void MultiWindowApplication::releasePrestart()
-{
- mDebug("MultiWindowApplication") << "Prestart released";
-}
-
-void MultiWindowApplication::restorePrestart()
-{
- resetAndStopWidgets();
-
- mDebug("MultiWindowApplication") << "Prestart restored";
-}
-
-void MultiWindowApplication::resetAndStopWidgets()
-{
- // Reset and stop all widgets of all pages here
- for (int i = 0; i < NUM_WINDOWS; i++)
- m_mainPage[i]->stopAndResetWidgets();
-}
-
-MultiWindowApplication::~MultiWindowApplication()
-{}
-
--- tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowapplication.h
+++ tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowapplication.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of applifed.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at 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.
-**
-****************************************************************************/
-
-#ifndef MULTIWINDOWAPPLICATION_H
-#define MULTIWINDOWAPPLICATION_H
-
-#include <MApplication>
-#include <MApplicationWindow>
-
-#include <QSharedPointer>
-
-#include "mainpage.h"
-#include "multiwindowservice.h"
-
-class MultiWindowApplication : public MApplication
-{
-public:
- static const int NUM_WINDOWS = 3;
-
- MultiWindowApplication(int argc, char ** argv,
- const QString &serviceName);
- virtual ~MultiWindowApplication();
- void activateWindow(int index);
-
-protected:
-
- //! \reimp
- virtual void releasePrestart();
-
- //! \reimp
- virtual void restorePrestart();
-
-private:
- void resetAndStopWidgets();
-
- QSharedPointer<MApplicationWindow> m_window[NUM_WINDOWS];
- QSharedPointer<MainPage> m_mainPage[NUM_WINDOWS];
-
- // D-Bus service to show a specific window. Showing a window also causes the
- // application to get released from the prestarted state.
- QSharedPointer<MultiWindowService> m_service;
-};
-
-#endif // MULTIWINDOWAPPLICATION_H
--- tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.cpp
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.cpp)
--- tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.h
+++ tests/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.h
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiwindowservice.h)
--- tests/TestApps/multiwindow_apps/multiplewindows3
+++ tests/TestApps/multiwindow_apps/multiplewindows3
-(directory)
--- tests/TestApps/multiwindow_apps/multiplewindows3/CMakeLists.txt
+++ tests/TestApps/multiwindow_apps/multiplewindows3/CMakeLists.txt
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/CMakeLists.txt)
--- tests/TestApps/multiwindow_apps/multiplewindows3/README.TXT
+++ tests/TestApps/multiwindow_apps/multiplewindows3/README.TXT
-Multiwindow test application that support also prestarting.
-
-Build the target and installs all relevant files to system:
-
-qmake
-make install
-
-Command to launch application to specific window, last paramater is the windowid:
-dbus-send --dest=com.nokia.MultiWindow3 --type="method_call" / com.nokia.MultipleWindowsIf.launchWindow int32:"2"
-
-Application supports 3 windowIds (1, 2 and 3).
-
-Window 3 is inherited from the MApplication window and it shows an example how to override windows
-closeEvent.
-
-Application could be started with the switch "-output-level debug" to get information what happens inside it.
-
-
-
--- tests/TestApps/multiwindow_apps/multiplewindows3/com.nokia.fali_mw3.service
+++ tests/TestApps/multiwindow_apps/multiplewindows3/com.nokia.fali_mw3.service
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/com.nokia.fali_mw3.service)
--- tests/TestApps/multiwindow_apps/multiplewindows3/main.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows3/main.cpp
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/main.cpp)
--- tests/TestApps/multiwindow_apps/multiplewindows3/mainpage.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows3/mainpage.cpp
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/mainpage.cpp)
--- tests/TestApps/multiwindow_apps/multiplewindows3/mainpage.h
+++ tests/TestApps/multiwindow_apps/multiplewindows3/mainpage.h
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/mainpage.h)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multi1.desktop
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multi1.desktop
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi1.desktop)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multi2.desktop
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multi2.desktop
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi2.desktop)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multi3.desktop
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multi3.desktop
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/multi3.desktop)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindows.xml
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindows.xml
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindows.xml)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindows3.pro
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindows3.pro
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiplewindows3.pro)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.cpp
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.cpp)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.h
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multiplewindowsifadaptor.h
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows1/multiplewindowsifadaptor.h)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.cpp
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.cpp)
--- tests/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.h
+++ tests/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.h
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/multiwindowservice.h)
--- tests/TestApps/multiwindow_apps/multiplewindows3/mywindow.cpp
+++ tests/TestApps/multiwindow_apps/multiplewindows3/mywindow.cpp
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/mywindow.cpp)
--- tests/TestApps/multiwindow_apps/multiplewindows3/mywindow.h
+++ tests/TestApps/multiwindow_apps/multiplewindows3/mywindow.h
(renamed to tests/Common/TestApps/multiwindow_apps/multiplewindows3/mywindow.h)
--- tests/TestScripts
+++ tests/TestScripts
-(directory)
--- tests/TestScripts/CMakeLists.txt
+++ tests/TestScripts/CMakeLists.txt
-# Find MeeGo Touch libraries for the test programs using pkg-config
-include(FindPkgConfig)
-pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MEEGOTOUCH_INCLUDE_DIRS})
-
-add_subdirectory(cpu_load)
-add_subdirectory(periodic_re_prestart)
-
-install(FILES functional.drive fautils.rb test-perf-prestart.py
- DESTINATION /usr/share/applifed-testscripts)
-
-install(PROGRAMS tc_applifed_one_instance.rb cp-service.rb ts_prestart.rb
- ts_mwtests.rb tc_daemonize.rb
- tc_prestart_preventing.rb
- DESTINATION /usr/share/applifed-testscripts)
-
-install(FILES
- functest_applifed.conf
- prevent.conf
- prevent.drive
- DESTINATION /usr/share/applifed-testscripts)
--- tests/TestScripts/cp-service.rb
+++ tests/TestScripts/cp-service.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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.
-#
-
-$path = string = `echo $PATH `
-if $path.include?("scratchbox")
- system("cp /usr/share/applifed-testscript/sbservice/com.nokia.fali_hello.service.sb /usr/share/dbus-1/services/com.nokia.fali_hello.service")
- system("cp /usr/share/applifed-testscript/sbservice/com.nokia.fali_toc.service.sb /usr/share/dbus-1/services/com.nokia.fali_toc.service")
-end
--- tests/TestScripts/cpu_load
+++ tests/TestScripts/cpu_load
-(directory)
--- tests/TestScripts/cpu_load/CMakeLists.txt
+++ tests/TestScripts/cpu_load/CMakeLists.txt
-install(FILES cpu_load_high.drive cpu_load_low.drive DESTINATION /usr/share/applifed-testscripts/cpu_load)
-
-install(PROGRAMS tc_cpu_load.rb DESTINATION /usr/share/applifed-testscripts/cpu_load)
-
-install(FILES cpu_load.conf DESTINATION /usr/share/applifed-testscripts/cpu_load)
-
--- tests/TestScripts/cpu_load/cpu_load.conf
+++ tests/TestScripts/cpu_load/cpu_load.conf
(renamed to tests/Harmattan/TestScripts/cpu_load/cpu_load.conf)
--- tests/TestScripts/cpu_load/cpu_load_high.drive
+++ tests/TestScripts/cpu_load/cpu_load_high.drive
(renamed to tests/Harmattan/TestScripts/cpu_load/cpu_load_high.drive)
--- tests/TestScripts/cpu_load/cpu_load_low.drive
+++ tests/TestScripts/cpu_load/cpu_load_low.drive
(renamed to tests/Harmattan/TestScripts/cpu_load/cpu_load_low.drive)
--- tests/TestScripts/cpu_load/tc_cpu_load.rb
+++ tests/TestScripts/cpu_load/tc_cpu_load.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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: Testcases for the prestart functionality
-#
-# * Objectives: To test that applications are prestarted based
-# on the cpu load.
-#
-
-require 'tdriver'
-require 'test/unit'
-include TDriverVerify
-
-
-class TC_CpuLoadTests < Test::Unit::TestCase
-
- $path = string = `echo $PATH `
- # method called before any test case
- def setup
- if $path.include?("scratchbox")
- puts "Inside SB, Do Nothing to unlock"
- else
- system "mcetool --set-tklock-mode=unlocked"
- end
- apps = ['fali_hello',
- 'fali_mw2',
- 'fali_toc']
-
- for app in apps
- if system("pgrep #{app}") == true
- system("kill -9 `pgrep #{app}`")
- sleep 1
- system("kill -9 `pgrep #{app}`")
- end
- end
- end
-
- # method called after any test case for cleanup purposes
- def teardown
- end
-
- # Test that a applications are prestarted when the cpu
- # load is lower than threshold value
- def test_cpu_load_low
- if FileTest.exists?("/tmp/cpuload_low.log")
- system "rm /tmp/cpuload_low.log"
- end
-
- if $path.include?("scratchbox")
- system "source /tmp/session_bus_address.user; DISPLAY=:1 applifed --test --log /tmp/cpuload_low.log < /usr/share/applifed-testscripts/cpu_load/cpu_load_low.drive &"
- else
- system "source /tmp/session_bus_address.user; DISPLAY=:0 applifed --test --log /tmp/cpuload_low.log < /usr/share/applifed-testscripts/cpu_load/cpu_load_low.drive &"
- end
- sleep 6
-
- verify_equal(true,30,"Application not prestarted"){
- system "grep \"Prestarting 'com.nokia.fali_toc', priority=1\" /tmp/cpuload_low.log"}
-
- verify_equal(true,2,"Application not prestarted"){
- system "grep \"'com.nokia.fali_hello' got registered\" /tmp/cpuload_low.log"}
-
- verify_equal(true,2,"Application not prestarted"){
- system "grep \"Prestarting 'com.nokia.fali_mw2', priority=2\" /tmp/cpuload_low.log"}
-
- verify_equal(true,2,"Application not prestarted"){
- system "grep \"'com.nokia.fali_toc' got registered\" /tmp/cpuload_low.log"}
-
- verify_equal(true,2,"Application not prestarted"){
- system "grep \"Prestarting 'com.nokia.fali_hello', priority=3\" /tmp/cpuload_low.log"}
-
- verify_equal(true,2,"Application not prestarted"){
- system "grep \"'com.nokia.fali_mw2' got registered\" /tmp/cpuload_low.log"}
- end
-
- # Test that applications are not prestarted when the cpu
- # load is higher than threshold value
- def test_cpu_load_high
- if FileTest.exists?("/tmp/cpuload_high.log")
- system "rm /tmp/cpuload_high.log"
- end
-
- if $path.include?("scratchbox")
- system "source /tmp/session_bus_address.user; DISPLAY=:1 applifed --test --log /tmp/cpuload_high.log < /usr/share/applifed-testscripts/cpu_load/cpu_load_high.drive &"
- else
- system "source /tmp/session_bus_address.user; DISPLAY=:0 applifed --test --log /tmp/cpuload_high.log < /usr/share/applifed-testscripts/cpu_load/cpu_load_high.drive &"
- end
- sleep 6
-
- verify_equal(false,2,"Application is prestarted"){
- system "grep \"Prestarting 'com.nokia.fali_hello', priority=3\" /tmp/cpuload_high.log"}
-
- verify_equal(false,2,"Application is prestarted"){
- system "grep \"Prestarting 'com.nokia.fali_toc', priority=1\" /tmp/cpuload_high.log"}
-
- verify_equal(false,2,"Application is prestarted"){
- system "grep \"Prestarting 'com.nokia.fali_mw2', priority=2\" /tmp/cpuload_high.log"}
- end
-
-end
--- tests/TestScripts/fautils.rb
+++ tests/TestScripts/fautils.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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.
-#
-
-module FaUtils
- # Returns a list of pids for an application.
- # Returns nil if no application was found to be running.
- def get_pids(app)
- pids = `pgrep #{app}`.split(/\s/).collect { |x| x.strip() }.delete_if { |x| x.empty? }
- pids = nil if pids.empty?
- return pids
- end
-
- # Returns the pid of an application or nil if it wasn't running.
- def get_pid(app)
- pids = get_pids(app)
-
- if not pids.nil? and pids.length >= 1
- return pids[0]
- end
-
- return nil
- end
-
- # Kill an application. Returns true if killed, false otherwise.
- def kill(app)
- system("pkill -9 #{app}")
- end
-
- # Returns true is at least one instance of application is running
- def running?(app)
- not get_pid(app).empty?
- end
-end
--- tests/TestScripts/functest_applifed.conf
+++ tests/TestScripts/functest_applifed.conf
(renamed to tests/Harmattan/TestScripts/functest_applifed.conf)
--- tests/TestScripts/functional.drive
+++ tests/TestScripts/functional.drive
(renamed to tests/Harmattan/TestScripts/functional.drive)
--- tests/TestScripts/periodic_re_prestart
+++ tests/TestScripts/periodic_re_prestart
-(directory)
--- tests/TestScripts/periodic_re_prestart/CMakeLists.txt
+++ tests/TestScripts/periodic_re_prestart/CMakeLists.txt
-install(FILES periodic_re_prestart.conf periodic_re_prestart.drive
- DESTINATION /usr/share/applifed-testscripts/periodic_re_prestart)
-
-install(PROGRAMS ts_periodic_re_prestart.rb
- DESTINATION /usr/share/applifed-testscripts/periodic_re_prestart)
-
--- tests/TestScripts/periodic_re_prestart/periodic_re_prestart.conf
+++ tests/TestScripts/periodic_re_prestart/periodic_re_prestart.conf
(renamed to tests/Meego/TestScripts/periodic_re_prestart/periodic_re_prestart.conf)
--- tests/TestScripts/periodic_re_prestart/periodic_re_prestart.drive
+++ tests/TestScripts/periodic_re_prestart/periodic_re_prestart.drive
-PRESTART=/usr/share/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.conf
-SCREEN_BLANKED_WITH_DELAY=25
-EXIT_WITH_DELAY=50
--- tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
+++ tests/TestScripts/periodic_re_prestart/ts_periodic_re_prestart.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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: Testcases for the periodic re-prestart functionality
-#
-# * Objectives: test the functionality of applifed from
-# the periodic re-prestart point of view
-#
-
-require 'tdriver'
-require 'date'
-require 'test/unit'
-include TDriverVerify
-
-
-class TC_PERIODICREPRESTART < Test::Unit::TestCase
-
- TIMES_TO_BE_RESTARTED = 5
-
- #Get the uname to find where are the tests running
- $path = string = `echo $PATH `
-
- # method called before any test case
- def setup
- if $path.include?("scratchbox")
- puts "Inside SB, Do Nothing to unlock"
- else
- system "mcetool --set-tklock-mode=unlocked"
- end
- @sut = TDriver.sut(:Id=>ARGV[0] || 'sut_qt_maemo')
-
- if $path.include?("scratchbox")
- @daemon_running = system('pkill applifed')
- else
- @daemon_running = system('initctl stop xsession/applifed')
- end
-
- #kill applications that are already running
- app = 'fali_hello'
- if system("pgrep #{app}") == true
- system("kill -9 `pgrep #{app}`")
- end
- #make sure that log file does not exist before the test run
- if FileTest.exists?("/tmp/periodic-re-prestart.log")
- system "rm /tmp/periodic-re-prestart.log"
- end
-
- #start applifed in test mode and prestart the listed applications
- if $path.include?("scratchbox")
- system "source /tmp/session_bus_address.user; DISPLAY=:1 applifed --test --log /tmp/periodic-re-prestart.log < /usr/share/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.drive &"
- else
- system "source /tmp/session_bus_address.user; DISPLAY=:0 applifed --test --log /tmp/periodic-re-prestart.log < /usr/share/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.drive &"
- end
-
- sleep 5
- end
-
- # method called after any test case for cleanup purposes
- def teardown
- if @daemon_running
- if $path.include?("scratchbox")
- system('applifed &')
- else
- system('initctl start xsession/applifed')
- end
- end
- end
-
- #To test that the application is prestarted by applifed
-
- def test_periodic_re_prestart
- $pid = string = `pgrep fali_hello`
- for i in 1..TIMES_TO_BE_RESTARTED
- string = `dbus-send --dest=com.nokia.fali_hello --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
- sleep(2)
- @app = @sut.application(:name => 'fali_hello')
- newpid = string = `pgrep fali_hello`
- verify_true(30,"Application is not prestarted"){$pid == newpid}
- @app.MButton( :name => 'CloseButton').tap
- end
- verify_equal(true,30,"Screen blanking did not happen"){
- system "grep \"Application 'com.nokia.fali_hello' scheduled for re-prestart\" /tmp/periodic-re-prestart.log"}
- sleep 6
- newpid = string = `pgrep fali_hello`
- puts newpid
- verify_true(30,"Application is not prestarted"){$pid != newpid}
- end
-end
--- tests/TestScripts/prevent.conf
+++ tests/TestScripts/prevent.conf
(renamed to tests/Meego/TestScripts/prevent.conf)
--- tests/TestScripts/prevent.drive
+++ tests/TestScripts/prevent.drive
-PRESTART=/usr/share/applifed-testscripts/prevent.conf
-EXIT_WITH_DELAY=30
-
-
-
--- tests/TestScripts/tc_applifed_one_instance.rb
+++ tests/TestScripts/tc_applifed_one_instance.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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: Testcases for the prestart functionality
-#
-# * Objectives: test the functionality of applifed from
-# the prestart point of view
-#
-
-require 'tdriver'
-require 'date'
-require 'test/unit'
-
-include TDriverVerify
-
-class TC_OnlyOneApplifed < Test::Unit::TestCase
- # Check that only one instance of applifed is running
- def get_pids(app)
- pids = `pgrep #{app}`.split(/\s/).collect { |x| x.strip() }.delete_if { |x| x.empty? }
- pids = nil if pids.empty?
- return pids
- end
-
- def test_only_one_applifed
- pids = get_pids('applifed')
-
- if not pids.nil?
- puts "pids: #{pids.join(' ')}"
- else
- verify_true(0, "Applifed is not running") { false }
- end
-
- verify_true(0, "Multiple instances of applifed running") {
- pids.length == 1
- }
- end
-
- def test_lock()
- verify_true(5, "applifed not running") {
- system("pgrep applifed")
- }
-
- verify_false(5, "only one instance should be allowed to run") {
- system("applifed --fork")
- }
- end
-end
-
--- tests/TestScripts/tc_daemonize.rb
+++ tests/TestScripts/tc_daemonize.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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.
-
-require 'date'
-require 'test/unit'
-require 'test/unit/testsuite'
-require 'test/unit/ui/console/testrunner'
-
-class TC_Daemonize < Test::Unit::TestCase
- def test_daemonize()
- puts "starting applifed daemonized"
- assert(system("applifed --fork"), "error while daemonizing")
-
- puts "sleeping ..."
- sleep(5)
-
- assert(system("pgrep applifed"), "applifed was not started")
-
- puts "trying to start fali_hello ..."
- system("dbus-send --dest=com.nokia.fali_hello --type=method_call " +
- "/org/maemo/m com.nokia.MApplicationIf.launch")
-
- puts "sleeping ..."
- sleep(5)
-
- assert(system("pgrep fali_hello"), "fali_hello was not started")
-
- system("pkill applifed")
- system("pkill fali_hello")
-
- if system("pgrep applifed")
- system("pkill -9 applifed")
- flunk("applifed not terminated, sent SIGKILL")
- end
- end
-end
-
-scratchbox = false
-
-if ENV['PATH'].include?('scratchbox') then
- scratchbox = true
-end
-
-if not scratchbox then
- system("initctl stop xsession/applifed")
-end
-
-system("pkill applifed")
-system("rm /tmp/applifed*")
-
-Test::Unit::UI::Console::TestRunner.run(TC_Daemonize)
-
-if not scratchbox then
- system("rm /tmp/applifed*")
- system("initctl start xsession/applifed")
-else
- system("applifed --fork")
-end
--- tests/TestScripts/tc_prestart_preventing.rb
+++ tests/TestScripts/tc_prestart_preventing.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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.
-
-# TODO: test that apps started by init system are not killed
-# when they go to prestarted state
-
-require 'tdriver'
-require 'test/unit'
-require 'test/unit/ui/console/testrunner'
-
-in_sb = false
-daemon_running_for = 50
-daemon_running = false
-
-class TC_PrestartPreventing < Test::Unit::TestCase
-
- def setup()
- @sut = TDriver.sut(:Id => ARGV[0] || 'sut_qt_maemo')
-
- if ENV['PATH'].include?("scratchbox")
- @in_sb = true
- else
- system("mcetool --set-tklock-mode=unlocked")
- @in_sb = false
- end
-
- # check for how long the daemon is going to sleep, default to 50 secs
- File.open('/usr/share/applifed-testscripts/prevent.drive') { |f|
- f.readlines().each { |line|
- if line =~ /^EXIT_WITH_DELAY=(\d+)/i
- @daemon_running_for = $1.to_i()
- break
- end
- }
- }
-
- puts("daemon is planning to sleep for #{@daemon_running_for} " +
- "seconds ...")
-
- # stop daemon if it's running on the system
- if @in_sb
- @daemon_running = system('pkill applifed')
- else
- @daemon_running = system('initctl stop xsession/applifed')
- end
-
- sleep(2)
-
- # kill applications that are already running
- system('pkill fali')
-
- # start the daemon in test mode
- system("source /tmp/session_bus_address.user; " +
- "DISPLAY=#{ENV['DISPLAY']} " +
- "applifed --test --log /tmp/prevent_prestart.log " +
- "< /usr/share/applifed-testscripts/prevent.drive &")
-
- @start_time = Time.now()
-
- sleep(5)
- end
-
- def teardown()
- # sleep so that the daemon has time to exit ...
- sleep_time = @daemon_running_for - (Time.now() - @start_time) + 5
- if sleep_time > 0
- puts "sleeping for #{sleep_time} seconds ..."
- sleep(sleep_time)
- end
-
- system('pkill fali')
-
- # start the daemon again, if necessary
- if @daemon_running
- if @in_sb
- system('applifed &')
- else
- system('initctl start xsession/applifed')
- end
- end
- end
-
- def test_prestart_preventing()
- # prestart fali_perf
- system('dbus-send --type=method_call --dest=com.nokia.fali_perf ' +
- '/org/maemo/m com.nokia.MApplicationIf.ping')
- sleep(2)
-
- # show its window
- system('dbus-send --type=method_call --dest=com.nokia.fali_perf ' +
- '/org/maemo/m com.nokia.MApplicationIf.launch')
- sleep(2)
-
- # close the window
- app = @sut.application(:name => 'fali_perf')
- app.MButton(:name => 'CloseButton').tap()
- sleep(5)
-
- # verify that fali_perf was killed
- assert(system('pgrep fali_perf') == false, 'fali_perf was not killed')
- end
-
- def test_whitelist()
- # start an app that can lazy shutdown (and that is whitelisted ...)
- system('/usr/bin/fali_mw1 -software -prestart &')
- sleep(2)
-
- # show a window
- system('dbus-send --dest=com.nokia.fali_mw1 --type=method_call ' +
- '/ com.nokia.MultipleWindowsIf.launchWindow int32:1')
- sleep(2)
-
- # close the window
- app = @sut.application(:name => 'fali_mw1')
- app.MButton(:name => 'CloseButton').tap()
- sleep(4)
-
- # verify that the app was not killed
- assert(system('pgrep fali_mw1'), 'fali_mw1 was killed!')
-
- system('pkill fali_mw1')
- end
-end
-
--- tests/TestScripts/test-perf-prestart.py
+++ tests/TestScripts/test-perf-prestart.py
-#!/usr/bin/env python
-"""
-This program tests the startup time of the given application with and
-without prestarting.
-
-Requirements:
-1. DISPLAY environment variable must be set correctly.
-2. DBus session bus must be running.
-3. DBus session bus address must be stored in /tmp/session_bus_address.user.
-4. Given application supports prestarting with -prestart commandline argument.
-
-Usage: test-perf-prestart <prestartable application>
-
-Example: test-perf-prestart /usr/bin/camera-ui
-
-Authors: antti.kervinen at nokia.com, juha.lintula at nokia.com
-"""
-import os
-import subprocess
-import commands
-import time
-import sys
-from optparse import OptionParser
-import unittest
-
-MEMORYHOG = '/usr/bin/memoryhog'
-DEV_NULL = file("/dev/null","w")
-LOG_FILE = '/tmp/applifed_perftest.log'
-
-_timer_pipe = None
-_start_time = 0
-_memory_stats = []
-
-
-appname = None
-test_mode = None
-
-def parseCommandLineOptions():
- global appname, test_mode
- my_parser = OptionParser()
- my_parser.add_option("-a", "--app", dest="app", help="path of the application you want to test", action="store")
- my_parser.add_option("-s", "--swap", dest="swap", help="Flag for swap mode of testing, if not used, test_mode = Regular", action="store_true", default=False)
- options, arguments = my_parser.parse_args()
- if not options.app:
- print "you must specify the application you want to test"
- sys.exit(1)
- else:
- assert (os.path.exists(options.app)), "The application %s does not exist" % options.app
- appname = options.app
- if options.swap:
- test_mode = 'Swap'
- else:
- test_mode = 'Regular'
-
-def debug(*msg):
- sys.stderr.write('[DEBUG %s] %s\n' % (time.time(), ' '.join([str(s) for s in msg]),))
-
-def error(*msg):
- sys.stderr.write('ERROR %s\n' % (' '.join([str(s) for s in msg]),))
- sys.exit(1)
-
-def basename(appname):
- return appname.split('/')[-1]
-
-def is_executable_file(filename):
- return os.path.isfile(filename) and os.access(filename, os.X_OK)
-
-def check_prerequisites(appname):
- if os.getenv('DISPLAY') == None:
- error("DISPLAY is not set. Check the requirements.")
-
- if os.getenv('DBUS_SESSION_BUS_ADDRESS') == None:
- error("DBUS_SESSION_BUS_ADDRESS is not set.\n" +
- "You probably want to source /tmp/session_bus_address.user")
-
- if not is_executable_file(appname):
- error("'%s' is not an executable file\n" % (appname,) +
- "(should be an application that supports prestarting)")
-
-class applifed_perf_tests(unittest.TestCase):
- def setUp(self):
- self.tcname = self.id().split('.')[-1]
-
- def tearDown(self):
- pass
- #print "End %s" % self.tcname
-
- def start_timer(self):
- # call measure_time after calling this...
- global _start_time
- _start_time = time.time()
-
- def measure_time(self):
- global _end_time
- fh = open(LOG_FILE, "r")
- lines = fh.readlines()
- lastline = lines[len(lines)-2]
- _end_time = lastline.split()[0]
- debug("End Time :%f" %float(_end_time))
- _app_start_time = float(_end_time) - float(_start_time)
- return _app_start_time
-
- def save_memory_usage(self, process_handle):
- global _memory_stats
- rss, private_dirty = 0, 0
- if process_handle:
- # calculate process memory usage
- # resident size in memory and private dirty
- smaps_lines = file("/proc/%s/smaps" % (process_handle.pid,)).readlines()
- for line in smaps_lines:
- if line.startswith("Rss:"):
- rss += int(line.split()[1])
- elif line.startswith("Private_Dirty:"):
- private_dirty += int(line.split()[1])
- # find out free system memory
- meminfo_lines = file("/proc/meminfo").readlines()
- for line in meminfo_lines:
- if line.startswith("MemFree:"):
- memfree = int(line.split()[1])
- elif line.startswith("Buffers:"):
- memfree += int(line.split()[1])
- elif line.startswith("Cached:"):
- memfree += int(line.split()[1])
- _memory_stats.append({'rss':rss,
- 'private_dirty': private_dirty,
- 'memfree': memfree})
-
- def eat_memory(self):
- debug("Running memoryhog...")
-
- p = subprocess.Popen(MEMORYHOG,
- stdout=subprocess.PIPE)
- # Memoryhog is ready when we are able to read 3 lines from it.
- debug ("Memoryhog: %s"%p.stdout.readline())
- debug ("Memoryhog: %s"%p.stdout.readline())
- debug ("Memoryhog: %s"%p.stdout.readline())
- return
-
- def run_without_prestarting(self, appname, test_mode):
- """returns process handle with pid attribute and terminate function"""
- os.system ('mcetool --set-tklock-mode=unlocked')
- if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
- os.system('rm %s' %LOG_FILE)
- if (test_mode == "Swap"):
- self.eat_memory()
-
- self.start_timer()
- p = subprocess.Popen(appname,
- shell=False,
- stdout=DEV_NULL, stderr=DEV_NULL)
- debug("app", appname, "started")
- return p
-
- def run_without_prestarting_without_duihome(self, appname, test_mode):
- """returns process handle with pid attribute and terminate function"""
- os.system ('mcetool --set-tklock-mode=unlocked')
- if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
- os.system('rm %s' %LOG_FILE)
- if (test_mode == "Swap"):
- self.eat_memory()
- os.system('pkill -STOP duihome')
- self.start_timer()
- p = subprocess.Popen(appname,
- shell=False,
- stdout=DEV_NULL, stderr=DEV_NULL)
- debug("app", appname, "started without duihome")
- os.system('pkill -CONT duihome')
- return p
-
- def run_with_prestarting(self, appname, test_mode):
- """returns process handle with pid attribute and terminate function"""
- # for lifecycle application, for instance, run
- # dbus-send --dest=com.nokia.lifecycle \
- # --type="method_call" \
- # /org/maemo/m com.nokia.MApplicationIf.launch
- os.system ('mcetool --set-tklock-mode=unlocked')
- global _start_time
- if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
- os.system('rm %s' %LOG_FILE)
- time.sleep(1)
- output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
- ' --type="method_call" /org/maemo/m ' +
- 'com.nokia.MApplicationIf.ping')
- debug("app prestarted, waiting for it to stabilize...")
- time.sleep(3)
- class p: pass
- p.pid = commands.getoutput('pgrep ' + basename(appname)[:15])
- # Make sure the application is prestarted and ready to receive the
- # launch signal. Hypothesis: if the application has not been
- # scheduled within the second, it is ready for launching
-
- #Commented, needs investigation why this waits when duihome stopped
- """switches = 0
- last_switches = -100
- counter = 0
- while (switches - last_switches) > 0 and counter < 20:
- debug("still waiting, switches, last_switches:...", switches, last_switches)
- time.sleep(1)
- counter = counter +1
- last_switches = switches
- switches = int(commands.getoutput("grep nr_switches /proc/%s/sched" %
- (p.pid,)).split()[2])"""
- self.save_memory_usage(p)
-
- # If we testing the the worst case, make sure that the prestarted is swapped off
- if (test_mode == "Swap"):
- self.eat_memory()
-
- # Launch the prestarted application and quit immediately so that
- # the time can be measured
- self.start_timer()
- debug("start time : %f"% _start_time)
- output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
- ' --type="method_call" /org/maemo/m ' +
- 'com.nokia.MApplicationIf.launch')
- return p
-
- def run_with_prestarting_without_duihome(self, appname, test_mode):
- """returns process handle with pid attribute and terminate function"""
- # for lifecycle application, for instance, run
- # dbus-send --dest=com.nokia.lifecycle \
- # --type="method_call" \
- # /org/maemo/m com.nokia.MApplicationIf.launch
- os.system ('mcetool --set-tklock-mode=unlocked')
- global _start_time
- if os.path.exists(LOG_FILE) and os.path.isfile(LOG_FILE):
- os.system('rm %s' %LOG_FILE)
- time.sleep(1)
- output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
- ' --type="method_call" /org/maemo/m ' +
- 'com.nokia.MApplicationIf.ping')
- debug("app prestarted, waiting for it to stabilize...")
- time.sleep(3)
- class p: pass
- p.pid = commands.getoutput('pgrep ' + basename(appname)[:15])
- # Make sure the application is prestarted and ready to receive the
- # launch signal. Hypothesis: if the application has not been
- # scheduled within the second, it is ready for launching
- switches = 0
- last_switches = -100
- counter = 0
- #Commented, needs investigation why this waits when duihome stopped
- """while (switches - last_switches) > 0 and counter < 30:
- debug("still waiting, switches, last_switches:...", switches, last_switches)
- time.sleep(1)
- counter = counter +1
- last_switches = switches
- switches = int(commands.getoutput("grep nr_switches /proc/%s/sched" %
- (p.pid,)).split()[2])"""
- self.save_memory_usage(p)
-
- # If we testing the the worst case, make sure that the prestarted is swapped off
- if (test_mode == "Swap"):
- self.eat_memory()
-
- # Launch the prestarted application and quit immediately so that
- # the time can be measured
- os.system('pkill -STOP duihome')
- self.start_timer()
- debug("start time : %f"% _start_time)
- output = commands.getoutput('dbus-send --dest=com.nokia.' + basename(appname) +
- ' --type="method_call" /org/maemo/m ' +
- 'com.nokia.MApplicationIf.launch')
- debug("prestarted app launched without duihome")
- os.system('pkill -CONT duihome')
- return p
-
-
- def kill_process(self, process_handle, appname):
- return commands.getoutput("pkill -9 %s" % (basename(appname)[:15],))
-
- def perftest_with_prestart(self, appname, test_mode):
- debug("run app with prestarting with duihome")
- self.save_memory_usage(None) # record free system memory
- p = self.run_with_prestarting(appname, test_mode)
- time.sleep(2)
- time_with_prestart = self.measure_time()
- time.sleep(2)
- self.save_memory_usage(p)
- self.kill_process(p, appname)
- if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
- debug("got time:", time_with_prestart)
- time.sleep(2)
-
- debug("run app with prestarting without duihome ")
- self.save_memory_usage(None) # record free system memory
- p = self.run_with_prestarting_without_duihome(appname, test_mode)
- time.sleep(2)
- time_with_prestart_without_duihome = self.measure_time()
- time.sleep(2)
- self.save_memory_usage(p)
- self.kill_process(p, appname)
- if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
- debug("got time:", time_with_prestart_without_duihome)
- time.sleep(2)
- return time_with_prestart, time_with_prestart_without_duihome
-
- def perftest_without_prestart(self, appname, test_mode):
- debug("run app without prestarting with duihome")
- self.save_memory_usage(None) # record free system memory
- p = self.run_without_prestarting(appname, test_mode)
- time.sleep(4)
- time_without_prestart = self.measure_time()
- self.save_memory_usage(p)
- time.sleep(4)
- self.kill_process(p, appname)
- if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
- debug("got time:", time_without_prestart)
- time.sleep(2)
-
- debug("run app without prestarting without duihome")
- self.save_memory_usage(None) # record free system memory
- p = self.run_without_prestarting_without_duihome(appname, test_mode)
- time.sleep(4)
- time_without_prestart_without_duihome = self.measure_time()
- self.save_memory_usage(p)
- time.sleep(4)
- self.kill_process(p, appname)
- if (test_mode=="Swap"): commands.getoutput("pkill -9 memoryhog")
- debug("got time:", time_without_prestart_without_duihome)
- time.sleep(2)
-
- return time_without_prestart, time_without_prestart_without_duihome
-
- def print_test_report(self, with_without_times, fileobj):
- """
- with_without_times is a list of pairs:
- (with_prestarting_startup_time,
- without_prestarting_startup_time)
- """
- global _memory_stats
- def writeline(*msg):
- fileobj.write("%s\n" % ' '.join([str(s) for s in msg]))
- def fmtfloat(f):
- return "%.2f" % (f,)
- def filterstats(data, field):
- return tuple([d[field] for d in data])
-
- if with_without_times == []: return
-
- writeline("")
- writeline('Memory consumptions [kB]:')
- memrowformat = "%10s %10s %10s %10s %10s %10s"
- while _memory_stats:
- oneround = _memory_stats[:5]
- _memory_stats = _memory_stats[5:]
-
- writeline(memrowformat %
- ('', 'before', 'before', 'after', 'before', 'after'))
- writeline(memrowformat %
- ('', 'prestart', 'launch', 'launch', 'normal', 'normal'))
- writeline(memrowformat %
- (('privdirt',) + filterstats(oneround, 'private_dirty')))
- writeline(memrowformat %
- (('rss',) + filterstats(oneround, 'rss')))
- writeline(memrowformat %
- (('free',) + filterstats(oneround, 'memfree')))
- writeline("")
-
- writeline("")
- rowformat = "%12s %12s %12s %12s"
- writeline('Startup times [s]:')
- writeline(rowformat % ('prestarted-Yes', 'prestarted-Yes', 'prestarted-No', 'prestarted-No'))
- writeline(rowformat % ('duihome-Yes ', 'duihome-No ', 'duihome-Yes ', 'duihome-No '))
-
- t1,t2,t3,t4 = [], [], [], []
- for wop_wd, wop_wod, wp_wd, wp_wod in with_without_times:
- t1.append(wop_wd)
- t2.append(wop_wod)
- t3.append(wp_wd)
- t4.append(wp_wod)
- writeline(rowformat % (fmtfloat(wop_wd), fmtfloat(wop_wod),
- fmtfloat(wp_wd), fmtfloat(wp_wod)))
-
- writeline('Average times:')
- writeline(rowformat % (fmtfloat(sum(t1)/len(t1)),fmtfloat(sum(t2)/len(t2)),
- fmtfloat(sum(t3)/len(t3)),fmtfloat(sum(t4)/len(t4))))
- return fmtfloat(sum(t1)/len(t1))
-
- def test_001(self):
- times = []
- times1, times2 = [], []
-
- for i in xrange(3):
- times1.append(self.perftest_with_prestart(appname, test_mode))
- for i in xrange(3):
- times2.append(self.perftest_without_prestart(appname, test_mode))
-
- times = [[t1[0], t1[1], times2[i][0], times2[i][1]] for i, t1 in enumerate(times1)]
- avg_with_prestart = self.print_test_report(times, sys.stdout)
- self.assert_(float(avg_with_prestart) < float(0.75), "prestarted application takes more than 0.75 sec")
-
-
-# main
-if __name__ == '__main__':
- parseCommandLineOptions()
- print sys.argv
- sys.argv = sys.argv[0:1]
- print sys.argv
- check_prerequisites(appname)
- unittest.main()
-
--- tests/TestScripts/ts_mwtests.rb
+++ tests/TestScripts/ts_mwtests.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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: Testcases for the prestart functionality
-#
-# * Objectives: test the functionality of applifed from
-# the prestart point of view for multiwindows
-#
-
-require 'tdriver'
-require 'date'
-require 'test/unit'
-include TDriverVerify
-
-class TC_MWTESTS < Test::Unit::TestCase
-
- TIMES_TO_BE_RESTARTED = 5
- $path = string = `echo $PATH `
-
- # method called before any test case
- def setup
- if $path.include?("scratchbox")
- puts "Inside SB, Do Nothing to unlock"
- else
- system "mcetool --set-tklock-mode=unlocked"
- # restart duihome so that qttasserver notices it
- verify {
- system("/sbin/initctl restart xsession/duihome")
- }
- end
- @sut = TDriver.sut(:Id=>ARGV[0] || 'sut_qt_maemo')
- end
-
- # method called after any test case for cleanup purposes
- def teardown
- kill_application()
- @appname = nil
- puts "exit from teardown"
- end
-
- def test_mw3_prestart
- #Test for a multiwindow application inherited from MApplication and override windows CloseEvents tested
- @appname = 'fali_mw3'
-
- start_exec()
- run_dbus_command_multiwindow('fali_mw3', '1')
- run_dbus_command_multiwindow('fali_mw3', '2')
- run_dbus_command_multiwindow('fali_mw3', '3')
-
- pid = string = `pgrep #{@appname}`
- @app = @sut.application(:name => @appname)
- @app.MyWindow( :name => 'Window 3' ).MainPage.MPannableViewport.MLabel(:text => 'Modify content').tap
- @app.MyWindow( :name => 'Window 3' ).MButton( :name => 'CloseButton' ).tap
- @app.MyWindow( :name => 'Window 3' ).MButton( :name => 'MDialogButtonYes' ).tap
-
- system "mcetool --set-tklock-mode=unlocked"
- @app.MApplicationWindow( :name => 'Window 2' ).MLabel(:text => 'Modify content').tap
- @app.MApplicationWindow( :name => 'Window 2' ).MButton( :name => 'CloseButton' ).tap
- @app.MApplicationWindow( :name => 'Window 1' ).MLabel(:text => 'Modify content').tap
- @app.MApplicationWindow( :name => 'Window 1' ).MButton( :name => 'CloseButton' ).tap
-
- #verifies that the multiwindow application is lazy shutdown and has the same pid after it is closed
- newid = string = `pgrep #{@appname}`
- verify_true(30,"The application is not prestarted"){pid == newid}
-
- run_dbus_command_multiwindow('fali_mw3', '3')
- verify(){@app.MyWindow( :name => 'Window 3' ).MLabel(:text => 'Fresh Window 3')}
-
- end
-
- def test_mw3_switcher
- #Test that all window of a multiwindow application exists in the switcher
- @appname = 'fali_mw3'
-
- start_exec()
- run_dbus_command_multiwindow('fali_mw3', '1')
- run_dbus_command_multiwindow('fali_mw3', '2')
- run_dbus_command_multiwindow('fali_mw3', '3')
-
- pid = string = `pgrep #{@appname}`
- @app = @sut.application(:name => @appname)
- @app.MyWindow( :name => 'Window 3' ).MHomeButtonPanel( :name => 'MHomeButtonPanel').MButton( :name => 'HomeButton').tap
- @app_home = @sut.application(:name => 'duihome')
-
- #verifies that all the three windows exist in the switcher
- verify(){@app_home.SwitcherButton(:text => 'Window 1')}
- verify(){@app_home.SwitcherButton(:text => 'Window 2')}
- verify(){@app_home.SwitcherButton(:text => 'Window 3')}
-
- end
-
- def test_mw2_close
- #Test for multiwindow re-prestart
- @appname = 'fali_mw2'
- if system("pgrep #{@appname}") == true
- system("kill -9 `pgrep #{@appname}`")
- end
- if $path.include?("scratchbox")
- system "source /tmp/session_bus_address.user; DISPLAY=:1 applifed --test --log /tmp/applifed-test.log < /usr/share/applifed-testscripts/functional.drive &"
- else
- system "source /tmp/session_bus_address.user; DISPLAY=:0 applifed --test --log /tmp/applifed-test.log < /usr/share/applifed-testscripts/functional.drive &"
- end
- sleep 10
- run_dbus_command_multiwindow('fali_mw2', '1')
- run_dbus_command_multiwindow('fali_mw2', '2')
- run_dbus_command_multiwindow('fali_mw2', '3')
-
- pid = string = `pgrep #{@appname}`
- @app = @sut.application(:name => @appname)
- @app.MApplicationWindow( :name => 'Window 3' ).MButton( :name => 'HomeButton' ).tap
- @app_home = @sut.application(:name => 'duihome')
-
- verify(){@app_home.SwitcherButton(:text => 'Window 1')}
- verify(){@app_home.SwitcherButton(:text => 'Window 2')}
- verify(){@app_home.SwitcherButton(:text => 'Window 3')}
- system "mcetool --set-tklock-mode=unlocked"
- @app_home.SwitcherButton(:text => 'Window 1').tap
- @app.MApplicationWindow( :name => 'Window 1' ).MButton( :name => 'CloseButton' ).tap
- @app_home.SwitcherButton(:text => 'Window 2').tap
- @app.MApplicationWindow( :name => 'Window 2' ).MButton( :name => 'CloseButton' ).tap
- @app_home.SwitcherButton(:text => 'Window 3').tap
- @app.MApplicationWindow( :name => 'Window 3' ).MButton( :name => 'CloseButton' ).tap
- sleep(6)
-
- #verifies that multiwindow application is a terminate and close application and is re-prestarted with a new pid
- newid = string = `pgrep #{@appname}`
- verify_true(30,"The application is not prestarted"){pid != newid}
- end
-
-
- def test_mw1_close
- #Test for multiwindow prestart and lazy shutdown
- @appname = 'fali_mw1'
-
- start_exec()
- #runs the test in a loop
- for i in 1..TIMES_TO_BE_RESTARTED
- if $path.include?("scratchbox")
- puts "Inside SB, Do Nothing to unlock"
- else
- system "mcetool --set-tklock-mode=unlocked"
- end
- run_dbus_command_multiwindow('fali_mw1', '1')
- run_dbus_command_multiwindow('fali_mw1', '2')
- run_dbus_command_multiwindow('fali_mw1', '3')
-
- pid = string = `pgrep #{@appname}`
- @app = @sut.application(:name => @appname)
- @app.MApplicationWindow( :name => 'Window 3' ).MButton( :name => 'HomeButton' ).tap
- @app_home = @sut.application(:name => 'duihome')
-
- verify(){@app_home.SwitcherButton(:text => 'Window 1')}
- verify(){@app_home.SwitcherButton(:text => 'Window 2')}
- verify(){@app_home.SwitcherButton(:text => 'Window 3')}
-
- @app_home.SwitcherButton(:text => 'Window 1').tap
- @app.MApplicationWindow( :name => 'Window 1' ).MButton( :name => 'CloseButton' ).tap
- sleep(1)
- @app_home.SwitcherButton(:text => 'Window 2').tap
- @app.MApplicationWindow( :name => 'Window 2' ).MButton( :name => 'CloseButton' ).tap
- sleep(1)
- @app_home.SwitcherButton(:text => 'Window 3').tap
- @app.MApplicationWindow( :name => 'Window 3' ).MButton( :name => 'CloseButton' ).tap
- sleep(1)
-
- #verifies that the multiwindow application is a lazy-shudown application and has the same pid after it is closed
- newid = string = `pgrep #{@appname}`
- verify_true(30,"The application is not prestarted"){pid == newid}
- end
- end
-
- def test_mw1_content
- #To test that multiwindow gets the correct window content
- @appname = 'fali_mw1'
-
- start_exec()
- run_dbus_command_multiwindow('fali_mw1', '1')
- run_dbus_command_multiwindow('fali_mw1', '2')
- run_dbus_command_multiwindow('fali_mw1', '3')
-
- pid = string = `pgrep #{@appname}`
- @app = @sut.application(:name => @appname)
-
- assert_equal("Window 3", @app.MApplicationWindow( :name => 'Window 3' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
- run_dbus_command_multiwindow('fali_mw1', '1')
- assert_equal("Window 1", @app.MApplicationWindow( :name => 'Window 1' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
- run_dbus_command_multiwindow('fali_mw1', '2')
- assert_equal("Window 2", @app.MApplicationWindow( :name => 'Window 2' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
- run_dbus_command_multiwindow('fali_mw1', '3')
- assert_equal("Window 3", @app.MApplicationWindow( :name => 'Window 3' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
- run_dbus_command_multiwindow('fali_mw1', '2')
- assert_equal("Window 2", @app.MApplicationWindow( :name => 'Window 2' ).MainPage.MLabel.attribute('text'), "Wrong Window Content")
-
- end
-
- def test_close_event
- #Test to hide and close a prestarted application
- @appname = 'close-event'
-
- start_exec()
- run_dbus_command_closeevent
-
- @app = @sut.application(:name => 'close-event')
- @app.MComboBox.MLabel( :name => 'CommonTitle' ).tap
- @app.MList.MLabel(:text => 'Ignore closeEvent').tap
- sleep 2
- @app.MButton( :name => 'CloseButton' ).tap
-
- pid = string = `pgrep close-event`
- @app.MComboBox.MLabel( :name => 'CommonTitle' ).tap
- @app.MList.MLabel(:text => 'Hide window (Lazy Shutdown)').tap
- sleep 2
- @app.MButton( :name => 'CloseButton' ).tap
-
- run_dbus_command_closeevent
- newid = string = `pgrep close-event`
- verify_true(30,"The application is not prestarted"){pid == newid}
-
- @app.MComboBox.MLabel( :name => 'CommonTitle' ).tap
- @app.MList.MLabel(:text => 'Really close window').tap
- sleep 2
- @app.MButton( :name => 'CloseButton' ).tap
- assert_not_equal(true, @sut.application.test_object_exists?("MLabel", { :name => 'MComboBoxSubtitle'}), "Window still visible")
- pid_now = string = `pgrep close-event`
- verify_true(30,"The application is not prestarted"){newid == pid_now}
- end
-
- def test_multi_instance_prestart
- #Test to prestart n number of applications at the same time
- @appname = 'fali_multiapp'
- for i in 1..MULTI_APP_PRESTART_TIME
- if $path.include?("scratchbox")
- system "#{@appname} #{i} -prestart -software&"
- else
- system "#{@appname} #{i} -prestart &"
- end
- sleep 2
- end
- pid = string = `pgrep #{@appname}`
- pidlist = pid.split("\n")
- no_of_app = pidlist.length
- assert_equal(MULTI_APP_PRESTART_TIME, no_of_app, "All applications were not prestarted")
- system "pkill #{@appname}"
-
- end
-
- def start_exec()
- #function to prestart the applications
- if $path.include?("scratchbox")
- system "export DISPLAY=:1; source /tmp/session_bus_address.user; #{@appname} -prestart -software &"
- else
- system "export DISPLAY=:0; source /tmp/session_bus_address.user; #{@appname} -prestart &"
- end
- sleep 3
- end
-
- def run_dbus_command_multiwindow(ename, num)
- #function that calls the dbus-send for each multiplewindow application
- if $path.include?("scratchbox")
- string = `export DISPLAY=:1; source /tmp/session_bus_address.user; dbus-send --dest=com.nokia.#{ename} --type="method_call" / com.nokia.MultipleWindowsIf.launchWindow int32:"#{num}"`
- else
- string = `export DISPLAY=:0; source /tmp/session_bus_address.user; dbus-send --dest=com.nokia.#{ename} --type="method_call" / com.nokia.MultipleWindowsIf.launchWindow int32:"#{num}"`
- end
- end
-
- def run_dbus_command_closeevent()
- #function that calls the dbus-send for close-event application
- if $path.include?("scratchbox")
- string = `export DISPLAY=:1; source /tmp/session_bus_address.user; dbus-send --dest=com.nokia.#{@appname} --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
- else
- string = `export DISPLAY=:0; source /tmp/session_bus_address.user; dbus-send --dest=com.nokia.#{@appname} --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
- end
- end
-
- def kill_application()
- #function to kill the running applications
- puts "going to kill application #{@appname}"
- system "kill -9 `pgrep #{@appname}`"
- sleep 1
- end
-end
--- tests/TestScripts/ts_prestart.rb
+++ tests/TestScripts/ts_prestart.rb
-#!/usr/bin/ruby1.8
-#
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# Contact: Nokia Corporation (directui at nokia.com)
-#
-# This file is part of applifed.
-#
-# If you have questions regarding the use of this file, please contact
-# Nokia at directui at 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: Testcases for the prestart functionality
-#
-# * Objectives: test the functionality of applifed from
-# the prestart point of view
-#
-
-require 'tdriver'
-require 'date'
-require 'test/unit'
-include TDriverVerify
-
-
-class TC_PrestartTDriverTests < Test::Unit::TestCase
-
- TIMES_TO_BE_RESTARTED = 10
- MULTI_APP_PRESTART_TIME = 20
-
- #Get the uname to find where are the tests running
- $path = string = `echo $PATH `
-
- # method called before any test case
- def setup
- if $path.include?("scratchbox")
- puts "Inside SB, Do Nothing to unlock"
- else
- system "mcetool --set-tklock-mode=unlocked"
- end
- @sut = TDriver.sut(:Id=>ARGV[0] || 'sut_qt_maemo')
-
- if $path.include?("scratchbox")
- @daemon_running = system('pkill applifed')
- else
- @daemon_running = system('initctl stop xsession/applifed')
- end
- #kill applications that are already running
- apps = ['fali_hello',
- 'fali_toc']
- for app in apps
- if system("pgrep #{app}") == true
- system("kill -9 `pgrep #{app}`")
- sleep 1
- system("kill -9 `pgrep #{app}`")
- end
- end
-
- #make sure that log file does not exist before the test run
- if FileTest.exists?("/tmp/applifed-test.log")
- system "rm /tmp/applifed-test.log"
- end
-
- #start applifed in test mode and prestart the listed applications
- if $path.include?("scratchbox")
- system "source /tmp/session_bus_address.user; DISPLAY=:1 applifed --test --log /tmp/applifed-test.log < /usr/share/applifed-testscripts/functional.drive &"
- else
- system "source /tmp/session_bus_address.user; DISPLAY=:0 applifed --test --log /tmp/applifed-test.log < /usr/share/applifed-testscripts/functional.drive &"
- end
-
- sleep 5
- end
-
- # method called after any test case for cleanup purposes
- def teardown
- if @daemon_running
- if $path.include?("scratchbox")
- system('applifed &')
- else
- system('initctl start xsession/applifed')
- end
- end
- end
-
- #To test that the application is prestarted by applifed
-
- def test_prestart
- $pid = string = `pgrep fali_hello`
- for i in 1..TIMES_TO_BE_RESTARTED
- string = `dbus-send --dest=com.nokia.fali_hello --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
- sleep(2)
- @app = @sut.application(:name => 'fali_hello')
- newpid = string = `pgrep fali_hello`
- verify_true(30,"Application is not prestarted"){$pid == newpid}
- @app.MButton( :name => 'CloseButton').tap
- end
- end
-
- #To test that the application is re-prestarted by applifed
- def test_re_prestart
- verify_equal(true,30,"Applifed not running"){system "pgrep applifed"}
-
- pid = string = `pgrep fali_toc`
-
- string = `dbus-send --dest=com.nokia.fali_toc --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
- sleep(2)
- @app = @sut.application(:name => 'fali_toc')
-
- verify_equal(true,30,"Application not prestarted"){
- system "grep \"Application 'com.nokia.fali_toc' released from prestarted state\" /tmp/applifed-test.log"}
-
- close_button = @app.MButton( :name => 'CloseButton' )
- close_button.tap
- sleep(15)
- newpid = string = `pgrep fali_toc`
- verify_true(30,"Re-prestarting Not done"){pid != newpid}
-
- verify_equal(true,30,"Application not Re-prestarted"){
- system "grep \"Re-prestarting 'com.nokia.fali_toc\" /tmp/applifed-test.log"}
- end
-
- #To test that the application is re-prestarted by applifed after they are killed
- def test_kill_re_prestart
- verify_equal(true,30,"Applifed not running"){system "pgrep applifed"}
-
- verify_equal(true,30,"Application not prestarted"){
- system "grep \"com.nokia.fali_toc' got registered\" /tmp/applifed-test.log"}
-
- verify_equal(true,30,"Application not prestarted"){
- system "grep \"com.nokia.fali_hello' got registered\" /tmp/applifed-test.log"}
-
- sleep(5)
-
- string = `dbus-send --dest=com.nokia.fali_toc --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
- string = `dbus-send --dest=com.nokia.fali_hello --type="method_call" /org/maemo/m com.nokia.MApplicationIf.launch`
-
- sleep(5)
-
- verify_equal(true,30,"Application not prestarted"){
- system "grep \"Application 'com.nokia.fali_toc' released from prestarted state\" /tmp/applifed-test.log"}
-
- verify_equal(true,30,"Application not prestarted"){
- system "grep \"Application 'com.nokia.fali_hello' released from prestarted state\" /tmp/applifed-test.log"}
-
- pid_toc = string = `pgrep fali_toc`
- pid_ah = string = `pgrep fali_hello`
-
- verify_equal(true,30,"fali_toc not killed"){system "pkill fali_toc"}
- verify_equal(true,30,"fali_hello not killed"){system "pkill fali_hello"}
- sleep(5)
-
- verify_equal(true,30,"Application not Re-prestarted"){
- system "grep \"'com.nokia.fali_toc' got unregistered..\" /tmp/applifed-test.log"}
-
- verify_equal(true,30,"Application not Re-prestarted"){
- system "grep \"Re-prestarting 'com.nokia.fali_toc\" /tmp/applifed-test.log"}
-
- verify_equal(true,30,"Application not Re-prestarted"){
- system "grep \"'com.nokia.fali_hello' got unregistered..\" /tmp/applifed-test.log"}
-
- verify_equal(true,30,"Application not Re-prestarted"){
- system "grep \"Re-prestarting 'com.nokia.fali_hello'\" /tmp/applifed-test.log"}
- end
-
-
-end
--- tests/art-tests
+++ tests/art-tests
-(directory)
--- tests/art-tests/CMakeLists.txt
+++ tests/art-tests/CMakeLists.txt
-install(FILES tests.xml DESTINATION /usr/share/applifed-art-tests)
-
--- tests/art-tests/tests.xml
+++ tests/art-tests/tests.xml
-
-<testdefinition version="0.1">
-
-<!-- Test suite, name mandatory - the same as test package name -->
- <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
- <suite name="applifed-art-test" domain="Application framework">
-
- <!-- At least one set per suite, name and description mandatory -->
- <set name="Installation-tests" description="Installation-ok tests" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
-
- <!-- Possibly some pre-steps to execute before running the test cases -->
- <pre_steps>
- <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
- </pre_steps>
-
- <!-- At least one case per set, name mandatory, description mandatory, other optional -->
- <!-- At least one step per test, expected_result optional - tells which return code is considered passed -->
-
- <case name="applifed2" type="Functional" description="Check that exactly one applifed is running" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_applifed_one_instance.rb --name test_only_one_applifed</step>
- </case>
-
- <!-- Environments optional - tells where the tests are run -->
- <environments>
- <scratchbox>false</scratchbox>
- <hardware>true</hardware>
- </environments>
-
- </set>
-
- <set name="Applifed-TDriver-Tests" description="Functional tests for applifed with TDriver tool" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
- <pre_steps>
- <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
- </pre_steps>
-
- <case name="Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_re_prestart</step>
- </case>
- <case name="Prestart" type="Functional" description="To test that the application is prestarted by applifed" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_prestart</step>
- </case>
- <case name="Kill-Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed after they are killed" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_kill_re_prestart</step>
- </case>
-
- <environments>
- <scratchbox>false</scratchbox>
- <hardware>true</hardware>
- </environments>
-
- <!--get>
- <file> /tmp/applifed-test.log</file>
- </get-->
- </set>
- </suite>
-</testdefinition>
-
-
--- tests/bug-tests
+++ tests/bug-tests
-(directory)
--- tests/bug-tests/CMakeLists.txt
+++ tests/bug-tests/CMakeLists.txt
-install(FILES tests.xml DESTINATION /usr/share/applifed-bug-tests)
-
--- tests/bug-tests/tests.xml
+++ tests/bug-tests/tests.xml
-
-<testdefinition version="0.1">
-
-<!-- Test suite, name mandatory - the same as test package name -->
- <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
- <suite name="applifed-bug-tests" domain="Application framework">
-
- <set name="Bug-Tests" description="Functional tests for applifed for multiwindow applications" feature="AF Application pre-starting enhancements" requirement="3O0137">
- <pre_steps>
- <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
- </pre_steps>
-
- <case name="Multi-Instance-Prestart" type="Functional" description="To test that n number of application is prestarted by applifed" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_multi_instance_prestart</step>
- </case>
- <case name="Periodic-Re-Prestart" type="Functional" description="To test the Periodic re-prestart feature for applifed" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb --name test_periodic_re_prestart</step>
- </case>
-
- <case name="Prestart-preventing" type="Functional" description="Test case for prestart preventing" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_prestart_preventing.rb --name test_prestart_preventing</step>
- </case>
- <case name="test-whitelist" type="Functional" description="Test for whilelist" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_prestart_preventing.rb --name test_whitelist</step>
- </case>
- <environments>
- <scratchbox>false</scratchbox>
- <hardware>true</hardware>
- </environments>
-
- <get>
- <file>/tmp/mw_applifed_result.txt</file>
- </get>
- </set>
-
- </suite>
-</testdefinition>
-
-
--- tests/functests
+++ tests/functests
-(directory)
--- tests/functests/CMakeLists.txt
+++ tests/functests/CMakeLists.txt
-install(FILES tests.xml DESTINATION /usr/share/applifed-functional-tests)
--- tests/functests/tests.xml
+++ tests/functests/tests.xml
-
-<testdefinition version="0.1">
-
-<!-- Test suite, name mandatory - the same as test package name -->
- <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
- <suite name="applifed-functioanl-tests" domain="Application framework">
-
- <!-- At least one set per suite, name and description mandatory -->
- <set name="Installation-tests" description="Installation-ok tests" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
-
- <!-- Possibly some pre-steps to execute before running the test cases -->
- <pre_steps>
- <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
- <step>/usr/share/applifed-testscripts/cp-service.rb</step>
- </pre_steps>
-
- <!-- At least one case per set, name mandatory, description mandatory, other optional -->
- <!-- At least one step per test, expected_result optional - tells which return code is considered passed -->
-
- <case name="applifed2" type="Functional" description="Check that exactly one applifed is running" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_applifed_one_instance.rb</step>
- </case>
-
- <case name="applifed-daemonized" type="Functional" description="Check that fork parameter works" timeout="120" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/tc_daemonize.rb</step>
- </case>
-
- <!-- Environments optional - tells where the tests are run -->
- <environments>
- <scratchbox>false</scratchbox>
- <hardware>true</hardware>
- </environments>
-
- </set>
-
- <set name="Applifed-TDriver-Tests" description="Functional tests for applifed with TDriver tool" feature="AF Application prestarting functionality (basic)" requirement="3O0105">
- <pre_steps>
- <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
- </pre_steps>
-
- <case name="Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_re_prestart</step>
- </case>
-
- <case name="Prestart" type="Functional" description="To test that the application is prestarted by applifed" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_prestart</step>
- </case>
-
- <case name="Kill-Re-Prestart" type="Functional" description="To test that the application is re-prestarted by applifed after they are killed" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb --name test_kill_re_prestart</step>
- </case>
-
- <!--This test is diabled for the time being for further investigation.Before enabling it needs some modifications -->
- <!--case name="Multi-Instance-Prestart" type="Functional" description="To test that n number of application is prestarted by applifed" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_prestart.rb name test_multi_instance_prestart</step>
- </case-->
-
- <environments>
- <scratchbox>false</scratchbox>
- <hardware>true</hardware>
- </environments>
-
- <!--get>
- <file> /tmp/applifed-test.log</file>
- </get-->
- </set>
-
- <set name="Multiwindow-Tests" description="Functional tests for applifed for multiwindow applications" feature="AF Application pre-starting enhancements" requirement="3O0137">
- <pre_steps>
- <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
- </pre_steps>
-
- <case name="MW3_Prestart" type="Functional" description="Test for a multiwindow application inherited from MApplication tested" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_mwtests.rb --name test_mw3_prestart</step>
- </case>
- <case name="MW3_Switcher" type="Functional" description="Test that all window of a multiwindow application exists in the switcher" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_mwtests.rb --name test_mw3_switcher</step>
- </case>
- <case name="MW2_Re_Prestart" type="Functional" description="Test for multiwindow re-prestart" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_mwtests.rb --name test_mw2_close</step>
- </case>
- <case name="MW1_Content" type="Functional" description="Test for multiwindow contents" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_mwtests.rb --name test_mw1_content</step>
- </case>
- <case name="MW1_Prestart" type="Functional" description="Test for multiwindow prestart and lazy shutdown" timeout="360" level="System" insignificant="true">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_mwtests.rb --name test_mw1_close</step>
- </case>
- <case name="CloseEvent_Prestart" type="Functional" description="Test to hide and close a prestarted application" timeout="360" level="System" insignificant="false">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/ts_mwtests.rb --name test_close_event</step>
- </case>
-
- <environments>
- <scratchbox>false</scratchbox>
- <hardware>true</hardware>
- </environments>
-
- <get>
- <file>/tmp/mw_applifed_result.txt</file>
- </get>
- </set>
-
- <set name="CPU_LOAD_TESTS" description="Functional tests for applifed for cpu load prestarting" feature="AF Application pre-starting enhancements" requirement="3O0137">
- <pre_steps>
- <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
- </pre_steps>
-
- <case name="LOW_CPULOAD" type="Functional" description="Test that a applications are prestarted when the cpu load is lower than threshold value" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/cpu_load/tc_cpu_load.rb --name test_cpu_load_low</step>
- </case>
- <case name="HIGH_CPULOAD" type="Functional" description="Test that applications are not prestarted when the cpu load is higher than threshold value" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applifed-testscripts/cpu_load/tc_cpu_load.rb --name test_cpu_load_high</step>
- </case>
-
- <environments>
- <scratchbox>false</scratchbox>
- <hardware>true</hardware>
- </environments>
-
- <get>
- <file>/tmp/cpuload_low.log</file>
- <file> /tmp/cpuload_high.log</file>
- </get>
- </set>
-
-
- </suite>
-</testdefinition>
-
-
--- tests/perftests
+++ tests/perftests
-(directory)
--- tests/perftests/CMakeLists.txt
+++ tests/perftests/CMakeLists.txt
-install(FILES tests.xml DESTINATION /usr/share/applifed-performance-tests)
--- tests/perftests/tests.xml
+++ tests/perftests/tests.xml
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<testdefinition version="0.1">
-
-<!-- Test suite, name mandatory - the same as test package name -->
- <!-- Schema: https://projects.maemo.org/docs/testing/xml-definition.html -->
- <suite name="applifed-performance-tests" domain="Application framework">
-
- <set name="Prestart-performance-tests" description="Applifed prestart performance tests" feature="AF Application prestarting functionality" requirement="300105">
- <pre_steps>
- <step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
- </pre_steps>
-
- <case name="Prestart1" type="Performance" description="Measure prestart performance" timeout="360" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applifed-testscripts/test-perf-prestart.py -a /usr/bin/fali_perf > /tmp/prestart_perf.txt</step>
- </case>
-
- <!-- Swap tests commented off temporalily -->
-
- <!-- <case name="SwapOn" type="Performance" description="Turn the swap on" timeout="360" level="System">
- <step expected_result="0">modprobe mtdswap partitions=4</step>
- <step expected_result="0">swapon /dev/mtdswap4</step>
- <step expected_result="0">[ $(free |grep Swap | awk '{print $2}') -gt 256000 ]</step>
- </case>
-
- <case name="Prestart2" type="Performance" description="Measure prestart performance when everything is swapped" timeout="1200" level="System">
- <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applifed-testscripts/test-perf-prestart.py -a /usr/bin/fali_perf -s > /tmp/prestart_perf_swap_on.txt</step>
- </case> -->
-
- <environments>
- <scratchbox>false</scratchbox>
- <hardware>true</hardware>
- </environments>
-
- <get>
- <file>/tmp/prestart_perf.txt</file>
- <!-- <file>/tmp/prestart_perf_swap_on.txt</file> -->
- </get>
- </set>
-
- </suite>
-</testdefinition>
-
-
--- tests/unittests
+++ tests/unittests
-(directory)
--- tests/unittests/CMakeLists.txt
+++ tests/unittests/CMakeLists.txt
-add_subdirectory(ut_configdata)
-
-add_subdirectory(ut_cpuload)
-
-add_subdirectory(ut_prestarter)
-
-add_subdirectory(ut_prestartapp)
-
-#add_subdirectory(ut_prestartparser)
-
-#file(MAKE_DIRECTORY /usr/share/applifed-tests)
-install(FILES tests.xml DESTINATION /usr/share/applifed-tests)
-
--- tests/unittests/common.pri
+++ tests/unittests/common.pri
(renamed to tests/Common/unittests/common.pri)
--- tests/unittests/tests.xml
+++ tests/unittests/tests.xml
(renamed to tests/Harmattan/unit-tests/tests.xml)
--- tests/unittests/ut_configdata
+++ tests/unittests/ut_configdata
-(directory)
--- tests/unittests/ut_configdata/CMakeLists.txt
+++ tests/unittests/ut_configdata/CMakeLists.txt
(renamed to tests/Common/unittests/ut_configdata/CMakeLists.txt)
--- tests/unittests/ut_configdata/ut_configdata.cpp
+++ tests/unittests/ut_configdata/ut_configdata.cpp
(renamed to tests/Common/unittests/ut_configdata/ut_configdata.cpp)
--- tests/unittests/ut_configdata/ut_configdata.h
+++ tests/unittests/ut_configdata/ut_configdata.h
(renamed to tests/Common/unittests/ut_configdata/ut_configdata.h)
--- tests/unittests/ut_cpuload
+++ tests/unittests/ut_cpuload
-(directory)
--- tests/unittests/ut_cpuload/CMakeLists.txt
+++ tests/unittests/ut_cpuload/CMakeLists.txt
(renamed to tests/Common/unittests/ut_cpuload/CMakeLists.txt)
--- tests/unittests/ut_cpuload/ut_cpuload.cpp
+++ tests/unittests/ut_cpuload/ut_cpuload.cpp
(renamed to tests/Common/unittests/ut_cpuload/ut_cpuload.cpp)
--- tests/unittests/ut_cpuload/ut_cpuload.h
+++ tests/unittests/ut_cpuload/ut_cpuload.h
(renamed to tests/Common/unittests/ut_cpuload/ut_cpuload.h)
--- tests/unittests/ut_prestartapp
+++ tests/unittests/ut_prestartapp
-(directory)
--- tests/unittests/ut_prestartapp/CMakeLists.txt
+++ tests/unittests/ut_prestartapp/CMakeLists.txt
(renamed to tests/Common/unittests/ut_prestartapp/CMakeLists.txt)
--- tests/unittests/ut_prestartapp/ut_prestartapp.cpp
+++ tests/unittests/ut_prestartapp/ut_prestartapp.cpp
(renamed to tests/Common/unittests/ut_prestartapp/ut_prestartapp.cpp)
--- tests/unittests/ut_prestartapp/ut_prestartapp.h
+++ tests/unittests/ut_prestartapp/ut_prestartapp.h
(renamed to tests/Common/unittests/ut_prestartapp/ut_prestartapp.h)
--- tests/unittests/ut_prestarter
+++ tests/unittests/ut_prestarter
-(directory)
--- tests/unittests/ut_prestarter/CMakeLists.txt
+++ tests/unittests/ut_prestarter/CMakeLists.txt
(renamed to tests/Common/unittests/ut_prestarter/CMakeLists.txt)
--- tests/unittests/ut_prestarter/ut_prestarter.cpp
+++ tests/unittests/ut_prestarter/ut_prestarter.cpp
-#include "ut_prestarter.h"
-
-Ut_Prestarter::Ut_Prestarter()
-{}
-
-Ut_Prestarter::~Ut_Prestarter()
-{}
-
-void Ut_Prestarter::initTestCase()
-{}
-
-void Ut_Prestarter::cleanupTestCase()
-{
- m_subject.reset();
-}
-
-void Ut_Prestarter::testAddPrestartApp()
-{
- m_subject.reset(new Prestarter());
- PrestartApp * foo = new PrestartApp("foo1", "com.nokia.foo1", 0);
-
- m_subject->addPrestartApp(foo);
-
- QVERIFY( m_subject->findAppWithService(foo->service()));
- QVERIFY(!m_subject->findAppWithService("com.nokia.dummy12345"));
-
- QVERIFY(m_subject->m_vectApps.size() == 1);
-
- // Test that the same application is not added to the list multiple times
- int sizeBeforeSameAdd = m_subject->m_vectApps.size();
- m_subject->addPrestartApp(foo);
-
- QVERIFY(m_subject->m_vectApps.size() == sizeBeforeSameAdd);
-}
-
-void Ut_Prestarter::testReleasedPrestart()
-{
- m_subject.reset(new Prestarter());
- m_subject->addPrestartApp(new PrestartApp("foo1", "com.nokia.foo1", 0));
- m_subject->addPrestartApp(new PrestartApp("foo2", "com.nokia.foo2", 0));
-
- foreach (PrestartApp * p, m_subject->m_vectApps)
- p->setReleased(false);
-
- m_subject->releasedPrestart(0);
-
- foreach (PrestartApp * p, m_subject->m_vectApps)
- QVERIFY(p->released());
-}
-
-// Test that Prestarter sets PrestartApp::released() correctly
-void Ut_Prestarter::testRestoredPrestart()
-{
- // Add some apps
- m_subject.reset(new Prestarter());
- m_subject->addPrestartApp(new PrestartApp("foo1", "com.nokia.foo1", 0));
- m_subject->addPrestartApp(new PrestartApp("foo2", "com.nokia.foo2", 0));
-
- // Set apps released
- foreach (PrestartApp * p, m_subject->m_vectApps)
- p->setReleased(true);
-
- // Tell Prestarter that all apps returned to the prestarted state
- m_subject->restoredPrestart(0);
-
- foreach (PrestartApp * p, m_subject->m_vectApps)
- QVERIFY(!p->released());
-}
-
-// Test that apps won't get re-prestarted if count is too low
-void Ut_Prestarter::testRePrestart2Neg()
-{
- m_subject.reset(new Prestarter());
-
- // Add some apps
- m_subject->addPrestartApp(new PrestartApp("foo1", "com.nokia.foo1", 0));
- m_subject->addPrestartApp(new PrestartApp("foo2", "com.nokia.foo2", 0));
-
- // Toggle setReleased to increase release count
- foreach (PrestartApp * p, m_subject->m_vectApps)
- {
- p->setRePrestartTrigger(1);
- p->setReleased(false);
- p->setReleased(true);
- }
-
- // Tell Prestarter that all apps returned to the prestarted state
- m_subject->restoredPrestart(0);
-
- foreach (PrestartApp * p, m_subject->m_vectApps)
- {
- QVERIFY(!p->released());
- QVERIFY(!p->rePrestarting());
- }
-}
-
-// Test that apps will get re-prestarted if count is high enough
-// Test also that SIGTERM and SIGKILL gets send.
-void Ut_Prestarter::testRePrestart2Pos()
-{
- m_subject.reset(new Prestarter());
-
- // Add app
- PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0, true);
- m_subject->addPrestartApp(p);
-
- // Toggle setReleased to increase release count
- p->setRePrestartTrigger(1);
- p->setReleased(false);
- p->setReleased(true);
- p->setReleased(false);
- p->setReleased(true);
-
- // Tell Prestarter that all apps returned to the prestarted state
- m_subject->restoredPrestart(0);
-
- QVERIFY(!p->released());
- QVERIFY(!p->sigTermSent());
- QVERIFY(p->rePrestarting());
-}
-
-// Test that apps won't get re-prestarted if denied
-void Ut_Prestarter::testRePrestart3()
-{
- m_subject.reset(new Prestarter());
-
- // Add app
- PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0);
- m_subject->addPrestartApp(p);
-
- // Toggle setReleased to increase release count
- p->setForcedRePrestartNotAllowed(true);
- p->setRePrestartTrigger(1);
- p->setReleased(false);
- p->setReleased(true);
- p->setReleased(false);
- p->setReleased(true);
- p->setReleased(false);
- p->setReleased(true);
-
- // Tell Prestarter that all apps returned to the prestarted state
- m_subject->restoredPrestart(0);
-
- QVERIFY(!p->released());
- QVERIFY(!p->rePrestarting());
-}
-
-// Test that app get SIGTERM and SIGKILL
-void Ut_Prestarter::testRePrestartSig1()
-{
- m_subject.reset(new Prestarter());
-
- // Add app
- PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0);
- m_subject->addPrestartApp(p);
-
- p->setRePrestarting(true);
-
- QVERIFY(!p->sigTermSent());
- QVERIFY(!p->sigKillSent());
-
- m_subject->triggerForcedRePrestarts();
-
- QVERIFY(p->sigTermSent());
- QVERIFY(!p->sigKillSent());
-
- m_subject->triggerForcedRePrestarts();
-
- QVERIFY(p->sigTermSent());
- QVERIFY(p->sigKillSent());
-}
-
-// Test that app get SIGTERM, but not SIGKILL
-void Ut_Prestarter::testRePrestartSig2()
-{
- m_subject.reset(new Prestarter());
-
- // Add app
- PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0);
- m_subject->addPrestartApp(p);
-
- p->setRePrestarting(true);
-
- QVERIFY(!p->sigTermSent());
- QVERIFY(!p->sigKillSent());
-
- m_subject->triggerForcedRePrestarts();
-
- QVERIFY(p->sigTermSent());
- QVERIFY(!p->sigKillSent());
-
- p->setRePrestarting(false);
-
- m_subject->triggerForcedRePrestarts();
-
- QVERIFY(!p->sigTermSent());
- QVERIFY(!p->sigKillSent());
-}
-
-// Test that no signals are sent if app gets released from the prestarted state
-void Ut_Prestarter::testRePrestartSig3()
-{
- // Add some apps
- m_subject.reset(new Prestarter());
-
- PrestartApp * p = new PrestartApp("foo1", "com.nokia.foo1", 0);
- m_subject->addPrestartApp(p);
-
- p->setRePrestarting(true);
-
- QVERIFY(!p->sigTermSent());
- QVERIFY(!p->sigKillSent());
-
- p->setReleased(true);
-
- m_subject->triggerForcedRePrestarts();
-
- QVERIFY(!p->sigTermSent());
- QVERIFY(!p->sigKillSent());
-}
-
-void Ut_Prestarter::testSomethingToRePrestart()
-{
- m_subject.reset(new Prestarter());
-
- QVERIFY(!m_subject->somethingToRePrestart());
-
- PrestartApp * app = new PrestartApp("foo1", "com.nokia.foo1", 0);
- m_subject->addPrestartApp(app);
-
- QVERIFY(!m_subject->somethingToRePrestart());
-
- app->setRePrestarting(true);
-
- QVERIFY(m_subject->somethingToRePrestart());
-}
-
-void Ut_Prestarter::testDoReadConfigurationGlobals()
-{
- m_subject.reset(new Prestarter());
-
- QString data("<?xml version=\"1.0\"?> \
- <applifed default_cpu_load_threshold=\"50\" \
- cpu_load_polling_delay=\"2\" \
- re-prestart_delay=\"3600\" \
- default_re-prestart_trigger=\"5\"> \
- </applifed>");
-
- QXmlInputSource input;
- input.setData(data);
- m_subject->doReadConfiguration(input);
-
- // Test that global default settings are correct
- QVERIFY(m_subject->m_cpuLoadPollingDelay == 2);
- QVERIFY(m_subject->m_rePrestartDelay == 3600);
-
- data = "<?xml version=\"1.0\"?> \
- <applifed default_cpu_load_threshold=\"51\" \
- cpu_load_polling_delay=\"3\" \
- re-prestart_delay=\"3601\" \
- default_re-prestart_trigger=\"6\"> \
- </applifed>";
-
- input.setData(data);
-
- m_subject->doReadConfiguration(input);
-
- // Test that global default settings are correct
- QVERIFY(m_subject->m_cpuLoadPollingDelay == 3);
- QVERIFY(m_subject->m_rePrestartDelay == 3601);
-}
-
-void Ut_Prestarter::testDoReadConfigurationApplications()
-{
- m_subject.reset(new Prestarter());
-
- QString data("<?xml version=\"1.0\"?> \
- <applifed> \
- <application name=\"bar1\" service=\"com.foo.bar1\" priority=\"4\"/> \
- <application name=\"bar2\" service=\"com.foo.bar2\" priority=\"3\"/> \
- <application name=\"bar3\" service=\"com.foo.bar3\" priority=\"2\"/> \
- <application name=\"bar4\" service=\"com.foo.bar4\" priority=\"1\"/> \
- </applifed>");
-
- QXmlInputSource input;
- input.setData(data);
- m_subject->doReadConfiguration(input);
-
- // Test that added apps are there
- QVERIFY(m_subject->m_vectApps.size() == 4);
-
- PrestartApp * app = m_subject->findAppWithService("com.foo.bar1");
- QVERIFY(app);
-
- app = m_subject->findAppWithService("com.foo.bar2");
- QVERIFY(app);
-
- app = m_subject->findAppWithService("com.foo.bar3");
- QVERIFY(app);
-
- app = m_subject->findAppWithService("com.foo.bar4");
- QVERIFY(app);
-
- // This should not be there
- app = m_subject->findAppWithService("com.foo.bar5");
- QVERIFY(!app);
-}
-
-void Ut_Prestarter::testDoReadConfigurationApplicationParams1()
-{
- m_subject.reset(new Prestarter());
-
- QString data("<?xml version=\"1.0\"?> \
- <applifed> \
- <application name=\"bar1\" service=\"com.foo.bar1\" \
- priority=\"4\" \
- cpu_load_threshold=\"10\" \
- forced_re-prestart_not_allowed=\"1\" \
- re-prestart_trigger=\"3\" \
- /> \
- <application name=\"bar2\" service=\"com.foo.bar2\" \
- priority=\"5\" \
- cpu_load_threshold=\"11\" \
- forced_re-prestart_not_allowed=\"0\" \
- re-prestart_trigger=\"4\" \
- /> \
- </applifed>");
-
- QXmlInputSource input;
- input.setData(data);
- m_subject->doReadConfiguration(input);
-
- // Test that params are correctly set
- PrestartApp * app = m_subject->findAppWithService("com.foo.bar1");
- QVERIFY(app);
- QVERIFY(app->name() == "bar1");
- QVERIFY(app->priority() == 4);
- QVERIFY(app->cpuLoadThreshold() == 10);
- QVERIFY(app->forcedRePrestartNotAllowed() == true);
- QVERIFY(app->rePrestartTrigger() == 3);
-
- app = m_subject->findAppWithService("com.foo.bar2");
- QVERIFY(app);
- QVERIFY(app->name() == "bar2");
- QVERIFY(app->priority() == 5);
- QVERIFY(app->cpuLoadThreshold() == 11);
- QVERIFY(app->forcedRePrestartNotAllowed() == false);
- QVERIFY(app->rePrestartTrigger() == 4);
-}
-
-void Ut_Prestarter::testDoReadConfigurationApplicationParams2()
-{
- m_subject.reset(new Prestarter());
-
- QString data("<?xml version=\"1.0\"?> \
- <applifed \
- default_cpu_load_threshold=\"51\" \
- default_re-prestart_trigger=\"6\"> \
- <application name=\"bar1\" service=\"com.foo.bar1\" \
- cpu_load_threshold=\"10\" \
- re-prestart_trigger=\"3\"/> \
- <application name=\"bar2\" service=\"com.foo.bar2\"/> \
- </applifed>");
-
- QXmlInputSource input;
- input.setData(data);
- m_subject->doReadConfiguration(input);
-
- // Test that default settings are used correctly
- PrestartApp * app = m_subject->findAppWithService("com.foo.bar1");
- QVERIFY(app);
- QVERIFY(app->cpuLoadThreshold() == 10);
- QVERIFY(app->rePrestartTrigger() == 3);
-
- app = m_subject->findAppWithService("com.foo.bar2");
- QVERIFY(app);
- QVERIFY(app->cpuLoadThreshold() == 51);
- QVERIFY(app->rePrestartTrigger() == 6);
-}
-
-void Ut_Prestarter::testDoReadConfigurationAllowLazyShutdown()
-{
- m_subject.reset(new Prestarter());
-
- QString data("<?xml version=\"1.0\"?> \
- <applifed> \
- <allow_lazy_shutdown binary_path=\"/usr/bin/foo1\"/> \
- <allow_lazy_shutdown binary_path=\"/usr/bin/foo2\"/> \
- </applifed>");
-
- QXmlInputSource input;
- input.setData(data);
- m_subject->doReadConfiguration(input);
-
- QVERIFY(m_subject->isLazyShutdownAllowed("/usr/bin/foo1"));
- QVERIFY(m_subject->isLazyShutdownAllowed("/usr/bin/foo2"));
- QVERIFY(!m_subject->isLazyShutdownAllowed("/usr/bin/foo3"));
-}
-
-QTEST_MAIN(Ut_Prestarter);
--- tests/unittests/ut_prestarter/ut_prestarter.h
+++ tests/unittests/ut_prestarter/ut_prestarter.h
-#include <QtCore/QString>
-#include <QtTest/QtTest>
-#include <QtCore/QCoreApplication>
-
-#define UNIT_TEST
-
-#include "prestarter.h"
-#include "prestartapp.h"
-
-#include <tr1/memory>
-
-using std::tr1::shared_ptr;
-
-class Ut_Prestarter : public QObject
-{
- Q_OBJECT
-
-public:
- Ut_Prestarter();
- virtual ~Ut_Prestarter();
-
-private Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
- void testAddPrestartApp();
- void testRestoredPrestart();
- void testRePrestart2Neg();
- void testRePrestart2Pos();
- void testRePrestart3();
- void testRePrestartSig1();
- void testRePrestartSig2();
- void testRePrestartSig3();
- void testReleasedPrestart();
- void testSomethingToRePrestart();
- void testDoReadConfigurationGlobals();
- void testDoReadConfigurationApplications();
- void testDoReadConfigurationApplicationParams1();
- void testDoReadConfigurationApplicationParams2();
- void testDoReadConfigurationAllowLazyShutdown();
-
-private:
- shared_ptr<Prestarter> m_subject;
-};
++++++ meegotouch-applifed.yaml
--- meegotouch-applifed.yaml
+++ meegotouch-applifed.yaml
@@ -1,6 +1,6 @@
Name: meegotouch-applifed
Summary: Application life cycle daemon
-Version: 0.20.0
+Version: 0.20.9
Release: 1
Group: System/Daemons
License: LGPLv2+
@@ -8,7 +8,6 @@
Sources:
- "%{name}-%{version}.tar.bz2"
Patches:
- - "0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch"
- "0002-Ship-empty-conf-file-in-MeeGo.patch"
- "0003-Install-.desktop-file-on-MeeGo.patch"
Description: applifed is an application life cycle daemon. It manages prestarted applications.
@@ -34,6 +33,8 @@
- "%{_bindir}/applifed"
- "%{_bindir}/close-event"
- "%{_bindir}/fali_hello"
+ - "%{_bindir}/fali_hello1"
+ - "%{_bindir}/fali_close"
- "%{_bindir}/fali_multiapp"
- "%{_bindir}/fali_mw1"
- "%{_bindir}/fali_mw2"
@@ -42,41 +43,46 @@
- "%{_bindir}/fali_toc"
- "%{_bindir}/memoryhog"
- "%{_datadir}/applications/fali_hello.desktop"
+ - "%{_datadir}/applications/fali_hello1.desktop"
+ - "%{_datadir}/applications/fali_close.desktop"
- "%{_datadir}/applications/fali_toc.desktop"
- - "%{_datadir}/applifed-art-tests/tests.xml"
- - "%{_datadir}/applifed-bug-tests/tests.xml"
- - "%{_datadir}/applifed-functional-tests/tests.xml"
- - "%{_datadir}/applifed-performance-tests/tests.xml"
+ - "%{_datadir}/applifed-M-art-tests/tests.xml"
+ - "%{_datadir}/applifed-M-bug-tests/tests.xml"
+ - "%{_datadir}/applifed-M-functional-tests/tests.xml"
+ - "%{_datadir}/applifed-M-performance-tests/tests.xml"
- "%{_datadir}/applifed-tests"
- - "%{_libdir}/applifed-tests/tests.xml"
+ - "%{_datadir}/applifed-M-tests/tests.xml"
- "%{_libdir}/applifed-tests/ut_configdata"
- "%{_libdir}/applifed-tests/ut_cpuload"
- "%{_libdir}/applifed-tests/ut_prestartapp"
- "%{_libdir}/applifed-tests/ut_prestarter"
- - "%{_datadir}/applifed-testscripts/cp-service.rb"
- - "%{_datadir}/applifed-testscripts/cpu_load/cpu_load.conf"
- - "%{_datadir}/applifed-testscripts/cpu_load/cpu_load_high.drive"
- - "%{_datadir}/applifed-testscripts/cpu_load/cpu_load_low.drive"
- - "%{_datadir}/applifed-testscripts/cpu_load/tc_cpu_load.rb"
- - "%{_datadir}/applifed-testscripts/fautils.rb"
- - "%{_datadir}/applifed-testscripts/functest_applifed.conf"
- - "%{_datadir}/applifed-testscripts/functional.drive"
- - "%{_datadir}/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.conf"
- - "%{_datadir}/applifed-testscripts/periodic_re_prestart/periodic_re_prestart.drive"
- - "%{_datadir}/applifed-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb"
- - "%{_datadir}/applifed-testscripts/prevent.conf"
- - "%{_datadir}/applifed-testscripts/prevent.drive"
+ - "%{_datadir}/applifed-M-testscripts/cp-service.rb"
+ - "%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load.conf"
+ - "%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load_high.drive"
+ - "%{_datadir}/applifed-M-testscripts/cpu_load/cpu_load_low.drive"
+ - "%{_datadir}/applifed-M-testscripts/cpu_load/tc_cpu_load.rb"
+ - "%{_datadir}/applifed-M-testscripts/fautils.rb"
+ - "%{_datadir}/applifed-M-testscripts/functest_applifed.conf"
+ - "%{_datadir}/applifed-M-testscripts/functional.drive"
+ - "%{_datadir}/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.conf"
+ - "%{_datadir}/applifed-M-testscripts/periodic_re_prestart/periodic_re_prestart.drive"
+ - "%{_datadir}/applifed-M-testscripts/periodic_re_prestart/ts_periodic_re_prestart.rb"
+ - "%{_datadir}/applifed-M-testscripts/prevent.conf"
+ - "%{_datadir}/applifed-M-testscripts/prevent.drive"
- "%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_hello.service.sb"
- "%{_datadir}/applifed-testscripts/sbservice/com.nokia.fali_toc.service.sb"
- - "%{_datadir}/applifed-testscripts/tc_applifed_one_instance.rb"
- - "%{_datadir}/applifed-testscripts/tc_daemonize.rb"
- - "%{_datadir}/applifed-testscripts/tc_prestart_preventing.rb"
- - "%{_datadir}/applifed-testscripts/test-perf-prestart.py"
- - "%{_datadir}/applifed-testscripts/test-perf-prestart.pyc"
- - "%{_datadir}/applifed-testscripts/test-perf-prestart.pyo"
- - "%{_datadir}/applifed-testscripts/ts_mwtests.rb"
- - "%{_datadir}/applifed-testscripts/ts_prestart.rb"
+ - "%{_datadir}/applifed-M-testscripts/tc_applifed_one_instance.rb"
+ - "%{_datadir}/applifed-M-testscripts/tc_daemonize.rb"
+ - "%{_datadir}/applifed-M-testscripts/tc_prestart_preventing.rb"
+ - "%{_datadir}/applifed-M-testscripts/test-perf-prestart.py"
+ - "%{_datadir}/applifed-M-testscripts/test-perf.rb"
+ - "%exclude %{_datadir}/applifed-M-testscripts/test-perf-prestart.pyc"
+ - "%exclude %{_datadir}/applifed-M-testscripts/test-perf-prestart.pyo"
+ - "%{_datadir}/applifed-M-testscripts/ts_mwtests.rb"
+ - "%{_datadir}/applifed-M-testscripts/ts_prestart.rb"
- "%{_datadir}/dbus-1/services/com.nokia.fali_hello.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_hello1.service"
+ - "%{_datadir}/dbus-1/services/com.nokia.fali_close.service"
- "%{_datadir}/dbus-1/services/com.nokia.fali_mw1.service"
- "%{_datadir}/dbus-1/services/com.nokia.fali_mw2.service"
- "%{_datadir}/dbus-1/services/com.nokia.fali_mw3.service"
++++++ deleted files:
--- 0001-Use-usr-bin-ruby-instead-of-usr-bin-ruby1.8.patch
More information about the MeeGo-commits
mailing list