Changes: Added 'all boosters up and running'-check in applauncherd tests

RevBy: TrustMe
pull/1/head
Nimika Keshri 15 years ago
parent a6fa5afcf9
commit 8b43ea2bd0

@ -13,6 +13,10 @@
<case name="applauncherd__test_001_daemon_list" type="Functional" description="To list the running daemons using invoker after boot" timeout="360" level="System" insignificant="false"> <case name="applauncherd__test_001_daemon_list" type="Functional" description="To list the running daemons using invoker after boot" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-daemons.py test_001_daemon_list</step> <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-daemons.py test_001_daemon_list</step>
</case> </case>
<case name="applauncherd__test_daemon" type="Functional" description="Test that the applauncherd can be started daemonized" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_daemon</step>
</case>
<environments> <environments>
<scratchbox>true</scratchbox> <scratchbox>true</scratchbox>
<hardware>true</hardware> <hardware>true</hardware>
@ -21,8 +25,8 @@
<set name="TC_Launcher" description="Launcher functional tests" feature="AF Basic Launcher daemon support" requirement="300168"> <set name="TC_Launcher" description="Launcher functional tests" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps> <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> <step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps> </pre_steps>
<case name="applauncherd__test_launcher_exist" type="Functional" description="To test if the launcher exists and is executable or not" timeout="360" level="System" insignificant="false"> <case name="applauncherd__test_launcher_exist" type="Functional" description="To test if the launcher exists and is executable or not" timeout="360" level="System" insignificant="false">
@ -45,9 +49,6 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_one_instance</step> <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_one_instance</step>
</case> </case>
<case name="applauncherd__test_daemon" type="Functional" description="Test that the applauncherd can be started daemonized" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_daemon</step>
</case>
<case name="applauncherd__test_launch_multiple_apps_cont" type="Functional" description="Test that launcher can launch multiple applications continously" timeout="360" level="System" insignificant="false"> <case name="applauncherd__test_launch_multiple_apps_cont" type="Functional" description="Test that launcher can launch multiple applications continously" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_launch_multiple_apps_cont</step> <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_launch_multiple_apps_cont</step>
@ -66,6 +67,7 @@
<set name="TC_Invoker" description="Tests for invoker" feature="AF Basic Launcher daemon support" requirement="300168"> <set name="TC_Invoker" description="Tests for invoker" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps> <pre_steps>
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step> <step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps> </pre_steps>
<case name="applauncherd__test_signal_forwarding" type="Functional" description="To Test that invoker is killed by the same signal as the application" timeout="360" level="System" insignificant="true"> <case name="applauncherd__test_signal_forwarding" type="Functional" description="To Test that invoker is killed by the same signal as the application" timeout="360" level="System" insignificant="true">
@ -92,7 +94,6 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_invoker_gid_uid</step> <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_invoker_gid_uid</step>
</case> </case>
<case name="applauncherd__test_launch_wo_applauncherd" type="Functional" description="Test invoker cannot launch applications when applauncherd is not running" timeout="360" level="System" insignificant="false"> <case name="applauncherd__test_launch_wo_applauncherd" type="Functional" description="Test invoker cannot launch applications when applauncherd is not running" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_launch_wo_applauncherd</step> <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_launch_wo_applauncherd</step>
</case> </case>
@ -114,6 +115,10 @@
<step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</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> </pre_steps>
<case name="applauncherd__test_restart_booster" type="Functional" description="Test that booster is restarted if it is killed" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_restart_booster</step>
</case>
<case name="applauncherd__test_booster_pid_change" type="Functional" description="Test that application pid changes to the booster 'x' when application is launched using booster 'x' " timeout="360" level="System" insignificant="false"> <case name="applauncherd__test_booster_pid_change" type="Functional" description="Test that application pid changes to the booster 'x' when application is launched using booster 'x' " timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_booster_pid_change</step> <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_booster_pid_change</step>
</case> </case>
@ -126,10 +131,6 @@
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_fd_booster_q</step> <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_fd_booster_q</step>
</case> </case>
<case name="applauncherd__test_restart_booster" type="Functional" description="Test that booster is restarted if it is killed" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_restart_booster</step>
</case>
<case name="applauncherd__test_booster_killed_or_restarted" type="Functional" description="Test that booster is restarted if applauncherd is killed" timeout="360" level="System" insignificant="false"> <case name="applauncherd__test_booster_killed_or_restarted" type="Functional" description="Test that booster is restarted if applauncherd is killed" timeout="360" level="System" insignificant="false">
<step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_booster_killed_or_restarted</step> <step expected_result="0">source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_booster_killed_or_restarted</step>
</case> </case>
@ -153,8 +154,8 @@
<set name="TC_Security" description="Tests that have something to do with the security platform" feature="AF Basic Launcher daemon support" requirement="300168"> <set name="TC_Security" description="Tests that have something to do with the security platform" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps> <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> <step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps> </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" > <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" >
@ -260,8 +261,8 @@
<!-- Test for qml booster --> <!-- Test for qml booster -->
<set name="TC_Qml_Booster" description="functional tests for qml boosters" feature="AF Basic Launcher daemon support" requirement="300168"> <set name="TC_Qml_Booster" description="functional tests for qml boosters" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps> <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> <step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps> </pre_steps>
@ -302,8 +303,8 @@
<!-- Test for e booster --> <!-- Test for e booster -->
<set name="TC_e_Booster" description="functional tests for qml boosters" feature="AF Basic Launcher daemon support" requirement="300168"> <set name="TC_e_Booster" description="functional tests for qml boosters" feature="AF Basic Launcher daemon support" requirement="300168">
<pre_steps> <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> <step>source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py stop_daemons</step>
<step>/usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120</step>
</pre_steps> </pre_steps>
<case name="applauncherd__test_zombie_state_e" type="Functional" description="To test that no Zombie process exist after the application is killed" timeout="360" level="System" insignificant="false"> <case name="applauncherd__test_zombie_state_e" type="Functional" description="To test that no Zombie process exist after the application is killed" timeout="360" level="System" insignificant="false">

@ -47,11 +47,7 @@ class CoreDumpTests(unittest.TestCase):
self.START_DAEMONS_AT_TEARDOWN = False self.START_DAEMONS_AT_TEARDOWN = False
if get_pid('applauncherd') == None: if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd') start_applauncherd()
time.sleep(5)
get_pid('booster-m')
get_pid('booster-q')
get_pid('booster-d')
#setup here #setup here
debug("Executing SetUp") debug("Executing SetUp")
@ -59,8 +55,8 @@ class CoreDumpTests(unittest.TestCase):
#teardown here #teardown here
debug("Executing TearDown") debug("Executing TearDown")
if get_pid('applauncherd') == None: if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd') start_applauncherd()
time.sleep(5) wait_for_single_applauncherd()
if self.START_DAEMONS_AT_TEARDOWN: if self.START_DAEMONS_AT_TEARDOWN:
start_daemons() start_daemons()

@ -91,11 +91,8 @@ class launcher_tests (unittest.TestCase):
self.START_DAEMONS_AT_TEARDOWN = False self.START_DAEMONS_AT_TEARDOWN = False
if get_pid('applauncherd') == None: if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd') start_applauncherd()
time.sleep(5)
get_pid('booster-m')
get_pid('booster-q')
get_pid('booster-d')
#setup here #setup here
debug("Executing SetUp") debug("Executing SetUp")
@ -103,9 +100,9 @@ class launcher_tests (unittest.TestCase):
#teardown here #teardown here
debug("Executing TearDown") debug("Executing TearDown")
if get_pid('applauncherd') == None: if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd') start_applauncherd()
time.sleep(5)
wait_for_single_applauncherd()
if self.START_DAEMONS_AT_TEARDOWN: if self.START_DAEMONS_AT_TEARDOWN:
start_daemons() start_daemons()
@ -549,6 +546,7 @@ class launcher_tests (unittest.TestCase):
#Test for m-booster #Test for m-booster
debug("Test for m-booster") debug("Test for m-booster")
st, op = commands.getstatusoutput("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_m.py") st, op = commands.getstatusoutput("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_m.py")
time.sleep(3)
debug("The Invoker killed by : <%s>" %op.split ('\n')[-1]) debug("The Invoker killed by : <%s>" %op.split ('\n')[-1])
self.assert_(op.split('\n')[-1] == 'Segmentation fault (core dumped)', "The invoker(m-booster) was not killed by the same signal") self.assert_(op.split('\n')[-1] == 'Segmentation fault (core dumped)', "The invoker(m-booster) was not killed by the same signal")
@ -557,6 +555,7 @@ class launcher_tests (unittest.TestCase):
#Test for d-booster #Test for d-booster
debug("Test for d-booster") debug("Test for d-booster")
st, op = commands.getstatusoutput("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_d.py") st, op = commands.getstatusoutput("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_d.py")
time.sleep(3)
debug("The Invoker killed by : %s" % op.split('\n')[-1]) debug("The Invoker killed by : %s" % op.split('\n')[-1])
self.assert_(op.split('\n')[-1] == 'Terminated', "The invoker(d-booster) was not killed by the same signal") self.assert_(op.split('\n')[-1] == 'Terminated', "The invoker(d-booster) was not killed by the same signal")
@ -565,6 +564,7 @@ class launcher_tests (unittest.TestCase):
#Test for e-booster #Test for e-booster
debug("Test for e-booster") debug("Test for e-booster")
st, op = commands.getstatusoutput("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_e.py") st, op = commands.getstatusoutput("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_e.py")
time.sleep(3)
debug("The Invoker killed by : %s" % op.split('\n')[-1]) debug("The Invoker killed by : %s" % op.split('\n')[-1])
self.assert_(op.split('\n')[-1] == 'Terminated', "The invoker(e-booster) was not killed by the same signal") self.assert_(op.split('\n')[-1] == 'Terminated', "The invoker(e-booster) was not killed by the same signal")
@ -574,6 +574,7 @@ class launcher_tests (unittest.TestCase):
#Test for q-booster #Test for q-booster
debug("Test for q-booster") debug("Test for q-booster")
st, op = commands.getstatusoutput("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_qt.py") st, op = commands.getstatusoutput("/usr/share/applauncherd-testscripts/signal-forward/fala_sf_qt.py")
time.sleep(3)
debug("The Invoker killed by : %s" %op.split('\n')[-1]) debug("The Invoker killed by : %s" %op.split('\n')[-1])
self.assert_(op.split('\n')[-1] == 'Aborted (core dumped)', "The invoker(q-booster) was not killed by the same signal") self.assert_(op.split('\n')[-1] == 'Aborted (core dumped)', "The invoker(q-booster) was not killed by the same signal")

@ -28,11 +28,7 @@ class SecurityTests(unittest.TestCase):
self.START_DAEMONS_AT_TEARDOWN = False self.START_DAEMONS_AT_TEARDOWN = False
if get_pid('applauncherd') == None: if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd') start_applauncherd()
time.sleep(5)
get_pid('booster-m')
get_pid('booster-q')
get_pid('booster-d')
#setup here #setup here
debug("Executing SetUp") debug("Executing SetUp")
@ -40,8 +36,8 @@ class SecurityTests(unittest.TestCase):
#teardown here #teardown here
debug("Executing TearDown") debug("Executing TearDown")
if get_pid('applauncherd') == None: if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd') start_applauncherd()
time.sleep(5) wait_for_single_applauncherd()
if self.START_DAEMONS_AT_TEARDOWN: if self.START_DAEMONS_AT_TEARDOWN:
start_daemons() start_daemons()

@ -64,11 +64,7 @@ class SingleInstanceTests(unittest.TestCase):
self.START_DAEMONS_AT_TEARDOWN = False self.START_DAEMONS_AT_TEARDOWN = False
if get_pid('applauncherd') == None: if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd') start_applauncherd()
time.sleep(5)
get_pid('booster-m')
get_pid('booster-q')
get_pid('booster-d')
#setup here #setup here
debug("Executing SetUp") debug("Executing SetUp")
@ -76,8 +72,8 @@ class SingleInstanceTests(unittest.TestCase):
#teardown here #teardown here
debug("Executing TearDown") debug("Executing TearDown")
if get_pid('applauncherd') == None: if get_pid('applauncherd') == None:
os.system('initctl start xsession/applauncherd') start_applauncherd()
time.sleep(5) wait_for_single_applauncherd()
if self.START_DAEMONS_AT_TEARDOWN: if self.START_DAEMONS_AT_TEARDOWN:
start_daemons() start_daemons()

@ -15,17 +15,16 @@ DAEMONS_TO_BE_STOPPED = ['xsession/applifed', 'xsession/conndlgs']
def stop_daemons(): def stop_daemons():
for daemon in DAEMONS_TO_BE_STOPPED: for daemon in DAEMONS_TO_BE_STOPPED:
os.system('initctl stop %s'%(daemon)) os.system('initctl stop %s'%(daemon))
wait_for_single_applauncherd()
get_booster_pid()
# Function to start desired daemons. This is also done in teardown function # Function to start desired daemons. This is also done in teardown function
# if start_daemons is not called before. # if start_daemons is not called before.
def start_daemons(): def start_daemons():
for daemon in DAEMONS_TO_BE_STOPPED: for daemon in DAEMONS_TO_BE_STOPPED:
os.system('initctl start %s'%(daemon)) os.system('initctl start %s'%(daemon))
time.sleep(5) wait_for_single_applauncherd()
wait_for_app('booster-m') get_booster_pid()
wait_for_app('booster-e')
wait_for_app('booster-d')
wait_for_app('booster-q')
def daemons_running(): def daemons_running():
st, op = commands.getstatusoutput('pgrep %s'%DAEMONS_TO_BE_STOPPED[0].split("/")[1]) st, op = commands.getstatusoutput('pgrep %s'%DAEMONS_TO_BE_STOPPED[0].split("/")[1])
@ -50,8 +49,7 @@ def remove_applauncherd_runtime_files():
Removes files that applauncherd leaves behind after it has been stopped Removes files that applauncherd leaves behind after it has been stopped
""" """
debug("Removing files that applauncherd leaves behind after it has been stopped") debug("Removing files that applauncherd leaves behind after it has been stopped")
files = ['/var/run/applauncherd.lock'] files = glob.glob('/tmp/boost*')
files += glob.glob('/tmp/boost*')
for f in files: for f in files:
debug("removing %s" % f) debug("removing %s" % f)
@ -66,8 +64,7 @@ def start_applauncherd():
handle = Popen(['initctl', 'start', 'xsession/applauncherd'], handle = Popen(['initctl', 'start', 'xsession/applauncherd'],
stdout = DEV_NULL, stderr = DEV_NULL, stdout = DEV_NULL, stderr = DEV_NULL,
shell = False) shell = False)
get_booster_pid()
time.sleep(6)
return handle.wait() == 0 return handle.wait() == 0
def stop_applauncherd(): def stop_applauncherd():
@ -141,7 +138,7 @@ def get_newest_pid(app):
return None return None
def wait_for_app(app = None, timeout = 5, sleep = 1): def wait_for_app(app = None, timeout = 10, sleep = 1):
""" """
Waits for an application to start. Checks periodically if Waits for an application to start. Checks periodically if
the app is running for a maximum wait set in timeout. the app is running for a maximum wait set in timeout.
@ -165,6 +162,26 @@ def wait_for_app(app = None, timeout = 5, sleep = 1):
return pid return pid
def wait_for_single_applauncherd(timeout = 20, sleep = 1):
pid = get_pid('applauncherd')
count = len(pid.split("\n"))
start = time.time()
while count > 1 and time.time() < start + timeout:
debug("waiting %s secs for single applauncherd" %sleep)
time.sleep(sleep)
pid = get_pid('applauncherd')
count = len(pid.split("\n"))
if count == 1:
break
def get_booster_pid():
wait_for_app('booster-q')
wait_for_app('booster-e')
wait_for_app('booster-d')
wait_for_app('booster-m')
def kill_process(appname=None, apppid=None, signum=15): def kill_process(appname=None, apppid=None, signum=15):
if apppid and appname: if apppid and appname:

Loading…
Cancel
Save