New: Testcase for the daemonized mode

RevBy: Olli Leppänen
pull/1/head
Oskari Timperi 16 years ago
parent c7d2a4936a
commit e72d9ee523

@ -47,6 +47,8 @@ DEV_NULL = file("/dev/null","w")
LAUNCHABLE_APPS = ['/usr/bin/fala_ft_hello','/usr/bin/fala_ft_hello1', '/usr/bin/fala_ft_hello2']
PREFERED_APP = '/usr/bin/fala_ft_hello'
using_scratchbox = False
def debug(*msg):
"""
Debug function
@ -417,6 +419,43 @@ class launcher_tests (unittest.TestCase):
self.kill_process(None, app_pid2)
self.assert_(False, "%s was not killed" % app_path)
def test_011(self):
# stop/kill applauncherd if it's running
if using_scratchbox:
commands.getstatusoutput("pkill applauncherd")
else:
commands.getstatusoutput("initctl stop xsession/applauncherd")
files = ['/tmp/applauncherd.lock', '/tmp/qtlnchr', '/tmp/mlnchr']
for f in files:
os.remove(f)
# start applauncherd daemonized
subprocess.Popen(["applauncherd.bin", "--daemon"],
shell=False,
stdout=DEV_NULL, stderr=DEV_NULL)
time.sleep(2)
# count should be 2 (pgrep -f returns the shell in which it is run ...)
st, op = commands.getstatusoutput('pgrep -f "applauncherd.bin --daemon"')
count = len(op.split("\n"))
commands.getstatusoutput('pkill -f "applauncherd.bin --daemon"')
for f in files:
os.remove(f)
# start applauncherd again
if using_scratchbox:
subprocess.Popen("applauncherd",
shell=False,
stdout=DEV_NULL, stderr=DEV_NULL)
else:
commands.getstatusoutput("initctl start xsession/applauncherd")
self.assert_(count == 2, "applauncherd was not daemonized")
# main
if __name__ == '__main__':
@ -424,6 +463,7 @@ if __name__ == '__main__':
# the tools/bin directory
if os.getenv('_SBOX_DIR') != None:
os.environ['PATH'] = os.getenv('PATH') + ":" + os.getenv('_SBOX_DIR') + '/tools/bin'
using_scratchbox = True
check_prerequisites()
start_launcher_daemon()

@ -31,6 +31,10 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_005_one_instance</step>
</case>
<case name="daemonized" type="Functional" description="Test that the applauncherd can be started daemonized" 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_011</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>

Loading…
Cancel
Save