def _test_ShutdownParent(self, node):
        self._setupDevices(node)

        # test aggregate device releaseObject functionality
        pids = getChildren(self._devBooter.pid)
        self._parentDevice.releaseObject()
        for pid in pids:
            number_attempts = 0
            while True:
                try:
                    os.kill(pid,
                            0)  # check to see if the process is still alive
                    time.sleep(0.5)
                    number_attempts += 1
                except:
                    break
                if number_attempts == 5:
                    break
        pids = getChildren(self._devBooter.pid)
        scatest.verifyDeviceLaunch(self, self._devMgr, 0)
        # make sure the child device was also released
        self.assertEqual(len(pids), 0)

        self._devMgr.shutdown()
        self.assert_(self.waitTermination(self._devBooter))
        self.assertEqual(len(self._domMgr._get_deviceManagers()), 0)
    def _test_ShutdownParent(self, node):
        self._setupDevices(node)

        # test aggregate device releaseObject functionality
        pids = getChildren(self._devBooter.pid)
        self._parentDevice.releaseObject()
        for pid in pids:
            number_attempts = 0
            while True:
                try:
                    os.kill(pid, 0) # check to see if the process is still alive
                    time.sleep(0.5)
                    number_attempts+=1
                except:
                    break
                if number_attempts == 5:
                    break
        pids = getChildren(self._devBooter.pid)
        self.assertEqual(len(self._devMgr._get_registeredDevices()), 0)
        # make sure the child device was also released
        self.assertEqual(len(pids), 0)

        self._devMgr.shutdown()
        self.assert_(self.waitTermination(self._devBooter))
        self.assertEqual(len(self._domMgr._get_deviceManagers()), 0)
    def _test_ShutdownChild(self, node):
        self._setupDevices(node)

        # test child device releaseObject functionality
        pids = getChildren(self._devBooter.pid)
        pids1 = getChildren(pids[0])
        pids2 = getChildren(pids[1])
        if len(pids2) == 1:
            child_pid = pids[0]
            parent_pid = pids[1]
        else:
            child_pid = pids[1]
            parent_pid = pids[0]
        self._childDevice.releaseObject()
        number_attempts = 0
        while True:
            try:
                os.kill(child_pid,
                        0)  # check to see if the process is still alive
                time.sleep(0.5)
                number_attempts += 1
            except:
                break
            if number_attempts == 5:
                break
        self.assertEqual(len(self._aggregateDevice._get_devices()), 0)
        scatest.verifyDeviceLaunch(self, self._devMgr, 1)
        # make sure child device no longer exists
        pids = getChildren(self._devBooter.pid)
        self.assertEqual(len(pids), 1)

        # now make sure parent device releases okay
        pids = getChildren(self._devBooter.pid)
        self._parentDevice.releaseObject()
        scatest.verifyDeviceLaunch(self, self._devMgr, 0)
        number_attempts = 0
        while True:
            try:
                os.kill(parent_pid,
                        0)  # check to see if the process is still alive
                time.sleep(0.5)
                number_attempts += 1
            except:
                break
            if number_attempts == 5:
                break
        pids = getChildren(self._devBooter.pid)
        self.assertEqual(len(pids), 0)

        self._devMgr.shutdown()
        self.assert_(self.waitTermination(self._devBooter))
        self.assertEqual(len(self._domMgr._get_deviceManagers()), 0)
    def _test_ShutdownChild(self, node):
        self._setupDevices(node)

        # test child device releaseObject functionality
        pids = getChildren(self._devBooter.pid)
        pids1 = getChildren(pids[0])
        pids2 = getChildren(pids[1])
        if len(pids2) == 1:
            child_pid = pids[0]
            parent_pid = pids[1]
        else:
            child_pid = pids[1]
            parent_pid = pids[0]
        self._childDevice.releaseObject()
        number_attempts = 0
        while True:
            try:
                os.kill(child_pid, 0) # check to see if the process is still alive
                time.sleep(0.5)
                number_attempts+=1
            except:
                break
            if number_attempts == 5:
                break
        self.assertEqual(len(self._aggregateDevice._get_devices()), 0)
        self.assertEqual(len(self._devMgr._get_registeredDevices()), 1)
        # make sure child device no longer exists
        pids = getChildren(self._devBooter.pid)
        self.assertEqual(len(pids), 1)

        # now make sure parent device releases okay
        pids = getChildren(self._devBooter.pid)
        self._parentDevice.releaseObject()
        self.assertEqual(len(self._devMgr._get_registeredDevices()), 0)
        number_attempts = 0
        while True:
            try:
                os.kill(parent_pid, 0) # check to see if the process is still alive
                time.sleep(0.5)
                number_attempts+=1
            except:
                break
            if number_attempts == 5:
                break
        pids = getChildren(self._devBooter.pid)
        self.assertEqual(len(pids), 0)

        self._devMgr.shutdown()
        self.assert_(self.waitTermination(self._devBooter))
        self.assertEqual(len(self._domMgr._get_deviceManagers()), 0)