From 3e64ed2536286d432d5b35021bd40eb977b4be79 Mon Sep 17 00:00:00 2001 From: Dmitry Rozenshtein Date: Mon, 5 Sep 2011 14:13:08 +0300 Subject: [PATCH 01/10] Changes: Add unit test for Logger - open log twice RevBy: Juha Lintula --- debian/changelog | 6 ++++++ tests/common/unittests/ut_logger/ut_logger.cpp | 16 ++++++++++++++++ tests/common/unittests/ut_logger/ut_logger.h | 1 + 3 files changed, 23 insertions(+) diff --git a/debian/changelog b/debian/changelog index 918b913..9b59fc9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +applauncherd (1.0.10) unstable; urgency=low + + * Changes: Add unit test for Logger - open log twice + + -- Dmitry Rozenshtein Mon, 5 Sep 2011 13:33:55 +0300 + applauncherd (1.0.9) stable; urgency=low * Changes: Improve test debug output. diff --git a/tests/common/unittests/ut_logger/ut_logger.cpp b/tests/common/unittests/ut_logger/ut_logger.cpp index 0078e7b..9d04552 100644 --- a/tests/common/unittests/ut_logger/ut_logger.cpp +++ b/tests/common/unittests/ut_logger/ut_logger.cpp @@ -101,6 +101,22 @@ void Ut_Logger::testCloseLog() { QVERIFY(m_subject->m_isOpened == false); } +void Ut_Logger::testOpenLogTwice() { + //open log first time with random name + _setTestPhrase(Q_FUNC_INFO); + Logger::openLog(m_testPhrase); + QVERIFY(m_subject->m_isOpened == true); + Logger::logInfo("Testing OpenLog twice"); + QVERIFY(_findPhraseInSyslog() == true); + //open log second time with another random name + _setTestPhrase(Q_FUNC_INFO); + Logger::openLog(m_testPhrase); + QVERIFY(m_subject->m_isOpened == true); + Logger::logInfo("Testing OpenLog twice"); + QVERIFY(_findPhraseInSyslog() == true); + Logger::closeLog(); +} + bool Ut_Logger::_findPhraseInSyslog() { diff --git a/tests/common/unittests/ut_logger/ut_logger.h b/tests/common/unittests/ut_logger/ut_logger.h index 4160dcb..e3a5731 100644 --- a/tests/common/unittests/ut_logger/ut_logger.h +++ b/tests/common/unittests/ut_logger/ut_logger.h @@ -46,6 +46,7 @@ private Q_SLOTS: void testLogInfo(); void testLogWarning(); void testCloseLog(); + void testOpenLogTwice(); private: char m_testPhrase[255]; From a24b68ec710750e56b8a19dea8421aed45dcef1e Mon Sep 17 00:00:00 2001 From: Alexey Shilov Date: Wed, 31 Aug 2011 15:43:40 +0300 Subject: [PATCH 02/10] =?UTF-8?q?Fixes:=20NB#269075=20-=20Precached=20(Lib?= =?UTF-8?q?Meegotouch)=20applications=20do=20not=20set=20WM=5FCLASS=20wind?= =?UTF-8?q?ow=20atom=20properly=20RevBy:=20Pertty=20Kellom=C3=A4ki,=20Dmit?= =?UTF-8?q?ry=20Rozenshtein?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 3 ++- src/launcherlib/booster.cpp | 4 ++++ src/launcherlib/booster.h | 14 +++++++++++--- src/mbooster/mbooster.cpp | 14 ++++++++++++++ src/mbooster/mbooster.h | 6 ++++++ src/qdeclarativebooster/mdeclarativecache.cpp | 10 ---------- src/qdeclarativebooster/qdeclarativebooster.cpp | 16 ++++++++++++++++ src/qdeclarativebooster/qdeclarativebooster.h | 6 ++++++ tests/harmattan/red-tests/tests.xml | 4 ++-- .../harmattan/testscripts/test-func-launcher.py | 14 +++++++------- 10 files changed, 68 insertions(+), 23 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9b59fc9..bb3790c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ -applauncherd (1.0.10) unstable; urgency=low +applauncherd (1.1.0) unstable; urgency=low * Changes: Add unit test for Logger - open log twice + * Fixes: NB#269075 - Precached (LibMeegotouch) applications do not set WM_CLASS window atom properly -- Dmitry Rozenshtein Mon, 5 Sep 2011 13:33:55 +0300 diff --git a/src/launcherlib/booster.cpp b/src/launcherlib/booster.cpp index 8a64654..245f0fe 100644 --- a/src/launcherlib/booster.cpp +++ b/src/launcherlib/booster.cpp @@ -530,6 +530,10 @@ int Booster::launchProcess() // Load the application and find out the address of main() void* handle = loadMain(); + // make booster specific initializations unless booster is in boot mode + if (!m_bootMode) + preinit(); + #ifdef WITH_COVERAGE __gcov_flush(); #endif diff --git a/src/launcherlib/booster.h b/src/launcherlib/booster.h index 5bbc56d..3a447c9 100644 --- a/src/launcherlib/booster.h +++ b/src/launcherlib/booster.h @@ -207,6 +207,14 @@ protected: const string &portraitSplash, const string &landscapeSplash, const string &pixmapId); + + /*! This method is called just before call boosted application's + * main function. Empty by default but some booster specific + * initializations can be done here. + * Re-implement if needed. + */ + virtual void preinit() {}; + //! Set nice value and store the old priority. Return true on success. bool pushPriority(int nice); @@ -223,6 +231,9 @@ protected: //! Reset out-of-memory killer adjustment void resetOomAdj(); + //! Data structure representing the application to be invoked + AppData* m_appData; + private: //! Disable copy-constructor @@ -238,9 +249,6 @@ private: //! Helper method: load the library and find out address for "main". void* loadMain(); - //! Data structure representing the application to be invoked - AppData* m_appData; - //! Socket connection to invoker Connection* m_connection; diff --git a/src/mbooster/mbooster.cpp b/src/mbooster/mbooster.cpp index 2c538b3..a126385 100644 --- a/src/mbooster/mbooster.cpp +++ b/src/mbooster/mbooster.cpp @@ -104,3 +104,17 @@ bool MBooster::receiveDataFromInvoker(int socketFd) } } +void MBooster::preinit() +{ + QString appName = QFileInfo(m_appData->argv()[0]).fileName(); + + QString appClass = appName.left(1).toUpper(); + if (appName.length() > 1) + appClass += appName.right(appName.length() - 1); + + char* app_name = qstrdup(appName.toLatin1().data()); + QApplication::setAppName(app_name); + + char* app_class = qstrdup(appClass.toLatin1().data()); + QApplication::setAppClass(app_class); +} diff --git a/src/mbooster/mbooster.h b/src/mbooster/mbooster.h index 072d7c3..35f6148 100644 --- a/src/mbooster/mbooster.h +++ b/src/mbooster/mbooster.h @@ -20,6 +20,9 @@ #ifndef MBOOSTER_H #define MBOOSTER_H +#include +#include "QFileInfo" + #include "eventhandler.h" #include "booster.h" @@ -77,6 +80,9 @@ protected: //! \reimp virtual bool receiveDataFromInvoker(int socketFd); + //! \reimp + virtual void preinit(); + private: //! Disable copy-constructor diff --git a/src/qdeclarativebooster/mdeclarativecache.cpp b/src/qdeclarativebooster/mdeclarativecache.cpp index 053744e..0b06b76 100644 --- a/src/qdeclarativebooster/mdeclarativecache.cpp +++ b/src/qdeclarativebooster/mdeclarativecache.cpp @@ -129,16 +129,6 @@ QApplication* MDeclarativeCachePrivate::qApplication(int &argc, char **argv) if (loadTestabilityEnv || loadTestabilityArg) testabilityInit(); - QString appClass = appName.left(1).toUpper(); - if (appName.length() > 1) - appClass += appName.right(appName.length() - 1); - - char* app_name = qstrdup(appName.toLatin1().data()); - QApplication::setAppName(app_name); - - char* app_class = qstrdup(appClass.toLatin1().data()); - QApplication::setAppClass(app_class); - #ifdef Q_WS_X11 // reinit WM_COMMAND X11 property if (qDeclarativeViewInstance) diff --git a/src/qdeclarativebooster/qdeclarativebooster.cpp b/src/qdeclarativebooster/qdeclarativebooster.cpp index f3a6647..f799553 100644 --- a/src/qdeclarativebooster/qdeclarativebooster.cpp +++ b/src/qdeclarativebooster/qdeclarativebooster.cpp @@ -94,3 +94,19 @@ bool QDeclarativeBooster::receiveDataFromInvoker(int socketFd) return true; } } + + +void QDeclarativeBooster::preinit() +{ + QString appName = QFileInfo(m_appData->argv()[0]).fileName(); + + QString appClass = appName.left(1).toUpper(); + if (appName.length() > 1) + appClass += appName.right(appName.length() - 1); + + char* app_name = qstrdup(appName.toLatin1().data()); + QApplication::setAppName(app_name); + + char* app_class = qstrdup(appClass.toLatin1().data()); + QApplication::setAppClass(app_class); +} diff --git a/src/qdeclarativebooster/qdeclarativebooster.h b/src/qdeclarativebooster/qdeclarativebooster.h index 36b9ce2..8ce08a4 100644 --- a/src/qdeclarativebooster/qdeclarativebooster.h +++ b/src/qdeclarativebooster/qdeclarativebooster.h @@ -20,6 +20,9 @@ #ifndef QDECLARATIVEBOOSTER_H #define QDECLARATIVEBOOSTER_H +#include +#include "QFileInfo" + #include "eventhandler.h" #include "booster.h" @@ -70,6 +73,9 @@ protected: //! \reimp virtual bool receiveDataFromInvoker(int socketFd); + //! \reimp + virtual void preinit(); + private: //! Disable copy-constructor diff --git a/tests/harmattan/red-tests/tests.xml b/tests/harmattan/red-tests/tests.xml index 3956a1e..2468b8a 100644 --- a/tests/harmattan/red-tests/tests.xml +++ b/tests/harmattan/red-tests/tests.xml @@ -30,9 +30,9 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-daemons.py test_app_exits_clean - + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_launched_app_wm_class_d diff --git a/tests/harmattan/testscripts/test-func-launcher.py b/tests/harmattan/testscripts/test-func-launcher.py index 0a36c5f..ea5dd17 100644 --- a/tests/harmattan/testscripts/test-func-launcher.py +++ b/tests/harmattan/testscripts/test-func-launcher.py @@ -842,16 +842,16 @@ class launcher_tests (unittest.TestCase): Test that launched application have correct WM_CLASS Xproperty booster m """ #For booster-m MApplicationWindow from MComponentCache - self._test_launched_app_wm_class_helper("m","fala_wl","-faulty","fala_wl",2) + self._test_launched_app_wm_class_helper("m","fala_wl","-faulty","fala_wl",1) - #For booster-m MApplicationWindow NOT from cache. 3 windows (2 for application + 1 is created by cache but not used) - self._test_launched_app_wm_class_helper("m","fala_ft_hello","-window-not-from-cache","fala_ft_hello",3) + #For booster-m MApplicationWindow NOT from cache. 2 windows (1 for application + 1 is created by cache but not used) + self._test_launched_app_wm_class_helper("m","fala_ft_hello","-window-not-from-cache","fala_ft_hello",2) - #For booster-m multiple MApplicationWindow (3 windows + 1) - self._test_launched_app_wm_class_helper("m","fala_multi-window","","fala_multi-window",4) + #For booster-m multiple MApplicationWindow (2 windows + 1) + self._test_launched_app_wm_class_helper("m","fala_multi-window","","fala_multi-window",3) - #For booster-m multiple MApplicationWindow NOT from cache (3 windows + 1 + 1 created by cache but not used) - self._test_launched_app_wm_class_helper("m","fala_multi-window","-window-not-from-cache","fala_multi-window",5) + #For booster-m multiple MApplicationWindow NOT from cache (2 windows + 1 + 1 created by cache but not used) + self._test_launched_app_wm_class_helper("m","fala_multi-window","-window-not-from-cache","fala_multi-window",4) def test_launched_app_wm_class_d(self): """ From 67b5990ce7d0910b5a4be3d5cbbe4c5a90da80a2 Mon Sep 17 00:00:00 2001 From: Olli Leppanen Date: Tue, 6 Sep 2011 12:00:03 +0300 Subject: [PATCH 03/10] Changes: New release RevBy: TrustMe --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index bb3790c..21c2825 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -applauncherd (1.1.0) unstable; urgency=low +applauncherd (1.1.0) stable; urgency=low * Changes: Add unit test for Logger - open log twice * Fixes: NB#269075 - Precached (LibMeegotouch) applications do not set WM_CLASS window atom properly From 6c59666b5f1839ba26d50d3cc75a08f65f18e08b Mon Sep 17 00:00:00 2001 From: Nimika Keshri Date: Thu, 1 Sep 2011 16:26:17 +0300 Subject: [PATCH 04/10] Changes: Fixed test for boot-mode due to fix NB#269075 RevBy: Alexey Shilov --- tests/harmattan/testscripts/test-boot-mode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/harmattan/testscripts/test-boot-mode.py b/tests/harmattan/testscripts/test-boot-mode.py index 448ea37..d691354 100644 --- a/tests/harmattan/testscripts/test-boot-mode.py +++ b/tests/harmattan/testscripts/test-boot-mode.py @@ -179,10 +179,10 @@ class BootModeTests(unittest.TestCase): 6, 6)) # assert that the normal mode results are correct - self.assert_(res_norm[0] == 6 and res_norm[1] == 6, + self.assert_(res_norm[0] == 6 and res_norm[1] == 12, "%d apps, %d windows. Expected %d apps, %d windows (normal mode)" % (res_norm[0], res_norm[1], - 6, 6)) + 6, 12)) def test_SIGUSR2(self): """ From b28bad62f5f7c72feebb8a7ccaa5b654278792ac Mon Sep 17 00:00:00 2001 From: Olli Leppanen Date: Wed, 7 Sep 2011 15:00:35 +0300 Subject: [PATCH 05/10] Changes: New unstable version RevBy: TrustMe --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 21c2825..d1f168d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +applauncherd (1.1.1) unstable; urgency=low + + * + + -- Olli Leppanen Wed, 7 Sep 2011 15:12:13 +0300 + applauncherd (1.1.0) stable; urgency=low * Changes: Add unit test for Logger - open log twice From c72bd141df0cebef5c9b0b43290034a72318729d Mon Sep 17 00:00:00 2001 From: Joona Hakkarainen Date: Thu, 8 Sep 2011 10:04:04 +0300 Subject: [PATCH 06/10] Changes: Add test to check applauncherd cant start second time RevBy: Nimika Keshri --- tests/harmattan/functests/tests.xml | 4 +++ .../testscripts/test-func-launcher.py | 26 ++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/tests/harmattan/functests/tests.xml b/tests/harmattan/functests/tests.xml index 144bc19..5a47f98 100644 --- a/tests/harmattan/functests/tests.xml +++ b/tests/harmattan/functests/tests.xml @@ -15,6 +15,10 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_unix_signal_handlers + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_only_one_applauncherd_exist + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_applications_exist diff --git a/tests/harmattan/testscripts/test-func-launcher.py b/tests/harmattan/testscripts/test-func-launcher.py index ea5dd17..7c9e944 100644 --- a/tests/harmattan/testscripts/test-func-launcher.py +++ b/tests/harmattan/testscripts/test-func-launcher.py @@ -93,6 +93,18 @@ class launcher_tests (unittest.TestCase): #Testcases + def test_only_one_applauncherd_exist(self): + """ + test_only_one_applauncherd_can_start + """ + stop_applauncherd() + st, op = commands.getstatusoutput("initctl start xsession/applauncherd") + time.sleep(2) + st_new, op = commands.getstatusoutput("initctl start xsession/applauncherd") + + self.assert_(st == 0, "Applauncherd do not start") + self.assert_(st_new != 0, "Applauncherd even force start second time") + def test_applications_exist(self): """ test_launchable_application_exists @@ -842,16 +854,16 @@ class launcher_tests (unittest.TestCase): Test that launched application have correct WM_CLASS Xproperty booster m """ #For booster-m MApplicationWindow from MComponentCache - self._test_launched_app_wm_class_helper("m","fala_wl","-faulty","fala_wl",1) + self._test_launched_app_wm_class_helper("m","fala_wl","-faulty","fala_wl",2) - #For booster-m MApplicationWindow NOT from cache. 2 windows (1 for application + 1 is created by cache but not used) - self._test_launched_app_wm_class_helper("m","fala_ft_hello","-window-not-from-cache","fala_ft_hello",2) + #For booster-m MApplicationWindow NOT from cache. 3 windows (2 for application + 1 is created by cache but not used) + self._test_launched_app_wm_class_helper("m","fala_ft_hello","-window-not-from-cache","fala_ft_hello",3) - #For booster-m multiple MApplicationWindow (2 windows + 1) - self._test_launched_app_wm_class_helper("m","fala_multi-window","","fala_multi-window",3) + #For booster-m multiple MApplicationWindow (3 windows + 1) + self._test_launched_app_wm_class_helper("m","fala_multi-window","","fala_multi-window",4) - #For booster-m multiple MApplicationWindow NOT from cache (2 windows + 1 + 1 created by cache but not used) - self._test_launched_app_wm_class_helper("m","fala_multi-window","-window-not-from-cache","fala_multi-window",4) + #For booster-m multiple MApplicationWindow NOT from cache (3 windows + 1 + 1 created by cache but not used) + self._test_launched_app_wm_class_helper("m","fala_multi-window","-window-not-from-cache","fala_multi-window",5) def test_launched_app_wm_class_d(self): """ From 8004ee681a7c80faedf60c9757442507ad445c93 Mon Sep 17 00:00:00 2001 From: Joona Hakkarainen Date: Thu, 8 Sep 2011 10:10:36 +0300 Subject: [PATCH 07/10] Revert "Changes: Add test to check applauncherd cant start second time" This reverts commit c72bd141df0cebef5c9b0b43290034a72318729d. --- tests/harmattan/functests/tests.xml | 4 --- .../testscripts/test-func-launcher.py | 26 +++++-------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/tests/harmattan/functests/tests.xml b/tests/harmattan/functests/tests.xml index 5a47f98..144bc19 100644 --- a/tests/harmattan/functests/tests.xml +++ b/tests/harmattan/functests/tests.xml @@ -15,10 +15,6 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_unix_signal_handlers - - source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_only_one_applauncherd_exist - - source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_applications_exist diff --git a/tests/harmattan/testscripts/test-func-launcher.py b/tests/harmattan/testscripts/test-func-launcher.py index 7c9e944..ea5dd17 100644 --- a/tests/harmattan/testscripts/test-func-launcher.py +++ b/tests/harmattan/testscripts/test-func-launcher.py @@ -93,18 +93,6 @@ class launcher_tests (unittest.TestCase): #Testcases - def test_only_one_applauncherd_exist(self): - """ - test_only_one_applauncherd_can_start - """ - stop_applauncherd() - st, op = commands.getstatusoutput("initctl start xsession/applauncherd") - time.sleep(2) - st_new, op = commands.getstatusoutput("initctl start xsession/applauncherd") - - self.assert_(st == 0, "Applauncherd do not start") - self.assert_(st_new != 0, "Applauncherd even force start second time") - def test_applications_exist(self): """ test_launchable_application_exists @@ -854,16 +842,16 @@ class launcher_tests (unittest.TestCase): Test that launched application have correct WM_CLASS Xproperty booster m """ #For booster-m MApplicationWindow from MComponentCache - self._test_launched_app_wm_class_helper("m","fala_wl","-faulty","fala_wl",2) + self._test_launched_app_wm_class_helper("m","fala_wl","-faulty","fala_wl",1) - #For booster-m MApplicationWindow NOT from cache. 3 windows (2 for application + 1 is created by cache but not used) - self._test_launched_app_wm_class_helper("m","fala_ft_hello","-window-not-from-cache","fala_ft_hello",3) + #For booster-m MApplicationWindow NOT from cache. 2 windows (1 for application + 1 is created by cache but not used) + self._test_launched_app_wm_class_helper("m","fala_ft_hello","-window-not-from-cache","fala_ft_hello",2) - #For booster-m multiple MApplicationWindow (3 windows + 1) - self._test_launched_app_wm_class_helper("m","fala_multi-window","","fala_multi-window",4) + #For booster-m multiple MApplicationWindow (2 windows + 1) + self._test_launched_app_wm_class_helper("m","fala_multi-window","","fala_multi-window",3) - #For booster-m multiple MApplicationWindow NOT from cache (3 windows + 1 + 1 created by cache but not used) - self._test_launched_app_wm_class_helper("m","fala_multi-window","-window-not-from-cache","fala_multi-window",5) + #For booster-m multiple MApplicationWindow NOT from cache (2 windows + 1 + 1 created by cache but not used) + self._test_launched_app_wm_class_helper("m","fala_multi-window","-window-not-from-cache","fala_multi-window",4) def test_launched_app_wm_class_d(self): """ From 4fec1351373264ac4361738c8c88a88091ccfa8a Mon Sep 17 00:00:00 2001 From: Joona Hakkarainen Date: Thu, 8 Sep 2011 10:32:35 +0300 Subject: [PATCH 08/10] Changes: Add test to applauncherd cant start twice RevBy:TrustMe --- tests/harmattan/functests/tests.xml | 5 +++++ tests/harmattan/testscripts/test-func-launcher.py | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tests/harmattan/functests/tests.xml b/tests/harmattan/functests/tests.xml index 144bc19..c149d23 100644 --- a/tests/harmattan/functests/tests.xml +++ b/tests/harmattan/functests/tests.xml @@ -19,6 +19,11 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_applications_exist + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_only_one_applauncherd_exist + + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_restart_booster diff --git a/tests/harmattan/testscripts/test-func-launcher.py b/tests/harmattan/testscripts/test-func-launcher.py index ea5dd17..6cbc524 100644 --- a/tests/harmattan/testscripts/test-func-launcher.py +++ b/tests/harmattan/testscripts/test-func-launcher.py @@ -103,6 +103,18 @@ class launcher_tests (unittest.TestCase): failed_apps.append(app) self.assert_(failed_apps == [], "Some applications do not have the launch files, list: %s" % str(failed_apps)) + def test_only_one_applauncherd_exist(self): + """ + test_only_one_applauncherd_can_start + """ + stop_applauncherd() + st, op = commands.getstatusoutput("initctl start xsession/applauncherd") + time.sleep(2) + st_new, op = commands.getstatusoutput("initctl start xsession/applauncherd") + + self.assert_(st == 0, "Applauncherd do not start") + self.assert_(st_new != 0, "Applauncherd even force start second time") + def test_zombie_state_m(self): self._test_zombie_state(PREFERED_APP,'m') From d787336ae11a48405293335983e556f148ba451d Mon Sep 17 00:00:00 2001 From: Dmitry Rozenshtein Date: Thu, 8 Sep 2011 10:21:46 +0300 Subject: [PATCH 09/10] Changes: Add functional test - invoker kills application when applauncherd dies RevBy: Nimika Keshri --- debian/changelog | 2 +- tests/harmattan/invoker-tests/tests.xml | 4 ++++ tests/harmattan/testscripts/test-invoker.py | 24 ++++++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index d1f168d..c487816 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ applauncherd (1.1.1) unstable; urgency=low - * + * Changes: Add functional test - invoker kills application when applauncherd dies -- Olli Leppanen Wed, 7 Sep 2011 15:12:13 +0300 diff --git a/tests/harmattan/invoker-tests/tests.xml b/tests/harmattan/invoker-tests/tests.xml index 63f5f1f..eaf86cd 100644 --- a/tests/harmattan/invoker-tests/tests.xml +++ b/tests/harmattan/invoker-tests/tests.xml @@ -87,6 +87,10 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-invoker.py test_invoker_bogus_apptype + + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-invoker.py test_invoker_applauncherd_dies + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons diff --git a/tests/harmattan/testscripts/test-invoker.py b/tests/harmattan/testscripts/test-invoker.py index ddb4e16..59a03ec 100644 --- a/tests/harmattan/testscripts/test-invoker.py +++ b/tests/harmattan/testscripts/test-invoker.py @@ -513,7 +513,29 @@ class InvokerTests(unittest.TestCase): kill_process(PREFERED_APP) - + + def test_invoker_applauncherd_dies(self): + """ + Test that invoker kills application and exits if applauncherd dies + """ + if get_pid(PREFERED_APP) != None: + kill_process(PREFERED_APP) #just to be sure application is not running prior the test + + if get_pid('applauncherd') == None: + start_applauncherd() #just to be sure applauncherd is running + + p = run_app_as_user_with_invoker(PREFERED_APP, booster = 'm') + + pid = wait_for_app(PREFERED_APP) + self.assert_(pid != None, "The application was not launched") + + stop_applauncherd() + time.sleep(20) #wait app to be terminated and invoker to exit + + pid = wait_for_app(PREFERED_APP, timeout = 2) #don't need to wait long since the app supposed not running + if pid != None: + kill_process(PREFERED_APP) + self.assert_(pid == None, "The application is still running!") # main if __name__ == '__main__': From 05ea0f6aaef2e51bd792244d35bc59dbd35e3c05 Mon Sep 17 00:00:00 2001 From: Joona Hakkarainen Date: Mon, 12 Sep 2011 16:10:20 +0300 Subject: [PATCH 10/10] Changes: print help from single-instance binary starting single-instance without parameters +2 lines RevBy: Trust me --- tests/harmattan/invoker-tests/tests.xml | 4 ++++ tests/harmattan/testscripts/test-invoker.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/tests/harmattan/invoker-tests/tests.xml b/tests/harmattan/invoker-tests/tests.xml index 63f5f1f..476fee4 100644 --- a/tests/harmattan/invoker-tests/tests.xml +++ b/tests/harmattan/invoker-tests/tests.xml @@ -27,6 +27,10 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-invoker.py test_invoker_usage_printing + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-invoker.py test_invoker_help_printing + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-invoker.py test_invoker_search_prog diff --git a/tests/harmattan/testscripts/test-invoker.py b/tests/harmattan/testscripts/test-invoker.py index ddb4e16..675f955 100644 --- a/tests/harmattan/testscripts/test-invoker.py +++ b/tests/harmattan/testscripts/test-invoker.py @@ -403,6 +403,14 @@ class InvokerTests(unittest.TestCase): p = run_cmd_as_user('invoker --help') self.assert_(p.wait() == 0, "'invoker --help' failed") + def test_invoker_help_printing(self): + """ + Test that applauncherd invoker usage printing ok + """ + + p = run_cmd_as_user('invoker') + self.assert_(p.wait() == 1, "'invoker' failed") + def test_app_link(self): """ Test that symlink of an application can be launched.