From bba317feaad1030f00a5a124172e07ecd080475e Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Tue, 27 Jul 2010 15:59:29 +0300 Subject: [PATCH] New: Testcase for invokers --delay parameter --- tests/TestScripts/test-func-launcher.py | 40 +++++++++++++++++++++++++ tests/functests/tests.xml | 4 +++ 2 files changed, 44 insertions(+) diff --git a/tests/TestScripts/test-func-launcher.py b/tests/TestScripts/test-func-launcher.py index a126782..2276644 100644 --- a/tests/TestScripts/test-func-launcher.py +++ b/tests/TestScripts/test-func-launcher.py @@ -42,6 +42,8 @@ import sys import unittest import re +from subprocess import Popen + LAUNCHER_BINARY='/usr/bin/applauncherd' DEV_NULL = file("/dev/null","w") LAUNCHABLE_APPS = ['/usr/bin/fala_ft_hello','/usr/bin/fala_ft_hello1', '/usr/bin/fala_ft_hello2'] @@ -419,7 +421,12 @@ class launcher_tests (unittest.TestCase): self.kill_process(None, app_pid2) self.assert_(False, "%s was not killed" % app_path) + def test_011(self): + """ + Test that the --daemon parameter works for applauncherd + """ + # function to remove some temporaries def rem(): files = ['/tmp/applauncherd.lock', '/tmp/qtlnchr', '/tmp/mlnchr'] @@ -483,6 +490,39 @@ class launcher_tests (unittest.TestCase): else: commands.getstatusoutput("initctl start xsession/applauncherd") + + def test_012(self): + """ + Test the --delay parameter of the invoker. + """ + + # launch an app with invoker --delay n + print "launching fala_ft_hello ..." + p = Popen(['/usr/bin/invoker', '--delay', '10', '--type=m', + '/usr/bin/fala_ft_hello.launch'], + shell=False, + stdout=DEV_NULL, stderr=DEV_NULL) + + # wait a little + print "waiting ..." + time.sleep(5) + + success = True + + if p.poll() == None: + print "NOT DEAD" + else: + print "DEAD" + success = False + + print "waiting for invoker to terminate ..." + p.wait() + + print "terminating fala_ft_hello ..." + Popen(['pkill', 'fala_ft_hello']).wait() + + self.assert_(success, "invoker terminated before delay elapsed") + # main if __name__ == '__main__': # When run with testrunner, for some reason the PATH doesn't include diff --git a/tests/functests/tests.xml b/tests/functests/tests.xml index 41523e6..70091c4 100644 --- a/tests/functests/tests.xml +++ b/tests/functests/tests.xml @@ -35,6 +35,10 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_011 + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_012 + + true true