VirtualBox

Ignore:
Timestamp:
May 6, 2020 7:53:54 PM (5 years ago)
Author:
vboxsync
Message:

Validation Kit/tdAddGuestCtrl: Added facility testing of VBoxService by waiting for readiness before starting to test anything with it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py

    r84161 r84175  
    15991599        return fRc;
    16001600
     1601    def waitForGuestFacility(self, oSession, eFacilityType, sDesc,
     1602                             eFacilityStatus, cMsTimeout = 30 * 1000):
     1603        """
     1604        Waits for a guest facility to enter a certain status.
     1605        By default the "Active" status is being used.
     1606        """
     1607
     1608        reporter.log('Waiting for Guest Additions facility "%s" to change to status %s (%dms timeout)...'
     1609                     % (sDesc, str(eFacilityStatus), cMsTimeout));
     1610
     1611        fRc = False;
     1612
     1613        eStatusOld = vboxcon.AdditionsFacilityStatus_Unknown;
     1614        tsStart    = base.timestampMilli();
     1615        while base.timestampMilli() - tsStart < cMsTimeout:
     1616            try:
     1617                eStatus, _ = oSession.o.console.guest.getFacilityStatus(eFacilityType);
     1618            except:
     1619                reporter.errorXcpt('Getting facility status failed');
     1620                break;
     1621            if eStatus != eStatusOld:
     1622                reporter.log('Status is now %s' % (str(eStatus)));
     1623                eStatusOld = eStatus;
     1624            if eStatus == eFacilityStatus:
     1625                fRc = True;
     1626                break;
     1627            self.oTstDrv.sleep(5); # Do some busy waiting.
     1628
     1629        if not fRc:
     1630            reporter.testFailure('Waiting for Guest Additions facility "%s" timed out' % (sDesc));
     1631        else:
     1632            reporter.testFailure('Guest Additions facility "%s" reached requested status %s after %dms'
     1633                                 % (sDesc, str(eFacilityStatus), base.timestampMilli() - tsStart));
     1634
     1635        return fRc;
     1636
    16011637    #
    16021638    # Guest test files.
     
    16091645        """
    16101646        _ = oSession;
     1647
     1648        #
     1649        # Wait for VBoxService to come up.
     1650        #
     1651        fRc = self.waitForGuestFacility(oSession, vboxcon.AdditionsFacilityType_VBoxService, "VBoxService",
     1652                                        vboxcon.AdditionsFacilityStatus_Active);
     1653        if not fRc:
     1654            return (False, oTxsSession);
    16111655
    16121656        #
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette