Fixes: NB#299083 - apps started via invoker --type m retain applauncher's privileges on D-Bus

RevBy: Alexey Shilov
pull/1/head
Dmitry Rozenshtein 14 years ago
parent e72c3a3a31
commit c99cc0b7ea

@ -22,6 +22,7 @@ usr/bin/fala_focus
usr/bin/fala_multi-window
usr/bin/fala_windowless
usr/bin/fala_multi-window
usr/bin/fala_dbus
usr/bin/xsendevent
usr/share/dbus-1/services/com.nokia.fala_testapp.service
usr/share/dbus-1/services/com.nokia.fala_wl.service

3
debian/changelog vendored

@ -4,8 +4,9 @@ applauncherd (3.0.2) stable; urgency=low
* disabling xsession/crash-reporter-daemon in performance test (probably breaks test at random cases)
* Changes: Fixes test test_invoker_signal_forward (extra warnings has appeared in test application)
* Fixes: NB#296154 - reopened - proprietary headers to LGPL
* Fixes: NB#299083 - apps started via invoker --type m retain applauncher's privileges on D-Bus
-- Marek Ruszczak <ext-marek.ruszczak@nokia.com> Thu, 23 Feb 2012 16:13:38 +0200
-- Dmitry Rozenshtein <ext-dmitry.2.rozenshtein@nokia.com> Wed, 20 Mar 2012 16:55:21 +0200
applauncherd (3.0.1) stable; urgency=low

@ -31,5 +31,8 @@ void invoke_send_str(int fd, char *str);
#define INVOKER_QT_SOCK "/tmp/boostq"
#define INVOKER_QDECL_SOCK "/tmp/boostd"
#define INVOKER_EXEC_SOCK "/tmp/booste"
// Existence of the test mode control file is checked
// to enable test mode.
#define TEST_MODE_CONTROL_FILE "/root/.itm"
#endif

@ -48,6 +48,8 @@
#include <sys/creds.h>
#endif
#include "whitelist.h"
// Delay before exit.
static const unsigned int EXIT_DELAY = 0;
static const unsigned int MIN_EXIT_DELAY = 1;
@ -473,6 +475,7 @@ static void usage(int status)
" in case the device is in landscape orientation.\n"
" -o, --daemon-mode Notify invoker that the launched process is a daemon.\n"
" This resets the oom_adj of the process.\n"
" -T, --test-mode Invoker test mode. Also control file in root home should be in place.\n"
" -h, --help Print this help.\n\n"
"Example: %s --type=m /usr/bin/helloworld\n\n",
PROG_NAME_INVOKER, PROG_NAME_LAUNCHER, EXIT_DELAY, RESPAWN_DELAY, MAX_RESPAWN_DELAY, PROG_NAME_INVOKER);
@ -653,15 +656,53 @@ static void invoke_fallback(char **prog_argv, char *prog_name, bool wait_term)
exit(EXIT_FAILURE);
}
//Check if application (MeeGo Touch) is allowed to be boosted
static bool is_application_whitelisted(const char *const prog_name)
{
bool result = false;
if (prog_name == 0)
{
return result;
}
unsigned int list_size = sizeof(app_whitelist) / sizeof(char *);
unsigned int i;
for (i = 0; i < list_size; i++)
{
const char * app = app_whitelist[i];
if (strcmp(app, prog_name) == 0)
{
result = true;
break;
}
}
return result;
}
// Invokes the given application
static int invoke(int prog_argc, char **prog_argv, char *prog_name,
enum APP_TYPE app_type, uint32_t magic_options, bool wait_term, unsigned int respawn_delay,
char *splash_file, char *landscape_splash_file)
char *splash_file, char *landscape_splash_file, bool test_mode)
{
int status = 0;
if (prog_name && prog_argv)
{
//If TEST_MODE_CONTROL_FILE doesn't exists switch off test mode
if (test_mode && access(TEST_MODE_CONTROL_FILE, F_OK) != 0)
{
test_mode = false;
info("Invoker test mode is not enabled.\n");
}
// This is a check if MeeGo Touch application is not allowed to be boosted
if (app_type == M_APP && !test_mode && !is_application_whitelisted(prog_name))
{
info("Application '%s' is not allowed to use booster '--type=m', '--type=q' will be used instead.\n", prog_name);
app_type = QT_APP;
}
// This is a fallback if connection with the launcher
// process is broken
int fd = invoker_init(app_type);
@ -695,6 +736,7 @@ int main(int argc, char *argv[])
char *splash_file = NULL;
char *landscape_splash_file = NULL;
struct stat file_stat;
bool test_mode = false;
// wait-term parameter by default
magic_options |= INVOKER_MSG_MAGIC_OPTION_WAIT;
@ -720,6 +762,7 @@ int main(int argc, char *argv[])
{"deep-syms", no_argument, NULL, 'D'},
{"single-instance", no_argument, NULL, 's'},
{"daemon-mode", no_argument, NULL, 'o'},
{"test-mode", no_argument, NULL, 'T'},
{"type", required_argument, NULL, 't'},
{"delay", required_argument, NULL, 'd'},
{"respawn", required_argument, NULL, 'r'},
@ -731,7 +774,7 @@ int main(int argc, char *argv[])
// Parse options
// TODO: Move to a function
int opt;
while ((opt = getopt_long(argc, argv, "hcwnGDsod:t:r:S:L:", longopts, NULL)) != -1)
while ((opt = getopt_long(argc, argv, "hcwnGDsoTd:t:r:S:L:", longopts, NULL)) != -1)
{
switch(opt)
{
@ -764,6 +807,10 @@ int main(int argc, char *argv[])
magic_options |= INVOKER_MSG_MAGIC_OPTION_DLOPEN_DEEP;
break;
case 'T':
test_mode = true;
break;
case 't':
if (strcmp(optarg, "m") == 0)
app_type = M_APP;
@ -853,7 +900,7 @@ int main(int argc, char *argv[])
// Send commands to the launcher daemon
info("Invoking execution: '%s'\n", prog_name);
int ret_val = invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term, respawn_delay, splash_file, landscape_splash_file);
int ret_val = invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term, respawn_delay, splash_file, landscape_splash_file, test_mode);
// Sleep for delay before exiting
if (delay)

@ -0,0 +1,49 @@
/***************************************************************************
**
** Copyright (C) 2012 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 WHITELIST_H
#define WHITELIST_H
const char * const app_whitelist[] =
{
"/usr/bin/conndlgs",
"/usr/bin/call-ui",
"/usr/bin/accounts-ui",
"/usr/bin/grob",
"/usr/bin/calc",
"/usr/bin/organiser",
"/usr/bin/call-history",
"/usr/bin/camera-ui",
"/usr/bin/contacts",
"/usr/bin/duicontrolpanel.launch",
"/usr/bin/gallery",
"/usr/bin/fenix",
"/usr/bin/mediaviewer",
"/usr/bin/messaging-ui",
"/usr/bin/music-suite",
"/usr/bin/notes",
"/usr/bin/office-tools",
"/usr/bin/search",
"/usr/bin/sync-ui",
"/usr/bin/userguide",
"/usr/bin/video-suite",
"/usr/bin/videosheetplayer"
};
#endif // WHITELIST_H

@ -550,10 +550,6 @@ int Booster::launchProcess()
if (!m_bootMode)
preinit();
// make booster specific initializations unless booster is in boot mode
if (!m_bootMode)
preinit();
#ifdef WITH_COVERAGE
__gcov_flush();
#endif

@ -97,3 +97,6 @@ add_subdirectory(common/testapps/fala_multiwindow)
# Sub build: common/testapps/fala_windowless
add_subdirectory(common/testapps/fala_windowless)
# Sub build: common/testapps/fala_dbus
add_subdirectory(common/testapps/fala_dbus)

@ -0,0 +1,35 @@
# Set sources
set(SRC fala_dbus.cpp)
link_libraries(${MEEGOTOUCH_LIBRARIES})
include(${QT_USE_FILE})
SET (QT_USE_QTDBUS true)
INCLUDE_DIRECTORIES(${QT_QTDBUS_INCLUDE_DIR})
# Use the compiler and linker flags given in meegotouch-boostable.pc
# in the source tree.
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config"
"--cflags"
"meegotouch-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_cflags
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config" "--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(fala_dbus ${SRC})
# Install
install(PROGRAMS fala_dbus DESTINATION /usr/bin/ )

@ -0,0 +1,50 @@
/***************************************************************************
**
** Copyright (C) 2012 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 <QDBusConnection>
#include <QDBusMessage>
#include <QString>
#include <syslog.h>
#include <iostream>
#include <MExport>
#ifdef HAVE_MCOMPONENTCACHE
#include <mcomponentcache.h>
#endif
M_EXPORT int main(int argc, char ** argv)
{
#ifdef HAVE_MCOMPONENTCACHE
MApplication *app = MComponentCache::mApplication(argc, argv);
#else
MApplication *app = new MApplication(argc, argv);
#endif
Q_UNUSED(app);
QDBusConnection bus = QDBusConnection::systemBus();
QDBusMessage msg = QDBusMessage::createMethodCall("com.nokia.dsme", "/com/nokia/dsme/request", "com.nokia.dsme.request", "req_powerup");
QDBusMessage reply = bus.call(msg,QDBus::AutoDetect, 5);
QString dbusReplyError = reply.errorName();
openlog ("qfala_dbus", LOG_NDELAY | LOG_PID | LOG_PERROR, LOG_DAEMON);
syslog (LOG_DAEMON | LOG_NOTICE, "fala_dbus connection error: '%s'", dbusReplyError.toLocal8Bit().data());
closelog();
std::cerr << "fala_dbus connection error:" << dbusReplyError.toLocal8Bit().data() << "\n";
_exit(0);
}

@ -5,7 +5,7 @@ Multiwindow test application.
Command to launch application
invoker --type=m /usr/bin/fala_multi-window [-window-not-from-cache]
invoker --test-mode --type=m /usr/bin/fala_multi-window [-window-not-from-cache]
Application can be started with the switch "-output-level debug" to get information what happens inside it.

@ -2,6 +2,6 @@
Type=Application
Name=fala_wl
Icon=icon-l-video
Exec=/usr/bin/invoker --type=m /usr/bin/fala_wl
Exec=/usr/bin/invoker --test-mode --type=m /usr/bin/fala_wl
Categories=X-MeeGo;X-Demos;
OnlyShowIn=X-MeeGo;

@ -8,12 +8,17 @@
<set name="TC_APPS" description="functional tests for apps dependent on applauncherd" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_no_aegis_invoker_creds" type="Functional" description="Test that no extra credentials are passed to invoker" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-security.py test_no_aegis_invoker_creds </step>
</case>
<post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>

@ -8,6 +8,7 @@
<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>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_launch_multiple_apps_m" type="Functional" description="To test that more than one applications are launched by the launcher" timeout="360" level="System">
@ -38,6 +39,10 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_unix_signal_handlers</step>
</case>
<post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>

@ -10,6 +10,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_launcher_exist" type="Functional" description="To test if the launcher exists and is executable or not" timeout="360" level="System" insignificant="false">
@ -41,6 +42,7 @@
</case>
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
@ -52,6 +54,7 @@
<set name="TC_Bootmode" description="functional tests for boot mode" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_change_to_normal_mode" type="Functional" description="To test change from boot mode to normal mode" timeout="360" level="System" insignificant="false">
@ -73,6 +76,10 @@
<case name="applauncherd__test_SIGUSR2_AFTER_SIGUSR1" type="Functional" description="Test for SIGUSR2 after SIGUSR1" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-boot-mode.py test_SIGUSR2_AFTER_SIGUSR1 </step>
</case>
<post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>

@ -8,6 +8,7 @@
<set name="TC_GLContext" description="functional tests for glcontext" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_q_booster_dont_have_GL_context" type="Functional" description="Test that q-booster don't have GL context" timeout="100" level="System" insignificant="false">
@ -46,6 +47,10 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_e_boosted_has_glcontext</step>
</case>
<post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
@ -56,6 +61,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_unix_signal_handlers" type="Functional" description="Test unixSignalHAndlers by killing booster-m and booster-d, singnal hup" timeout="360" level="System" insignificant="false">
@ -120,6 +126,7 @@
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
@ -132,6 +139,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_check_applauncherd_sighup_m"
@ -196,6 +204,7 @@
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>
@ -208,6 +217,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_check_applauncherd_sighup_q"
@ -238,6 +248,10 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_detect_booster_q_leaks_file_descriptor_when_invoker_is_using_app_directly</step>
</case>
<post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
@ -249,6 +263,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_check_applauncherd_sighup_d"
@ -309,6 +324,7 @@
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
@ -323,6 +339,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_check_applauncherd_sighup_e"
@ -362,6 +379,7 @@
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>
@ -374,6 +392,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_no_aegis" type="Functional" description="Check that an application that doesn't have aegis file doesn't get any funny credentials." timeout="360" level="System" insignificant="false" >
@ -394,6 +413,7 @@
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
@ -405,6 +425,7 @@
<set name="TC_Splash" description="functional tests for splash" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_splash" type="Functional" description="To test --splash functionality" timeout="360" level="System" insignificant="false">
@ -419,6 +440,10 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/tc_splash.rb --name test_no_splash</step>
</case>
<post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
@ -432,6 +457,7 @@
requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_stress_boosted_apps"
@ -442,6 +468,11 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_stress_boosted_apps</step>
</case>
<post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
@ -453,6 +484,7 @@
<step>initctl stop xsession/pkgm-timed-checks</step>
<step>rm /var/lib/dpkg/lock</step>
<step>dpkg --configure -a</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_that_other_apps_dont_gain_new_token_on_update"
@ -481,6 +513,7 @@
<post_steps>
<step>initctl start xsession/pkgm-timed-checks</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>

@ -9,6 +9,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_oom_adj_minus_two" type="Functional" description="Test that oom.adj is -1 for launched application process when using invokers -o parameter" timeout="360" level="System" insignificant="false">
@ -95,8 +96,18 @@
<case name="applauncherd__test_invoker_applauncherd_dies" type="Functional" description="test invoker kills app if applauncherd dies" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-invoker.py test_invoker_applauncherd_dies</step>
</case>
<case name="applauncherd__test_invoker_dbus_security" type="Functional" description="Test that invoker doesn't allow not-privileged application to re-use restricted d-bus connection opened by m-booster" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-invoker.py test_invoker_dbus_security</step>
</case>
<case name="applauncherd__test_invoker_test_mode" type="Functional" description="Test that invoker test mode is disabled if test mode control file doesn't exist." timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-invoker.py test_invoker_test_mode</step>
</case>
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
@ -111,6 +122,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_single_instance_window_raise_wo_invoker" type="Functional" description="Test basic single instance functionality and window raising" timeout="360" level="System" insignificant="false">
@ -130,6 +142,7 @@
</case>
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>
@ -142,6 +155,7 @@
<pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_single_instance_window_raise_w_invoker" type="Functional" description="Test basic single instance functionality and window raising" timeout="360" level="System" insignificant="false">
@ -165,6 +179,7 @@
</case>
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>

@ -10,10 +10,11 @@
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_applifed</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>initctl stop xsession/crash-reporter-daemon</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="Perf-Test-Command-launcher" type="Performance" description="Measure startup time of the application using launcher" timeout="500" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -c "invoker --type=m /usr/bin/fala_wl" -b "fala_wl" -s 600 -t 50 -w 10 -f "/tmp/fala_wl.log" &gt; /tmp/perf_commandline_with_launcher.txt</step>
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 /usr/share/applauncherd-testscripts/test-perf.rb name test_performance -- -c "invoker --test-mode --type=m /usr/bin/fala_wl" -b "fala_wl" -s 600 -t 50 -w 10 -f "/tmp/fala_wl.log" &gt; /tmp/perf_commandline_with_launcher.txt</step>
</case>
<post_steps>
@ -22,7 +23,8 @@
<!-- starting applifed commented as it is started in the next set's post-step
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_applifed</step>
-->
</post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>
@ -43,6 +45,7 @@
-->
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>initctl stop xsession/crash-reporter-daemon</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="Perf-Test-Grid-launcher" type="Performance" description="Measure startup time of the application using launcher" timeout="840" level="System" insignificant="false">
@ -53,6 +56,7 @@
<step>initctl start xsession/crash-reporter-daemon</step>
<step>cp /tmp/fala_wl.log /tmp/grid_fala_wl.log</step>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_applifed</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>

@ -8,6 +8,7 @@
<set name="TC_GLContext" description="functional tests for glcontext" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_m_booster_dont_have_GL_context"
@ -28,6 +29,10 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_m_boosted_has_glcontext</step>
</case>
<post_steps>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>
@ -39,6 +44,7 @@
<step>initctl stop xsession/pkgm-timed-checks</step>
<step>rm /var/lib/dpkg/lock</step>
<step>dpkg --configure -a</step>
<step>touch /root/.itm</step> <!--Enable test mode for invoker -->
</pre_steps>
<case name="applauncherd__test_installation_of_new_token_when_deamon_is_disabled"
type="Functional"
@ -50,6 +56,7 @@
</case>
<post_steps>
<step>initctl start xsession/pkgm-timed-checks</step>
<step>rm -f /root/.itm</step> <!--Disable test mode for invoker -->
</post_steps>
<environments>
<scratchbox>false</scratchbox>

@ -130,7 +130,7 @@ class launcher_perf_tests (unittest.TestCase):
os.system('rm %s' %LOG_FILE)
self.start_timer()
os.system('invoker --type=m --no-wait %s' %TESTAPP)
os.system('invoker --test-mode --type=m --no-wait %s' %TESTAPP)
debug("app", TESTAPP, "started with launcher")
time.sleep(5)
self.read_log()
@ -146,7 +146,7 @@ class launcher_perf_tests (unittest.TestCase):
os.system('pkill -STOP duihome')
os.system('pkill -STOP meegotouchhome')
self.start_timer()
os.system('invoker --type=m --no-wait %s' %TESTAPP)
os.system('invoker --test-mode --type=m --no-wait %s' %TESTAPP)
debug("app", TESTAPP, "started with launcher")
time.sleep(5)
os.system('pkill -CONT duihome')

@ -63,7 +63,7 @@ class TC_PRESTARTLAUNCHTESTS < Test::Unit::TestCase
system "pgrep #{@appname}"}
#Prestart application using invoker
system("su - user -c '/usr/bin/invoker --type=m --no-wait #{@appname} -prestart'&")
system("su - user -c '/usr/bin/invoker --type=m --test-mode --no-wait #{@appname} -prestart'&")
sleep(2)
#verify that the application is prestarted and it has a valid pid
@ -78,7 +78,7 @@ class TC_PRESTARTLAUNCHTESTS < Test::Unit::TestCase
verify_equal("",2,"Application was Launched"){@switcher}
#Now Launch the prestarted application
system("su - user -c '/usr/bin/invoker --type=m --no-wait #{@appname}'")
system("su - user -c '/usr/bin/invoker --type=m --test-mode --no-wait #{@appname}'")
sleep(2)
#verify that Window state of applications is Normal as the application is launhced

@ -7,7 +7,7 @@ import commands
os.system("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_m.sh &")
time.sleep(2)
st, op = commands.getstatusoutput("pgrep -lf 'invoker --type=m --wait-term /usr/bin/fala_ft_hello'")
st, op = commands.getstatusoutput("pgrep -lf 'invoker --test-mode --type=m --wait-term /usr/bin/fala_ft_hello'")
op = op.split("\n")[0].split(" ")[0]
#Killing application with a signal 11 (Segmentation Fault)

@ -1,3 +1,3 @@
#!/bin/sh
invoker --type=m --wait-term /usr/bin/fala_ft_hello
invoker --test-mode --type=m --wait-term /usr/bin/fala_ft_hello

@ -98,7 +98,7 @@ class TC_Splash < Test::Unit::TestCase
To Test that splash parameters are set when application is launched
using --splash
"""
system "invoker --splash #{PortraitImg} --type=m #{TestApp} &"
system "invoker --splash #{PortraitImg} --test-mode --type=m #{TestApp} &"
sleep(2)
p = wait_for_app(TestApp)
@ -127,7 +127,7 @@ class TC_Splash < Test::Unit::TestCase
To Test that splash-landscape parameters are set when application is launched
using --splash-landscape
"""
system "invoker --splash #{PortraitImg} --splash-landscape #{LandscapeImg} --type=m #{TestApp} &"
system "invoker --splash #{PortraitImg} --splash-landscape #{LandscapeImg} --test-mode --type=m #{TestApp} &"
sleep(2)
p = wait_for_app(TestApp)
@ -156,11 +156,11 @@ class TC_Splash < Test::Unit::TestCase
To Test that splash parameters remains the same even if application is
launched without using splash
"""
system "invoker --splash #{PortraitImg} --splash-landscape #{LandscapeImg} --type=m #{TestApp} &"
system "invoker --splash #{PortraitImg} --splash-landscape #{LandscapeImg} --test-mode --type=m #{TestApp} &"
p = wait_for_app(TestApp)
system "kill -15 #{p}"
sleep(2)
system "invoker --type=m #{No_Splash_App} &"
system "invoker --test-mode --type=m #{No_Splash_App} &"
pid = wait_for_app(No_Splash_App)
w = get_compositor_wid

@ -125,7 +125,7 @@ class BootModeTests(CustomTestCase):
def launch_apps(self, n = 6, btype = 'm'):
# check that launching works and the apps are there
for i in range(n):
run_cmd_as_user('/usr/bin/invoker -n -r 2 --type=%s fala_multi-instance %d' % (btype, i))
run_cmd_as_user('/usr/bin/invoker --test-mode -n -r 2 --type=%s fala_multi-instance %d' % (btype, i))
time.sleep(4)
# give the applications time to really start

@ -157,7 +157,7 @@ class DaemonTests(unittest.TestCase):
#launch application using booster
debug("launch fala_wl using booster")
status = os.system('invoker --type=m /usr/bin/fala_wl &')
status = os.system('invoker --test-mode --type=m /usr/bin/fala_wl &')
#get fd of booster after launching the application
debug("get fd of booster after launching the application")
@ -196,12 +196,12 @@ class DaemonTests(unittest.TestCase):
Test that Booster gives warning while trying to launch non launchable applications
Here fala_wid is a shell script and libebooster.so is a library
"""
st, op = commands.getstatusoutput("/usr/bin/invoker --type=m /usr/bin/fala_wid")
st, op = commands.getstatusoutput("/usr/bin/invoker --test-mode --type=m /usr/bin/fala_wid")
debug("The Warning is %s" %(op.split("\n")[0]))
pos = op.split("\n")[0].find("Booster: Loading invoked application failed:")
self.assert_(pos != -1, "The booster did not give warning")
st, op = commands.getstatusoutput("/usr/bin/invoker --type=m /usr/lib/applauncherd/libebooster.so")
st, op = commands.getstatusoutput("/usr/bin/invoker --test-mode --type=m /usr/lib/applauncherd/libebooster.so")
debug("The Warning is %s" %(op.split("\n")[0]))
pos = op.split("\n")[0].find("Booster: Loading symbol 'main' failed:")
self.assert_(pos != -1, "The booster did not give warning")
@ -252,7 +252,7 @@ class DaemonTests(unittest.TestCase):
launcher_pid = wait_for_single_applauncherd
mbooster_pid = wait_for_app("booster-m")
cmd = '/usr/bin/invoker --type=m /usr/bin/fala_exit'
cmd = '/usr/bin/invoker --test-mode --type=m /usr/bin/fala_exit'
st, op = commands.getstatusoutput(cmd)
time.sleep(5)
self.assert_(st == 0, "The application did not exit clean")

@ -347,7 +347,7 @@ class launcher_tests (CustomTestCase):
#launch application using booster
debug("launch %s using booster" % app_name)
st = os.system('invoker --type=%s --no-wait %s' % (btype, app_name))
st = os.system('invoker --test-mode --type=%s --no-wait %s' % (btype, app_name))
self.assert_(st == 0, "failed to start %s,%s" % (app_name,st))
# wait for new booster and app to start
@ -477,7 +477,7 @@ class launcher_tests (CustomTestCase):
for bType in ('m', 'd', 'e', 'q') :
#Launching application with booster-m
bpid = wait_for_app('booster-%s' %bType, timeout = 10)
p = run_app_as_user_with_invoker(bType!='d' and PREFERED_APP or PREFERED_APP_QML, booster = bType, arg = '--no-wait')
p = run_app_as_user_with_invoker(bType!='d' and PREFERED_APP or PREFERED_APP_QML, booster = bType, arg = '--no-wait --test-mode')
app_pid = wait_for_app(bType!='d' and 'fala_ft_hello' or 'fala_qml_helloworld', timeout = 10)
bpid_new = wait_for_app('booster-%s' %bType, timeout = 10)
self.assertNotEqual(app_pid, None, "Application is not running")
@ -511,7 +511,7 @@ class launcher_tests (CustomTestCase):
debug("The value of queue is %d" %count)
return count
invokerCall = 'invoker --type=%s --no-wait %s %s' %(booster_type,
invokerCall = 'invoker --test-mode --type=%s --no-wait %s %s' %(booster_type,
singleInstanceArg and "--single-instance" or "",
app_name)
debug("Starting stress test for boosted application with %s-boster and single-instance switch %s"
@ -561,7 +561,7 @@ class launcher_tests (CustomTestCase):
#For booster-m
for bType in ('m', 'd', 'q', 'e') :
appName = bType != 'd' and 'fala_wl' or 'fala_qml_helloworld'
p = run_cmd_as_user('invoker --type=%s --no-wait %s -faulty' %(bType, appName))
p = run_cmd_as_user('invoker --type=%s --test-mode --no-wait %s -faulty' %(bType, appName))
pid = wait_for_app(appName, timeout = 40)
self.assert_(pid, "Fail to launch '%s' application" %appName)
try :
@ -667,7 +667,7 @@ class launcher_tests (CustomTestCase):
for i in range(2):
debug("Running cycle %s" %i)
cmd = ['su', '-', 'user', '-c']
invoke="export QT_LOAD_TESTABILITY=1; /usr/bin/invoker --type=%s %s" %(btype, testapp)
invoke="export QT_LOAD_TESTABILITY=1; /usr/bin/invoker --test-mode --type=%s %s" %(btype, testapp)
cmd.append(invoke)
p = subprocess.Popen(cmd, shell = False, stdout = DEV_NULL, stderr = DEV_NULL, preexec_fn=permit_sigpipe)
@ -715,7 +715,7 @@ class launcher_tests (CustomTestCase):
os.system("rm %s" % logFileName)
if get_pid(testapp)!= None:
kill_process(testapp)
p = run_cmd_as_user('invoker --type=%s %s/%s' % (btype, path, testapp))
p = run_cmd_as_user('invoker --test-mode --type=%s %s/%s' % (btype, path, testapp))
pid = wait_for_app(testapp)
self.assert_(pid != None, "The application was not launched")
try :
@ -755,7 +755,7 @@ class launcher_tests (CustomTestCase):
os.system("rm %s" % logFileName)
if get_pid(testapp)!= None:
kill_process(testapp)
p = run_cmd_as_user('invoker --type=%s /usr/bin/%s --log-args 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t' % (btype, testapp))
p = run_cmd_as_user('invoker --test-mode --type=%s /usr/bin/%s --log-args 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t' % (btype, testapp))
pid = wait_for_app(testapp)
self.assert_(pid != None, "The application was not launched")
@ -792,7 +792,7 @@ class launcher_tests (CustomTestCase):
os.system("rm %s" % logFileName)
if get_pid(testapp)!= None:
kill_process(testapp)
p = run_cmd_as_user('invoker --type=%s /usr/bin/%s --log-args 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z' % (btype, testapp))
p = run_cmd_as_user('invoker --test-mode --type=%s /usr/bin/%s --log-args 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z' % (btype, testapp))
pid = wait_for_app(testapp)
self.assert_(pid != None, "The application was not launched")
try:
@ -940,7 +940,7 @@ class launcher_tests (CustomTestCase):
def _test_launched_app_wm_class_helper(self,btype,test_application,cmd_arguments,window_name,window_count):
run_command = 'invoker --type=%s --no-wait %s %s' %(btype, test_application, cmd_arguments)
run_command = 'invoker --test-mode --type=%s --no-wait %s %s' %(btype, test_application, cmd_arguments)
p = run_cmd_as_user(run_command)
pid = wait_for_app(test_application)
@ -1005,7 +1005,7 @@ class launcher_tests (CustomTestCase):
self.assert_(not has_GL_context(booster_pid), "booster-%s has GL context!"%btype)
# run app which has GL context
p = run_app_as_user_with_invoker(testapp, booster = btype, arg = '--no-wait')
p = run_app_as_user_with_invoker(testapp, booster = btype, arg = '--test-mode --no-wait')
app_pid = wait_for_app(testapp)
self.assert_(app_pid != None, "Process '%s' is not running"%testapp)
self.assert_(app_pid == booster_pid, "Process '%s' is not a boosted app"%testapp)
@ -1037,7 +1037,7 @@ class launcher_tests (CustomTestCase):
debug("Boster name: %s app name: %s" %(boosterName, testAppName))
# note that application is run by direct invacation not by calling the service
run_command = 'invoker --single-instance --type=%s /usr/bin/%s' %(boosterType, testAppName)
run_command = 'invoker --test-mode --single-instance --type=%s /usr/bin/%s' %(boosterType, testAppName)
p = run_cmd_as_user(run_command)
# wait for first use of booster

@ -186,7 +186,7 @@ class InvokerTests(CustomTestCase):
invokerDelay = 10
# launch an app with invoker --delay n
debug("launching fala_ft_hello ...")
p = Popen(['/usr/bin/invoker', '--delay', str(invokerDelay), '--type=m', '--no-wait',
p = Popen(['/usr/bin/invoker', '--delay', str(invokerDelay), '--type=m', '--test-mode', '--no-wait',
'/usr/bin/fala_ft_hello'],
shell=False,
stdout=DEV_NULL, stderr=DEV_NULL, preexec_fn=permit_sigpipe)
@ -233,7 +233,7 @@ class InvokerTests(CustomTestCase):
#Run application with invoker and get the exit status - booster-m case
debug("Run application with invoker and get the exit status")
st, op = commands.getstatusoutput('invoker --type=m --wait-term /usr/bin/fala_status')
st, op = commands.getstatusoutput('invoker --test-mode --type=m --wait-term /usr/bin/fala_status')
app_st_w_inv = os.WEXITSTATUS(st)
debug("The exit status of app with invoker (booster-m) is : %d" %app_st_w_inv)
@ -267,7 +267,7 @@ class InvokerTests(CustomTestCase):
# launch with relative path
p = run_cmd_as_user('cd /usr/share/; invoker --type=m --no-wait ' +
p = run_cmd_as_user('cd /usr/share/; invoker --test-mode --type=m --no-wait ' +
"../bin/fala_ft_hello")
try:
self.waitForAsertEqual(lambda: p.poll(), 0, "Couldn't launch fala_ft_hello" +
@ -277,7 +277,7 @@ class InvokerTests(CustomTestCase):
kill_process('fala_ft_hello')
# and finally, try to launch something that doesn't exist
p = run_cmd_as_user('invoker --type=m --no-wait spam_cake')
p = run_cmd_as_user('invoker --test-mode --type=m --no-wait spam_cake')
try :
self.waitForAsertEqual(lambda: p.poll(), 1, "spam_cake has been found!")
finally:
@ -301,7 +301,7 @@ class InvokerTests(CustomTestCase):
#get invokers's uid and gid by running the application using invoker in user mode
debug("get invoker's uid and gid by running the application using invoker in user mode")
app = "invoker --type=m --no-wait /usr/bin/fala_status"
app = "invoker --test-mode --type=m --no-wait /usr/bin/fala_status"
st, op = commands.getstatusoutput('su user -c "%s"' %app );
usr_id = op.split('\n')[1]
grp_id = op.split('\n')[2]
@ -330,7 +330,7 @@ class InvokerTests(CustomTestCase):
#get id by running the application using invoker in root mode
debug("get invoker's uid and gid by running the application using invoker in root mode")
app = "invoker --type=m --no-wait /usr/bin/fala_status"
app = "invoker --test-mode --type=m --no-wait /usr/bin/fala_status"
st, op = commands.getstatusoutput("%s" %app );
usr_id = op.split('\n')[1]
grp_id = op.split('\n')[2]
@ -408,14 +408,14 @@ class InvokerTests(CustomTestCase):
debug("Launch application with wrong type %s" %cmd)
st, op = commands.getstatusoutput('su - user -c "%s"' %cmd)
self.assert_(op.split("\n")[0] == 'invoker: error: Unknown application type: f ',"No Error displayed")
self.assert_(op.split("\n")[2] == 'Usage: invoker [options] [--type=TYPE] [file] [args]',"No usgae displayed")
self.assert_(op.split("\n")[2] == 'Usage: invoker [options] [--type=TYPE] [file] [args]',"No usage displayed")
def test_unknown_parameter(self):
"""
Test that help is printed if unknown parameter
is passed to invoker
"""
cmd = '/usr/bin/invoker --type=m --x /usr/bin/fala_wl'
cmd = '/usr/bin/invoker --test-mode --type=m --x /usr/bin/fala_wl'
debug("Launch application with wrong option %s" %cmd)
st, op = commands.getstatusoutput('su - user -c "%s"' %cmd)
self.assert_(op.split("\n")[2] == 'Usage: invoker [options] [--type=TYPE] [file] [args]',"No usage displayed")
@ -425,7 +425,7 @@ class InvokerTests(CustomTestCase):
Test that invoker gives error when it tries to launch
a binary that does not exist
"""
cmd = '/usr/bin/invoker --type=m /usr/bin/fala_foo'
cmd = '/usr/bin/invoker --test-mode --type=m /usr/bin/fala_foo'
debug("Launch a non existing application %s" %cmd)
st, op = commands.getstatusoutput('su - user -c "%s"' %cmd)
self.assert_(st != 0,"The application was launched")
@ -435,7 +435,7 @@ class InvokerTests(CustomTestCase):
Test that the symlink of invoker is unable to launch applications
"""
os.system("ln -s /usr/bin/invoker /usr/bin/invoker_link")
cmd = "/usr/bin/invoker_link --type=m /usr/bin/fala_wl"
cmd = "/usr/bin/invoker_link --test-mode --type=m /usr/bin/fala_wl"
st, op = commands.getstatusoutput('su - user -c "%s"' %cmd)
os.system("rm /usr/bin/invoker_link")
self.assert_(st != 0,"The application was launched")
@ -461,7 +461,7 @@ class InvokerTests(CustomTestCase):
Test that symlink of an application can be launched.
"""
os.system("ln -s /usr/bin/fala_wl /usr/bin/fala_link")
cmd = "/usr/bin/invoker --type=m /usr/bin/fala_link"
cmd = "/usr/bin/invoker --test-mode --type=m /usr/bin/fala_link"
os.system('su - user -c "%s"&' %cmd)
pid = wait_for_app("fala_link")
os.system("rm /usr/bin/fala_link")
@ -502,7 +502,7 @@ class InvokerTests(CustomTestCase):
"""
#Test for a directory
os.system("mkdir /usr/bin/fala_dir")
st, op = commands.getstatusoutput("/usr/bin/invoker --type=m /usr/bin/fala_dir")
st, op = commands.getstatusoutput("/usr/bin/invoker --test-mode --type=m /usr/bin/fala_dir")
os.system("rm -rf /usr/bin/fala_dir")
self.assert_(st != 0 ,"The application was not launched")
@ -515,7 +515,7 @@ class InvokerTests(CustomTestCase):
Unset the PATH env variable and try to launch an application with
relative path. The launch should fail
"""
st, op = commands.getstatusoutput("(unset PATH;/usr/bin/invoker --type=m fala_wl)")
st, op = commands.getstatusoutput("(unset PATH;/usr/bin/invoker --test-mode --type=m fala_wl)")
self.assert_(st != 0, "The application was launched")
self.assert_(op == "invoker: died: could not get PATH environment variable", "The application was launched")
@ -529,7 +529,7 @@ class InvokerTests(CustomTestCase):
# launch an app with invoker --wait-term
debug("launching fala_wait ...")
p = Popen(['/usr/bin/invoker', '--type=m', '--wait-term',
p = Popen(['/usr/bin/invoker', '--type=m', '--test-mode', '--wait-term',
'/usr/bin/fala_wait'],
shell=False,
stdout=DEV_NULL, stderr=DEV_NULL, preexec_fn=permit_sigpipe)
@ -564,7 +564,7 @@ class InvokerTests(CustomTestCase):
"""
Test that invoker searches the application through relative path
"""
os.system("(cd /usr;export PATH=bin;/usr/bin/invoker --type=m fala_wl&)")
os.system("(cd /usr;export PATH=bin;/usr/bin/invoker --test-mode --type=m fala_wl&)")
pid = wait_for_app("fala_wl")
kill_process("fala_wl")
self.assert_(pid != None ,"The application was not launched")
@ -613,6 +613,55 @@ class InvokerTests(CustomTestCase):
self.waitForAsert(lambda:p.poll() != None, "Invoker didn't terminate.")
self.assert_(wait_for_process_end(PREFERED_APP), "invoker didn't kill application after applauncherd termination.")
def test_invoker_dbus_security(self, sighup = True):
"""
Test that invoker doesn't allow not-privileged application
to re-use restricted d-bus connection opened by m-booster
"""
#run without launcher
cmd = '/usr/bin/fala_dbus'
st, op = commands.getstatusoutput('su - user -c "%s"' %cmd)
errorName = op.split('\n')[0]
self.assert_(errorName.endswith('Error.AccessDenied'),"fala_dbus was able to connect to restricted d-bus service\n output: %s" %op)
#run with launcher (m-booster). invoker not in test mode
cmd = 'invoker --type=m /usr/bin/fala_dbus'
st, op = commands.getstatusoutput('su - user -c "%s"' %cmd)
errorName = op.split('\n')[0]
self.assert_(errorName.endswith('Error.AccessDenied'),"fala_dbus was able to use m-booster to connect to restricted d-bus service \n output: %s" %op)
#run with launcher (m-booster). invoker in test mode
cmd = 'invoker --test-mode --type=m /usr/bin/fala_dbus'
st, op = commands.getstatusoutput('su - user -c "%s"' %cmd)
errorName = op.split('\n')[0]
self.assert_(errorName.endswith('Error.NoReply'),"fala_dbus was not able to use m-booster in test-mode to connect to restricted d-bus service \n output: %s" %op)
if(sighup):
self.sighup_applauncherd()
self.test_invoker_dbus_security(False)
def test_invoker_test_mode(self, sighup = True):
"""
Test that invoker test mode is disabled if
test mode control file doesn't exist
"""
#remove test mode control file
os.system("rm -f /root/.itm")
#run with launcher (m-booster). Try to start invoker in test mode
cmd = 'invoker --test-mode --type=m /usr/bin/fala_dbus'
st, op = commands.getstatusoutput('su - user -c "%s"' %cmd)
#restore test mode control file
os.system("touch /root/.itm")
output = op.split('\n')
self.assert_(len(output) > 2, "No error reported by invoker running test mode without test mode control file. \n output: %s " %op)
error = output[2];
self.assert_(error.endswith("Invoker test mode is not enabled."), "Incorrect error reported by invoker running test mode without test mode control file. \n output: %s " %op)
if(sighup):
self.sighup_applauncherd()
self.test_invoker_dbus_security(False)
# main
if __name__ == '__main__':

@ -185,7 +185,7 @@ class SecurityTests(unittest.TestCase):
#launching the testapp with actual invoker
debug("launching the testapp with actual invoker")
st = os.system('%s --type=m --no-wait %s'%(INVOKER_BINARY, Testapp))
st = os.system('%s --test-mode --type=m --no-wait %s'%(INVOKER_BINARY, Testapp))
pid = get_pid(Testapp)
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)
@ -196,7 +196,7 @@ class SecurityTests(unittest.TestCase):
#launching the testapp with fake invoker
debug("launching the testapp with fake invoker")
st = os.system('%s --type=m --no-wait %s'%(FAKE_INVOKER_BINARY, Testapp))
st = os.system('%s --test-mode --type=m --no-wait %s'%(FAKE_INVOKER_BINARY, Testapp))
pid = get_pid(Testapp)
self.assert_(not (st == 0), "Application was launched using fake launcher")
self.assert_((pid == None), "Application was launched using fake launcher")
@ -218,7 +218,7 @@ class SecurityTests(unittest.TestCase):
# launch an application, leave invoker running
print "launching application"
invoker = run_app_as_user_with_invoker('/usr/bin/fala_ft_hello', booster = 'm', arg = '--wait-term')
invoker = run_app_as_user_with_invoker('/usr/bin/fala_ft_hello', booster = 'm', arg = '--test-mode --wait-term')
wait_for_app('fala_ft_hello')
@ -360,9 +360,9 @@ class SecurityTests(unittest.TestCase):
#Hardcoding the invoker specific credentials.Needs to be changed if invoker creds changes
invoker_specific_creds = ['applauncherd-invoker::applauncherd-invoker',\
'applauncherd-launcher::access']
p = run_app_as_user_with_invoker("/usr/bin/fala_wl")
p = run_app_as_user_with_invoker("/usr/bin/fala_wl", arg = '--test-mode')
wait_for_app('fala_wl')
st, op = commands.getstatusoutput("pgrep -lf '/usr/bin/invoker --type=m /usr/bin/fala_wl'")
st, op = commands.getstatusoutput("pgrep -lf '^/usr/bin/invoker --type=m --test-mode /usr/bin/fala_wl'")
pid = op.split("\n")[0].split(" ")[0]
debug("The pid of Invoker is %s" % pid)

@ -392,25 +392,25 @@ class SingleInstanceTests(CustomTestCase):
self.single_instance_abnormal_lock_release('single-instance')
def test_single_instance_window_raise_with_invoker(self, sighup = True):
self.single_instance_window_raise('invoker --type=m --single-instance')
self.single_instance_window_raise('invoker --test-mode --type=m --single-instance')
if(sighup):
self.sighup_applauncherd()
self.test_single_instance_window_raise_with_invoker(False)
def test_single_instance_and_non_single_instance_with_invoker(self, sighup = True):
self.single_instance_and_non_single_instance('invoker --type=m --single-instance')
self.single_instance_and_non_single_instance('invoker --test-mode --type=m --single-instance')
if(sighup):
self.sighup_applauncherd()
self.test_single_instance_and_non_single_instance_with_invoker(False)
def test_single_instance_stress_test_with_invoker(self, sighup = True):
self.single_instance_stress_test('invoker --type=m --single-instance')
self.single_instance_stress_test('invoker --test-mode --type=m --single-instance')
if(sighup):
self.sighup_applauncherd()
self.test_single_instance_stress_test_with_invoker(False)
def test_single_instance_abnormal_lock_release_with_invoker(self, sighup = True):
self.single_instance_abnormal_lock_release('invoker --type=m --single-instance')
self.single_instance_abnormal_lock_release('invoker --test-mode --type=m --single-instance')
if(sighup):
self.sighup_applauncherd()
self.test_single_instance_abnormal_lock_release_with_invoker(False)

Loading…
Cancel
Save