Changes: First public release

pull/1/head
Antti Kervinen 16 years ago
commit d18c8d95ef

36
.gitignore vendored

@ -0,0 +1,36 @@
CMakeCache.txt
Makefile
cmake_install.cmake
install_manifest.txt
CMakeFiles/
*.cxx
*.so
*.o
*.log
*.substvars
tests/unittests/ut_booster/ut_booster
tests/unittests/ut_connection/ut_connection
tests/unittests/ut_daemon/ut_daemon
tests/unittests/ut_mbooster/ut_mbooster
tests/unittests/ut_qtbooster/ut_qtbooster
src/invoker/invoker
src/launcher/applauncherd.bin
tests/perftests/startup-perftest/testapp/testapp
tests/perftests/waitforwindow/wait_window
tests/helloworld/helloworld
tests/perftests/hello_no_launcher/hello_no_launcher
tests/perftests/launcher_perf.txt
debian/applauncherd-dev/
debian/applauncherd-doc/
build-stamp
configure-stamp
debian/applauncherd-functional-tests/
debian/applauncherd-invoker/
debian/applauncherd-launcher/
debian/applauncherd-performance-tests/
debian/applauncherd-tests/
debian/applauncherd.aegis.more
debian/applauncherd/
debian/files
debian/tmp/

@ -0,0 +1,80 @@
project(Applauncherd)
cmake_minimum_required(VERSION 2.6)
cmake_policy(VERSION 2.6)
set(CMAKE_VERBOSE_MAKEFILE ON)
# Set default C++ flags
#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")
# By default only QtCore and QtGui modules are enabled
#set(QT_USE_QTDBUS TRUE)
# Find Qt4
find_package(Qt4 4.6.0 REQUIRED)
include(${QT_USE_FILE})
if (${QTVERSION} VERSION_LESS 4.6.0)
message(FATAL_ERROR "You need Qt4.6, found ${QTVERSION}.")
endif (${QTVERSION} VERSION_LESS 4.6.0)
# Find creds.h (and libcreds if the header is found)
message(STATUS "checking for creds.h")
find_file(CREDS_H NAMES creds.h PATHS /usr/include/sys)
if (EXISTS ${CREDS_H})
message(STATUS " found: " ${CREDS_H})
message(STATUS "checking for libcreds")
find_library(LIBCREDS NAMES creds)
if (EXISTS ${LIBCREDS})
add_definitions(-DHAVE_CREDS)
link_libraries(${LIBCREDS})
message(STATUS " found: " ${LIBCREDS})
else (EXISTS ${LIBCREDS})
message(STATUS " not found: Platform Security is disabled.")
endif (EXISTS ${LIBCREDS})
else (EXISTS ${CREDS_H})
message(STATUS " not found: Platform Security is disabled.")
endif (EXISTS ${CREDS_H})
if ($ENV{DISABLE_VERIFICATION})
add_definitions(-DDISABLE_VERIFICATION)
endif ($ENV{DISABLE_VERIFICATION})
# Build with test coverage switch if BUILD_COVERAGE environment variable is set
if ($ENV{BUILD_COVERAGE})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")
set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -ftest-coverage -fprofile-arcs")
endif ($ENV{BUILD_COVERAGE})
# Sub build: applauncherd
add_subdirectory(src)
# Build tests if BUILD_TESTS environment variable is set
if ($ENV{BUILD_TESTS})
# Sub build: tests
# This will build the HelloWorld test library, unit tests, functional tests
# and performance tests
add_subdirectory(tests)
endif ($ENV{BUILD_TESTS})
# Target for documentation (make doc)
find_program(Doxygen NAMES doxygen)
if (EXISTS ${Doxygen})
add_custom_target(doc COMMAND ${Doxygen} doc/Doxyfile)
else (EXISTS ${Doxygen})
message(STATUS "Doxygen not found: you're not able to build documentation.")
endif (EXISTS ${Doxygen})
# Install README
install(FILES README DESTINATION /usr/share/doc/applauncherd)
# Install meegotouch-boostable.pc
install(FILES data/pkgconfig/meegotouch-boostable.pc DESTINATION /usr/lib/pkgconfig)
# Install the qmake config feature file
install(FILES data/mkspecs/features/meegotouch-boostable.prf DESTINATION /usr/share/qt4/mkspecs/features)

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

@ -0,0 +1,360 @@
# - a pkg-config module for CMake
#
# Usage:
# pkg_check_modules(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
# checks for all the given modules
#
# pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
# checks for given modules and uses the first working one
#
# When the 'REQUIRED' argument was set, macros will fail with an error
# when module(s) could not be found
#
# It sets the following variables:
# PKG_CONFIG_FOUND ... true if pkg-config works on the system
# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
# <PREFIX>_FOUND ... set to 1 if module(s) exist
#
# For the following variables two sets of values exist; first one is the
# common one and has the given PREFIX. The second set contains flags
# which are given out when pkgconfig was called with the '--static'
# option.
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
#
# There are some special variables whose prefix depends on the count
# of given modules. When there is only one module, <PREFIX> stays
# unchanged. When there are multiple modules, the prefix will be
# changed to <PREFIX>_<MODNAME>:
# <XPREFIX>_VERSION ... version of the module
# <XPREFIX>_PREFIX ... prefix-directory of the module
# <XPREFIX>_INCLUDEDIR ... include-dir of the module
# <XPREFIX>_LIBDIR ... lib-dir of the module
#
# <XPREFIX> = <PREFIX> when |MODULES| == 1, else
# <XPREFIX> = <PREFIX>_<MODNAME>
#
# A <MODULE> parameter can have the following formats:
# {MODNAME} ... matches any version
# {MODNAME}>={VERSION} ... at least version <VERSION> is required
# {MODNAME}={VERSION} ... exactly version <VERSION> is required
# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
#
# Examples
# pkg_check_modules (GLIB2 glib-2.0)
#
# pkg_check_modules (GLIB2 glib-2.0>=2.10)
# requires at least version 2.10 of glib2 and defines e.g.
# GLIB2_VERSION=2.10.3
#
# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
# requires both glib2 and gtk2, and defines e.g.
# FOO_glib-2.0_VERSION=2.10.3
# FOO_gtk+-2.0_VERSION=2.8.20
#
# pkg_check_modules (XRENDER REQUIRED xrender)
# defines e.g.:
# XRENDER_LIBRARIES=Xrender;X11
# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
#
# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
# Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
#
# Redistribution and use, with or without modification, are permitted
# provided that the following conditions are met:
#
# 1. Redistributions must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
### Common stuff ####
set(PKG_CONFIG_VERSION 1)
set(PKG_CONFIG_FOUND 0)
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
if(PKG_CONFIG_EXECUTABLE)
set(PKG_CONFIG_FOUND 1)
endif(PKG_CONFIG_EXECUTABLE)
# Unsets the given variables
macro(_pkgconfig_unset var)
set(${var} "" CACHE INTERNAL "")
endmacro(_pkgconfig_unset)
macro(_pkgconfig_set var value)
set(${var} ${value} CACHE INTERNAL "")
endmacro(_pkgconfig_set)
# Invokes pkgconfig, cleans up the result and sets variables
macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
set(_pkgconfig_invoke_result)
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
OUTPUT_VARIABLE _pkgconfig_invoke_result
RESULT_VARIABLE _pkgconfig_failed)
if (_pkgconfig_failed)
set(_pkgconfig_${_varname} "")
_pkgconfig_unset(${_prefix}_${_varname})
else(_pkgconfig_failed)
string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
if (NOT ${_regexp} STREQUAL "")
string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
endif(NOT ${_regexp} STREQUAL "")
separate_arguments(_pkgconfig_invoke_result)
#message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}")
set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result})
_pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}")
endif(_pkgconfig_failed)
endmacro(_pkgconfig_invoke)
# Invokes pkgconfig two times; once without '--static' and once with
# '--static'
macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
_pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN})
_pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN})
endmacro(_pkgconfig_invoke_dyn)
# Splits given arguments into options and a package list
macro(_pkgconfig_parse_options _result _is_req)
set(${_is_req} 0)
foreach(_pkg ${ARGN})
if (_pkg STREQUAL "REQUIRED")
set(${_is_req} 1)
endif (_pkg STREQUAL "REQUIRED")
endforeach(_pkg ${ARGN})
set(${_result} ${ARGN})
list(REMOVE_ITEM ${_result} "REQUIRED")
endmacro(_pkgconfig_parse_options)
###
macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
_pkgconfig_unset(${_prefix}_FOUND)
_pkgconfig_unset(${_prefix}_VERSION)
_pkgconfig_unset(${_prefix}_PREFIX)
_pkgconfig_unset(${_prefix}_INCLUDEDIR)
_pkgconfig_unset(${_prefix}_LIBDIR)
_pkgconfig_unset(${_prefix}_LIBS)
_pkgconfig_unset(${_prefix}_LIBS_L)
_pkgconfig_unset(${_prefix}_LIBS_PATHS)
_pkgconfig_unset(${_prefix}_LIBS_OTHER)
_pkgconfig_unset(${_prefix}_CFLAGS)
_pkgconfig_unset(${_prefix}_CFLAGS_I)
_pkgconfig_unset(${_prefix}_CFLAGS_OTHER)
_pkgconfig_unset(${_prefix}_STATIC_LIBDIR)
_pkgconfig_unset(${_prefix}_STATIC_LIBS)
_pkgconfig_unset(${_prefix}_STATIC_LIBS_L)
_pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS)
_pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER)
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS)
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I)
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER)
# create a better addressable variable of the modules and calculate its size
set(_pkg_check_modules_list ${ARGN})
list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt)
if(PKG_CONFIG_EXECUTABLE)
# give out status message telling checked module
if (NOT ${_is_silent})
if (_pkg_check_modules_cnt EQUAL 1)
message(STATUS "checking for module '${_pkg_check_modules_list}'")
else(_pkg_check_modules_cnt EQUAL 1)
message(STATUS "checking for modules '${_pkg_check_modules_list}'")
endif(_pkg_check_modules_cnt EQUAL 1)
endif(NOT ${_is_silent})
set(_pkg_check_modules_packages)
set(_pkg_check_modules_failed)
# iterate through module list and check whether they exist and match the required version
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
set(_pkg_check_modules_exist_query)
# check whether version is given
if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}")
string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}")
else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
set(_pkg_check_modules_pkg_op)
set(_pkg_check_modules_pkg_ver)
endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
# handle the operands
if (_pkg_check_modules_pkg_op STREQUAL ">=")
list(APPEND _pkg_check_modules_exist_query --atleast-version)
endif(_pkg_check_modules_pkg_op STREQUAL ">=")
if (_pkg_check_modules_pkg_op STREQUAL "=")
list(APPEND _pkg_check_modules_exist_query --exact-version)
endif(_pkg_check_modules_pkg_op STREQUAL "=")
if (_pkg_check_modules_pkg_op STREQUAL "<=")
list(APPEND _pkg_check_modules_exist_query --max-version)
endif(_pkg_check_modules_pkg_op STREQUAL "<=")
# create the final query which is of the format:
# * --atleast-version <version> <pkg-name>
# * --exact-version <version> <pkg-name>
# * --max-version <version> <pkg-name>
# * --exists <pkg-name>
if (_pkg_check_modules_pkg_op)
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
else(_pkg_check_modules_pkg_op)
list(APPEND _pkg_check_modules_exist_query --exists)
endif(_pkg_check_modules_pkg_op)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR)
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}")
list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}")
# execute the query
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
RESULT_VARIABLE _pkgconfig_retval)
# evaluate result and tell failures
if (_pkgconfig_retval)
if(NOT ${_is_silent})
message(STATUS " package '${_pkg_check_modules_pkg}' not found")
endif(NOT ${_is_silent})
set(_pkg_check_modules_failed 1)
endif(_pkgconfig_retval)
endforeach(_pkg_check_modules_pkg)
if(_pkg_check_modules_failed)
# fail when requested
if (${_is_required})
message(SEND_ERROR "A required package was not found")
endif (${_is_required})
else(_pkg_check_modules_failed)
# when we are here, we checked whether requested modules
# exist. Now, go through them and set variables
_pkgconfig_set(${_prefix}_FOUND 1)
list(LENGTH _pkg_check_modules_packages pkg_count)
# iterate through all modules again and set individual variables
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages})
# handle case when there is only one package required
if (pkg_count EQUAL 1)
set(_pkg_check_prefix "${_prefix}")
else(pkg_count EQUAL 1)
set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
endif(pkg_count EQUAL 1)
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix )
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
endforeach(_pkg_check_modules_pkg)
# set variables which are combined for multiple modules
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
endif(_pkg_check_modules_failed)
else(PKG_CONFIG_EXECUTABLE)
if (${_is_required})
message(SEND_ERROR "pkg-config tool not found")
endif (${_is_required})
endif(PKG_CONFIG_EXECUTABLE)
endmacro(_pkg_check_modules_internal)
###
### User visible macros start here
###
###
macro(pkg_check_modules _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
_pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN})
_pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
endmacro(pkg_check_modules)
###
macro(pkg_search_module _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
set(_pkg_modules_found 0)
_pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN})
message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
# iterate through all modules and stop at the first working one.
foreach(_pkg_alt ${_pkg_modules_alt})
if(NOT _pkg_modules_found)
_pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
endif(NOT _pkg_modules_found)
if (${_prefix}_FOUND)
set(_pkg_modules_found 1)
endif(${_prefix}_FOUND)
endforeach(_pkg_alt)
if (NOT ${_prefix}_FOUND)
if(${_pkg_is_required})
message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found")
endif(${_pkg_is_required})
endif(NOT ${_prefix}_FOUND)
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
endmacro(pkg_search_module)
### Local Variables:
### mode: cmake
### End:

@ -0,0 +1,37 @@
BUILD & INSTALL
===============
Applauncherd uses the CMake build system.
Configure
---------
* Configure applauncherd only:
./configure
* Configure applauncherd + tests:
BUILD_TESTS=1 ./configure
* Configure applauncherd with security check for invoker disabled:
DISABLE_VERIFICATION=1 ./configure
* If you are building the .deb package, check debian/rules for the configuration used
Build
-----
make
Build Doxygen -documentation if Doxygen was found
-------------------------------------------------
make doc
Install
-------
make install

136
README

@ -0,0 +1,136 @@
What is applauncherd?
==============================
Applauncherd is a daemon and it helps to launch applications faster by preloading MeeGo Touch and Qt dynamically linked libraries and making some initializations before loading the application binary and executing the main function.
The applauncherd daemon is started by UpStart as part of XSession, that is, at the same level as the desktop (MeeGo Touch homescreen). Applauncherd forks the will-be-application process a.k.a booster before knowing which application is going to be launched next.
Users use the launcher always through a special invoker program. The invoker (/usr/bin/invoker) tells booster process to load an application binary.
Before loading, booster process changes its security credentials so that the code in the application binary will be executed with the correct credentials. Loading the binary is done with dlopen(), and therefore the application needs to be compiled and linked as a shared library or a position independent executable. The booster process also sets the
environment variables. Finally, it finds the main function in the application binary with dlsym() and calls the main() with the command line arguments given by the invoker.
Aegis platform security is used to protect the socket connection between invoker and launcher. Currently this works only on the target device. It is automatically disabled by the build scripts when compiling on x86.
Each application type (currently Qt and MeeGo Touch) has its own booster process. When booster launches the application by calling the "main()" function, applauncherd will create new booster process of that type. Qt booster can be used for all kinds of applicationts.
Booster processes do some initializations that cannot be shared among other processes and therefore have to be done after the fork. This allows, for instance, instantiating a MeeGo Touch application before knowing the name of the application. Then the booster process waits for a connection from the invoker with the information about which application should be launched.
With MeeGo Touch booster it's possible to fetch certain objects from a cache. This will significantly reduce the startup time of an application. Please refer to the MeeGo Touch documentation for instructions on MComponentCache and how to enable it in your application.
Using applauncherd
==============================
1. COMPILING YOUR APPLICATION TO BE LAUNCHABLE
Binaries intended to be run with applauncherd should be compiled with -fPIC option to produce position independent code. In order to produce a position independent executable, -pie option and -rdynamic options can be used in linking. This allows the result to be executed traditionally and with the launcher.
To improve linking and load times of shared object libraries the size of dynamic export table it is encouraged to hide the unnecessary symbols from the resulting binary by using -fvisibility=hidden and -fvisibility-inlines-hidden flags in compilation as well.
Manual settings for QMake
-------------------------
If you are using QMake, you can define following variables in .pro file:
QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
QMAKE_LFLAGS += -pie -rdynamic
Manual settings for CMake
-------------------------
With CMake, you can compile and install your program like this:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden -fvisibility-inlines-hidden")
set(CMAKE_EXE_LINKER_FLAGS " -pie -rdynamic")
install(PROGRAMS myapplication DESTINATION /usr/bin RENAME myapplication.launch)
Automatic settings with pkg-config
----------------------------------
The correct flags can be automatically obtained with:
pkg-config --cflags --libs meegotouch-boostable
And with qmake:
CONFIG += meegotouch-boostable
CMake also has a pkg-config support.
When using these, your application must build-depend on applauncherd-dev.
Symbol visibility
-----------------
With -fvisibility=hidden you must make sure that the symbol for main() is exported,
because otherwise the launcher is not able to find the entry point for your
application. This can be done like this (MeeGo Touch):
#include <MExport>
M_EXPORT int main(int argc, char **argv)
{
...
}
or like this (Qt):
#include <QtCore/QtGlobal>
Q_DECL_EXPORT int main(int argc, char **argv)
{
...
}
or like this (generic way with gcc):
extern "C" __attribute__ ((__visibility__("default"))) int main(int argc, char **argv)
{
...
}
2. LAUNCHING YOUR APPLICATION
Rename appication binary to <application_name>.launch and replace the original binary by a wrapper script that executes invoker with correct application type and the name of the application binary as a parameter.
Use --type=m parameter for MeeGo Touch applications and --type=qt for plain Qt applications and everything else. Launch script example for typical application:
#!/bin/sh
echo "/usr/bin/invoker --type=m" $0.launch $@
exec /usr/bin/invoker --type=m $0.launch $@
If you are using D-Bus to launch your application, then this can be done straightly in the .service-file without any wrapper scripts:
[D-BUS Service]
Name=com.nokia.launchable_app
Exec=/usr/bin/invoker --type=m /usr/bin/launchable_app.launch
3. STARTING Applaucherd
Applauncherd is started by UpStart during the boot time, but it can be also started manually in scratchbox or on the device by the /usr/bin/applauncherd -script
4. PLATFORM SECURITY (Aegis)
Altough the connection between invoker and launcher is protected by Aegis, Application developer doesn't need to request for any additional security tokens to make things work.
5. PACKAGING
Add dependency to applauncherd package to "Depends" section of your applications debian/control file.
Current known issues
==============================
Forking and MComponentCache
---------------------------
It's not possible to use MComponentCache if you fork() in your application
before trying to fetch components from the cache. This is just due to the
fact that X11 connections get messed up after fork().
Questions and Bug Reports
==============================
TBD

@ -0,0 +1,6 @@
TODO
====
- Update README

3
configure vendored

@ -0,0 +1,3 @@
#!/bin/sh
rm -f CMakeCache.txt
cmake .

@ -0,0 +1,5 @@
# Tell qmake to use pkg-config to get correct compiler and linker
# flags to make an application usable with applauncherd.
CONFIG += link_pkgconfig
PKGCONFIG += meegotouch-boostable

@ -0,0 +1,5 @@
Name: meegotouch-boostable
Description: make application boostable by applauncherd
Version: 0.2.0
Libs: -pie -rdynamic
Cflags: -fPIC -fvisibility=hidden -fvisibility-inlines-hidden

@ -0,0 +1 @@
usr/share/applauncherd-art-tests/tests.xml

@ -0,0 +1 @@
usr/share/applauncherd-bug-tests/tests.xml

@ -0,0 +1,2 @@
usr/lib/pkgconfig/meegotouch-boostable.pc
usr/share/qt4/mkspecs/features/meegotouch-boostable.prf

@ -0,0 +1 @@
usr/share/doc/applauncherd/README

@ -0,0 +1 @@
usr/share/applauncherd-functional-tests/tests.xml

@ -0,0 +1,8 @@
<aegis>
<request>
<credential name="applauncherd-launcher::access"/>
<for path="/usr/bin/invoker" id="client"/>
</request>
</aegis>

@ -0,0 +1 @@
usr/bin/invoker

@ -0,0 +1,20 @@
<aegis>
<request>
<credential name="CAP::setgid"/>
<credential name="CAP::setuid"/>
<credential name="CAP::setfcap"/>
<credential name="CAP::sys_nice"/>
<credential name="drm"/>
<credential name="Cellular"/>
<credential name="ReadUserData"/>
<credential name="ReadWriteUserData"/>
<for path="/usr/bin/applauncherd.bin"/>
</request>
<provide>
<credential name="access" />
</provide>
</aegis>

@ -0,0 +1,2 @@
usr/bin/applauncherd.bin
usr/bin/applauncherd

@ -0,0 +1,2 @@
usr/share/applauncherd-performance-tests/tests.xml

@ -0,0 +1,16 @@
<aegis>
<request>
<credential name="tcb" />
<credential name="drm" />
<credential name="Telephony" />
<credential name="CAP::setuid" />
<credential name="CAP::setgid" />
<credential name="CAP::setfcap" />
<for path="/usr/bin/fala_ft_creds1.launch" />
</request>
<request>
<credential name="Cellular" />
<for path="/usr/bin/fala_ft_creds2.launch" />
</request>
</aegis>

@ -0,0 +1,16 @@
usr/bin/fala_ft_hello
usr/bin/fala_ft_hello1
usr/bin/fala_ft_hello2
usr/bin/fala_ft_hello.launch
usr/bin/fala_ft_hello1.launch
usr/bin/fala_ft_hello2.launch
usr/bin/qhelloworld
usr/bin/fala_ft_creds1
usr/bin/fala_ft_creds1.launch
usr/bin/fala_ft_creds2
usr/bin/fala_ft_creds2.launch
usr/bin/fala_testapp
usr/share/dbus-1/services/com.nokia.fala_testapp.service
usr/bin/fala_ft_themetest.launch
usr/bin/fala_ft_themetest
usr/share/themes/base/meegotouch/fala_ft_themetest/*

@ -0,0 +1,6 @@
usr/share/applauncherd-tests/tests.xml
usr/share/applauncherd-tests/ut_daemon
usr/share/applauncherd-tests/ut_booster
usr/share/applauncherd-tests/ut_connection
usr/share/applauncherd-tests/ut_mbooster
usr/share/applauncherd-tests/ut_qtbooster

@ -0,0 +1,5 @@
usr/share/applauncherd-testscripts/test-func-launcher.py
usr/share/applauncherd-testscripts/ts_prestartapp.rb
usr/share/applauncherd-testscripts/check_pipes.py
usr/share/applauncherd-testscripts/test-perf-mbooster.py
usr/share/applauncherd-testscripts/tc_theming.rb

120
debian/changelog vendored

@ -0,0 +1,120 @@
applauncherd (0.7.0-2) stable; urgency=low
* Fixes: NB#176326 - Conndlgs launched using Applauncherd respawns until respawn limit
-- Antti Kervinen <antti.kervinen@nokia.com> Tue, 07 Jul 2010 12:21:29 +0300
applauncherd (0.7.0-1) stable; urgency=low
* Invoker waits for launched process to terminate when run with --wait-term
* Dbg packages added: applauncherd-dbg, applauncherd-invoker-dbg, applauncherd-launcher-dbg and applauncherd-testapps-dbg
* Fixes: NB#177439, invoker starts reloading cache too soon
* Implemented: SWP#DUI-3384
-- Antti Kervinen <antti.kervinen@nokia.com> Tue, 07 Jul 2010 10:10:29 +0300
applauncherd (0.6.0-1) stable; urgency=low
* applauncherd-art-tests and applauncherd-bug-tests added
-- Nimika Keshri <nimika.1.keshri@nokia.com> Thu, 24 Jun 2010 19:26:17 +0300
applauncherd (0.5.0-3) stable; urgency=low
* Fixes: NB#174460, applauncherd-functional-tests package fails very frequently in ART
* Coverity tool fixes
-- Nimika Keshri <nimika.1.keshri@nokia.com> Mon, 14 Jun 2010 19:26:20 +0300
applauncherd (0.5.0-2) stable; urgency=low
* delay is initialized to DEFAULT_DELAY
* Refactored test application for performance tests
-- Nimika Keshri <nimika.1.keshri@nokia.com> Mon, 07 Jun 2010 12:39:54 +0300
applauncherd (0.5.0-1) stable; urgency=low
* Platform security feature improved
* mcomponentcache enabled
* disable LD_BIND_NOW environment variable
* added delay parameter to invoker, invoker debug logging disabled by default, code refactoring
-- Nimika Keshri <nimika.1.keshri@nokia.com> Fri, 04 Jun 2010 12:18:59 +0300
applauncherd (0.4.1-1) stable; urgency=low
* applauncherd-dev install meegotouch-boostable.prf for qmake
* Socket permissions set to 777
* Documentation updates
* Aegis tests updated / fixed
-- Jussi Lind <jussi.lind@nokia.com> Thu, 27 May 2010 14:34:47 +0300
applauncherd (0.4.0-1) stable; urgency=low
* Platform security stuff added: confine for the forked process + verification for the invoker (disabled for now)
* Applauncherd package divided into applauncherd-launcher and applauncherd-invoker
* Fixes: NB#170267, applauncherd-functional-tests package error
* applauncherd-dev installs meegotouch-boostable.pc that shows correct linker flags for applications
* Documentation updates
-- Jussi Lind <jussi.lind@nokia.com> Thu, 20 May 2010 15:38:42 +0300
applauncherd (0.3.1-1) stable; urgency=low
* Workaround: NB#168188, populating cache disabled for not allocating graphics memory
-- Antti Kervinen <antti.kervinen@nokia.com> Mon, 17 May 2010 14:51:25 +0300
applauncherd (0.3.0-1) stable; urgency=low
* Added the feature and requirements fields inside tests.xml files
* Updated functional and unit tests according the MBooster change
* Code refactoring
* Implemented: SWP#DUI-2964
-- Olli Leppanen <olli.leppanen@nokia.com> Tue, 05 May 2010 12:16:40 +0300
applauncherd (0.2.0-5) stable; urgency=low
* Naming changes: libdui => libmeegotouch
* Unit tests are updated
* Implemented: SWP#DUI-2483
-- Alexey Shilov <alexey.shilov@nokia.com> Tue, 27 Apr 2010 16:16:40 +0300
applauncherd (0.2.0-4) stable; urgency=low
* applifed-performance-tests is trying to overwrite the file ./usr/bin/waitforwindow, which was provided by applauncherd-performance-tests
* Fixes: NB#161251
-- Jussi Lind <jussi.lind@nokia.com> Tue, 06 Apr 2010 13:59:16 +0300
applauncherd (0.2.0-3) stable; urgency=low
* Instructions for developers added
* Process nice parameter passed from invoker to launcher
* Unit tests are updated
* Implemented: SWP#DUI-2127, SWP#DUI-2152
-- Alexey Shilov <alexey.shilov@nokia.com> Fri, 11 Mar 2010 13:13:02 +0200
applauncherd (0.2.0-2) stable; urgency=low
* Naming changes: launcher => applauncherd, applaucherd => applauncherd.bin
-- Jussi Lind <jussi.lind@nokia.com> Mon, 08 Mar 2010 13:13:02 +0200
applauncherd (0.2.0-1) stable; urgency=low
* First released version: basic launcher functionality with basic test set
* Implemented: SWP#DUI-2270, SWP#DUI-2128
-- Jussi Lind <jussi.lind@nokia.com> Fri, 05 Mar 2010 11:16:03 +0200
launcher (0.1.0-1) unstable; urgency=low
* Initial release
-- Jussi Lind <jussi.lind@nokia.com> Fri, 12 Feb 2010 16:00:08 +0200

1
debian/compat vendored

@ -0,0 +1 @@
5

127
debian/control vendored

@ -0,0 +1,127 @@
Source: applauncherd
Section: admin
Priority: important
Maintainer: Jussi Lind <jussi.lind@nokia.com>
Build-Depends: cmake (>= 2.6.0), debhelper (>= 7), libqt4-dev (>= 4.5.0), libmeegotouch-dev, libcreds2-dev [arm armel], aegis-builder (>= 1.4) [arm armel]
Standards-Version: 3.8.0
Package: applauncherd
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-invoker (= ${Source-Version})
Description: Meta package for applauncherd and invoker
Launcher daemon and invoker to speed up launches.
Special boosters for MeeGo Touch and Qt.
Package: applauncherd-dbg
Architecture: any
Depends: applauncherd-invoker-dbg, applauncherd-launcher-dbg
Description: Meta package for applauncherd and invoker debug symbols
Package: applauncherd-invoker
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-launcher (= ${Source-Version}), libcreds2 [arm armel]
Description: Invoker part of applauncherd
Invoker part of applauncherd.
Package: applauncherd-invoker-dbg
Section: debug
Architecture: any
Depends: applauncherd-invoker (= ${Source-Version})
Description: Invoker debug package
Debug symbols for invoker
Package: applauncherd-launcher
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libcreds2 [arm armel]
Description: Launcher part of applauncherd
Launcher part of applauncherd.
Package: applauncherd-launcher-dbg
Section: debug
Architecture: any
Depends: applauncherd-launcher (= ${Source-Version})
Description: Launcher debug package
Debug symbols for launcher
Package: applauncherd-dev
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, pkg-config
Description: Development files for applications using applauncherd
Development files for applications using applauncherd.
Package: applauncherd-tests
Section: extra
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libmeegotouchcore0, libmeegotouchviews0, libmeegotouchextensions0, libmeegotouchsettings0, testrunner, applauncherd, ci-testing, libcreds[arm armel]
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, staging, acceptance, validation
Description: applauncherd unit tests
Unit testing binaries and shellscripts for testing applauncherd.
Package: applauncherd-testscripts
Section: extra
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, testrunner, applauncherd, ci-testing, matti, libcreds2 [arm armel], libcreds2-tools [arm armel], meego-env, mcetools (>= 1.10.40)
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, staging, acceptance, validation
Description: applauncherd testscripts
Testscripts for testing applauncherd
Package: applauncherd-testapps
Section: extra
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd, libmeegotouchcore0, libmeegotouchviews0, libmeegotouchextensions0, libmeegotouchsettings0, libcreds2 [arm armel], libcreds2-tools [arm armel]
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, staging, acceptance, validation
Description: applaunched testapps
Test applications for testing applauncherd.
Package: applauncherd-testapps-dbg
Section: debug
Architecture: any
Depends: applauncherd-testapps
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, staging, acceptance, validation
Description: debug symbols for applauncherd testapps
Package: applauncherd-functional-tests
Section: extra
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, staging, acceptance, validation
Description: applauncherd functional tests
Functional tests for testing applauncherd.
Package: applauncherd-art-tests
Section: extra
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, staging, acceptance, validation
Description: applauncherd art tests
Art tests for testing applauncherd.
Package: applauncherd-bug-tests
Section: extra
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, staging, acceptance, validation
Description: applauncherd bug tests
Tests related to bugs for testing applauncherd.
Package: applauncherd-performance-tests
Section: extra
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, applauncherd-testapps, applauncherd-testscripts
XB-Maemo-CI-Packages: applauncherd
XB-Maemo-CI-Stage: fast, acceptance, validation
Description: applauncherd performance tests
Performance testing binaries and shellscripts for testing applauncherd.
Package: applauncherd-doc
Section: doc
Architecture: all
Description: Instructions for application developers

37
debian/copyright vendored

@ -0,0 +1,37 @@
This package was debianized by Jussi Lind <jussi.lind@nokia.com> on
Wed, 28 Oct 2009 12:27:28 +0200.
It was downloaded from <url://example.com>
Upstream Author(s):
Antti Kervinen, antti.kervinen@nokia.com
Jussi Lind, jussi.lind@nokia.com
Alexey Shilov, alexey.shilov@nokia.com
Guillem Jover, guillem.jover@nokia.com (original invoker)
Copyright:
Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
License:
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
The Debian packaging is copyright 2010 Nokia Corporation and/or its subsidiary(-ies), and is licensed under the LGPL version 2.1.
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.

2
debian/dirs vendored

@ -0,0 +1,2 @@
usr/bin
usr/sbin

99
debian/rules vendored

@ -0,0 +1,99 @@
#!/usr/bin/make -f
#include /usr/share/cdbs/1/rules/debhelper.mk
#include /usr/share/cdbs/1/class/cmake.mk
# architecture we're building for
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
configure: configure-stamp
configure-stamp:
dh_testdir
ifeq ($(DEB_HOST_ARCH), arm)
# Configure Applauncherd to be build with tests
# TODO: remove DISABLE_VERIFICATION=1 when works
BUILD_TESTS=1 ./configure
else ifeq ($(DEB_HOST_ARCH), armel)
# Configure Applauncherd to be build with tests
# TODO: remove DISABLE_VERIFICATION=1 when works
BUILD_TESTS=1 ./configure
else
# Configure Applauncherd to be build with tests and without checking invoker credentials
BUILD_TESTS=1 ./configure
endif
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
make
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
rm -f CMakeCache.txt
dh_clean
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
DESTDIR=debian/tmp make install
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_install --sourcedir=debian/tmp -v
# dh_installexamples
# dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
# dh_installcron
# dh_installinfo
# dh_installman
dh_link
dh_strip -p applauncherd-launcher --dbg-package=applauncherd-launcher-dbg
dh_strip -p applauncherd-invoker --dbg-package=applauncherd-invoker-dbg
dh_strip -p applauncherd-testapps --dbg-package=applauncherd-testapps-dbg
dh_compress
dh_fixperms
# dh_perl
# dh_python
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
# TODO: CLEAN THIS UP!
ifeq ($(DEB_HOST_ARCH), arm)
aegis-deb-add -control debian/applauncherd-launcher/DEBIAN/control .. debian/applauncherd-launcher.aegis=_aegis
aegis-deb-add -control debian/applauncherd-invoker/DEBIAN/control .. debian/applauncherd-invoker.aegis=_aegis
aegis-deb-add -control debian/applauncherd-testapps/DEBIAN/control .. debian/applauncherd-testapps.aegis=_aegis
else ifeq ($(DEB_HOST_ARCH), armel)
aegis-deb-add -control debian/applauncherd-launcher/DEBIAN/control .. debian/applauncherd-launcher.aegis=_aegis
aegis-deb-add -control debian/applauncherd-invoker/DEBIAN/control .. debian/applauncherd-invoker.aegis=_aegis
aegis-deb-add -control debian/applauncherd-testapps/DEBIAN/control .. debian/applauncherd-testapps.aegis=_aegis
endif
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
# Sub build: invoker
add_subdirectory(invoker)
# Sub build: launcher
add_subdirectory(launcher)

@ -0,0 +1,43 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef PROTOCOL_H
#define PROTOCOL_H
#include <stdint.h>
const uint32_t INVOKER_MSG_MASK = 0xffff0000;
const uint32_t INVOKER_MSG_MAGIC = 0xb0070000;
const uint32_t INVOKER_MSG_MAGIC_VERSION_MASK = 0x0000ff00;
const uint32_t INVOKER_MSG_MAGIC_VERSION = 0x00000300;
const uint32_t INVOKER_MSG_MAGIC_OPTION_MASK = 0x000000ff;
const uint32_t INVOKER_MSG_MAGIC_OPTION_WAIT = 0x00000001;
const uint32_t INVOKER_MSG_NAME = 0x5a5e0000;
const uint32_t INVOKER_MSG_EXEC = 0xe8ec0000;
const uint32_t INVOKER_MSG_ARGS = 0xa4650000;
const uint32_t INVOKER_MSG_ENV = 0xe5710000;
const uint32_t INVOKER_MSG_PRIO = 0xa1ce0000;
const uint32_t INVOKER_MSG_IO = 0x10fd0000;
const uint32_t INVOKER_MSG_END = 0xdead0000;
const uint32_t INVOKER_MSG_PID = 0x1d1d0000;
const uint32_t INVOKER_MSG_EXIT = 0xe4170000;
const uint32_t INVOKER_MSG_ACK = 0x600d0000;
const uint32_t INVOKER_MSG_BAD_CREDS = 0x60035800;
#endif // PROTOCOL_H

@ -0,0 +1,19 @@
# Set sources
set(SRC invokelib.c invoker.c report.c search.c)
# Set include dirs
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common)
# Set C flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wall -O2")
# Set precompiler flags
add_definitions(-DPROG_NAME="invoker")
# Set target
add_executable(invoker ${SRC})
# Add install rule
install(PROGRAMS invoker DESTINATION /usr/bin/)

@ -0,0 +1,84 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "report.h"
#include "invokelib.h"
bool invoke_send_msg(int fd, uint32_t msg)
{
debug("%s: %08x\n", __FUNCTION__, msg);
return write(fd, &msg, sizeof(msg)) != -1;
}
bool invoke_recv_msg(int fd, uint32_t *msg)
{
int res = read(fd, msg, sizeof(*msg));
debug("%s: %08x\n", __FUNCTION__, *msg);
return res != -1;
}
bool invoke_send_str(int fd, char *str)
{
uint32_t size;
/* Send size. */
size = strlen(str) + 1;
invoke_send_msg(fd, size);
debug("%s: '%s'\n", __FUNCTION__, str);
/* Send the string. */
return write(fd, str, size) != -1;
}
char* invoke_recv_str(int fd)
{
int size = 0;
char *str;
/* Get the size. */
invoke_recv_msg(fd, (uint32_t*) &size);
str = (char*)malloc(size);
if (!str)
{
error("mallocing in %s\n", __FUNCTION__);
return NULL;
}
/* Get the string. */
int ret = read(fd, str, size);
if (ret < size)
{
error("getting string, got %u of %u bytes\n", ret, size);
free(str);
return NULL;
}
str[size - 1] = '\0';
debug("%s: '%s'\n", __FUNCTION__, str);
return str;
}

@ -0,0 +1,37 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef INVOKELIB_H
#define INVOKELIB_H
#include <stdbool.h>
#include <stdint.h>
bool invoke_send_msg(int fd, uint32_t msg);
bool invoke_recv_msg(int fd, uint32_t *msg);
bool invoke_send_str(int fd, char *str);
char *invoke_recv_str(int fd);
/* FIXME: Should be '/var/run/'. */
//#define INVOKER_SOCK "/tmp/."PACKAGE
#define INVOKER_M_SOCK "/tmp/mlnchr"
#define INVOKER_QT_SOCK "/tmp/qtlnchr"
#endif

@ -0,0 +1,457 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/socket.h>
#include <bits/socket.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>
#include <limits.h>
#include <getopt.h>
#include "report.h"
#include "protocol.h"
#include "invokelib.h"
#include "search.h"
#ifdef HAVE_CREDS
#include <sys/creds.h>
#endif
// Delay before exit
static const int DEFAULT_DELAY = 0;
// Enumeration of possible application types:
// M_APP: MeeGo Touch application
// QT_APP: Qt/generic application
//
enum APP_TYPE { M_APP, QT_APP, UNKNOWN_APP };
// Environment
extern char ** environ;
/*
* Show a list of credentials that the client has
*/
static void show_credentials(void)
{
#ifdef HAVE_CREDS
creds_t creds;
creds_value_t value;
creds_type_t type;
int i;
creds = creds_gettask(0);
for (i = 0; (type = creds_list(creds, i, &value)) != CREDS_BAD; ++i) {
char buf[200];
(void)creds_creds2str(type, value, buf, sizeof(buf));
buf[sizeof(buf)-1] = 0;
printf("\t%s\n", buf);
}
creds_free(creds);
#else
printf("Security credential information isn't available.\n");
#endif
exit(0);
}
static bool invoke_recv_ack(int fd)
{
uint32_t action;
// Receive ACK.
invoke_recv_msg(fd, &action);
if (action == INVOKER_MSG_BAD_CREDS)
{
die(1, "Security credential check failed.\n");
}
else if (action != INVOKER_MSG_ACK)
{
die(1, "Received wrong ack (%08x)\n", action);
}
return true;
}
static int invoker_init(enum APP_TYPE app_type)
{
int fd;
struct sockaddr_un sun;
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0)
{
die(1, "Failed to open invoker socket.\n");
}
sun.sun_family = AF_UNIX; //AF_FILE;
const int maxSize = sizeof(sun.sun_path) - 1;
if(app_type == M_APP)
{
strncpy(sun.sun_path, INVOKER_M_SOCK, maxSize);
}
else if (app_type == QT_APP)
{
strncpy(sun.sun_path, INVOKER_QT_SOCK, maxSize);
}
else
{
die(1, "Unknown type of application: %d\n", app_type);
}
sun.sun_path[maxSize] = '\0';
if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) < 0)
{
die(1, "Failed to initiate connect on the socket.\n");
}
return fd;
}
static bool invoker_send_magic(int fd, int options)
{
// Send magic.
invoke_send_msg(fd, INVOKER_MSG_MAGIC | INVOKER_MSG_MAGIC_VERSION | options);
invoke_recv_ack(fd);
return true;
}
static bool invoker_send_name(int fd, char *name)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_NAME);
invoke_send_str(fd, name);
invoke_recv_ack(fd);
return true;
}
static bool invoker_send_exec(int fd, char *exec)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_EXEC);
invoke_send_str(fd, exec);
invoke_recv_ack(fd);
return true;
}
static bool invoker_send_args(int fd, int argc, char **argv)
{
int i;
// Send action.
invoke_send_msg(fd, INVOKER_MSG_ARGS);
invoke_send_msg(fd, argc);
for (i = 0; i < argc; i++)
{
debug("param %d %s \n", i, argv[i]);
invoke_send_str(fd, argv[i]);
}
invoke_recv_ack(fd);
return true;
}
static bool invoker_send_prio(int fd, int prio)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_PRIO);
invoke_send_msg(fd, prio);
invoke_recv_ack(fd);
return true;
}
static bool invoker_send_env(int fd)
{
int i, n_vars;
// Count the amount of environment variables.
for (n_vars = 0; environ[n_vars] != NULL; n_vars++) ;
// Send action.
invoke_send_msg(fd, INVOKER_MSG_ENV);
invoke_send_msg(fd, n_vars);
for (i = 0; i < n_vars; i++)
{
invoke_send_str(fd, environ[i]);
}
return true;
}
static bool invoker_send_io(int fd)
{
struct msghdr msg;
struct cmsghdr *cmsg = NULL;
int io[3] = { 0, 1, 2 };
char buf[CMSG_SPACE(sizeof(io))];
struct iovec iov;
int dummy;
memset(&msg, 0, sizeof(struct msghdr));
iov.iov_base = &dummy;
iov.iov_len = 1;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_control = buf;
msg.msg_controllen = sizeof(buf);
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = CMSG_LEN(sizeof(io));
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
memcpy(CMSG_DATA(cmsg), io, sizeof(io));
msg.msg_controllen = cmsg->cmsg_len;
invoke_send_msg(fd, INVOKER_MSG_IO);
if (sendmsg(fd, &msg, 0) < 0)
{
warning("sendmsg failed in invoker_send_io: %s /n", strerror(errno));
return false;
}
return true;
}
static bool invoker_send_end(int fd)
{
// Send action.
invoke_send_msg(fd, INVOKER_MSG_END);
invoke_recv_ack(fd);
return true;
}
static void usage(int status)
{
printf("\nUsage: %s [options] [--type=TYPE] [file] [args]\n"
"Launch m or qt application.\n\n"
"TYPE chooses the type of booster used. Qt-booster may be used to launch anything.\n"
"Possible values for TYPE: \n"
" m Launch a MeeGo Touch application.\n"
" qt Launch a Qt application.\n\n"
"Options:\n"
" -c, --creds Print Aegis security credentials (if enabled).\n"
" -d, --delay SECS After invoking sleep for SECS seconds (default %d).\n"
" -w, --wait-term Wait for launched process to terminate.\n"
" -h, --help Print this help message.\n\n"
"Example: %s --type=m /usr/bin/helloworld \n",
PROG_NAME, DEFAULT_DELAY, PROG_NAME);
exit(status);
}
static unsigned int get_delay(char *delay_arg)
{
unsigned int delay;
if (delay_arg)
{
errno = 0; // To distinguish success/failure after call
delay = strtoul(delay_arg, NULL, 10);
// Check for various possible errors
if ((errno == ERANGE && delay == ULONG_MAX) || delay == 0)
{
report(report_error, "Wrong value of delay parameter: %s\n", delay_arg);
usage(1);
}
}
else
delay = DEFAULT_DELAY;
return delay;
}
static void invoke(int prog_argc, char **prog_argv, char *prog_name,
enum APP_TYPE app_type, int magic_options, bool wait_term)
{
if (prog_name && prog_argv)
{
errno = 0;
int prog_prio = getpriority(PRIO_PROCESS, 0);
if (errno && prog_prio < 0)
{
prog_prio = 0;
}
int fd = invoker_init(app_type);
invoker_send_magic(fd, magic_options);
invoker_send_name(fd, prog_argv[0]);
invoker_send_exec(fd, prog_name);
invoker_send_args(fd, prog_argc, prog_argv);
invoker_send_prio(fd, prog_prio);
invoker_send_io(fd);
invoker_send_env(fd);
invoker_send_end(fd);
if (prog_name)
{
free(prog_name);
}
// Wait for launched process to exit
if (wait_term)
{
char dummy_buf = 0;
recv(fd, (void *)&dummy_buf, 0, MSG_WAITALL);
}
close(fd);
}
}
int main(int argc, char *argv[])
{
enum APP_TYPE app_type = UNKNOWN_APP;
int prog_argc = 0;
int magic_options = 0;
bool wait_term = false;
unsigned int delay = DEFAULT_DELAY;
char **prog_argv = NULL;
char *prog_name = NULL;
if (!strstr(argv[0], PROG_NAME) )
{
// Called with a different name, old way of using invoker
die(1,
"Incorrect use of invoker, don't use symlinks. "
"Run invoker explicitly from e.g. a D-Bus service file instead.\n");
}
// stops args parsing as soon as a non-option argument is encountered
putenv("POSIXLY_CORRECT=1");
struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{"creds", no_argument, NULL, 'c'},
{"wait-term", no_argument, NULL, 'w'},
{"type", required_argument, NULL, 't'},
{"delay", required_argument, NULL, 'd'},
{0, 0, 0, 0}
};
int opt;
while ((opt = getopt_long(argc, argv, "hcwd:t:", longopts, NULL)) != -1)
{
switch(opt)
{
case 'h':
usage(0);
break;
case 'c':
show_credentials();
break;
case 'w':
wait_term = true;
break;
case 't':
if (strcmp(optarg, "qt") == 0)
app_type = QT_APP;
else if (strcmp(optarg, "m") == 0)
app_type = M_APP;
else
{
report(report_error, "Unknown application type: %s \n", optarg);
usage(1);
}
break;
case 'd':
delay = get_delay(optarg);
break;
case '?':
usage(1);
}
}
// option processing stops as soon as application name is encountered
if (optind < argc)
{
prog_name = search_program(argv[optind]);
if (!prog_name)
{
report(report_error, "Can't find application to invoke.\n");
usage(0);
}
char *period = strstr(argv[optind], ".launch");
if (period)
{
*period = '\0';
}
prog_argc = argc - optind;
prog_argv = &argv[optind];
}
if (!prog_name)
{
die(1, "Application's name is unknown.\n");
}
if (app_type == UNKNOWN_APP)
{
die(1, "Application's type is unknown. \n");
}
// Send commands to the launcher daemon
info("Invoking execution: '%s'\n", prog_name);
invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term);
// Sleep for delay before exiting
if (delay)
{
// DBUS cannot cope some times if the invoker exits too early.
debug("Delaying exit for %d seconds..\n", delay);
sleep(delay);
}
return 0;
}

@ -0,0 +1,99 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <syslog.h>
#include "report.h"
static enum report_output output = report_console;
void report_set_output(enum report_output new_output)
{
if (output == new_output)
return;
if (output == report_syslog)
closelog();
if (new_output == report_syslog)
openlog(PROG_NAME, LOG_PID, LOG_DAEMON);
output = new_output;
}
static void vreport(enum report_type type, char *msg, va_list arg)
{
char str[400];
char *str_type = "";
int log_type;
switch (type)
{
case report_debug:
log_type = LOG_DEBUG;
break;
default:
case report_info:
log_type = LOG_INFO;
break;
case report_warning:
str_type = "warning: ";
log_type = LOG_WARNING;
break;
case report_error:
str_type = "error: ";
log_type = LOG_ERR;
break;
case report_fatal:
str_type = "died: ";
log_type = LOG_ERR;
break;
}
vsnprintf(str, sizeof(str), msg, arg);
if (output == report_console)
printf("%s: %s%s", PROG_NAME, str_type, str);
else if (output == report_syslog)
syslog(log_type, "%s%s", str_type, str);
}
void report(enum report_type type, char *msg, ...)
{
va_list arg;
va_start(arg, msg);
vreport(type, msg, arg);
va_end(arg);
}
void die(int status, char *msg, ...)
{
va_list arg;
va_start(arg, msg);
vreport(report_fatal, msg, arg);
va_end(arg);
exit(status);
}

@ -0,0 +1,60 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef REPORT_H
#define REPORT_H
#ifdef __GNUC__
#define ATTR_NORET __attribute__((noreturn))
#else
#define ATTR_NORET
#endif
enum report_output {
report_console,
report_syslog,
report_none
};
enum report_type {
report_debug,
report_info,
report_warning,
report_error,
report_fatal
};
extern void report_set_output(enum report_output new_output);
extern void report(enum report_type type, char *msg, ...);
//#define _DEBUG
#ifdef _DEBUG
#define debug(msg, ...) report(report_debug, msg, ##__VA_ARGS__)
#else
#define debug(...)
#endif
#define info(msg, ...) report(report_info, msg, ##__VA_ARGS__)
#define warning(msg, ...) report(report_warning, msg, ##__VA_ARGS__)
#define error(msg, ...) report(report_error, msg, ##__VA_ARGS__)
extern void ATTR_NORET die(int status, char *msg, ...);
#endif

@ -0,0 +1,105 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "report.h"
#include "search.h"
static char* merge_paths(const char *base_path, const char *rel_path)
{
char *path;
if (asprintf(&path, "%s%s%s", base_path,
(base_path[strlen(base_path) - 1] == '/' ? "" : "/"),
rel_path) < 0)
{
die(1, "allocating merge path buffer");
}
return path;
}
char* search_program(const char *progname)
{
char *launch = NULL;
char *cwd;
if (progname[0] == '/')
{
launch = strdup(progname);
if (!launch)
{
die(1, "allocating program name buffer");
}
}
else if (strchr(progname, '/') != NULL)
{
cwd = get_current_dir_name();
launch = merge_paths(cwd, progname);
free(cwd);
}
else
{
char *path = getenv("PATH");
char *saveptr = NULL;
char *token;
if (path == NULL)
{
die(1, "could not get PATH environment variable");
}
path = strdup(path);
for (token = strtok_r(path, ":", &saveptr); token != NULL; token = strtok_r(NULL, ":", &saveptr))
{
launch = merge_paths(token, progname);
if (access(launch, X_OK) == 0)
break;
free(launch);
launch = NULL;
}
free(path);
if (launch == NULL)
{
die(1, "could not locate program \"%s\" to launch \n", progname);
}
if (launch[0] != '/')
{
char *relative = launch;
cwd = get_current_dir_name();
launch = merge_paths(cwd, relative);
free(cwd);
free(relative);
}
}
return launch;
}

@ -0,0 +1,26 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef SEARCH_H
#define SEARCH_H
char *search_program(const char *progname);
#endif

@ -0,0 +1,37 @@
# Qt support
include(${QT_USE_FILE})
# Find Meego Touch libraries using pkg-config.
include(FindPkgConfig)
pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${MEEGOTOUCH_INCLUDE_DIRS})
# Check if it's possible to compile MBooster with MComponentCache. If so,
# HAVE_MCOMPONENTCACHE is set.
message(STATUS "checking for mcomponentcache.h")
find_file(M_COMPONENT_CACHE NAMES mcomponentcache.h PATHS ${MEEGOTOUCH_INCLUDE_DIRS})
if (EXISTS ${M_COMPONENT_CACHE})
message(STATUS " found")
add_definitions(-DHAVE_MCOMPONENTCACHE)
else (EXISTS ${M_COMPONENT_CACHE})
message(STATUS " not found")
endif (EXISTS ${M_COMPONENT_CACHE})
# Set sources
set(SRC appdata.cpp booster.cpp connection.cpp daemon.cpp mbooster.cpp logger.cpp main.cpp qtbooster.cpp)
# Set the program name define used in daemon.cpp
add_definitions(-DPROG_NAME="applauncherd")
# Find libdl
find_library(LIBDL NAMES dl)
# Set libraries to be linked
link_libraries(${QT_LIBRARIES} ${MEEGOTOUCH_LIBRARIES} ${LIBDL})
# Set executable
add_executable(applauncherd.bin ${SRC})
# Add install rule
install(PROGRAMS applauncherd.bin scripts/applauncherd DESTINATION /usr/bin/)

@ -0,0 +1,131 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "appdata.h"
AppData::AppData() :
m_options(0),
m_argc(0),
m_argv(NULL),
m_appName(""),
m_fileName(""),
m_prio(0),
m_entry(NULL),
m_ioDescriptors()
{}
void AppData::setOptions(int newOptions)
{
m_options = newOptions;
}
int AppData::options() const
{
return m_options;
}
void AppData::setArgc(int newArgc)
{
m_argc = newArgc;
}
int AppData::argc() const
{
return m_argc;
}
void AppData::setArgv(const char ** newArgv)
{
m_argv = newArgv;
}
const char ** AppData::argv() const
{
return m_argv;
}
void AppData::setAppName(const string & newAppName)
{
m_appName = newAppName;
}
const string & AppData::appName() const
{
return m_appName;
}
void AppData::setFileName(const string & newFileName)
{
m_fileName = newFileName;
}
const string & AppData::fileName() const
{
return m_fileName;
}
void AppData::setPriority(int newPriority)
{
m_prio = newPriority;
}
int AppData::priority() const
{
return m_prio;
}
void AppData::setEntry(entry_t newEntry)
{
m_entry = newEntry;
}
entry_t AppData::entry() const
{
return m_entry;
}
const vector<int> & AppData::ioDescriptors() const
{
return m_ioDescriptors;
}
void AppData::setIODescriptors(const vector<int> & newIODescriptors)
{
m_ioDescriptors = newIODescriptors;
}
void AppData::deleteArgv()
{
if (m_argv)
{
for (int i = 0; i < m_argc; i++)
{
delete m_argv[i];
m_argv[i] = NULL;
}
delete [] m_argv;
m_argv = NULL;
}
}
AppData::~AppData()
{
deleteArgv();
}

@ -0,0 +1,110 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef APPDATA_H
#define APPDATA_H
#include <string>
using std::string;
#include <vector>
using std::vector;
typedef int (*entry_t)(int, char **);
//! Structure for application data read from the invoker
class AppData
{
public:
//! Constructor
AppData();
//! Destructor
~AppData();
//! Set options
void setOptions(int options);
//! Return options
int options() const;
//! Set argument count
void setArgc(int argc);
//! Return argument count
int argc() const;
//! Set address of the argument vector
void setArgv(const char ** argv);
//! Return address of the argument vector
const char ** argv() const;
//! Set application name
void setAppName(const string & appName);
//! Return application name
const string & appName() const;
//! Set file name
void setFileName(const string & fileName);
//! Return file name
const string & fileName() const;
//! Set priority
void setPriority(int priority);
//! Return priority
int priority() const;
//! Set entry point for the application
void setEntry(entry_t entry);
//! Get the entry point
entry_t entry() const;
//! Get I/O descriptors
const vector<int> & ioDescriptors() const;
//! Set I/O descriptors
void setIODescriptors(const vector<int> & ioDescriptors);
//! Frees the memory reserved for argv
void deleteArgv();
private:
AppData(const AppData & r);
AppData & operator= (const AppData & r);
int m_options;
int m_argc;
const char ** m_argv;
string m_appName;
string m_fileName;
int m_prio;
entry_t m_entry;
vector<int> m_ioDescriptors;
};
#endif // APPDATA_H

@ -0,0 +1,221 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "booster.h"
#include "connection.h"
#include "logger.h"
#include <cstdlib>
#include <dlfcn.h>
#include <cerrno>
#include <unistd.h>
#include <sys/user.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#ifdef HAVE_CREDS
#include <sys/creds.h>
#endif
Booster::Booster() :
m_argvArraySize(0),
m_oldPriority(0),
m_oldPriorityOk(false)
{}
Booster::~Booster()
{}
bool Booster::preload()
{
return true;
}
bool Booster::readCommand()
{
// Setup the conversation channel with the invoker.
Connection conn(socketId());
// Accept a new invocation.
if (conn.acceptConn())
{
if (conn.receiveApplicationData(m_app))
{
return true;
}
// Close connection
conn.closeConn();
}
return false;
}
void Booster::run()
{
if (!m_app.fileName().empty())
{
Logger::logInfo("invoking '%s' ", m_app.fileName().c_str());
launchProcess();
}
else
{
Logger::logError("nothing to invoke\n");
}
}
void Booster::renameProcess(int parentArgc, char** parentArgv)
{
if (m_argvArraySize == 0)
{
// rename process for the first time
// calculate and store size of parentArgv array
for (int i = 0; i < parentArgc; i++)
m_argvArraySize += strlen(parentArgv[i]) + 1;
m_argvArraySize--;
}
if (m_app.appName().empty())
{
// application name isn't known yet, let's give to the process
// temporary booster name
string newProcessName("booster-");
newProcessName.append(1, boosterType());
m_app.setAppName(newProcessName);
}
const char* newProcessName = m_app.appName().c_str();
Logger::logNotice("set new name for process: %s", newProcessName);
// This code copies all the new arguments to the space reserved
// in the old argv array. If an argument won't fit then the algorithm
// leaves it fully out and terminates.
int spaceAvailable = m_argvArraySize;
if (spaceAvailable > 0)
{
memset(parentArgv[0], '\0', spaceAvailable);
strncat(parentArgv[0], newProcessName, spaceAvailable);
spaceAvailable -= strlen(parentArgv[0]);
for (int i = 1; i < m_app.argc(); i++)
{
if (spaceAvailable > static_cast<int>(strlen(m_app.argv()[i])) + 1)
{
strncat(parentArgv[0], " ", 1);
strncat(parentArgv[0], m_app.argv()[i], spaceAvailable);
spaceAvailable -= strlen(m_app.argv()[i] + 1);
}
else
{
break;
}
}
}
// Set the process name using prctl, killall and top use it
if ( prctl(PR_SET_NAME, basename(newProcessName)) == -1 )
Logger::logError("on set new process name: %s ", strerror(errno));
setenv("_", newProcessName, true);
}
void Booster::launchProcess()
{
// Possibly restore process priority
errno = 0;
const int cur_prio = getpriority(PRIO_PROCESS, 0);
if (!errno && cur_prio < m_app.priority())
setpriority(PRIO_PROCESS, 0, m_app.priority());
// Load the application and find out the address of main()
void* handle = loadMain();
for (unsigned int i = 0; i < m_app.ioDescriptors().size(); i++)
if (m_app.ioDescriptors()[i] > 0)
dup2(m_app.ioDescriptors()[i], i);
Logger::logNotice("launching process: '%s' ", m_app.fileName().c_str());
// Close logger
Logger::closeLog();
// Jump to main()
const int retVal = m_app.entry()(m_app.argc(), const_cast<char **>(m_app.argv()));
m_app.deleteArgv();
dlclose(handle);
exit(retVal);
}
void* Booster::loadMain()
{
#ifdef HAVE_CREDS
// Set application's platform security credentials
creds_confine(m_app.fileName().c_str());
#endif
// Load the application as a library
void * module = dlopen(m_app.fileName().c_str(), RTLD_LAZY | RTLD_GLOBAL);
if (!module)
Logger::logErrorAndDie(EXIT_FAILURE, "loading invoked application: '%s'\n", dlerror());
// Find out the address for symbol "main".
dlerror();
m_app.setEntry(reinterpret_cast<entry_t>(dlsym(module, "main")));
const char * error_s = dlerror();
if (error_s != NULL)
Logger::logErrorAndDie(EXIT_FAILURE, "loading symbol 'main': '%s'\n", error_s);
return module;
}
bool Booster::pushPriority(int nice)
{
errno = 0;
m_oldPriorityOk = true;
m_oldPriority = getpriority(PRIO_PROCESS, getpid());
if (errno)
{
m_oldPriorityOk = false;
}
else
{
return setpriority(PRIO_PROCESS, getpid(), nice) != -1;
}
return false;
}
bool Booster::popPriority()
{
if (m_oldPriorityOk)
{
return setpriority(PRIO_PROCESS, getpid(), m_oldPriority) != -1;
}
return false;
}

@ -0,0 +1,139 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef BOOSTER_H
#define BOOSTER_H
#include <cstdlib>
#include <string>
using std::string;
#include "appdata.h"
/*!
* \class Booster
* \brief Abstract base class for all boosters (Qt-booster, M-booster and so on..)
*
* Booster is a class that is used to initialize certain resources in libraries
* common to all applications of a type.
*
* Booster also communicates with the invoker process and handles the actual
* jump to the main() -method of the application to be launched.
*
* Booster instance dies with the launched application and a new one must be created
* in advance so as to launch a new application.
*/
class Booster
{
public:
//! Constructor
Booster();
//! Destructor
virtual ~Booster();
/*!
* \brief Run the application to be invoked.
* This method causes the application binary to be loaded
* using dlopen(). Program execution jumps to the address of
* "main()" found in the newly loaded library. The Booster process
* exits with corresponding exit-code after the execution of
* main() has finished.
*/
void run();
/*!
* \brief Wait for connection from invoker and read the input.
* This method accepts a socket connection from the invoker
* and reads the data of an application to be launched.
*
* \return true on success
*/
bool readCommand();
/*!
* \brief Initialize and preload stuff
* Override in the custom Booster.
*/
virtual bool preload();
/*!
* \brief Rename process.
* This method overrides the argument data starting from initialArgv[0].
* This is needed so as to get the process name and arguments displayed
* correctly e.g. in the listing by 'ps'. initialArgv[1] may provide an
* empty dummy space to be used. It is assumed, that the arguments are
* located continuosly in memory and this is how it's done in glibc.
*
* \param initialArgc Number of the arguments of the launcher process.
* \param initialArgv Address of the argument array of the launcher process.
*/
void renameProcess(int initialArgc, char** initialArgv);
/*!
* \brief Return booster type common to all instances.
* This is used in the simple communication between booster process.
* and the daemon. Override in the custom Booster.
*
* \return A (unique) character representing the type of the Booster.
*/
virtual char boosterType() const = 0;
//! Set nice value and store the old priority. Return true on success.
bool pushPriority(int nice);
//! Restore the old priority stored by the previous successful setPriority().
bool popPriority();
protected:
/*!
* \brief Return the communication socket used by a Booster.
* This method returns the socket used between invoker and the Booster.
* (common to all Boosters of the type). Override in the custom Booster.
* \return Path to the socket file
*/
virtual const string & socketId() const = 0;
private:
//! Disable copy-constructor
Booster(const Booster & r);
//! Disable assignment operator
Booster & operator= (const Booster & r);
void complainAndExit();
void launchProcess();
void* loadMain();
AppData m_app;
int m_argvArraySize;
int m_oldPriority;
bool m_oldPriorityOk;
#ifdef UNIT_TEST
friend class Ut_Booster;
#endif
};
#endif // BOOSTER_H

@ -0,0 +1,492 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "connection.h"
#include "logger.h"
#include <sys/socket.h>
#include <sys/stat.h> // For chmod
#include <cstring>
#include <cstdlib>
#include <cerrno>
#include <unistd.h>
#if defined (HAVE_CREDS) && ! defined (DISABLE_VERIFICATION)
const char * Connection::m_credsStr = "applauncherd-launcher::access";
#endif
PoolType Connection::socketPool;
Connection::Connection(const string socketId) :
m_fd(-1),
m_curSocket(findSocket(socketId)),
m_fileName(""),
m_argc(0),
m_argv(NULL),
m_priority(0)
{
m_io[0] = -1;
m_io[1] = -1;
m_io[2] = -1;
if (m_curSocket == -1)
{
Logger::logErrorAndDie(EXIT_FAILURE, "socket isn't initialized\n");
}
#if defined (HAVE_CREDS) && ! defined (DISABLE_VERIFICATION)
m_credsType = creds_str2creds(m_credsStr, &m_credsValue);
if (m_credsType == CREDS_BAD)
{
Logger::logError("credentials %s conversion failed \n", m_credsStr);
}
#endif
}
Connection::~Connection()
{}
int Connection::findSocket(const string socketId)
{
PoolType::iterator it(socketPool.find(socketId));
return it == socketPool.end() ? -1 : it->second;
}
void Connection::initSocket(const string socketId)
{
PoolType::iterator it(socketPool.find(socketId));
if (it == socketPool.end())
{
Logger::logInfo("%s: init socket '%s'", __FUNCTION__, socketId.c_str());
int sockfd = socket(PF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0)
Logger::logErrorAndDie(EXIT_FAILURE, "opening invoker socket\n");
unlink(socketId.c_str());
struct sockaddr sun;
sun.sa_family = AF_UNIX;
int maxLen = sizeof(sun.sa_data) - 1;
strncpy(sun.sa_data, socketId.c_str(), maxLen);
sun.sa_data[maxLen] = '\0';
if (bind(sockfd, &sun, sizeof(sun)) < 0)
Logger::logErrorAndDie(EXIT_FAILURE, "binding to invoker socket\n");
if (listen(sockfd, 10) < 0)
Logger::logErrorAndDie(EXIT_FAILURE, "listening to invoker socket\n");
chmod(socketId.c_str(), S_IRUSR | S_IWUSR | S_IXUSR |
S_IRGRP | S_IWGRP | S_IXGRP |
S_IROTH | S_IWOTH | S_IXOTH);
socketPool[socketId] = sockfd;
}
}
bool Connection::acceptConn()
{
m_fd = accept(m_curSocket, NULL, NULL);
if (m_fd < 0)
{
Logger::logError("accepting connections (%s)\n", strerror(errno));
return false;
}
#if defined (HAVE_CREDS) && ! defined (DISABLE_VERIFICATION)
creds_t ccreds = creds_getpeer(m_fd);
int allow = creds_have_p(ccreds, m_credsType, m_credsValue);
creds_free(ccreds);
if (!allow)
{
Logger::logError("invoker doesn't have enough credentials to call launcher \n");
sendMsg(INVOKER_MSG_BAD_CREDS);
closeConn();
return false;
}
#endif
return true;
}
void Connection::closeConn()
{
if (m_fd != -1)
{
close(m_fd);
m_fd = -1;
}
}
bool Connection::sendMsg(uint32_t msg)
{
Logger::logInfo("%s: %08x", __FUNCTION__, msg);
return write(m_fd, &msg, sizeof(msg)) != -1;
}
bool Connection::recvMsg(uint32_t *msg)
{
uint32_t buf = 0;
int len = sizeof(buf);
ssize_t ret = read(m_fd, &buf, len);
if (ret < len) {
Logger::logError("can't read data from connecton in %s", __FUNCTION__);
*msg = 0;
} else {
Logger::logInfo("%s: %08x", __FUNCTION__, *msg);
*msg = buf;
}
return ret != -1;
}
bool Connection::sendStr(const char * str)
{
// Send size.
uint32_t size = strlen(str) + 1;
sendMsg(size);
Logger::logInfo("%s: '%s'", __FUNCTION__, str);
// Send the string.
return write(m_fd, str, size) != -1;
}
const char * Connection::recvStr()
{
// Get the size.
uint32_t size = 0;
const uint32_t STR_LEN_MAX = 4096;
bool res = recvMsg(&size);
if (!res || size == 0 || size > STR_LEN_MAX)
{
Logger::logError("string receiving failed in %s, string length is %d", __FUNCTION__, size);
return NULL;
}
char * str = new char[size];
if (!str)
{
Logger::logError("mallocing in %s", __FUNCTION__);
return NULL;
}
// Get the string.
uint32_t ret = read(m_fd, str, size);
if (ret < size)
{
Logger::logError("getting string, got %u of %u bytes", ret, size);
delete [] str;
return NULL;
}
str[size - 1] = '\0';
Logger::logInfo("%s: '%s'", __FUNCTION__, str);
return str;
}
int Connection::receiveMagic()
{
uint32_t magic = 0;
// Receive the magic.
recvMsg(&magic);
if ((magic & INVOKER_MSG_MASK) == INVOKER_MSG_MAGIC)
{
if ((magic & INVOKER_MSG_MAGIC_VERSION_MASK) == INVOKER_MSG_MAGIC_VERSION)
sendMsg(INVOKER_MSG_ACK);
else
{
Logger::logError("receiving bad magic version (%08x)\n", magic);
return -1;
}
}
return magic & INVOKER_MSG_MAGIC_OPTION_MASK;
}
string Connection::receiveAppName()
{
uint32_t msg = 0;
// Get the action.
recvMsg(&msg);
if (msg != INVOKER_MSG_NAME)
{
Logger::logError("receiving invalid action (%08x)", msg);
return string();
}
const char* name = recvStr();
if (!name)
{
Logger::logError("receiving application name");
return string();
}
sendMsg(INVOKER_MSG_ACK);
string appName(name);
delete [] name;
return appName;
}
bool Connection::receiveExec()
{
const char* filename = recvStr();
if (!filename)
return false;
sendMsg(INVOKER_MSG_ACK);
m_fileName = filename;
delete [] filename;
return true;
}
bool Connection::receivePriority()
{
recvMsg(&m_priority);
sendMsg(INVOKER_MSG_ACK);
return true;
}
bool Connection::receiveArgs()
{
// Get argc
recvMsg(&m_argc);
const uint32_t ARG_MAX = 1024;
if (m_argc > 0 && m_argc < ARG_MAX)
{
// Reserve memory for argv
m_argv = new const char * [m_argc];
if (!m_argv)
{
Logger::logError("reserving memory for argv");
return false;
}
// Get argv
for (uint i = 0; i < m_argc; i++)
{
m_argv[i] = recvStr();
if (!m_argv[i])
{
Logger::logError("receiving argv[%i]", i);
return false;
}
}
}
else
{
Logger::logError("invalid number of parameters %d", m_argc);
return false;
}
sendMsg(INVOKER_MSG_ACK);
return true;
}
// coverity[ +tainted_string_sanitize_content : arg-0 ]
bool putenv_sanitize(const char * s)
{
return static_cast<bool>(strchr(s, '='));
}
// coverity[ +free : arg-0 ]
int putenv_wrapper(char * var)
{
return putenv(var);
}
bool Connection::receiveEnv()
{
// Have some "reasonable" limit for environment variables to protect from
// malicious data
const uint32_t MAX_VARS = 1024;
// Get number of environment variables.
uint32_t n_vars = 0;
recvMsg(&n_vars);
if (n_vars > 0 && n_vars < MAX_VARS)
{
// Get environment variables
for (uint32_t i = 0; i < n_vars; i++)
{
const char * var = recvStr();
if (var == NULL)
{
Logger::logError("receiving environ[%i]", i);
return false;
}
// In case of error, just warn and try to continue, as the other side is
// going to keep sending the reset of the message.
// String pointed to by var shall become part of the environment, so altering
// the string shall change the environment, don't free it
if (putenv_sanitize(var))
{
if (putenv_wrapper(const_cast<char *>(var)) != 0)
{
Logger::logWarning("putenv failed");
}
}
else
{
delete [] var;
var = NULL;
Logger::logWarning("invalid environment data");
}
}
}
else
{
Logger::logError("invalid environment variable count %d", n_vars);
return false;
}
return true;
}
bool Connection::receiveIO()
{
int dummy = 0;
struct iovec iov;
iov.iov_base = &dummy;
iov.iov_len = 1;
char buf[CMSG_SPACE(sizeof(m_io))];
struct msghdr msg;
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_control = buf;
msg.msg_controllen = sizeof(buf);
struct cmsghdr *cmsg;
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = CMSG_LEN(sizeof(m_io));
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
memcpy(CMSG_DATA(cmsg), m_io, sizeof(m_io));
if (recvmsg(m_fd, &msg, 0) < 0)
{
Logger::logWarning("recvmsg failed in invoked_get_io: %s", strerror(errno));
return false;
}
if (msg.msg_flags)
{
Logger::logWarning("unexpected msg flags in invoked_get_io");
return false;
}
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL || cmsg->cmsg_len != CMSG_LEN(sizeof(m_io)) ||
cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS)
{
Logger::logWarning("invalid cmsg in invoked_get_io");
return false;
}
memcpy(m_io, CMSG_DATA(cmsg), sizeof(m_io));
return true;
}
bool Connection::receiveActions()
{
Logger::logInfo("enter: %s", __FUNCTION__);
while (1)
{
uint32_t action = 0;
// Get the action.
recvMsg(&action);
switch (action)
{
case INVOKER_MSG_EXEC:
receiveExec();
break;
case INVOKER_MSG_ARGS:
receiveArgs();
break;
case INVOKER_MSG_ENV:
receiveEnv();
break;
case INVOKER_MSG_PRIO:
receivePriority();
break;
case INVOKER_MSG_IO:
receiveIO();
break;
case INVOKER_MSG_END:
sendMsg(INVOKER_MSG_ACK);
return true;
default:
Logger::logError("receiving invalid action (%08x)\n", action);
return false;
}
}
}
bool Connection::receiveApplicationData(AppData & rApp)
{
// Read magic number
rApp.setOptions(receiveMagic());
if (rApp.options() == -1)
return false;
// Read application name
rApp.setAppName(receiveAppName());
if (rApp.appName().empty())
return false;
// Read application parameters
if (receiveActions())
{
rApp.setFileName(m_fileName);
rApp.setPriority(m_priority);
rApp.setArgc(m_argc);
rApp.setArgv(m_argv);
rApp.setIODescriptors(vector<int>(m_io, m_io + sizeof(m_io)));
}
else
{
return false;
}
return true;
}

@ -0,0 +1,161 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef CONNECTION_H
#define CONNECTION_H
#include "appdata.h"
#include "protocol.h"
#include <stdint.h>
#include <string>
using std::string;
#include <map>
using std::map;
#include <vector>
using std::vector;
typedef map<string, int> PoolType;
#ifdef HAVE_CREDS
#include <sys/creds.h>
#endif
/*!
* \class Connection.
* \brief Wrapper class for the connection between invoker and launcher.
*
* This class wraps up the UNIX file socket connection between the invoker
* and the launcher daemon.
*/
class Connection
{
public:
/*! \brief Constructor.
* \param socketId Path to the UNIX file socket to be used.
*/
explicit Connection(const string socketId);
//! \brief Destructor
virtual ~Connection();
/*! \brief Accept connection.
* Accept a socket connection from the invoker.
* \return true on success.
*/
bool acceptConn();
//! \brief Close the socket connection.
void closeConn();
//! \brief Receive application data to rApp.
bool receiveApplicationData(AppData & rApp);
/*! \brief Initialize a file socket.
* \param socketId Path to the socket file
*/
static void initSocket(const string socketId);
private:
/*! \brief Receive actions.
* This method executes the actual data-receiving loop and terminates
* after INVOKER_MSG_END is received.
* \return True on success
*/
bool receiveActions();
/*! \brief Receive and return the magic number.
* \return The magic number received from the invoker.
*/
int receiveMagic();
/*! \brief Receive and return the application name.
* \return Name string
*/
string receiveAppName();
/*! \brief Return initialized socket.
* \param socketId Path to the socket file
*/
static int findSocket(const string socketId);
//! Disable copy-constructor
Connection(const Connection & r);
//! Disable assignment operator
Connection & operator= (const Connection & r);
//! Receive executable name
bool receiveExec();
//! Receive arguments
bool receiveArgs();
//! Receive environment
bool receiveEnv();
//! Receive I/O descriptors
bool receiveIO();
//! Receive priority
bool receivePriority();
//! Send message to a socket. This is a virtual to help unit testing.
virtual bool sendMsg(uint32_t msg);
//! Receive a message from a socket. This is a virtual to help unit testing.
virtual bool recvMsg(uint32_t *msg);
//! Send a string. This is a virtual to help unit testing.
virtual bool sendStr(const char * str);
//! Receive a string. This is a virtual to help unit testing.
virtual const char * recvStr();
//! Pool of sockets mapped to id's
static PoolType socketPool;
//! Socket fd
int m_fd;
int m_curSocket;
string m_fileName;
uint32_t m_argc;
const char ** m_argv;
int m_io[3];
uint32_t m_priority;
#if defined (HAVE_CREDS) && ! defined (DISABLE_VERIFICATION)
static const char * m_credsStr;
creds_value_t m_credsValue;
creds_type_t m_credsType;
#endif
#ifdef UNIT_TEST
friend class Ut_Connection;
#endif
};
#endif //CONNECTION_H

@ -0,0 +1,395 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "daemon.h"
#include "logger.h"
#include "connection.h"
#include "booster.h"
#include "mbooster.h"
#include "qtbooster.h"
#include <cstdlib>
#include <cerrno>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/prctl.h>
#include <signal.h>
#include <fcntl.h>
#include <iostream>
Daemon * Daemon::m_instance = NULL;
int Daemon::m_lockFd = -1;
Daemon::Daemon(int & argc, char * argv[]) :
m_testMode(false),
m_daemon(false),
m_quiet(false)
{
if (!Daemon::m_instance)
{
Daemon::m_instance = this;
}
else
{
std::cerr << "Daemon already created!" << std::endl;
exit(EXIT_FAILURE);
}
// Parse arguments
parseArgs(ArgVect(argv, argv + argc));
// Disable console output
if (m_quiet)
consoleQuiet();
// Store arguments list
m_initialArgv = argv;
m_initialArgc = argc;
// Daemonize if desired
if (m_daemon)
{
daemonize();
}
}
void Daemon::consoleQuiet()
{
close(0);
close(1);
close(2);
if (open("/dev/null", O_RDONLY) < 0)
Logger::logErrorAndDie(EXIT_FAILURE, "opening /dev/null readonly");
int fd = open("/dev/null", O_WRONLY);
if ((fd == -1) || (dup(fd) < 0))
Logger::logErrorAndDie(EXIT_FAILURE, "opening /dev/null writeonly");
}
Daemon * Daemon::instance()
{
return Daemon::m_instance;
}
Daemon::~Daemon()
{}
bool Daemon::lock(void)
{
struct flock fl;
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
fl.l_start = 0;
fl.l_len = 1;
if((m_lockFd = open("/tmp/applauncherd.lock", O_WRONLY | O_CREAT, 0666)) == -1)
return false;
if(fcntl(m_lockFd, F_SETLK, &fl) == -1)
return false;
return true;
}
void Daemon::unlock(void)
{
if (m_lockFd != -1)
{
close(m_lockFd);
m_lockFd = -1;
}
}
void Daemon::run()
{
// Make sure that LD_BIND_NOW does not prevent dynamic linker to
// use lazy binding in later dlopen() calls.
unsetenv("LD_BIND_NOW");
// create sockets for each of the boosters
Connection::initSocket(MBooster::socketName());
Connection::initSocket(QtBooster::socketName());
// Pipe used to tell the parent that a new
// booster is needed
int pipefd[2];
if (pipe(pipefd) == -1)
{
Logger::logErrorAndDie(EXIT_FAILURE, "Creating a pipe failed!!!\n");
}
forkBooster(MBooster::type(), pipefd);
forkBooster(QtBooster::type(), pipefd);
while (true)
{
// Wait for something appearing in the pipe
char msg;
ssize_t count = read(pipefd[0], reinterpret_cast<void *>(&msg), 1);
if (count)
{
// Guarantee some time for the just launched application to
// start up before forking new booster. Not doing this would
// slow down the start-up significantly on single core CPUs.
sleep(2);
// Fork a new booster of the given type
forkBooster(msg, pipefd);
}
else
{
Logger::logWarning("Nothing read from the pipe\n");
}
}
}
bool Daemon::forkBooster(char type, int pipefd[2])
{
// Fork a new process
pid_t newPid = fork();
if (newPid == -1)
Logger::logErrorAndDie(EXIT_FAILURE, "Forking while invoking");
if (newPid == 0) /* Child process */
{
// Reset used signal handlers
signal(SIGCHLD, SIG_DFL);
// Will get this signal if applauncherd dies
prctl(PR_SET_PDEATHSIG, SIGHUP);
// Close unused read end
close(pipefd[0]);
// close lock file, it's not needed in the booster
Daemon::unlock();
if (setsid() < 0)
{
Logger::logError("Setting session id\n");
}
Logger::logNotice("Running a new Booster of %c type...", type);
// Create a new booster and initialize it
Booster * booster = NULL;
if (MBooster::type() == type)
{
booster = new MBooster();
}
else if (QtBooster::type() == type)
{
booster = new QtBooster();
}
else
{
Logger::logErrorAndDie(EXIT_FAILURE, "Unknown booster type \n");
}
// Drop priority (nice = 10)
booster->pushPriority(10);
// Preload stuff
booster->preload();
// Clean-up all the env variables
clearenv();
// Rename launcher process to booster
booster->renameProcess(m_initialArgc, m_initialArgv);
// Restore priority
booster->popPriority();
// Wait and read commands from the invoker
Logger::logNotice("Wait for message from invoker");
booster->readCommand();
// Give to the process an application specific name
booster->renameProcess(m_initialArgc, m_initialArgv);
// Signal the parent process that it can create a new
// waiting booster process and close write end
const char msg = booster->boosterType();
ssize_t ret = write(pipefd[1], reinterpret_cast<const void *>(&msg), 1);
if (ret == -1) {
Logger::logError("Can't send signal to launcher process' \n");
}
close(pipefd[1]);
// Don't care about fate of parent applauncherd process any more
prctl(PR_SET_PDEATHSIG, 0);
// Run the current Booster
booster->run();
// Finish
delete booster;
exit(EXIT_SUCCESS);
}
else /* Parent process */
{
// Store the pid so that we can reap it later
m_children.push_back(newPid);
}
return true;
}
void Daemon::reapZombies()
{
PidVect::iterator i(m_children.begin());
while (i != m_children.end())
{
if (waitpid(*i, NULL, WNOHANG))
{
i = m_children.erase(i);
}
else
{
i++;
}
}
}
void Daemon::daemonize()
{
// Our process ID and Session ID
pid_t pid, sid;
// Fork off the parent process: first fork
pid = fork();
if (pid < 0)
{
Logger::logError("Unable to fork daemon, code %d (%s)", errno, strerror(errno));
exit(EXIT_FAILURE);
}
// If we got a good PID, then we can exit the parent process.
if (pid > 0)
{
exit(EXIT_SUCCESS);
}
// Fork off the parent process: second fork
pid = fork();
if (pid < 0)
{
Logger::logError("Unable to fork daemon, code %d (%s)", errno, strerror(errno));
exit(EXIT_FAILURE);
}
// If we got a good PID, then we can exit the parent process.
if (pid > 0)
{
exit(EXIT_SUCCESS);
}
// Change the file mode mask
umask(0);
// Open any logs here
// Create a new SID for the child process
sid = setsid();
if (sid < 0)
{
Logger::logError("Unable to create a new session, code %d (%s)", errno, strerror(errno));
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));
exit(EXIT_FAILURE);
}
// Open file descriptors pointing to /dev/null
// Redirect standard file descriptors to /dev/null
// Close new file descriptors
const int new_stdin = open("/dev/null", O_RDONLY);
if (new_stdin != -1) {
dup2(new_stdin, STDIN_FILENO);
close(new_stdin);
}
const int new_stdout = open("/dev/null", O_WRONLY);
if (new_stdout != -1) {
dup2(new_stdout, STDOUT_FILENO);
close(new_stdout);
}
const int new_stderr = open("/dev/null", O_WRONLY);
if (new_stderr != -1) {
dup2(new_stderr, STDERR_FILENO);
close(new_stderr);
}
}
void Daemon::usage() const
{
std::cout << "Usage: "<< PROG_NAME << " [options]\n"
<< "\n"
<< "Options:\n"
<< " --daemon Fork and go into the background.\n"
//<< " --pidfile FILE Specify a different pid file (default " << LAUNCHER_PIDFILE << " ).\n"
//<< " --send-app-died Send application died signal.\n"
<< " --quiet Do not print anything.\n"
<< " --help Print this help message.\n"
<< "\n"
<< "Use the invoker to start a <shared object> from the launcher.\n"
<< "Where <shared object> is a binary including a 'main' symbol.\n"
<< "Note that the binary needs to be linked with -shared or -pie.\n";
exit(EXIT_SUCCESS);
}
void Daemon::parseArgs(const ArgVect & args)
{
for (ArgVect::const_iterator i(args.begin()); i != args.end(); i++)
{
if ((*i) == "--help")
{
usage();
}
else if ((*i) == "--daemon")
{
m_daemon = true;
}
else if ((*i) == "--quiet")
{
m_quiet = true;
}
else if ((*i) == "--test")
{
m_testMode = true;
}
}
}

@ -0,0 +1,128 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef DAEMON_H
#define DAEMON_H
#include <vector>
#include <string>
#include <sys/types.h>
using std::vector;
using std::string;
/*!
* \class Daemon.
* \brief Daemon wraps up the daemonizing functionality.
*
* Daemon wraps up the daemonizing functionality and is the
* main object of the launcher program. It runs the main loop of the
* application, listens connections from the invoker and forks Booster
* processes.
*/
class Daemon
{
public:
/*!
* \brief Constructor
* \param argc Argument count delivered to main()
* \param argv Argument array delivered to main()
*
* Supported arguments:
* --daemon == daemonize
* --quiet == quiet
* --help == print usage
*/
Daemon(int & argc, char * argv[]);
/*!
* \brief Destructor
*/
virtual ~Daemon();
/*!
* \brief Run main loop and fork Boosters.
*/
void run();
/*! \brief Return the one-and-only Daemon instance.
* \return Pointer to the Daemon instance.
*/
static Daemon * instance();
//! \brief Reapes children processes gone zombies (finished Boosters).
void reapZombies();
//! Lock file to prevent launch of second instance
static bool lock(void);
//! Unlock file (lock is not needed in boosters)
static void unlock(void);
private:
//! Disable copy-constructor
Daemon(const Daemon & r);
//! Disable assignment operator
Daemon & operator= (const Daemon & r);
//! Parse arguments
typedef vector<string> ArgVect;
void parseArgs(const ArgVect & args);
//! Fork to a daemon
void daemonize();
//! Print usage
void usage() const;
//! Forks and initializes a new Booster
bool forkBooster(char type, int pipefd[2]);
//! Don't use console for output
void consoleQuiet();
//! Test mode flag
bool m_testMode;
//! Daemonize flag
bool m_daemon;
//! Debug print flag
bool m_quiet;
//! Vector of current child PID's
typedef vector<pid_t> PidVect;
PidVect m_children;
int m_initialArgc;
char** m_initialArgv;
static Daemon * m_instance;
static int m_lockFd;
#ifdef UNIT_TEST
friend class Ut_Daemon;
#endif
};
#endif // DAEMON_H

@ -0,0 +1,212 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "logger.h"
#include <cstdlib>
#include <syslog.h>
#include <cstdarg>
#include <QDateTime>
#include <QDir>
#include <QString>
namespace {
const QString logDirectory("/var/log");
const QString logFileName(logDirectory + "/launcher.log");
const QString oldLogFileName(logDirectory + "/launcher.log.old");
const QString dateFormat("yyyy-MM-dd hh:mm:ss.zzz");
}
bool Logger::m_isOpened = false;
QTextStream Logger::m_logStream;
QFile Logger::m_logFile;
bool Logger::m_useSyslog = false;
bool Logger::m_echoMode = false;
void Logger::openLog(const char * progName)
{
if (!Logger::m_isOpened)
{
// Check if it's possible to write under /var/log
// Should make it possible to get the logs in the enviroments
// with and without syslog.
QDir logDir;
if (logDir.exists(logDirectory)) {
// Directory exists, is it possible to create a file in it?
m_logFile.setFileName(oldLogFileName);
if (m_logFile.open(QIODevice::WriteOnly)) {
m_logFile.close();
m_logFile.remove();
}
else {
// It is not possible to write to file. Use syslog
m_useSyslog = true;
}
}
else {
// Directory does not exist. Is it possible to create it?
if (logDir.mkdir(logDirectory) == false) {
// Not possible to create directory. Use syslog.
m_useSyslog = true;
}
}
// Initialize the logging interface
if (m_useSyslog == false) {
// Remove the oldest log file
m_logFile.setFileName(oldLogFileName);
m_logFile.remove();
// Copy latest log file to applifed.log.old
m_logFile.setFileName(logFileName);
m_logFile.rename(oldLogFileName);
// Open current log file
m_logFile.setFileName(logFileName);
if (m_logFile.open(QIODevice::WriteOnly)) {
Logger::m_logStream.setDevice(&m_logFile);
}
else {
m_useSyslog = true;
}
}
if (m_useSyslog) {
openlog(progName, LOG_PID, LOG_DAEMON);
}
Logger::m_isOpened = true;
}
}
void Logger::closeLog()
{
if (Logger::m_isOpened) {
if (m_useSyslog) {
closelog();
}
else {
m_logFile.close();
}
Logger::m_isOpened = false;
}
}
void Logger::writeLog(const int priority, const char * format, va_list ap)
{
if (Logger::m_isOpened) {
if (m_echoMode) {
vprintf(format, ap);
printf("\n");
}
if (m_useSyslog) {
vsyslog(priority, format, ap);
}
else {
QString msg;
msg.vsprintf(format, ap);
m_logStream <<
QDateTime::currentDateTime().toString(dateFormat);
switch (priority) {
case LOG_NOTICE:
m_logStream << " [NOTICE] ";
break;
case LOG_ERR:
m_logStream << " [ERROR] ";
break;
case LOG_WARNING:
m_logStream << " [WARNING] ";
break;
case LOG_INFO:
m_logStream << " [INFO] ";
break;
default:
m_logStream << " [N/A] ";
break;
}
m_logStream << msg << "\n";
m_logStream.flush();
}
}
}
void Logger::logNotice(const char * format, ...)
{
#ifdef _DEBUG
va_list(ap);
va_start(ap, format);
writeLog(LOG_NOTICE, format, ap);
va_end(ap);
#else
Q_UNUSED(format);
#endif
}
void Logger::logWarning(const char * format, ...)
{
#ifdef _DEBUG
va_list(ap);
va_start(ap, format);
writeLog(LOG_WARNING, format, ap);
va_end(ap);
#else
Q_UNUSED(format);
#endif
}
void Logger::logInfo(const char * format, ...)
{
#ifdef _DEBUG
va_list(ap);
va_start(ap, format);
writeLog(LOG_INFO, format, ap);
va_end(ap);
#else
Q_UNUSED(format);
#endif
}
void Logger::logError(const char * format, ...)
{
va_list(ap);
va_start(ap, format);
writeLog(LOG_ERR, format, ap);
va_end(ap);
}
void Logger::logErrorAndDie(int code, const char * format, ...)
{
va_list(ap);
va_start(ap, format);
writeLog(LOG_ERR, format, ap);
va_end(ap);
exit(code);
}
void Logger::setEchoMode(bool enable)
{
Logger::m_echoMode = enable;
}

@ -0,0 +1,119 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef LOGGER_H
#define LOGGER_H
#include <QTextStream>
#include <QFile>
#include <cstdarg>
/*!
* \class Logger
* \brief Logging utility class
*
*/
class Logger
{
public:
/*!
* \brief Open the log
* \param progName Program name as it will be seen in the log.
*/
static void openLog(const char * progName);
/*!
* \brief Close the log
*/
static void closeLog();
/*!
* \brief Log a notice to the system message logger
* \param format String identical to a printf format string
* \param additionalArgs Depending on the format string, the function may expect a
* sequence of additional arguments, each containing one value to be inserted
* in the format parameter, if any.
*/
static void logNotice(const char * format, ...);
/*!
* \brief Log an error to the system message logger
* \param format String identical to a printf format string
* \param additionalArgs Depending on the format string, the function may expect a
* sequence of additional arguments, each containing one value to be inserted
* in the format parameter, if any.
*/
static void logError(const char * format, ...);
/*!
* \brief Log a warning to the system message logger
* \param format String identical to a printf format string
* \param additionalArgs Depending on the format string, the function may expect a
* sequence of additional arguments, each containing one value to be inserted
* in the format parameter, if any.
*/
static void logWarning(const char * format, ...);
/*!
* \brief Log a piece of information to the system message logger
* \param format String identical to a printf format string
* \param additionalArgs Depending on the format string, the function may expect a
* sequence of additional arguments, each containing one value to be inserted
* in the format parameter, if any.
*/
static void logInfo(const char * format, ...);
/*!
* \brief Log an error to the system message logger and exit
* \param format String identical to a printf format string
* \param additionalArgs Depending on the format string, the function may expect a
* sequence of additional arguments, each containing one value to be inserted
* in the format parameter, if any.
*/
static void logErrorAndDie(int code, const char * format, ...);
/*!
* \brief Forces Logger to echo everything to stdout if set to true.
*/
static void setEchoMode(bool enable);
private:
static void writeLog(const int priority, const char * format, va_list ap);
//! True if the log is open
static bool m_isOpened;
//! Log file which is used if the syslog is not available
//static QFile m_logFile;
static QFile m_logFile;
//! Text stream for log file
static QTextStream m_logStream;
//! True if the syslog is available
static bool m_useSyslog;
//! Echo everything to stdout if true
static bool m_echoMode;
};
#endif // LOGGER_H

@ -0,0 +1,75 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "daemon.h"
#include "logger.h"
#include <cstdlib>
#include <signal.h>
#include <fcntl.h>
#include <sys/file.h>
//! Signal handler to reap zombies
void reapZombies(int)
{
if (Daemon::instance())
Daemon::instance()->reapZombies();
}
//! Signal handler to kill booster
void exitBooster(int)
{
Logger::logErrorAndDie(EXIT_FAILURE, "due to parent process applauncherd died, booster exit too");
}
void exitLauncher(int)
{
exit(0);
}
//! Main function
int main(int argc, char * argv[])
{
// Open the log
Logger::openLog(PROG_NAME);
Logger::logNotice("%s starting..", PROG_NAME);
// Check that an instance of launcher is not already running
if(!Daemon::lock())
{
Logger::logErrorAndDie(EXIT_FAILURE, "try to launch second instance");
}
// Install signal handlers
signal(SIGCHLD, reapZombies);
signal(SIGHUP, exitBooster);
signal(SIGTERM, exitLauncher);
// Create main daemon instance
Daemon myDaemon(argc, argv);
// Run the main loop
myDaemon.run();
// Close the log
Logger::closeLog();
return EXIT_SUCCESS;
}

@ -0,0 +1,57 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "mbooster.h"
#ifdef HAVE_MCOMPONENTCACHE
#include <mcomponentcache.h>
#endif
const string MBooster::m_socketId = "/tmp/mlnchr";
MBooster::MBooster()
{
}
MBooster::~MBooster()
{
}
const string & MBooster::socketId() const
{
return m_socketId;
}
bool MBooster::preload()
{
#ifdef HAVE_MCOMPONENTCACHE
MComponentCache::populateForMApplication();
#endif
return true;
}
const string & MBooster::socketName()
{
return m_socketId;
}
char MBooster::type()
{
return 'm';
}

@ -0,0 +1,82 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef MBOOSTER_H
#define MBOOSTER_H
#include "booster.h"
/*!
\class MBooster
\brief MeeGo Touch -specific version of the Booster.
MBooster effectively fills MComponentCache with fresh objects.
MeeGo Touch applications can then try to use already initialized objects
from MComponentCache. This can significantly reduce the startup time of a
MeeGo Touch application.
*/
class MBooster : public Booster
{
public:
//! \brief Constructor
MBooster();
//! \brief Destructor
virtual ~MBooster();
//! \reimp
virtual bool preload();
/*!
* \brief Return the socket name common to all MBooster objects.
* \return Path to the socket file.
*/
static const string & socketName();
//! \reimp
virtual char boosterType() const { return type(); }
/*!
* \brief Return a unique character ('d') represtenting the type of MBoosters.
* \return Type character.
*/
static char type();
protected:
//! \reimp
virtual const string & socketId() const;
private:
//! Disable copy-constructor
MBooster(const MBooster & r);
//! Disable assignment operator
MBooster & operator= (const MBooster & r);
static const string m_socketId;
#ifdef UNIT_TEST
friend class Ut_MBooster;
#endif
};
#endif // MBOOSTER_H

@ -0,0 +1,50 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "qtbooster.h"
const string QtBooster::m_socketId = "/tmp/qtlnchr";
QtBooster::QtBooster()
{
}
QtBooster::~QtBooster()
{
}
const string & QtBooster::socketId() const
{
return m_socketId;
}
const string & QtBooster::socketName()
{
return m_socketId;
}
char QtBooster::type()
{
return 'q';
}
bool QtBooster::preload()
{
return true;
}

@ -0,0 +1,77 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef QTBOOSTER_H
#define QTBOOSTER_H
#include "booster.h"
/*!
* \class QtBooster.
* \brief Qt-specific version of the Booster.
*/
class QtBooster : public Booster
{
public:
//! Constructor.
QtBooster();
//! Destructor.
virtual ~QtBooster();
/*!
* \brief Return the socket name common to all QtBooster objects.
* \return Path to the socket file.
*/
static const string & socketName();
//! \reimp
virtual char boosterType() const { return type(); }
/*!
* \brief Return a unique character ('q') represtenting the type of QtBoosters.
* \return Type character.
*/
static char type();
//! \reimp
virtual bool preload();
protected:
//! \reimp
virtual const string & socketId() const;
private:
//! Disable copy-constructor
QtBooster(const QtBooster & r);
//! Disable assignment operator
QtBooster & operator= (const QtBooster & r);
static const string m_socketId;
#ifdef UNIT_TEST
friend class Ut_QtBooster;
#endif
};
#endif //QTBOOSTER_H

@ -0,0 +1,15 @@
#!/bin/sh
# Forces resolving symbols of libraries to which applauncherd.bin is
# linked to.
# commented out because of broken libamjpeg library
# export LD_BIND_NOW=1
# Use 50 chars long dummy parameter to reserve place for application
# name and parameters so that we get some space to modify them
# afterwards. If the length of the application name with parameters is
# longer than space available, only the params that fully fit will be
# shown in the output of top and ps commands.
exec /usr/bin/applauncherd.bin " "

@ -0,0 +1,45 @@
# Find libmeegotouch for the test programs
include(FindPkgConfig)
pkg_check_modules(MEEGOTOUCH meegotouch>=0.20 REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MEEGOTOUCH_INCLUDE_DIRS})
# Check if it's possible to compile MBooster with MComponentCache. If so,
# HAVE_MCOMPONENTCACHE is set.
message(STATUS "checking for mcomponentcache.h")
find_file(M_COMPONENT_CACHE NAMES mcomponentcache.h PATHS ${MEEGOTOUCH_INCLUDE_DIRS})
if (EXISTS ${M_COMPONENT_CACHE})
message(STATUS " found")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_MCOMPONENTCACHE")
else (EXISTS ${M_COMPONENT_CACHE})
message(STATUS " not found")
endif (EXISTS ${M_COMPONENT_CACHE})
# Sub build: helloworld
add_subdirectory(TestApps/helloworld)
# Sub build: unit tests
add_subdirectory(unittests)
# Sub build: perftests
add_subdirectory(perftests)
# Sub build: functests
add_subdirectory(functests)
# Sub build: art-tests
add_subdirectory(art-tests)
# Sub build: bug-tests
add_subdirectory(bug-tests)
# Sub build: TestScripts
add_subdirectory(TestScripts)
# Sub build: TestApps
add_subdirectory(TestApps/creds)
# Sub build: TestApps
add_subdirectory(TestApps/testapp)
# Sub build: TestApps
add_subdirectory(TestApps/themetest)

@ -0,0 +1,15 @@
set(SRC creds_test.cpp)
link_libraries(${MEEGOTOUCH_LIBRARIES})
include(${QT_USE_FILE})
add_library(creds_test MODULE ${SRC})
# max creds
install(PROGRAMS libcreds_test.so DESTINATION /usr/bin RENAME fala_ft_creds1.launch)
install(PROGRAMS fala_ft_creds DESTINATION /usr/bin RENAME fala_ft_creds1)
# "normal" creds
install(PROGRAMS libcreds_test.so DESTINATION /usr/bin RENAME fala_ft_creds2.launch)
install(PROGRAMS fala_ft_creds DESTINATION /usr/bin RENAME fala_ft_creds2)

@ -0,0 +1,106 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <MApplication>
#include <MApplicationWindow>
#include <MApplicationPage>
#include <MExport>
#include <MTextEdit>
#include <QStringList>
#ifdef HAVE_MCOMPONENTCACHE
#include <MComponentCache>
#endif
#ifdef HAVE_CREDS
#include <cstdlib>
#include <sys/creds.h>
/**
* Returns a QStringList filled with credentials the
* application currently has.
*/
QStringList credentials()
{
QStringList credList;
// credentials for the current pid
creds_t creds;
if ((creds = creds_gettask(0)) == NULL)
{
return credList;
}
creds_type_t creds_type;
creds_value_t creds_value;
int i = 0;
// Retrieve all credentials
while ((creds_type = creds_list(creds, i++, &creds_value)) != CREDS_BAD)
{
// Some magic to get the correct buffer length
int size = creds_creds2str(creds_type, creds_value, NULL, 0);
char *buf = new char [size+1];
creds_creds2str(creds_type, creds_value, buf, size+1);
credList << QString(buf);
delete [] buf;
}
creds_free(creds);
return credList;
}
#endif // HAVE_CREDS
M_EXPORT int main(int argc, char **argv)
{
#ifdef HAVE_MCOMPONENTCACHE
MApplication *app = MComponentCache::mApplication(argc, argv);
MApplicationWindow *win = MComponentCache::mApplicationWindow();
#else
MApplication *app = new MApplication(argc, argv);
MApplicationWindow *win = new MApplicationWindow;
#endif
MApplicationPage page;
win->show();
page.setTitle("Applauncherd Aegis test");
page.appear();
MTextEdit *edit = new MTextEdit(MTextEditModel::MultiLine);
edit->setReadOnly(true);
page.setCentralWidget(edit);
#ifdef HAVE_CREDS
edit->setText(credentials().join("\n"));
#else
edit->setText("Credential support not compiled");
#endif
return app->exec();
}

@ -0,0 +1,13 @@
TEMPLATE = lib
TARGET = creds_test
DEPENDPATH += .
INCLUDEPATH += .
SOURCES += creds_test.cpp
CONFIG += meegotouch plugin
#QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
#QMAKE_LFLAGS += -pie -rdynamic
LIBS += -lcreds

@ -0,0 +1,3 @@
#!/bin/sh
echo "/usr/bin/invoker --type=m" $0.launch $@
exec /usr/bin/invoker --type=m $0.launch $@

@ -0,0 +1,16 @@
# Set sources
set(SRC helloworld.cpp)
link_libraries(${MEEGOTOUCH_LIBRARIES})
include(${QT_USE_FILE})
add_library(helloworld MODULE ${SRC})
# Install
install(PROGRAMS libhelloworld.so DESTINATION /usr/bin RENAME fala_ft_hello.launch)
install(PROGRAMS scripts/fala_ft_hello DESTINATION /usr/bin/)
install(PROGRAMS scripts/qhelloworld DESTINATION /usr/bin/)
# Install symlinks so that /usr/bin/helloworldX launches /usr/bin/helloworldX.launch
install(SCRIPT scripts/create_links.cmake)

@ -0,0 +1,65 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <MApplication>
#include <MApplicationPage>
#include <MApplicationWindow>
#include <QDebug>
#include <MExport>
#include <MButton>
#include <MLabel>
#include <MSlider>
#include <MLayout>
#include <MLinearLayoutPolicy>
#ifdef HAVE_MCOMPONENTCACHE
#include <mcomponentcache.h>
#endif
M_EXPORT int main(int, char**);
int main(int argc, char ** argv)
{
#ifdef HAVE_MCOMPONENTCACHE
MApplication *app = MComponentCache::mApplication(argc, argv);
MApplicationWindow *window = MComponentCache::mApplicationWindow();
#else
MApplication *app = new MApplication(argc, argv);
MApplicationWindow *window = new MApplicationWindow;
#endif
MApplicationPage *mainPage = new MApplicationPage;
mainPage->setTitle("Hello World! (Now supports Launcher)");
mainPage->centralWidget()->setObjectName("centralWidget");
MLayout *layout = new MLayout(mainPage->centralWidget());
MLinearLayoutPolicy *linearPolicy = new MLinearLayoutPolicy(layout,
Qt::Vertical);
linearPolicy->addItem(new MLabel("I'm a label"));
linearPolicy->addItem(new MButton("Click me!"));
linearPolicy->addItem(new MSlider);
window->show();
// Explicitly state where to appear, just to be sure :-)
mainPage->appear(window);
return app->exec();
}

@ -0,0 +1,8 @@
TEMPLATE = app
TARGET = fala_ft_hello
CONFIG = qt meegotouch
QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
QMAKE_LFLAGS += -pie -rdynamic
SOURCES += helloworld.cpp

@ -0,0 +1,6 @@
execute_process(COMMAND echo "Creating symlinks for fala_ft_hello..")
execute_process(COMMAND ln -v -s /usr/bin/fala_ft_hello $ENV{DESTDIR}/usr/bin/fala_ft_hello1)
execute_process(COMMAND ln -v -s /usr/bin/fala_ft_hello $ENV{DESTDIR}/usr/bin/fala_ft_hello2)
execute_process(COMMAND ln -v -s /usr/bin/fala_ft_hello.launch $ENV{DESTDIR}/usr/bin/fala_ft_hello1.launch)
execute_process(COMMAND ln -v -s /usr/bin/fala_ft_hello.launch $ENV{DESTDIR}/usr/bin/fala_ft_hello2.launch)

@ -0,0 +1,4 @@
#!/bin/sh
echo "/usr/bin/invoker --type=m" $0.launch $@
exec /usr/bin/invoker --type=m $0.launch $@

@ -0,0 +1,5 @@
#!/bin/sh
echo "/usr/bin/invoker --type=qt" helloworld.launch $@
exec /usr/bin/invoker --type=qt helloworld.launch $@

@ -0,0 +1,14 @@
# Set sources
set(SRC main.cpp)
link_libraries(${MEEGOTOUCH_LIBRARIES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden -fvisibility-inlines-hidden")
set(CMAKE_EXE_LINKER_FLAGS "-pie -rdynamic")
# Enable Qt-support
include(${QT_USE_FILE})
add_executable(fala_testapp ${SRC})
# Install
install(PROGRAMS fala_testapp DESTINATION /usr/bin/)
install(FILES com.nokia.fala_testapp.service DESTINATION /usr/share/dbus-1/services)

@ -0,0 +1,4 @@
[D-BUS Service]
Name=com.nokia.fala_testapp
Exec=/usr/bin/fala_testapp -prestart

@ -0,0 +1,81 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <MApplication>
#include <MApplicationWindow>
#include <MApplicationPage>
#ifdef HAVE_MCOMPONENTCACHE
#include <MComponentCache>
#endif
#include <MExport>
#include <QFile>
#include <sys/time.h>
void FANGORNLOG(const char* s)
{
QFile f("/tmp/testapp.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 MyApplicationPage: public MApplicationPage
{
public:
MyApplicationPage(): MApplicationPage() {}
virtual ~MyApplicationPage() {}
void enterDisplayEvent() {
timestamp("MyApplicationPage::enterDisplayEvent");
}
};
M_EXPORT int main(int, char**);
int main(int argc, char **argv) {
timestamp("application main");
#ifdef HAVE_MCOMPONENTCACHE
MApplication* app = MComponentCache::mApplication(argc, argv);
MApplicationWindow* w = MComponentCache::mApplicationWindow();
#else
MApplication* app = new MApplication(argc, argv);
MApplicationWindow* w = new MApplicationWindow;
#endif
MyApplicationPage p;
MApplication::setPrestartMode(M::LazyShutdown);
p.setTitle("Applauncherd testapp");
w->show();
p.appear();
return app->exec();
}

@ -0,0 +1,14 @@
######################################################################
# Automatically generated by qmake (2.01a) Wed Apr 21 10:44:49 2010
######################################################################
TEMPLATE = app
QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
QMAKE_LFLAGS += -pie -rdynamic
TARGET = testapp
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += meegotouch
# Input
SOURCES += main.cpp

@ -0,0 +1,5 @@
add_subdirectory(src)
# Install themes
install(DIRECTORY themes/ DESTINATION /usr/share/themes/base/meegotouch/fala_ft_themetest)

@ -0,0 +1,20 @@
# Set sources
set(SRC themetest.cpp)
link_libraries(${MEEGOTOUCH_LIBRARIES})
include(${QT_USE_FILE})
# This is an extremely contrived way to get at the compiler
# and linker flags given in meegotouch-boostable.pc in the
# source tree.
execute_process(COMMAND "./pkg-config-sourcetree.sh" "--cflags" "meegotouch-boostable" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE booster_cflags OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "./pkg-config-sourcetree.sh" "--libs" "meegotouch-boostable" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE booster_libs OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cflags}")
set(CMAKE_EXE_LINKER_FLAGS ${booster_libs})
add_executable(themetest ${SRC})
# Install
install(PROGRAMS themetest DESTINATION /usr/bin RENAME fala_ft_themetest.launch)
install(PROGRAMS fala_ft_themetest DESTINATION /usr/bin/)

@ -0,0 +1,3 @@
#!/bin/sh
echo "/usr/bin/invoker --type=m" $0.launch $@
exec /usr/bin/invoker --type=m $0.launch $@

@ -0,0 +1,3 @@
#!/bin/sh
# Run pkg-config with PKG_CONFIG_PATH set to the source tree.
env PKG_CONFIG_PATH=../../../../data/pkgconfig pkg-config $*

@ -0,0 +1,60 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <MApplication>
#include <MApplicationPage>
#include <MApplicationWindow>
#include <MLabel>
#include <MButton>
#include <QDebug>
#include <MLinearLayoutPolicy>
#include <MLayout>
#include <MTheme>
#include <mcomponentcache.h>
extern "C" __attribute__((visibility("default"))) int main(int, char**);
int main(int argc, char ** argv)
{
MApplication *app = MComponentCache::mApplication(argc, argv, "fala_ft_themetest");
MApplicationWindow *window = MComponentCache::mApplicationWindow();
MApplicationPage page;
page.setTitle("fala_ft_themetest");
MLayout *layout = new MLayout;
MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical);
policy->setSpacing(10);
MLabel *label = new MLabel(QString("Hello, themed world!"));
label->setObjectName("themedlabel");
label->setAlignment(Qt::AlignCenter);
policy->addItem(label);
label = new MLabel(QString("With sheep"));
label->setObjectName("themedlabelwithgraphics");
label->setAlignment(Qt::AlignLeft);
policy->addItem(label);
page.centralWidget()->setLayout(layout);
page.appear();
window->show();
return app->exec();
}

@ -0,0 +1,55 @@
#themedlabel.Landscape {
preferred-size: 300 79;
minimum-size: 128 79;
maximum-size: 300 79;
text-color: $COLOR_INVERTED_FOREGROUND;
background-color: #D4F5D0;
font: $FONT_XLARGE;
text-margin-left: 20px;
margin-left: $MARGIN_DOUBLE;
margin-top:$MARGIN_DOUBLE;
}
#themedlabel.Portrait {
preferred-size: 300 93;
minimum-size: 105 93;
maximum-size: 300 93;
text-color: $COLOR_INVERTED_FOREGROUND;
background-color: #D4F5D0;
font: $FONT_XLARGE;
text-margin-left: 20px;
margin-left: $MARGIN_DOUBLE;
margin-top:$MARGIN_DOUBLE;
}
#themedlabelwithgraphics.Landscape {
preferred-size: 300 79;
minimum-size: 128 79;
maximum-size: 300 79;
text-color: $COLOR_INVERTED_FOREGROUND;
background-image: "baa";
font: $FONT_XLARGE;
text-margin-left: 20px;
margin-left: $MARGIN_DOUBLE;
margin-top:$MARGIN_DOUBLE;
}
#themedlabelwithgraphics.Portrait {
preferred-size: 300 93;
minimum-size: 105 93;
maximum-size: 300 93;
text-color: $COLOR_INVERTED_FOREGROUND;
background-image: "baa";
font: $FONT_XLARGE;
text-margin-left: 20px;
margin-left: $MARGIN_DOUBLE;
margin-top:$MARGIN_DOUBLE;
}

@ -0,0 +1,711 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg3644"
version="1.1"
inkscape:version="0.47pre4 r22446"
sodipodi:docname="sheep.svg">
<defs
id="defs3646">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective3652" />
<inkscape:perspective
id="perspective3672"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672-6"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672-3"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672-35"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672-2"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672-4"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672-67"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3672-33"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3789"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3679"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-9"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-5"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-1"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-0"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-13"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-8"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-7"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-89"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-3"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-6"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-33"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-18"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-05"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-10"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-04"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-99"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-98"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3701-39"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="14"
inkscape:cx="31.835131"
inkscape:cy="24"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1680"
inkscape:window-height="1026"
inkscape:window-x="1440"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata3649">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="baa"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
id="path3654"
sodipodi:cx="9.6428576"
sodipodi:cy="18.785715"
sodipodi:rx="3.7857144"
sodipodi:ry="1.9285715"
d="m 13.428572,18.785715 a 3.7857144,1.9285715 0 1 1 -7.5714288,0 3.7857144,1.9285715 0 1 1 7.5714288,0 z"
style="fill:#ff9955"
transform="matrix(1.5420309,-0.25805364,0.26095121,1.8649676,-11.438222,-17.21116)" />
<path
sodipodi:type="arc"
style="fill:#ff9955"
id="path3656"
sodipodi:cx="21.928572"
sodipodi:cy="27.928572"
sodipodi:rx="10.071428"
sodipodi:ry="4.7857141"
d="m 32,27.928572 a 10.071428,4.7857141 0 1 1 -20.142857,0 10.071428,4.7857141 0 1 1 20.142857,0 z"
transform="matrix(1.3571374,0,0,1.4919304,-3.0082753,-18.979186)" />
<path
sodipodi:type="arc"
style="fill:#ff9955"
id="path3658"
sodipodi:cx="24.357143"
sodipodi:cy="16.071428"
sodipodi:rx="4.9285712"
sodipodi:ry="2.3571429"
d="m 29.285715,16.071428 a 4.9285712,2.3571429 0 1 1 -9.857143,0 4.9285712,2.3571429 0 1 1 9.857143,0 z"
transform="matrix(0.87235109,1.142885,-1.0396276,0.95899438,9.8040159,-24.611052)" />
<path
sodipodi:type="arc"
style="fill:#552200"
id="path3662"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(1.3365194,0.259071,-0.23566444,1.4692646,16.402748,-28.908781)" />
<path
sodipodi:type="arc"
style="fill:#552200"
id="path3662-7"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(1.3571374,0,0,1.4919304,6.7825021,-21.217084)" />
<path
sodipodi:type="arc"
style="fill:#552200"
id="path3662-0"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(1.275292,-0.51027027,0.46416834,1.401956,8.7597902,-19.287371)" />
<path
sodipodi:type="arc"
style="fill:#552200"
id="path3662-6"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(1.3365194,0.259071,-0.23566444,1.4692646,35.693487,-21.76883)" />
<path
sodipodi:type="arc"
style="fill:#552200"
id="path3662-4"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(-1.3954334,0.28264367,0.22527631,1.4734212,41.550185,-28.934224)" />
<path
sodipodi:type="arc"
style="fill:#552200"
id="path3662-06"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(1.3365194,0.259071,-0.23566444,1.4692646,38.213885,-22.195096)" />
<path
sodipodi:type="arc"
style="fill:#ff9955"
id="path3662-49"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(-0.23566447,-1.4692646,1.3365194,-0.25907103,-9.7578617,41.32338)" />
<path
sodipodi:type="arc"
style="fill:#552200"
id="path3662-3"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(1.3365194,0.259071,-0.23566444,1.4692646,19.601715,-28.37595)" />
<path
sodipodi:type="arc"
style="fill:#552200"
id="path3662-8"
sodipodi:cx="7.9285712"
sodipodi:cy="38.07143"
sodipodi:rx="0.64285713"
sodipodi:ry="2.5"
d="m 8.5714284,38.07143 a 0.64285713,2.5 0 1 1 -1.2857143,0 0.64285713,2.5 0 1 1 1.2857143,0 z"
transform="matrix(1.3365194,-0.259071,0.23566444,1.4692646,1.8514265,-18.300104)" />
<rect
style="fill:#000000"
id="rect3770"
width="1.6164445"
height="3.9025185"
x="-0.72986764"
y="10.57036"
transform="matrix(0.73503661,-0.67802742,0.60673898,0.79490113,0,0)" />
<rect
style="fill:#000000"
id="rect3770-8"
width="1.5909256"
height="3.9612279"
x="-15.635607"
y="-4.541935"
transform="matrix(-0.84429955,-0.53587151,0.46496422,-0.88532947,0,0)" />
<path
sodipodi:type="spiral"
style="fill:#552200;stroke:#6e4e4e;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path3818"
sodipodi:cx="-42.714287"
sodipodi:cy="3"
sodipodi:expansion="1"
sodipodi:revolution="1.5"
sodipodi:radius="2.236068"
sodipodi:argument="-8.9611301"
sodipodi:t0="0"
d="m -42.714287,3 c -0.200553,-0.1002769 0.03623,-0.3198153 0.166667,-0.3333333 0.353489,-0.036633 0.546923,0.3673047 0.5,0.6666668 -0.08393,0.5354884 -0.679426,0.7934401 -1.166667,0.6666664 -0.715046,-0.1860455 -1.045363,-0.9950943 -0.833333,-1.6666669 0.282602,-0.8951006 1.311932,-1.2994739 2.166667,-0.9999995 1.075597,0.376858 1.554694,1.6293044 1.166666,2.6666669"
transform="matrix(-2.5258969e-8,-1.4919304,1.3571374,-2.776773e-8,6.5752464,-48.260282)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.33768974,0,0,0.35259921,-58.444238,-7.3117593)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,58.846237,29.748536)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-4"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,67.182938,28.682871)"
inkscape:transform-center-x="31.601913"
inkscape:transform-center-y="-3.3177701" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-9"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,56.519715,23.354547)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-2"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,59.23399,21.436352)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-3"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,71.448227,23.993947)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-99"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,75.519639,25.272745)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-45"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,63.887034,20.796953)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-5"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,72.999241,22.502017)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-33"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,71.642103,29.748536)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-55"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,74.550255,28.896004)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-8"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,68.733952,20.796953)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-0"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,53.417688,19.731288)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-6"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,52.06055,23.780814)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-7"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,63.111526,30.601067)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-1"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,65.631923,24.633345)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-30"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,53.999316,27.83034)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-54"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,60.978881,25.485877)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-94"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.33768974,0,0,0.35259921,-66.85138,2.2322821)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-16"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.33768974,0,0,0.35259921,-46.137094,18.660854)" />
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:0.39123183;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3669-4-334"
sodipodi:cx="-82.285713"
sodipodi:cy="-4.7142859"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="7.49966"
sodipodi:argument="-17.983253"
sodipodi:t0="0"
d="m -82.285713,-4.7142859 c 0.243529,0.2865053 -0.266055,0.4696244 -0.476191,0.4047619 -0.569455,-0.1757733 -0.602452,-0.9261053 -0.333333,-1.357143 0.481391,-0.7710252 1.569661,-0.777685 2.238095,-0.2619043 0.980955,0.7569288 0.958927,2.2222408 0.190476,3.1190477 -1.024223,1.1953025 -2.878063,1.1427762 -4,0.1190469 -1.411843,-1.2882589 -1.327986,-3.5354404 -0.04762,-4.8809525 1.550697,-1.6295954 4.193695,-1.5139846 5.761905,0.023811 1.848081,1.8122383 1.700479,4.8524971 -0.09524,6.64285722 -2.073227,2.06704158 -5.511664,1.88730403 -7.523809,-0.16666802 -2.286327,-2.3338536 -2.074361,-6.1710887 0.238097,-8.404762 2.594227,-2.5058436 6.830699,-2.2615846 9.285714,0.3095254 2.725532,2.8544193 2.448934,7.4904516 -0.380954,10.1666669"
transform="matrix(0.45829137,0,0,0.52605349,50.703413,18.239358)" />
<path
sodipodi:type="arc"
style="fill:#803300;stroke:#6e4e4e;stroke-width:0.13500001;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3879"
sodipodi:cx="-11.142858"
sodipodi:cy="18.214285"
sodipodi:rx="0.5714286"
sodipodi:ry="0.9285714"
d="m -10.571429,18.214285 a 0.5714286,0.9285714 0 1 1 -1.142857,0 0.5714286,0.9285714 0 1 1 1.142857,0 z"
transform="matrix(1.3571374,0,0,1.4919304,18.512047,-11.093268)" />
<path
sodipodi:type="arc"
style="fill:#000000;stroke:#6e4e4e;stroke-width:0.13500001;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3881"
sodipodi:cx="-7.7142859"
sodipodi:cy="19.071428"
sodipodi:rx="0.2857143"
sodipodi:ry="0.2857143"
d="m -7.4285716,19.071428 a 0.2857143,0.2857143 0 1 1 -0.5714285,0 0.2857143,0.2857143 0 1 1 0.5714285,0 z"
transform="matrix(1.3571374,0,0,1.4919304,17.542663,-15.462494)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 42 KiB

@ -0,0 +1,10 @@
install(FILES
test-perf-mbooster.py
check_pipes.py
test-func-launcher.py
DESTINATION /usr/share/applauncherd-testscripts)
install(PROGRAMS
ts_prestartapp.rb
tc_theming.rb
DESTINATION /usr/share/applauncherd-testscripts)

@ -0,0 +1,48 @@
#!/usr/bin/env python
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# Contact: Nokia Corporation (directui@nokia.com)
#
# This file is part of applauncherd.
#
# If you have questions regarding the use of this file, please contact
# Nokia at directui@nokia.com.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation
# and appearing in the file LICENSE.LGPL included in the packaging
# of this file.
import subprocess
import sys
p = subprocess.Popen("(for p in $(pgrep applauncherd); do ls -l /proc/$p/fd | grep pipe ; done) | awk -F\: '{print $3}' | sort -u",
shell=True,
stdout=subprocess.PIPE)
result= p.stdout.read()
print type(result), result
if result[0]!='[':
sys.exit(1)
p = subprocess.Popen("(for p in $(pgrep applauncherd); do ls -l /proc/$p/fd | grep pipe ; done) | awk -F\: '{print $3}' | sort -u | wc -l",
shell=True,
stdout=subprocess.PIPE)
result= int(p.stdout.read())
if result!=1:
sys.exit(2)
p = subprocess.Popen("(for p in $(pgrep applauncherd); do ls -l /proc/$p/fd | grep pipe ; done) | awk -F\: '{print $3}' | wc -l",
shell=True,
stdout=subprocess.PIPE)
result= int(p.stdout.read())
if result!=4:
sys.exit(4)

@ -0,0 +1,168 @@
#!/usr/bin/ruby1.8
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# Contact: Nokia Corporation (directui@nokia.com)
#
# This file is part of applauncherd.
#
# If you have questions regarding the use of this file, please contact
# Nokia at directui@nokia.com.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation
# and appearing in the file LICENSE.LGPL included in the packaging
# of this file.
"""
This script tests that system theming works for launched applications.
Testing that changing the theme is done as follows:
* launch application
* take a screenshot (1)
* change theme
* take a screenshot (2)
* change theme back to original theme
* take a screenshot (3)
* make sure that 1 and 2 differ and that 1 and 3 are the same
Testing that application specific theming is done using an application
which has application specific theming and application specific svg
graphics:
* start application without launcher
* take screenshot of themed widgets (1)
* start application with launcher
* take screenshot of themed widgets (2)
* verify that (1) and (2) are equal
"""
require 'matti'
require 'date'
require 'test/unit'
include MattiVerify
SCREENSHOT_DIR = '/home/user/MyDocs'
if ENV.has_key?('_SBOX_DIR')
ENV['PATH'] += ":" + ENV['_SBOX_DIR'] + "/tools/bin"
SCREENSHOT_DIR = '/tmp'
end
class TC_Theming < Test::Unit::TestCase
def change_theme(theme_name)
puts "Changing theme from #{get_theme()} to #{theme_name}"
cmd = "gconftool-2 -s /meegotouch/theme/name -t string " + theme_name
verify_equal(true, 5, "Could not change theme") {
system(cmd)
}
sleep(5)
end
def get_theme()
`gconftool-2 -g /meegotouch/theme/name`.strip()
end
def setup
system('mcetool --set-tklock-mode=unlocked')
@sut = MATTI.sut(:Id => ARGV[0] || 'sut_qt_maemo')
end
def test_global_theming
app_name = 'fala_ft_hello'
system("pkill #{app_name}")
system(app_name)
sleep(5)
#pid = `pgrep -n #{app_name}`
app = @sut.application(:name => app_name)
widget = app.MWidget(:name => 'centralWidget')
original_theme = get_theme()
alternative_theme = 'plankton'
if original_theme == alternative_theme
alternative_theme = 'blanco'
end
widget.capture_screen('PNG', SCREENSHOT_DIR + '/testshot1.png', true)
change_theme(alternative_theme)
widget.capture_screen('PNG', SCREENSHOT_DIR + '/testshot2.png', true)
change_theme(original_theme)
widget.capture_screen('PNG', SCREENSHOT_DIR + '/testshot3.png', true)
system("pkill #{app_name}")
# diff returns an error when files are different
verify_equal(false, 1, "Shots 1 & 2 should differ!") {
system("diff #{SCREENSHOT_DIR}/testshot1.png #{SCREENSHOT_DIR}/testshot2.png")
}
# diff returns success when files are the same
verify_equal(true, 1, "Shots 1 & 3 should be the same!") {
system("diff #{SCREENSHOT_DIR}/testshot1.png #{SCREENSHOT_DIR}/testshot3.png")
}
File.delete(SCREENSHOT_DIR + "/testshot1.png",
SCREENSHOT_DIR + "/testshot2.png",
SCREENSHOT_DIR + "/testshot3.png")
end
def test_application_specific_theming
app_with_launcher = 'fala_ft_themetest'
app_without_launcher = "#{app_with_launcher}.launch"
# start app and take screenshots of the themed widgets
system("pkill #{app_without_launcher}")
system("pkill #{app_with_launcher}")
system("#{app_without_launcher} &")
sleep(5)
app = @sut.application(:name => app_without_launcher)
widget = app.MLabel(:name => 'themedlabel')
widget.capture_screen('PNG', '/tmp/testshot1.png', true)
widget = app.MLabel(:name => 'themedlabelwithgraphics')
widget.capture_screen('PNG', '/tmp/testshot2.png', true)
close_button = app.MButton( :name => 'CloseButton' )
close_button.tap
# once again using the launcher
system("#{app_with_launcher} &")
sleep(5)
app = @sut.application(:name => app_with_launcher)
widget = app.MLabel(:name => 'themedlabel')
widget.capture_screen('PNG', '/tmp/testshot3.png', true)
widget = app.MLabel(:name => 'themedlabelwithgraphics')
widget.capture_screen('PNG', '/tmp/testshot4.png', true)
close_button = app.MButton( :name => 'CloseButton' )
close_button.tap
verify_equal(true, 1, "Application specific theming failed with launcher!") {
# diff returns success when files are the same
system("diff /tmp/testshot1.png /tmp/testshot3.png")
}
verify_equal(true, 1, "Application specific svg files not found with launcher!") {
# diff returns success when files are the same
system("diff /tmp/testshot2.png /tmp/testshot4.png")
}
File.delete("/tmp/testshot1.png", "/tmp/testshot2.png",
"/tmp/testshot3.png", "/tmp/testshot4.png")
end
end

@ -0,0 +1,384 @@
#!/usr/bin/env python
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# Contact: Nokia Corporation (directui@nokia.com)
#
# This file is part of applauncherd.
#
# If you have questions regarding the use of this file, please contact
# Nokia at directui@nokia.com.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation
# and appearing in the file LICENSE.LGPL included in the packaging
# of this file.
"""
This program tests the startup time of the given application with and
without launcher.
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 launcher with .launcher binary in /usr/bin/.
5. launcher application should be installed.
Usage: test-func-launcher <launcherable application>
Example: test-func-launcher /usr/bin/fala_ft_hello
Authors: ext-nimika.1.keshri@nokia.com
ext-oskari.timperi@nokia.com
"""
import os
import subprocess
import commands
import time
import sys
import unittest
LAUNCHER_BINARY='/usr/bin/applauncherd'
DEV_NULL = file("/dev/null","w")
LAUNCHABLE_APPS = ['/usr/bin/fala_ft_hello','/usr/bin/fala_ft_hello1', '/usr/bin/fala_ft_hello2']
PREFERED_APP = '/usr/bin/fala_ft_hello'
def debug(*msg):
"""
Debug function
"""
sys.stderr.write('[DEBUG %s] %s\n' % (time.ctime(), \
' '.join([str(s) for s in msg]),))
def error(*msg):
"""
exit when error, give proper log
"""
sys.stderr.write('ERROR %s\n' % (' '.join([str(s) for s in msg]),))
sys.exit(1)
def basename(filepath):
"""
return base name of a file
"""
return os.path.basename(filepath)
def start_launcher_daemon():
temp = basename(LAUNCHER_BINARY)
st, op = commands.getstatusoutput("pgrep %s" %temp)
if st == 0:
debug("Launcher already started")
return op
def check_prerequisites():
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")
for app in LAUNCHABLE_APPS:
assert(len(basename(app)) <= 14, "For app: %s, base name !<= 14" % app)
class launcher_tests (unittest.TestCase):
def setUp(self):
#setup here
print "Executing SetUp"
def tearDown(self):
#teardown here
print "Executing TearDown"
#Other functions
def run_app_with_launcher(self, appname):
p = subprocess.Popen(appname,
shell=False,
stdout=DEV_NULL, stderr=DEV_NULL)
return p
#get_pid = lambda appname: commands.getstatusoutput("pgrep %s" % appname)[-1]
def get_pid(self, appname):
temp = basename(appname)[:14]
st, op = commands.getstatusoutput("pgrep %s" % temp)
if st == 0:
return op
else:
return None
def kill_process(self, appname=None, apppid=None):
if apppid and appname:
return None
else:
if apppid:
st, op = commands.getstatusoutput("kill -9 %s" % str(apppid))
if appname:
temp = basename(appname)[:14]
st, op = commands.getstatusoutput("pkill -9 %s" % temp)
os.wait()
def process_state(self, processid):
st, op = commands.getstatusoutput('cat /proc/%s/stat' %processid)
if st == 0:
return op
else:
debug(op)
return None
def get_creds(self, path):
"""
Tries to launch an application and if successful, returns the
credentials the application has as a list.
"""
# try launch the specified application
handle = self.run_app_with_launcher(path)
# sleep for a moment to allow applauncherd to start the process
time.sleep(5)
# with luck, the process should have correct name by now
pid = self.get_pid(path)
debug("%s has PID %s" % (basename(path), pid,))
self.assert_(pid != None, "Couldn't launch %s" % basename(path))
# get the status and output (needs creds-get from libcreds2-tools
# package)
st, op = commands.getstatusoutput("/usr/bin/creds-get -p %s" % pid)
self.kill_process(path)
return op.split("\n"), pid
#Testcases
def test_001_launcher_exist(self):
"""
To test if the launcher exists and is executable or not
"""
self.assert_(os.path.isfile(LAUNCHER_BINARY), "Launcher file does not exist")
self.assert_(os.access(LAUNCHER_BINARY, os.X_OK), "Launcher exists, but is not executable")
def test_002_applications_exist(self):
"""
test_launchable_application_exists
"""
failed_apps = []
for app in LAUNCHABLE_APPS:
temp = "%s.launch" % app
if not (os.path.isfile(temp) and os.access(temp, os.X_OK)):
failed_apps.append(temp)
self.assert_(failed_apps == [], "Some applications do not have the launch files, list: %s" % str(failed_apps))
def wait_for_app(self, app = None, timeout = 5, sleep = 0.5):
"""
Waits for an application to start. Checks periodically if
the app is running for a maximum wait set in timeout.
Returns the pid of the application if it was running before
the timeout finished, otherwise None is returned.
"""
pid = None
start = time.time()
while pid == None and time.time() < start + timeout:
pid = self.get_pid(app)
if pid != None:
break
print "waiting %s secs for %s" % (sleep, app)
time.sleep(sleep)
return pid
def test_003_zombie_state(self):
"""
To test that no Zombie process exist after the application is killed
"""
#launch application with launcher
#check if the application is running
#kill the application (pid = p.pid)
#check if pgrep appname should be nothing
#self.kill_process(LAUNCHER_BINARY)
process_handle = self.run_app_with_launcher(PREFERED_APP)
process_id = self.wait_for_app(PREFERED_APP, 5)
print process_id
self.kill_process(PREFERED_APP)
time.sleep(4)
process_handle = self.run_app_with_launcher(PREFERED_APP)
process_id1 = self.wait_for_app(PREFERED_APP, 5)
print process_id1
self.kill_process(PREFERED_APP)
time.sleep(4)
process_id1 = self.get_pid(PREFERED_APP)
print process_id1
self.assert_(process_id != process_id1 , "New Process not launched")
self.assert_(process_id1 == None , "Process still running")
def test_004_launch_multiple_apps(self):
"""
To test that more than one applications are launched by the launcher
"""
for app in LAUNCHABLE_APPS:
#launch application with launcher
#check if the application is running
#check if p.pid is same as pgrep appname
#in a global dictionary, append the pid
process_handle = self.run_app_with_launcher(app)
time.sleep(5)
process_id = self.get_pid(app)
self.assert_(not (process_id == None), "All Applications were not launched using launcher")
self.kill_process(PREFERED_APP)
def test_005_one_instance(self):
"""
To test that only one instance of a application exist
"""
#launch application
#self.run_app_with_launcher(appname)
#get pid of application
#launch applicatoin again
#check pgrep application
#y = commands.getstatusoutput(pgrep appname)
#len(y[-1].split(' ')) == 1
process_handle = self.run_app_with_launcher(PREFERED_APP)
process_id = self.get_pid(PREFERED_APP)
debug("PID of first %s" % process_id)
process_handle1 = self.run_app_with_launcher(PREFERED_APP)
time.sleep(2)
process_id = self.get_pid(PREFERED_APP)
debug("PID of 2nd %s" % process_id)
self.assert_( len(process_id.split(' ')) == 1, "Only one instance of app not running")
self.kill_process(PREFERED_APP)
def test_006_creds(self):
"""
Test that the fala_ft_creds* applications have the correct
credentials set (check aegis file included in the debian package)
"""
op1, pid1 = self.get_creds('/usr/bin/fala_ft_creds1')
op2, pid2 = self.get_creds('/usr/bin/fala_ft_creds2')
debug("fala_ft_creds1 has %s" % ', '.join(op1))
debug("fala_ft_creds2 has %s" % ', '.join(op2))
# required common caps
caps = ['UID::user', 'GID::users', 'SRC::com.nokia.maemo',
'applauncherd-testapps::applauncherd-testapps']
# required caps for fala_ft_creds1
cap1 = ['Retrieving credentials for pid: %s' %pid1, 'tcb', 'drm', 'Telephony', 'CAP::setuid', 'CAP::setgid',
'CAP::setfcap'] + caps
# required caps for fala_ft_creds2
cap2 = ['Retrieving credentials for pid: %s' %pid2, 'Cellular'] + caps
# check that all required creds are there
for cap in cap1:
self.assert_(cap in op1, "%s not set for fala_ft_creds1" % cap)
for cap in cap2:
self.assert_(cap in op2, "%s not set for fala_ft_creds2" % cap)
# check that no other creds are set
op1.sort()
cap1.sort()
self.assert_(op1 == cap1, "fala_ft_creds1 has non-requested creds!")
op2.sort()
cap2.sort()
self.assert_(op2 == cap2, "fala_ft_creds2 has non-requested creds!")
def test_007_no_aegis_Bug170905(self):
"""
Check that an application that doesn't have aegis file doesn't
get any funny credentials.
"""
creds, pid = self.get_creds('/usr/bin/fala_ft_hello')
debug("fala_ft_hello has %s" % ', '.join(creds))
req_creds = ['UID::nobody', 'GID::nogroup']
creds.sort()
req_creds.sort()
self.assert_(creds == req_creds, "fala_ft_hello has differnt creds set!")
def test_008_invoker_creds(self):
"""
Test that the launcher registered customized credentials
and invoker has proper credentials to access launcher
"""
INVOKER_BINARY='/usr/bin/invoker'
FAKE_INVOKER_BINARY='/usr/bin/faulty_inv'
#test application used for testing invoker
Testapp = '/usr/bin/fala_ft_hello.launch'
#launching the testapp with actual invoker
st = os.system('%s --type=m %s'%(INVOKER_BINARY, Testapp))
pid = self.get_pid(Testapp.replace('.launch', ''))
self.assert_((st == 0), "Application was not launched using launcher")
self.assert_(not (pid == None), "Application was not launched using launcher: actual pid%s" %pid)
print pid
#self.kill_process(Testapp.replace('.launch', ''))
self.kill_process(apppid=pid)
pid = self.get_pid(Testapp.replace('.launch', ''))
self.assert_((pid == None), "Application still running")
#launching the testapp with fake invoker
st = os.system('%s --type=m %s'%(FAKE_INVOKER_BINARY, Testapp))
pid = self.get_pid(Testapp.replace('.launch', ''))
self.assert_(not (st == 0), "Application was launched using fake launcher")
self.assert_((pid == None), "Application was launched using fake launcher")
def test_009_launch_multiple_apps_cont(self):
"""
To test that more than one applications are launched by the launcher
"""
for app in LAUNCHABLE_APPS:
#launch application with launcher
#check if the application is running
#check if p.pid is same as pgrep appname
#in a global dictionary, append the pid
process_handle = self.run_app_with_launcher(app)
time.sleep(8)
process_id = self.get_pid('fala_ft_hello')
pid_list = process_id.split()
self.assert_(len(pid_list) == len(LAUNCHABLE_APPS), "All Applications were not launched using launcher")
self.kill_process(PREFERED_APP)
# main
if __name__ == '__main__':
# When run with testrunner, for some reason the PATH doesn't include
# the tools/bin directory
if os.getenv('_SBOX_DIR') != None:
os.environ['PATH'] = os.getenv('PATH') + ":" + os.getenv('_SBOX_DIR') + '/tools/bin'
check_prerequisites()
start_launcher_daemon()
tests = sys.argv[1:]
mysuite = unittest.TestSuite(map(launcher_tests, tests))
result = unittest.TextTestRunner(verbosity=2).run(mysuite)
if not result.wasSuccessful():
sys.exit(1)
sys.exit(0)

@ -0,0 +1,264 @@
#!/usr/bin/env python
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# Contact: Nokia Corporation (directui@nokia.com)
#
# This file is part of applauncherd.
#
# If you have questions regarding the use of this file, please contact
# Nokia at directui@nokia.com.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation
# and appearing in the file LICENSE.LGPL included in the packaging
# of this file.
"""
This program tests the startup time of the given application with and
without launcher.
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 launcher with -launcher commandline argument.
5. waitforwindow application should be installed.
Usage: test-perf-mbooster <launcherable application>
Example: test-perf-mbooster /usr/bin/testapp
Authors: Nimika Keshri ext-nimika.1.keshri@nokia.com
"""
import os
import subprocess
import commands
import time
import sys
import unittest
TESTAPP = '/usr/bin/fala_testapp'
LOG_FILE = '/tmp/testapp.log'
DEV_NULL = file("/dev/null","w")
_start_time = 0
_end_time = 0
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(filepath):
"""
return base name of a file
"""
return os.path.basename(filepath)
def is_executable_file(filename):
return os.path.isfile(filename) and os.access(filename, os.X_OK)
def check_prerequisites():
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(TESTAPP):
error("'%s' is not an executable file\n" % (TESTAPP,) +
"(should be an application that supports launcher)")
class launcher_perf_tests (unittest.TestCase):
def setUp(self):
print "Setup Executed"
def tearDown(self):
print "Teardown Executed"
#Other functions
def start_timer(self):
global _start_time
_start_time = time.time()
def run_without_launcher(self, appname):
"""starts the testapp without the launcher"""
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)
self.start_timer()
p = subprocess.Popen(appname,
shell=False,
stdout=DEV_NULL, stderr=DEV_NULL)
debug("app", TESTAPP, "started without launcher")
time.sleep(5)
self.read_log()
app_time = self.app_start_time()
self.kill_process(appname)
return app_time
def run_without_launcher_without_duihome(self, appname):
"""starts the testapp without launcher and without duihome"""
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)
os.system('pkill -STOP duihome')
self.start_timer()
p = subprocess.Popen(TESTAPP,
shell=False,
stdout=DEV_NULL, stderr=DEV_NULL)
debug("app", TESTAPP, "started without launcher")
time.sleep(5)
os.system('pkill -CONT duihome')
self.read_log()
app_time = self.app_start_time()
self.kill_process(appname)
return app_time
def run_with_launcher(self, appname):
"""starts the testapp with launcher and with duihome"""
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)
self.start_timer()
os.system('invoker --type=m %s' %TESTAPP)
debug("app", TESTAPP, "started with launcher")
time.sleep(5)
self.read_log()
app_time = self.app_start_time()
self.kill_process(appname)
return app_time
def run_with_launcher_without_duihome(self, appname):
"""starts the testapp with launcher but without duihome"""
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)
os.system('pkill -STOP duihome')
self.start_timer()
os.system('invoker --type=m %s' %TESTAPP)
debug("app", TESTAPP, "started with launcher")
time.sleep(5)
os.system('pkill -CONT duihome')
self.read_log()
app_time = self.app_start_time()
self.kill_process(appname)
return app_time
def read_log(self):
"""Reads the log file to get the startup time"""
global _end_time
fh = open(LOG_FILE, "r")
lines = fh.readlines()
lastline = lines[len(lines)-2]
_end_time = lastline.split()[0]
return _end_time
def app_start_time(self):
"""Calculates the startup time for the testapp"""
global _app_start_time
_app_start_time = float(_end_time) - float(_start_time)
return _app_start_time
def kill_process(self, appname):
"""Kills the testapp"""
commands.getoutput("pkill -9 %s" % (basename(appname)[:15],))
def perftest_with_launcher(self, appname):
debug("run app with launcher without duihome")
twlnd = self.run_with_launcher_without_duihome(appname)
time.sleep(5)
debug("run app with launcher with duihome")
twlwd = self.run_with_launcher(appname)
time.sleep(5)
return twlwd, twlnd
def perftest_without_launcher(self, appname):
"""Runs all the 4 scenarios with and without launcher"""
debug("run app without launcher with duihome")
tnlwd = self.run_without_launcher(appname)
time.sleep(5)
debug("run app without launcher without duihome")
tnlnd = self.run_without_launcher_without_duihome(appname)
time.sleep(5)
return tnlwd, tnlnd
def print_test_report(self, with_without_times, fileobj):
"""
with_without_times is a list of pairs:
(with_launcher_startup_time,
without_launcher_startup_time)
"""
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("")
rowformat = "%12s %12s %12s %12s"
writeline('Startup times [s]:')
writeline(rowformat % ('launcher-Yes', 'launcher-Yes', 'launcher-No', 'launcher-No'))
writeline(rowformat % ('duihome-Yes', 'duihome-No', 'duihome-Yes', 'duihome-No'))
t1,t2,t3,t4 = [], [], [], []
for tnlwd,tnlnd,twlwd,twlnd in with_without_times:
t1.append(tnlwd)
t2.append(tnlnd)
t3.append(twlwd)
t4.append(twlnd)
writeline(rowformat % (fmtfloat(tnlwd),fmtfloat(tnlnd),
fmtfloat(twlwd),fmtfloat(twlnd)))
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):
"""Performance test to measure the startup time for application
launched using launcher and comparing the results with application launched
without launcher"""
times = []
times1, times2 = [], []
for i in xrange(3):
times1.append(self.perftest_with_launcher(TESTAPP))
for i in xrange(3):
times2.append(self.perftest_without_launcher(TESTAPP))
times = [[t1[0], t1[1], times2[i][0], times2[i][1]] for i, t1 in enumerate(times1)]
avg_with_launcher = self.print_test_report(times, sys.stdout)
self.assert_(float(avg_with_launcher) < float(0.75), "application launched with launcher takes more than 0.75 sec")
# main
if __name__ == '__main__':
check_prerequisites()
tests = sys.argv[1:]
mysuite = unittest.TestSuite(map(launcher_perf_tests, tests))
result = unittest.TextTestRunner(verbosity=2).run(mysuite)
if not result.wasSuccessful():
sys.exit(1)
sys.exit(0)

@ -0,0 +1,74 @@
#!/usr/bin/ruby1.8
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# Contact: Nokia Corporation (directui@nokia.com)
#
# This file is part of applauncherd.
#
# If you have questions regarding the use of this file, please contact
# Nokia at directui@nokia.com.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation
# and appearing in the file LICENSE.LGPL included in the packaging
# of this file.
#
#
# * Description: Testcases for the prestart functionality
#
# * Objectives: Test that a prestarted application can be
# launched as well
require 'matti'
require 'date'
require 'test/unit'
include MattiVerify
# When run by testrunner in scratchbox, the PATH environment variable
# is missing some vital entries ...
if ENV.has_key?('_SBOX_DIR')
ENV['PATH'] += ":" + ENV['_SBOX_DIR'] + "/tools/bin"
end
class TC_PRESTARTLAUNCHTESTS < Test::Unit::TestCase
# method called before any test case
def setup
system "mcetool --set-tklock-mode=unlocked"
@sut = MATTI.sut(:Id=>ARGV[0] || 'sut_qt_maemo')
end
# method called after any test case for cleanup purposes
def teardown
end
def test_launch_prestarted_app
#Test that a prestarted application can be launched
@appname = 'fala_testapp'
if system("pgrep #{@appname}") == true
system("kill -9 `pgrep #{@appname}`")
end
sleep 2
verify_equal(false,2,"Application is Prestarted"){
system "pgrep #{@appname}"}
sleep 2
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.ping`
sleep 1
verify_equal(true,2,"Application is not Prestarted"){
system "pgrep #{@appname}"}
pid = string = `pgrep #{@appname}`
sleep 1
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`
@app = @sut.application( :name => 'fala_testapp' )
@app.MButton( :name => 'CloseButton' ).tap
newid = string = `pgrep #{@appname}`
verify_true(30,"The application is not prestarted"){pid == newid}
sleep 1
system "kill -9 `pgrep #{@appname}`"
end
end

@ -0,0 +1,2 @@
install(FILES tests.xml DESTINATION /usr/share/applauncherd-art-tests)

@ -0,0 +1,58 @@
<?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="applauncherd-art-tests" domain="Application framework">
<set name="applauncherd-art-tests" description="Launcher functional tests" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="zombie-state" type="Functional" description="To test that process exits after the application is killed" timeout="120" level="System">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_003_zombie_state</step>
</case>
<case name="launch-multi-app" type="Functional" description="To test that more than one applications are launched by the launcher" timeout="120" level="System">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_004_launch_multiple_apps</step>
</case>
<case name="one-instance" type="Functional" description="To test that only one instance of a application exist" timeout="120" level="System">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_005_one_instance</step>
</case>
<!-- Enable this test for art once the credientials are stable-->
<!--case name="creds-test" type="Functional" description="Test that launched applications get correct credentials when they provide Aegis files" timeout="120" level="System">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_006_creds</step>
</case-->
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
<set name="Prestart-launched" description="To test that prestarted application is launched" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="Prestart-launched" type="Functional" description="To test that prestarted application is launched" timeout="120" level="System">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/ts_prestartapp.rb --name test_launch_prestarted_app</step>
</case>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
</suite>
</testdefinition>

@ -0,0 +1,2 @@
install(FILES tests.xml DESTINATION /usr/share/applauncherd-bug-tests)

@ -0,0 +1,61 @@
<?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="applauncherd-bug-tests" domain="Application framework">
<set name="applauncherd-bug-tests" description="Launcher functional tests" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="no-aegis-test" type="Functional" description="Check that an application that doesn't have aegis file doesn't get any funny credentials." timeout="120" level="System" insignificant="true" >
<step expected_result="0">`pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_007_no_aegis_Bug170905</step>
</case>
<case name="invoker-creds" type="Functional" description="Test that launcher and invoker have correct credentials" timeout="120" level="System" insignificant="true">
<step expected_result="0">`pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_008_invoker_creds</step>
</case>
<case name="launch-multi-app-cont" type="Functional" description="Test that launcher and invoker have correct credentials" timeout="120" level="System" insignificant="true">
<step expected_result="0">`pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_009_launch_multiple_apps_cont</step>
</case>
<case name="creds-test" type="Functional" description="Test that launched applications get correct credentials when they provide Aegis files" timeout="120" level="System" insignificant="true">
<step expected_result="0">`pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_006_creds</step>
</case>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
<set name="Theme-tests" description="Test that global and application specific theming work with launched apps" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="app-specific" type="Functional" description="Application specific theming tests" timeout="120" level="System" insignificant="true">
<step expected_result="0">/usr/share/applauncherd-testscripts/tc_theming.rb --name test_application_specific_theming</step>
</case>
<case name="global-theming" type="Functional" description="Tests that global theming changes affect launched applications" timeout="120" level="System" insignificant="true">
<step expected_result="0">/usr/share/applauncherd-testscripts/tc_theming.rb --name test_global_theming</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
</suite>
</testdefinition>

@ -0,0 +1,2 @@
install(FILES tests.xml DESTINATION /usr/share/applauncherd-functional-tests)

@ -0,0 +1,78 @@
<?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="applauncherd-functional-tests" domain="Application framework">
<set name="applauncherd-functional-tests" description="Launcher functional tests" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="launcher-exist" type="Functional" description="To test if the launcher exists and is executable or not" timeout="120" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_001_launcher_exist</step>
</case>
<case name="launchable-app-exist" type="Functional" description="test_launchable_application_exists " timeout="120" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_002_applications_exist</step>
</case>
<case name="zombie-state" type="Functional" description="To test that process exits after the application is killed" timeout="120" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_003_zombie_state</step>
</case>
<case name="launch-multi-app" type="Functional" description="To test that more than one applications are launched by the launcher" timeout="120" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_004_launch_multiple_apps</step>
</case>
<case name="one-instance" type="Functional" description="To test that only one instance of a application exist" timeout="120" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_005_one_instance</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
<set name="Security" description="Tests that have something to do with the security platform" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="creds-test" type="Functional" description="Test that launched applications get correct credentials when they provide Aegis files" timeout="120" level="System" insignificant="true">
<step expected_result="0">source /tmp/session_bus_address.user; `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_006_creds</step>
</case>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
</environments>
</set>
<set name="Prestart-launched" description="To test that prestarted application is launched" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="Prestart-launched" type="Functional" description="To test that prestarted application is launched" timeout="120" level="System">
<step expected_result="0">source /tmp/session_bus_address.user; /usr/share/applauncherd-testscripts/ts_prestartapp.rb --name test_launch_prestarted_app</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
</suite>
</testdefinition>

@ -0,0 +1 @@
install(FILES tests.xml DESTINATION /usr/share/applauncherd-performance-tests/)

@ -0,0 +1,31 @@
<?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="applauncherd-performance-tests" domain="Application framework">
<set name="applauncherd-performance-tests" description="applauncherd performance tests for Meego touch applications" feature="AF DUI Booster for Launcher daemon" requirement="300195">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps>
<case name="launcher1" type="Performance" description="Measure launcher performance" timeout="240" level="System">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-perf-mbooster.py test_001 &gt; /tmp/launcher_perf.txt</step>
</case>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
</environments>
<get>
<file>/tmp/launcher_perf.txt</file>
<file>/tmp/testapp.log</file>
</get>
</set>
</suite>
</testdefinition>

@ -0,0 +1,8 @@
add_subdirectory(ut_daemon)
add_subdirectory(ut_booster)
add_subdirectory(ut_mbooster)
add_subdirectory(ut_qtbooster)
add_subdirectory(ut_connection)
install(FILES tests.xml DESTINATION /usr/share/applauncherd-tests)

@ -0,0 +1,81 @@
<?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="applauncherd-tests" domain="Application framework">
<set name="launcher-tests" description="Basic launcher unit tests" feature="AF Basic Launcher daemon support" requirement="300168" >
<pre_steps>
<step>export DISPLAY=:0</step>
<step>source /tmp/session_bus_address.user</step>
<!-- step>other pre steps</step -->
</pre_steps>
<case name="Daemon" type="Functional" description="Unit tests for Daemon class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_daemon</step>
</case>
<case name="Connection" type="Functional" description="Unit tests for Connection class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_connection</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
<set name="mbooster-tests" description="MBooster unit tests" feature="AF MBooster for Launcher daemon" requirement="300195" >
<pre_steps>
<step>export DISPLAY=:0</step>
<step>source /tmp/session_bus_address.user</step>
<!-- step>other pre steps</step -->
</pre_steps>
<case name="MBooster" type="Functional" description="Unit tests for MBooster class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_mbooster</step>
</case>
<case name="Booster" type="Functional" description="Unit tests for Booster class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_booster</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
<set name="qtbooster-tests" description="QtBooster unit tests" feature="AF Launcher daemon support for Plain Qt applications" requirement="421032" >
<pre_steps>
<step>export DISPLAY=:0</step>
<step>source /tmp/session_bus_address.user</step>
<!-- step>other pre steps</step -->
</pre_steps>
<case name="QtBooster" type="Functional" description="Unit tests for QtBooster class" level="Component" timeout="20">
<step expected_result="0">/usr/share/applauncherd-tests/ut_qtbooster</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
<!--get>
</get-->
</set>
</suite>
</testdefinition>

@ -0,0 +1,27 @@
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcher)
# Set sources
set(SRC ut_booster.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp ${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp)
# Set moc headers
set(MOC_HDRS ut_booster.h)
# Run moc
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
# Enable test library
set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBCREDS})
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})
add_executable(ut_booster ${SRC} ${MOC_SRC})
# Install
install(PROGRAMS ut_booster DESTINATION /usr/share/applauncherd-tests/)

@ -0,0 +1,265 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "ut_booster.h"
#include "booster.h"
// Booster is an abstract base-class, so let's inherit it
class MyBooster : public Booster
{
public:
MyBooster();
char boosterType() const;
const std::string & socketId() const;
private:
const string m_socketId;
};
MyBooster::MyBooster() :
m_socketId("/tmp/MyBooster")
{}
char MyBooster::boosterType() const
{
return 'm';
}
const std::string & MyBooster::socketId() const
{
return m_socketId;
}
Ut_Booster::Ut_Booster()
{}
Ut_Booster::~Ut_Booster()
{}
void Ut_Booster::initTestCase()
{}
void Ut_Booster::cleanupTestCase()
{}
char ** Ut_Booster::packTwoArgs(const char * arg0, const char * arg1)
{
char ** argv = new char * [2];
char * result = new char[strlen(arg0) + strlen(arg1) + 2];
memset(result, '\0', strlen(arg0) + strlen(arg1) + 2);
strcat(result, arg0);
strcat(result, " ");
strcat(result, arg1);
// Arguments are allocated consecutively in Linux
argv[0] = result;
argv[1] = argv[0] + strlen(arg0) + 1;
argv[0][strlen(arg0)] = '\0';
return argv;
}
void Ut_Booster::testRenameBoosterProcess()
{
m_subject.reset(new MyBooster);
// if m_app.appName isn't initialized, new process name is booster_x
// 20 chars dummy buffer used to fool ps to show correct process name with args
const int INIT_ARGS = 2;
char ** initialArgv = packTwoArgs("oldName", " ");
m_subject->renameProcess(INIT_ARGS, const_cast<char **>(initialArgv));
// New name and arguments fit and are correct
QVERIFY(strcmp(initialArgv[0], "booster-m") == 0);
// Define and copy args because it's assumed that they are allocated in the heap
// (AppData deletes the argv on exit)
const int ARGS = 3;
m_subject->m_app.setArgc(ARGS);
char ** argv = new char * [ARGS];
argv[0] = strdup("newName");
argv[1] = strdup("--foo");
argv[2] = strdup("--bar");
m_subject->m_app.setArgv(const_cast<const char **>(argv));
m_subject->m_app.setAppName("newName");
m_subject->renameProcess(INIT_ARGS, const_cast<char **>(initialArgv));
// New name and arguments fit and are correct
QVERIFY2(strcmp(initialArgv[0], "newName --foo --bar") == 0, initialArgv[0]);
delete initialArgv[0];
delete [] initialArgv;
}
void Ut_Booster::testRenameProcess()
{
m_subject.reset(new MyBooster);
// Define and copy args because it's assumed that they are allocated in the heap
// (AppData deletes the argv on exit)
const int ARGS = 3;
m_subject->m_app.setArgc(ARGS);
char ** argv = new char * [ARGS];
argv[0] = strdup("newName");
argv[1] = strdup("--foo");
argv[2] = strdup("--bar");
m_subject->m_app.setArgv(const_cast<const char **>(argv));
m_subject->m_app.setAppName(m_subject->m_app.argv()[0]);
// 20 chars dummy buffer used to fool ps to show correct process name with args
const int INIT_ARGS = 2;
char ** initialArgv = packTwoArgs("oldName", " ");
m_subject->renameProcess(INIT_ARGS, const_cast<char **>(initialArgv));
// New name and arguments fit and are correct
QVERIFY(strcmp(initialArgv[0], "newName --foo --bar") == 0);
delete initialArgv[0];
delete [] initialArgv;
}
void Ut_Booster::testRenameProcessNotEnoughSpace()
{
m_subject.reset(new MyBooster);
const int ARGS = 3;
m_subject->m_app.setArgc(ARGS);
char ** argv = new char * [ARGS];
argv[0] = strdup("newNameLong");
argv[1] = strdup("--foo");
argv[2] = strdup("--bar");
m_subject->m_app.setArgv(const_cast<const char **>(argv));
m_subject->m_app.setAppName(m_subject->m_app.argv()[0]);
const int INIT_ARGS = 2;
char ** initialArgv = packTwoArgs("oldName", " ");
int initLen = strlen(initialArgv[0]);
m_subject->renameProcess(INIT_ARGS, initialArgv);
// Not enough space for the new name nor the arguments:
// name should be cut
QVERIFY(strncmp(initialArgv[0], m_subject->m_app.argv()[0], initLen - 1) == 0);
delete [] initialArgv[0];
delete [] initialArgv;
}
void Ut_Booster::testRenameProcessNotEnoughSpace2()
{
m_subject.reset(new MyBooster);
const int ARGS = 3;
m_subject->m_app.setArgc(ARGS);
char ** argv = new char * [ARGS];
argv[0] = strdup("newName");
argv[1] = strdup("--foo");
argv[2] = strdup("--bar");
m_subject->m_app.setArgv(const_cast<const char **>(argv));
m_subject->m_app.setAppName(m_subject->m_app.argv()[0]);
const int INIT_ARGS = 2;
char ** initialArgv = packTwoArgs("oldName", " ");
m_subject->renameProcess(INIT_ARGS, initialArgv);
// Not enough space for the second argument:
// second argument should be left out
QVERIFY(strcmp(initialArgv[0], "newName --foo") == 0);
delete initialArgv[0];
delete [] initialArgv;
}
void Ut_Booster::testRenameProcessNotEnoughSpace3()
{
m_subject.reset(new MyBooster);
const int ARGS = 3;
m_subject->m_app.setArgc(ARGS);
char ** argv = new char * [ARGS];
argv[0] = strdup("newName");
argv[1] = strdup("--foo");
argv[2] = strdup("--bar");
m_subject->m_app.setArgv(const_cast<const char **>(argv));
m_subject->m_app.setAppName(m_subject->m_app.argv()[0]);
const int INIT_ARGS = 2;
char ** initialArgv = packTwoArgs("app", " ");
m_subject->renameProcess(INIT_ARGS, initialArgv);
// Not enough space for arguments but just enough space
// for the new name
QVERIFY(strcmp(initialArgv[0], "newName") == 0);
delete initialArgv[0];
delete [] initialArgv;
}
void Ut_Booster::testRenameProcessNotEnoughSpace4()
{
m_subject.reset(new MyBooster);
const int ARGS = 3;
m_subject->m_app.setArgc(ARGS);
char ** argv = new char * [ARGS];
argv[0] = strdup("newNameLongLong");
argv[1] = strdup("--foo");
argv[2] = strdup("--bar");
m_subject->m_app.setArgv(const_cast<const char **>(argv));
m_subject->m_app.setAppName(m_subject->m_app.argv()[0]);
const int INIT_ARGS = 2;
char ** initialArgv = packTwoArgs("app", " ");
m_subject->renameProcess(INIT_ARGS, initialArgv);
// Not enough space for newName, but dummy space exist: should be cut
QVERIFY(strcmp(initialArgv[0], "newName") == 0);
delete initialArgv[0];
delete [] initialArgv;
}
void Ut_Booster::testRenameProcessNoArgs()
{
m_subject.reset(new MyBooster);
const int ARGS = 2;
m_subject->m_app.setArgc(ARGS);
char ** argv = new char * [ARGS];
argv[0] = strdup("newName");
argv[1] = strdup("--foo");
m_subject->m_app.setArgv(const_cast<const char **>(argv));
m_subject->m_app.setAppName(m_subject->m_app.argv()[0]);
const int INIT_ARGS = 1;
char ** initialArgv = new char * [INIT_ARGS];
initialArgv[0] = strdup("oldName");
m_subject->renameProcess(INIT_ARGS, initialArgv);
// No dummy space argument at all, only name fits
QVERIFY(strcmp(initialArgv[0], m_subject->m_app.argv()[0]) == 0);
delete initialArgv[0];
delete [] initialArgv;
}
QTEST_APPLESS_MAIN(Ut_Booster);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save