VirtualBox

Changeset 84185 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
May 7, 2020 12:29:49 PM (5 years ago)
Author:
vboxsync
Message:

Validation Kit/tdAddBasic1.py: Implemented testing of (some) guest facilities we need in order to prepare/run subsequential tests.

File:
1 edited

Legend:

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

    r84180 r84185  
    8181        reporter.log('onAdditionsStateChange');
    8282        self.oTstDrv.fGAStatusCallbackFired = True;
    83         self.oTstDrv.iGAStatusCallbackRunlevel = self.oGuest.additionsRunLevel;
     83        self.oTstDrv.eGAStatusCallbackRunlevel = self.oGuest.additionsRunLevel;
    8484        self.oVBoxMgr.interruptWaitEvents();
    8585        return None;
     
    106106
    107107        self.fGAStatusCallbackFired    = False;
    108         self.iGAStatusCallbackRunlevel = 0;
     108        self.eGAStatusCallbackRunlevel = 0;
    109109
    110110    #
     
    249249        """
    250250        # No need to wait as we already reached the run level?
    251         if eRunLevel == oGuest.additionsRunLevel:
     251        eRunLevelCur = oGuest.additionsRunLevel;
     252        if eRunLevelCur == eRunLevel:
    252253            reporter.log('Already reached run level %s' % eRunLevel);
    253254            return True;
    254255
    255         reporter.log('Waiting for Guest Additions to reach run level %s ...' % eRunLevel);
     256        reporter.log('Waiting for Guest Additions to reach run level %s with %dms (current: %s) ...' %
     257                     (eRunLevel, cMsTimeout, eRunLevelCur));
    256258
    257259        oConsoleCallbacks = oSession.registerDerivedEventHandler(tdAddBasicConsoleCallbacks, \
     
    266268                    break;
    267269                if self.fGAStatusCallbackFired:
    268                     reporter.log('Reached new run level %s' % eRunLevel);
    269                     if eRunLevel == self.iGAStatusCallbackRunlevel:
     270                    reporter.log('Reached new run level %s after %dms' %
     271                                 (self.eGAStatusCallbackRunlevel, base.timestampMilli() - tsStart));
     272                    if eRunLevel == self.eGAStatusCallbackRunlevel:
    270273                        fRc = True;
    271274                        break;
    272275                    self.fGAStatusCallbackFired = False;
    273276            if fRc:
    274                 reporter.log('Guest Additions run level reached after %dms' % (base.timestampMilli() - tsStart));
     277                reporter.log('Final Guest Additions run level reached after %dms' % (base.timestampMilli() - tsStart));
    275278            else:
    276279                reporter.error('Guest Additions run level not reached');
     
    278281            # cleanup.
    279282            oConsoleCallbacks.unregister();
     283        else:
     284            reporter.error('Registering derived event handler failed');
    280285
    281286        if not fRc:
     
    295300                           (oTestVm.sKind, oTestVm.sVmName,));
    296301            fRc = False;
     302        fRc = True;
    297303
    298304        #
     
    308314                return (False, oTxsSession);
    309315
     316            # Wait for the GAs to come up.
     317            reporter.testStart('IGuest::additionsRunLevel');
     318            fRc = self.testIGuest_additionsRunLevel(oSession, oTestVm, oGuest);
     319            reporter.testDone();
     320
    310321            # Check the additionsVersion attribute. It must not be empty.
    311322            reporter.testStart('IGuest::additionsVersion');
    312323            fRc = self.testIGuest_additionsVersion(oGuest);
    313324            reporter.testDone();
    314             if not fRc:
    315                 return (False, oTxsSession);
    316 
    317             # Wait for the GAs to come up.
    318             reporter.testStart('IGuest::additionsRunLevel');
    319             fRc = self.testIGuest_additionsRunLevel(oSession, oTestVm, oGuest);
     325
     326            # Check Guest Additions facilities
     327            reporter.testStart('IGuest::getFacilityStatus');
     328            fRc = self.testIGuest_getFacilityStatus(oTestVm, oGuest);
    320329            reporter.testDone();
    321             if not fRc:
    322                 return (False, oTxsSession);
    323 
    324             ## @todo test IAdditionsFacilities.
    325330
    326331        return (fRc, oTxsSession);
     
    471476        return (fRc, oTxsSession);
    472477
     478    def testIGuest_additionsRunLevel(self, oSession, oTestVm, oGuest):
     479        """
     480        Do run level tests.
     481        """
     482        if oTestVm.isWindows():
     483            if oTestVm.isLoggedOntoDesktop():
     484                eExpectedRunLevel = vboxcon.AdditionsRunLevelType_Desktop;
     485            else:
     486                eExpectedRunLevel = vboxcon.AdditionsRunLevelType_Userland;
     487        else:
     488            ## @todo VBoxClient does not have facility statuses implemented yet.
     489            eExpectedRunLevel = vboxcon.AdditionsRunLevelType_Userland;
     490
     491        return self.waitForGuestAdditionsRunLevel(oSession, oGuest, 60 * 1000, eExpectedRunLevel);
     492
    473493    def testIGuest_additionsVersion(self, oGuest):
    474494        """
     
    498518        return True;
    499519
    500     def testIGuest_additionsRunLevel(self, oSession, oTestVm, oGuest):
    501         """
    502         Do run level tests.
    503         """
    504         if oTestVm.isLoggedOntoDesktop():
    505             eExpectedRunLevel = vboxcon.AdditionsRunLevelType_Desktop;
     520    def checkFacilityStatus(self, oGuest, eFacilityType, sDesc, fMustSucceed = True):
     521        """
     522        Prints the current status of a Guest Additions facility.
     523
     524        Return success status.
     525        """
     526
     527        fRc = True;
     528
     529        try:
     530            eStatus, _ = oGuest.getFacilityStatus(eFacilityType);
     531            reporter.log3('%s -> %s' % (sDesc, eStatus,));
     532        except:
     533            if fMustSucceed:
     534                reporter.errorXcpt('Getting facility status for %s failed' % (eFacilityType,));
     535                fRc = False;
    506536        else:
    507             eExpectedRunLevel = vboxcon.AdditionsRunLevelType_Userland;
    508 
    509         return self.waitForGuestAdditionsRunLevel(oSession, oGuest, 5 * 60 * 1000, eExpectedRunLevel);
     537            if eStatus == vboxcon.AdditionsFacilityStatus_Inactive:
     538                sStatus = "INACTIVE";
     539            elif eStatus == vboxcon.AdditionsFacilityStatus_Paused:
     540                sStatus = "PAUSED";
     541            elif eStatus == vboxcon.AdditionsFacilityStatus_PreInit:
     542                sStatus = "PREINIT";
     543            elif eStatus == vboxcon.AdditionsFacilityStatus_Init:
     544                sStatus = "INIT";
     545            elif eStatus == vboxcon.AdditionsFacilityStatus_Active:
     546                sStatus = "ACTIVE";
     547            elif eStatus == vboxcon.AdditionsFacilityStatus_Terminating:
     548                sStatus = "TERMINATING";
     549                fRc = not fMustSucceed;
     550            elif eStatus == vboxcon.AdditionsFacilityStatus_Terminated:
     551                sStatus = "TERMINATED";
     552                fRc = not fMustSucceed;
     553            elif eStatus == vboxcon.AdditionsFacilityStatus_Failed:
     554                sStatus = "FAILED";
     555                fRc = not fMustSucceed;
     556            else:
     557                sStatus = "UNKNOWN";
     558                fRc = not fMustSucceed;
     559
     560        reporter.log('Guest Additions facility "%s": %s' % (sDesc, sStatus));
     561        if      fMustSucceed \
     562        and not fRc:
     563            reporter.error('Guest Additions facility "%s" did not report expected status (is "%s")' % (sDesc, sStatus));
     564
     565        return fRc;
     566
     567    def testIGuest_getFacilityStatus(self, oTestVm, oGuest):
     568        """
     569        Checks Guest Additions facilities for their status.
     570
     571        Returns success status.
     572        """
     573
     574        reporter.testStart('Status VBoxGuest Driver');
     575        fRc = self.checkFacilityStatus(oGuest, vboxcon.AdditionsFacilityType_VBoxGuestDriver, "VBoxGuest Driver");
     576        reporter.testDone();
     577
     578        reporter.testStart('Status VBoxService');
     579        fRc = self.checkFacilityStatus(oGuest, vboxcon.AdditionsFacilityType_VBoxService,     "VBoxService") and fRc;
     580        reporter.testDone();
     581
     582        if oTestVm.isWindows():
     583            if oTestVm.isLoggedOntoDesktop():
     584                ## @todo VBoxClient does not have facility statuses implemented yet.
     585                reporter.testStart('Status VBoxTray / VBoxClient');
     586                fRc = self.checkFacilityStatus(oGuest, vboxcon.AdditionsFacilityType_VBoxTrayClient,
     587                                               "VBoxTray / VBoxClient") and fRc;
     588                reporter.testDone();
     589        ## @todo Add more.
     590
     591        return fRc;
    510592
    511593    def testGuestProperties(self, oSession, oTxsSession, oTestVm):
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