New: Testcase for invokers --delay parameter

pull/1/head
Oskari Timperi 15 years ago
parent f3a43312ca
commit bba317feaa

@ -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

@ -35,6 +35,10 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_011</step>
</case>
<case name="invoker-delay" type="Functional" description="Test that invokers --delay parameter works" timeout="120" level="System" insignificant="true">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_012</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>

Loading…
Cancel
Save