def test_OrphanProcesses(self):
"""
Tests that all child processes associated with a component get
terminated with that component.
"""
nb, domMgr = self.launchDomainManager()
self.assertNotEqual(domMgr, None)
nb, devMgr = self.launchDeviceManager('/nodes/test_BasicTestDevice_node/DeviceManager.dcd.xml')
self.assertNotEqual(devMgr, None)
domMgr.installApplication('/waveforms/orphaned_child/orphaned_child.sad.xml')
appFact = domMgr._get_applicationFactories()[0]
self.assertEqual(appFact._get_name(), 'orphaned_child')
app = appFact.create(appFact._get_name(), [], [])
pid = app._get_componentProcessIds()[0].processId
children = [int(line) for line in commands.getoutput('ps --ppid %d --no-headers -o pid' % (pid,)).split()]
app.releaseObject()
orphans = 0
for pid in children:
try:
os.kill(pid, 9)
orphans += 1
except OSError:
pass
self.assertEqual(orphans, 0)
test_04_ApplicationFactory.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录