Changes: Added daemon killing before security tests.

RevBy: Olli Leppanen
pull/1/head
Juha Lintula 15 years ago
parent 48b4c1e333
commit 502c9caa08

@ -126,7 +126,7 @@
</case-->
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
</post_steps>
<environments>
@ -140,6 +140,7 @@
<pre_steps>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
</pre_steps>
<case name="applauncherd__test_no_aegis" type="Functional" description="Check that an application that doesn't have aegis file doesn't get any funny credentials." timeout="360" level="System" insignificant="false" >
@ -159,7 +160,10 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-security.py test_dont_pass_invoker_creds</step>
</case>
<post_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py start_daemons</step>
</post_steps>
<environments>
<scratchbox>false</scratchbox>
<hardware>true</hardware>

@ -51,7 +51,6 @@ LAUNCHABLE_APPS = ['/usr/bin/fala_ft_hello','/usr/bin/fala_ft_hello1', '/usr/bin
LAUNCHABLE_APPS_QML = ['/usr/bin/fala_qml_helloworld','/usr/bin/fala_qml_helloworld1', '/usr/bin/fala_qml_helloworld2']
PREFERED_APP = '/usr/bin/fala_ft_hello'
PREFERED_APP_QML = '/usr/bin/fala_qml_helloworld'
DAEMONS_TO_BE_STOPPED = ['xsession/applifed', 'xsession/conndlgs']
using_scratchbox = False
@ -73,17 +72,6 @@ def check_prerequisites():
for app in LAUNCHABLE_APPS:
assert len(basename(app)) <= 15, "For app: %s , base name !<= 14" %app
# Function to stop desired daemons. This is also done in setup function
# if stop_daemons is not called before.
def stop_daemons():
for daemon in DAEMONS_TO_BE_STOPPED:
os.system('initctl stop %s'%(daemon))
# Function to start desired daemons. This is also done in teardown function
# if start_daemons is not called before.
def start_daemons():
for daemon in DAEMONS_TO_BE_STOPPED:
os.system('initctl start %s'%(daemon))
class daemon_handling (unittest.TestCase):
@ -96,15 +84,12 @@ class daemon_handling (unittest.TestCase):
class launcher_tests (unittest.TestCase):
def setUp(self):
# Check if first of the desired daemons is running, and if so, start those all
st, op = commands.getstatusoutput('pgrep %s'%DAEMONS_TO_BE_STOPPED[0].split("/")[1])
if st == 0:
if daemons_running():
stop_daemons()
self.START_DAEMONS_AT_TEARDOWN = True
else:
self.START_DAEMONS_AT_TEARDOWN = False
if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd')
time.sleep(5)
@ -120,9 +105,10 @@ class launcher_tests (unittest.TestCase):
if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd')
time.sleep(5)
debug ("START_DAEMONS_AT_TEARDOWN: %s"%self.START_DAEMONS_AT_TEARDOWN)
if self.START_DAEMONS_AT_TEARDOWN:
start_daemons()
get_pid('booster-m')
get_pid('booster-q')
get_pid('booster-d')

@ -21,6 +21,12 @@ from utils import *
class SecurityTests(unittest.TestCase):
def setUp(self):
if daemons_running():
stop_daemons()
self.START_DAEMONS_AT_TEARDOWN = True
else:
self.START_DAEMONS_AT_TEARDOWN = False
if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd')
time.sleep(5)
@ -36,6 +42,10 @@ class SecurityTests(unittest.TestCase):
if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd')
time.sleep(5)
if self.START_DAEMONS_AT_TEARDOWN:
start_daemons()
get_pid('booster-m')
get_pid('booster-q')
get_pid('booster-d')

@ -8,6 +8,23 @@ from subprocess import Popen
from os.path import basename
DEV_NULL = file("/dev/null","w")
DAEMONS_TO_BE_STOPPED = ['xsession/applifed', 'xsession/conndlgs']
# Function to stop desired daemons. This is also done in setup function
# if stop_daemons is not called before.
def stop_daemons():
for daemon in DAEMONS_TO_BE_STOPPED:
os.system('initctl stop %s'%(daemon))
# Function to start desired daemons. This is also done in teardown function
# if start_daemons is not called before.
def start_daemons():
for daemon in DAEMONS_TO_BE_STOPPED:
os.system('initctl start %s'%(daemon))
def daemons_running():
st, op = commands.getstatusoutput('pgrep %s'%DAEMONS_TO_BE_STOPPED[0].split("/")[1])
return not(st)
def debug(*msg):
"""

Loading…
Cancel
Save