From e85397078d8f1999239194022f2778e856066c3f Mon Sep 17 00:00:00 2001 From: Nimika Keshri Date: Thu, 12 Aug 2010 13:09:42 +0300 Subject: [PATCH] Changes: New test added to test that boosters are restarted if they are killed RevBy: TrustMe --- tests/TestScripts/test-func-launcher.py | 34 +++++++++++++++++++++++-- tests/bug-tests/tests.xml | 5 +++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/tests/TestScripts/test-func-launcher.py b/tests/TestScripts/test-func-launcher.py index e30aae2..c4a8e04 100644 --- a/tests/TestScripts/test-func-launcher.py +++ b/tests/TestScripts/test-func-launcher.py @@ -105,8 +105,6 @@ class launcher_tests (unittest.TestCase): stdout=DEV_NULL, stderr=DEV_NULL) return p - #get_pid = lambda appname: commands.getstatusoutput("pgrep %s" % appname)[-1] - def get_pid(self, appname): temp = basename(appname)[:14] st, op = commands.getstatusoutput("pgrep %s" % temp) @@ -602,6 +600,38 @@ class launcher_tests (unittest.TestCase): count = self.get_file_descriptor("booster-q","qt") self.assert_(count != 0, "None of the file descriptors were changed") + def test_016_restart_booster(self): + """ + Test that booster is restarted if it is killed + """ + #get the pids of boosters and make sure they are running + qpid = self.get_pid('booster-q') + print "Pid of booster-q before killing :%s" %qpid + self.assert_(qpid != None, "No booster process running") + + mpid = self.get_pid('booster-m') + print "Pid of booster-m before killing :%s" %mpid + self.assert_(mpid != None, "No booster process running") + + #Kill the booster processes + self.kill_process(apppid=qpid) + self.kill_process(apppid=mpid) + + #wait for the boosters to be restarted + time.sleep(6) + + #check that the new boosters are started + qpid_new = self.get_pid('booster-q') + print "Pid of booster-q after killing :%s" %qpid_new + self.assert_(qpid_new != None, "No booster process running") + self.assert_(qpid_new != qpid, "booster process was not killed") + + mpid_new = self.get_pid('booster-m') + print "Pid of booster-m after killing :%s" %mpid_new + self.assert_(mpid_new != None, "No booster process running") + self.assert_(mpid_new != mpid, "booster process was not killed") + + # main if __name__ == '__main__': # When run with testrunner, for some reason the PATH doesn't include diff --git a/tests/bug-tests/tests.xml b/tests/bug-tests/tests.xml index e7260a8..79b3ec4 100644 --- a/tests/bug-tests/tests.xml +++ b/tests/bug-tests/tests.xml @@ -71,7 +71,7 @@ - + /usr/bin/waitloadavg.rb -l 1.0 -p 1.0 -t 120 @@ -84,6 +84,9 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_015_fd_booster_q + + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_016_restart_booster + true true