VirtualBox

Ignore:
Timestamp:
Jun 25, 2019 2:41:07 PM (5 years ago)
Author:
vboxsync
Message:

ValKit/tdAddGuestCtrl.py: Cleanups. bugref:9320

File:
1 edited

Legend:

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

    r79327 r79328  
    6464    """
    6565    Class for handling a guest process input/output stream.
     66
     67    @todo write stdout/stderr tests.
    6668    """
    6769    def appendStream(self, stream, convertTo = '<b'):
     
    7274        self.extend(struct.pack(convertTo, stream));
    7375
    74 class tdCtxTest(object):
    75     """
    76     Provides the actual test environment.
    77     Should be kept as generic as possible.
    78     """
    79     def __init__(self, oSession, oTxsSession, oTestVm): # pylint: disable=unused-argument
    80         ## The desired Main API result.
    81         self.fRc = False;
    82         ## IGuest reference.
    83         self.oGuest      = oSession.o.console.guest; ## @todo may throw shit
    84         self.oSession    = oSession;
    85         self.oTxsSession = oTxsSession;
    86         self.oTestVm     = oTestVm;
    8776
    8877class tdCtxCreds(object):
     
    121110    """
    122111    def __init__(self):
    123         self.oTest  = None;
    124         self.oCreds = None;
    125         self.timeoutMS = 30 * 1000; # 30s timeout
    126         ## IGuestSession reference or None.
    127         self.oGuestSession = None;
     112        self.oGuest    = None;      ##< IGuest.
     113        self.oCreds    = None       ##< type: tdCtxCreds
     114        self.timeoutMS = 30 * 1000; ##< 30s timeout
     115        self.oGuestSession = None;  ##< IGuestSession reference or None.
    128116
    129117    def setEnvironment(self, oSession, oTxsSession, oTestVm):
     
    131119        Sets the test environment required for this test.
    132120        """
    133         self.oTest = tdCtxTest(oSession, oTxsSession, oTestVm);
     121        _ = oTxsSession;
     122
     123        try:
     124            self.oGuest = oSession.o.console.guest;
     125        except:
     126            reporter.errorXcpt();
     127
    134128        if self.oCreds is None:
    135129            self.oCreds = tdCtxCreds();
    136130        self.oCreds.applyDefaultsIfNotSet(oTestVm);
    137         return self.oTest;
     131
     132        return True;
    138133
    139134    def uploadLogData(self, oTstDrv, aData, sFileName, sDesc):
     
    162157            reporter.log('Creating session "%s" ...' % (sName,));
    163158            try:
    164                 self.oGuestSession = self.oTest.oGuest.createSession(self.oCreds.sUser,
    165                                                                      self.oCreds.sPassword,
    166                                                                      self.oCreds.sDomain,
    167                                                                      sName);
     159                self.oGuestSession = self.oGuest.createSession(self.oCreds.sUser,
     160                                                               self.oCreds.sPassword,
     161                                                               self.oCreds.sDomain,
     162                                                               sName);
    168163            except:
    169164                # Just log, don't assume an error here (will be done in the main loop then).
     
    832827        opened guest sessions of a VM.
    833828        """
    834         if self.oTest.oGuest is None:
     829        if self.oGuest is None:
    835830            return 0;
    836831        try:
    837             aoSession = oVBoxMgr.getArray(self.oTest.oGuest, 'sessions')
     832            aoSession = oVBoxMgr.getArray(self.oGuest, 'sessions')
    838833        except:
    839834            reporter.errorXcpt('sSessionName: %s' % (self.sSessionName,));
     
    23662361            # Try check that none of the remaining sessions got closed.
    23672362            try:
    2368                 aoGuestSessions = self.oTstDrv.oVBoxMgr.getArray(atTests[0][0].oTest.oGuest, 'sessions');
     2363                aoGuestSessions = self.oTstDrv.oVBoxMgr.getArray(atTests[0][0].oGuest, 'sessions');
    23692364            except:
    23702365                return (reporter.errorXcpt('i=%d/%d' % (i, cMaxGuestSessions,)), oTxsSession);
     
    48014796                break;
    48024797            try:
    4803                 oCurProgress = oCurTest.oTest.oGuest.updateGuestAdditions(oCurTest.sSrc, oCurTest.asArgs, oCurTest.fFlags);
     4798                oCurProgress = oCurTest.oGuest.updateGuestAdditions(oCurTest.sSrc, oCurTest.asArgs, oCurTest.fFlags);
    48044799                if oCurProgress is not None:
    48054800                    oProgress = vboxwrappers.ProgressWrapper(oCurProgress, self.oTstDrv.oVBoxMgr, self.oTstDrv, "gctrlUpGA");
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