VirtualBox

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


Ignore:
Timestamp:
Jun 19, 2019 3:11:15 PM (6 years ago)
Author:
vboxsync
Message:

testdriver: Hack to work around what seems like missing processing during syncUploadFile in tdAddGuestCtrl.py/prepareGuestForTesting. bugref:9151 bugref:9320 bug

Location:
trunk/src/VBox/ValidationKit/testdriver
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/base.py

    r79180 r79245  
    409409    """
    410410
    411     def __init__(self, sCaller):
    412         self.sDbgCreated    = '%s: %s' % (utils.getTimePrefix(), sCaller);
    413         self.fSignalled     = False;
    414         self.__oRLock       = threading.RLock();
    415         self.oCv            = threading.Condition(self.__oRLock);
    416         self.oOwner         = None;
    417         self.msStart        = timestampMilli();
    418         self.oLocker        = None;
     411    def __init__(self, sCaller, fnProcessEvents = None):
     412        self.sDbgCreated        = '%s: %s' % (utils.getTimePrefix(), sCaller);
     413        self.fSignalled         = False;
     414        self.__oRLock           = threading.RLock();
     415        self.oCv                = threading.Condition(self.__oRLock);
     416        self.oOwner             = None;
     417        self.msStart            = timestampMilli();
     418        self.oLocker            = None;
     419
     420        ## Callback function that takes no parameters and will not be called holding the lock.
     421        ## It is a hack to work the XPCOM and COM event queues, so we won't hold back events
     422        ## that could block task progress (i.e. hangs VM).
     423        self.fnProcessEvents    = fnProcessEvents;
    419424
    420425    def __del__(self):
     
    540545        Overriable.
    541546        """
     547        if self.fnProcessEvents:
     548            self.fnProcessEvents();
     549
    542550        self.lockTask();
    543551
    544552        fState = self.pollTask(True);
    545553        if not fState:
    546             # Don't wait more than 1s.  This allow lazy state polling.
     554            # Don't wait more than 1s.  This allow lazy state polling and avoid event processing trouble.
    547555            msStart = timestampMilli();
    548556            while not fState:
     
    558566                except:
    559567                    pass;
     568
     569                if self.fnProcessEvents:
     570                    self.unlockTask();
     571                    self.fnProcessEvents();
     572                    self.lockTask();
     573
    560574                reporter.doPollWork('TdTaskBase.waitForTask');
    561575                fState = self.pollTask(True);
    562576
    563577        self.unlockTask();
     578
     579        if self.fnProcessEvents:
     580            self.fnProcessEvents();
     581
    564582        return fState;
    565583
  • trunk/src/VBox/ValidationKit/testdriver/txsclient.py

    r79219 r79245  
    386386    """
    387387
    388     def __init__(self, oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = False):
     388    def __init__(self, oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = False, fnProcessEvents = None):
    389389        """
    390390        Construct a TXS session.
     
    393393        when connected or the timeout has been reached.
    394394        """
    395         TdTaskBase.__init__(self, utils.getCallerName());
     395        TdTaskBase.__init__(self, utils.getCallerName(), fnProcessEvents);
    396396        self.oTransport     = oTransport;
    397397        self.sStatus        = "";
     
    21042104
    21052105
    2106 def openTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0):
     2106def openTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0, fnProcessEvents = None):
    21072107    """
    21082108    Opens a connection to a Test Execution Service via TCP, given its name.
     2109
     2110    The optional fnProcessEvents callback should be set to vbox.processPendingEvents
     2111    or similar.
    21092112    """
    2110     reporter.log2('openTcpSession(%s, %s, %s, %s, %s)' % \
     2113    reporter.log2('openTcpSession(%s, %s, %s, %s, %s)' %
    21112114                  (cMsTimeout, sHostname, uPort, fReversedSetup, cMsIdleFudge));
    21122115    try:
    21132116        oTransport = TransportTcp(sHostname, uPort, fReversedSetup);
    2114         oSession = Session(oTransport, cMsTimeout, cMsIdleFudge);
     2117        oSession = Session(oTransport, cMsTimeout, cMsIdleFudge, fnProcessEvents = fnProcessEvents);
    21152118    except:
    21162119        reporter.errorXcpt(None, 15);
     
    21192122
    21202123
    2121 def tryOpenTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0):
     2124def tryOpenTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0, fnProcessEvents = None):
    21222125    """
    21232126    Tries to open a connection to a Test Execution Service via TCP, given its name.
     
    21282131    try:
    21292132        oTransport = TransportTcp(sHostname, uPort, fReversedSetup);
    2130         oSession = Session(oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = True);
     2133        oSession = Session(oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = True, fnProcessEvents = fnProcessEvents);
    21312134    except:
    21322135        reporter.errorXcpt(None, 15);
  • trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py

    r79087 r79245  
    237237            except KeyboardInterrupt: raise;
    238238            except: pass;
     239            if self.fnProcessEvents:
     240                self.fnProcessEvents();
    239241            reporter.doPollWork('ProgressWrapper.waitForTask');
    240242            fState = self.pollTask(False);
     
    696698            except KeyboardInterrupt: raise;
    697699            except: pass;
     700            if self.fnProcessEvents:
     701                self.fnProcessEvents();
    698702            reporter.doPollWork('SessionWrapper.waitForTask');
    699703            fState = self.pollTask(False);
     
    29782982        # Kick off the task.
    29792983        try:
    2980             oTask = TxsConnectTask(self, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup);
     2984            oTask = TxsConnectTask(self, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup,
     2985                                   fnProcessEvents = self.oTstDrv.processPendingEvents);
    29812986        except:
    29822987            reporter.errorXcpt();
     
    29983003
    29993004        oTxsSession = txsclient.tryOpenTcpSession(cMsTimeout, sHostname, fReversedSetup = fReversed,
    3000                                                   cMsIdleFudge = cMsTimeout // 2);
     3005                                                  cMsIdleFudge = cMsTimeout // 2,
     3006                                                  fnProcessEvents = self.oTstDrv.processPendingEvents);
    30013007        if oTxsSession is None:
    30023008            return False;
     
    30463052
    30473053
    3048     def __init__(self, oSession, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup):
     3054    def __init__(self, oSession, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup, fnProcessEvents = None):
    30493055        TdTaskBase.__init__(self, utils.getCallerName());
    30503056        self.cMsTimeout         = cMsTimeout;
     3057        self.fnProcessEvents    = fnProcessEvents;
    30513058        self.sIpAddr            = None;
    30523059        self.sNextIpAddr        = None;
     
    31473154        self.oCv.acquire();
    31483155        if self.oTxsSession is None:
    3149             reporter.log2('_openTcpSession: sIpAddr=%s, uPort=%d, fReversedSetup=%s' % \
     3156            reporter.log2('_openTcpSession: sIpAddr=%s, uPort=%d, fReversedSetup=%s' %
    31503157                          (sIpAddr, uPort if uPort is not None else 0, fReversedSetup));
    31513158            self.sIpAddr     = sIpAddr;
    3152             self.oTxsSession = txsclient.openTcpSession(self.cMsTimeout, sIpAddr, uPort, \
    3153                                                         fReversedSetup, cMsIdleFudge);
     3159            self.oTxsSession = txsclient.openTcpSession(self.cMsTimeout, sIpAddr, uPort, fReversedSetup,
     3160                                                        cMsIdleFudge, fnProcessEvents = self.fnProcessEvents);
    31543161            self.oTxsSession.setTaskOwner(self);
    31553162        else:
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