diff --git a/debian/changelog b/debian/changelog index 2854d44..0781bf7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +applauncherd (3.0.1) unstable; urgency=low + + * Changes: Adds new test for applauncherd re-exec. Checking state of running application when it is updated. + + -- Alexey Shilov Mon, 14 Nov 2011 13:39:38 +0200 + applauncherd (2.0.16) stable; urgency=low * Fixes: NB#296154 - proprietary headers in applauncherd replaced to LGPL diff --git a/debian/rules b/debian/rules index 39ca8e4..a91f243 100755 --- a/debian/rules +++ b/debian/rules @@ -49,7 +49,7 @@ install: build dh_installdirs DESTDIR=debian/tmp make install - cp tests/harmattan/testapps/applauncherd-token-test_1.0_armel.deb debian/tmp/usr/share/fala_images + cp tests/harmattan/testapps/applauncherd-token-test_1.?_armel.deb debian/tmp/usr/share/fala_images cp tests/harmattan/testapps/applauncherd-usrlib-test_1.?_armel.deb debian/tmp/usr/share/fala_images #tests/harmattan/testapps/applauncherd-token-test_1.0_armel.deb: diff --git a/tests/harmattan/red-tests/tests.xml b/tests/harmattan/red-tests/tests.xml index 55e71df..ef85705 100644 --- a/tests/harmattan/red-tests/tests.xml +++ b/tests/harmattan/red-tests/tests.xml @@ -100,6 +100,14 @@ insignificant="true"> source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_reexec_when_file_in_usrlib_modified + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-security.py test_that_other_apps_dont_gain_new_token + initctl start xsession/pkgm-timed-checks diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/applauncherd-token-test.conf b/tests/harmattan/testapps/applauncherd-token-test-1.1/applauncherd-token-test.conf new file mode 100644 index 0000000..a08ba63 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/applauncherd-token-test.conf @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/applauncherd-token-test.pro b/tests/harmattan/testapps/applauncherd-token-test-1.1/applauncherd-token-test.pro new file mode 100644 index 0000000..b2d6229 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/applauncherd-token-test.pro @@ -0,0 +1,63 @@ +## This file is part of test package applauncherd-token-test +# +# Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# Contact: Marek Ruszczak +# +# This software, including documentation, is protected by copyright +# controlled by Nokia Corporation. All rights are reserved. Copying, +# including reproducing, storing, adapting or translating, any or all +# of this material requires the prior written consent of Nokia +# Corporation. This material also contains confidential information +# which may not be disclosed to others without the prior written +# consent of Nokia. +## + +QMAKEVERSION = $$[QMAKE_VERSION] +ISQT4 = $$find(QMAKEVERSION, ^[2-9]) +isEmpty( ISQT4 ) { + error("Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4"); +} + +QT += core +QT -= gui + +TARGET = fala-token-test-app +TEMPLATE = app +CONFIG += warn_on link_pkgconfig +CONFIG += console +CONFIG -= app_bundle + +DESTDIR = bin +OBJECTS_DIR = obj +MOC_DIR = obj + +SOURCES += main.cpp + +# Flags to reduce binary size where possible +QMAKE_CXXFLAGS += -fdata-sections -ffunction-sections +QMAKE_LFLAGS += --discard-local --discard-all -Wl --gc-sections +QMAKE_CXXFLAGS -= -O2 +QMAKE_CXXFLAGS += -Os + +unix { + #VARIABLES + isEmpty(PREFIX) { + PREFIX = /usr + } + BINDIR = $$PREFIX/bin + DATADIR =$$PREFIX/share + + DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\" + + #MAKE INSTALL + + INSTALLS += target aegisfs_config + + target.path =$$BINDIR + + aegisfs_config.files = applauncherd-token-test.conf + aegisfs_config.path = /etc/aegisfs.d +} + diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/README b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/README new file mode 100644 index 0000000..561a6b1 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/README @@ -0,0 +1,6 @@ +The Debian Package applauncherd-token-test +---------------------------- + +This packeged is used to test that applauncherd is gaining custom tokens when installed appliaction is using a booster. + + -- Marek Ruszczak Fri, 04 Nov 2011 16:05:43 +0200 diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/applauncherd-token-test.aegis b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/applauncherd-token-test.aegis new file mode 100644 index 0000000..fa0b74e --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/applauncherd-token-test.aegis @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/applauncherd-token-test.postinst b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/applauncherd-token-test.postinst new file mode 100644 index 0000000..4d46836 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/applauncherd-token-test.postinst @@ -0,0 +1,3 @@ +#!/bin/sh + +aegisfs --install /etc/aegisfs.d/applauncherd-token-test.conf diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/changelog b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/changelog new file mode 100644 index 0000000..c96bf91 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/changelog @@ -0,0 +1,11 @@ +applauncherd-token-test (1.1) unstable; urgency=low + + * adding additional custom credential token. + + -- Marek Ruszczak Tue, 15 Nov 2011 15:33:16 +0200 + +applauncherd-token-test (1.0) stable; urgency=low + + * Initial Release. + + -- Marek Ruszczak Fri, 04 Nov 2011 16:05:43 +0200 diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/compat b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/compat @@ -0,0 +1 @@ +7 diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/control b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/control new file mode 100644 index 0000000..a8c2a82 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/control @@ -0,0 +1,22 @@ +Source: applauncherd-token-test +Section: unknown +Priority: extra +Maintainer: Marek Ruszczak +Build-Depends: pkg-config, debhelper (>= 7.0.50~), libqt4-dev, applauncherd-dev, applauncherd, aegis-builder (>= 1.4), libmeegotouch-dev +Standards-Version: 3.9.1 + +Package: applauncherd-token-test +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-core, libqtgui4, applauncherd, libmeegotouchcore0 +Description: Application used to test applauncherd reexec + This application is used to test that installation of new security tokens + is properly handled by applauncherd deamon. + +Package: applauncherd-token-test-dbg +Architecture: devel +Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-core, libqtgui4, applauncherd, libmeegotouchcore0, applauncherd-token-test (= ${binary:Version}) +Description: Application used to test applauncherd reexec + This application with debug symbols is used to test that + installation of new security tokens is properly handled + by applauncherd deamon. + diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/copyright b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/copyright new file mode 100644 index 0000000..5aad6fe --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/copyright @@ -0,0 +1,16 @@ +This work was packaged for Debian by: + + Marek Ruszczak Fri, 04 Nov 2011 16:05:43 +0200 + +Copyright: + + Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + +This software, including documentation, is protected by copyright +controlled by Nokia Corporation. All rights are reserved. Copying, +including reproducing, storing, adapting or translating, any or all +of this material requires the prior written consent of Nokia +Corporation. This material also contains confidential information +which may not be disclosed to others without the prior written +consent of Nokia. diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/rules b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/rules new file mode 100755 index 0000000..b1260e0 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/debian/rules @@ -0,0 +1,74 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS = -Wall -g + +APPNAME := applauncherd-token-test + +Makefile: + qmake-qt4 + +build: build-stamp + +build-stamp: Makefile + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch $@ + +clean: Makefile + dh_testdir + dh_testroot + rm -f build-stamp + $(MAKE) clean + dh_clean + +install: + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/your_appname + $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/$(APPNAME) install + +aegis: + # setting up aegis credentials + aegis-deb-add -control debian/applauncherd-token-test/DEBIAN/control .. debian/applauncherd-token-test.aegis=_aegis + # aegis-deb-add -control debian/applauncherd-token-test-dbg/DEBIAN/control .. debian/applauncherd-token-test-dbg.aegis=_aegis + +# Build architecture-independent files here. +binary-indep: +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installman + dh_link + dh_strip --dbg-package=$(APPNAME)-dbg + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch aegis +.PHONY: build clean binary-indep binary-arch binary install configure + diff --git a/tests/harmattan/testapps/applauncherd-token-test-1.1/main.cpp b/tests/harmattan/testapps/applauncherd-token-test-1.1/main.cpp new file mode 100644 index 0000000..fcfeb77 --- /dev/null +++ b/tests/harmattan/testapps/applauncherd-token-test-1.1/main.cpp @@ -0,0 +1,9 @@ +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + return a.exec(); +} + diff --git a/tests/harmattan/testapps/applauncherd-token-test_1.1_armel.deb b/tests/harmattan/testapps/applauncherd-token-test_1.1_armel.deb new file mode 100644 index 0000000..b3376ac Binary files /dev/null and b/tests/harmattan/testapps/applauncherd-token-test_1.1_armel.deb differ diff --git a/tests/harmattan/testscripts/test-security.py b/tests/harmattan/testscripts/test-security.py index c643194..73601c2 100644 --- a/tests/harmattan/testscripts/test-security.py +++ b/tests/harmattan/testscripts/test-security.py @@ -16,6 +16,7 @@ # of this file. import unittest +import re from utils import * class SecurityTests(unittest.TestCase): @@ -398,15 +399,14 @@ class SecurityTests(unittest.TestCase): packageFileName = '/usr/share/fala_images/applauncherd-token-test_1.0_armel.deb' packageName = 'applauncherd-token-test' token = 'applauncherd-token-test::applauncherd-test-token' - - #check that facebook is NOT installed - notInstaled, op = commands.getstatusoutput('dpkg -l %s' %(packageName)) - if (notInstaled==0) : + + #check that test package is NOT installed + if (isPackageInstalled(packageName)) : debug('Tested package "%s" is isntalled, removing it.' %(packageName)) self.__test_reexec_remove_test_package(packageName) initialBoosters = get_booster_pid() - + def waitFoNewBoosters(oldBoosters) : oldBoosters = set(oldBoosters) for i in range(3) : @@ -415,7 +415,7 @@ class SecurityTests(unittest.TestCase): return newBoosters time.sleep(1) return None - + #send sighup just in case to clear capabilites of applaucherd (prevent problems from other bugy installations) commands.getstatusoutput('kill -hup `pgrep applauncherd`') @@ -433,7 +433,7 @@ class SecurityTests(unittest.TestCase): debug('Installing test packege "%s"...' %(packageName)) st, op = commands.getstatusoutput('dpkg -i %s' %(packageFileName)) - self.assertEqual(st, 0, 'Installation of "%s" failed see:\n%s' %(packageName, op)) + self.assertEqual(st, 0, 'Installation of "%s" failed (error code: %s) see:\n%s' %(packageName, st, op)) debug('...Instalation was successful.') newBoostersPids = waitFoNewBoosters(oldBoostersPids) @@ -459,6 +459,75 @@ class SecurityTests(unittest.TestCase): debug('Restoring system to initial state: removing test package after test was complleted.') self.__test_reexec_remove_test_package(packageName) + def test_that_other_apps_dont_gain_new_token(self) : + """ + Checks that when running application is upgraded and upgrade contains new token, then + this runing application doesn't gain new token until it is restarted (re-exec of + applauncherd don't have impact on child processes). + It is assumed that application is boosted (run by invoker). + """ + + package1FileName = '/usr/share/fala_images/applauncherd-token-test_1.0_armel.deb' + package2FileName = '/usr/share/fala_images/applauncherd-token-test_1.1_armel.deb' + packageName = 'applauncherd-token-test' + firstToken = 'applauncherd-token-test::applauncherd-test-token' + secondToken = 'applauncherd-token-test::applauncherd-test-second-token' + appName = "fala-token-test-app" + + #check that test package is NOT installed + if (isPackageInstalled(packageName)) : + debug('Tested package "%s" is isntalled, removing it.' %(packageName)) + self.__test_reexec_remove_test_package(packageName) + + versionSearch = re.compile(r"_(\d+(\.\d+)+)_\w+\.deb") + debug("Installing '%s' in version: %s" %(packageName, versionSearch.search(package1FileName).group(1))) + st, op = commands.getstatusoutput('dpkg -i %s' %(package1FileName)) + self.assertEqual(st, 0, 'Installation of "%s" failed (error code: %s) see:\n%s' %(packageName, st, op)) + debug('...Instalation was successful.') + + try : + p = run_app_as_user_with_invoker(appName, 'e') + appPid = wait_for_app(appName) + self.assert_(appPid, "Application '%s' was not launched successfuly" %(appName)) + + oldCredentials = get_creds(pid = appPid) + self.assert_(oldCredentials, "Failed to fetch credentials for application '%s' with pid: %s." %(appName, appPid)) + self.assert_(firstToken in oldCredentials, "Expected credential '%s' not found for '%s' application." + %(firstToken, appName)) + self.assert_((packageName+"::"+packageName) in oldCredentials, "Default package credential '%s' not found for '%s' application." + %(packageName+"::"+packageName, appName)) + self.assert_(not (secondToken in oldCredentials), "Old version of %s shouldn't have '%s' token" + %(appName, secondToken)) + + debug("Instaling upgrade of package '%s' with version %s" %(packageName, versionSearch.search(package2FileName).group(1))) + st, op = commands.getstatusoutput('dpkg -i %s' %(package2FileName)) + self.assertEqual(st, 0, 'Upgrade of package "%s" failed (error code: %s) see:\n%s' %(packageName, st, op)) + debug('...Instalation was successful.') + + newCredentials = get_creds(pid = appPid) + self.assert_(newCredentials, "Failed to fetch credentials for application '%s' with pid: %s. Application might have crush." %(appName, appPid)) + + credDiff = set(oldCredentials).symmetric_difference(set(newCredentials)) + self.assertEqual(len(credDiff), 0, "Application '%s' has a diffrance in tokens: %s, after installing update (application was not restarted)." + %(appName, credDiff)) + + kill_process(appName) + time.sleep(2) + + p = run_app_as_user_with_invoker(appName, 'e') + appPid = wait_for_app(appName) + newCredentials = get_creds(pid = appPid) + credDiff = set(oldCredentials).symmetric_difference(set(newCredentials)) + self.assertEqual(credDiff, set([secondToken]), "After rerun of '%s' it should gain only '%s' token, not: %s" + %(appName, secondToken, credDiff)) + + finally: + debug('Restoring system to initial state: removing test package after test was complleted.') + kill_process(appName) + self.__test_reexec_remove_test_package(packageName) + + + # main if __name__ == '__main__': # When run with testrunner, for some reason the PATH doesn't include