Changeset 79245 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Jun 19, 2019 3:11:15 PM (6 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testdriver
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/base.py
r79180 r79245 409 409 """ 410 410 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; 419 424 420 425 def __del__(self): … … 540 545 Overriable. 541 546 """ 547 if self.fnProcessEvents: 548 self.fnProcessEvents(); 549 542 550 self.lockTask(); 543 551 544 552 fState = self.pollTask(True); 545 553 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. 547 555 msStart = timestampMilli(); 548 556 while not fState: … … 558 566 except: 559 567 pass; 568 569 if self.fnProcessEvents: 570 self.unlockTask(); 571 self.fnProcessEvents(); 572 self.lockTask(); 573 560 574 reporter.doPollWork('TdTaskBase.waitForTask'); 561 575 fState = self.pollTask(True); 562 576 563 577 self.unlockTask(); 578 579 if self.fnProcessEvents: 580 self.fnProcessEvents(); 581 564 582 return fState; 565 583 -
trunk/src/VBox/ValidationKit/testdriver/txsclient.py
r79219 r79245 386 386 """ 387 387 388 def __init__(self, oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = False ):388 def __init__(self, oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = False, fnProcessEvents = None): 389 389 """ 390 390 Construct a TXS session. … … 393 393 when connected or the timeout has been reached. 394 394 """ 395 TdTaskBase.__init__(self, utils.getCallerName() );395 TdTaskBase.__init__(self, utils.getCallerName(), fnProcessEvents); 396 396 self.oTransport = oTransport; 397 397 self.sStatus = ""; … … 2104 2104 2105 2105 2106 def openTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0 ):2106 def openTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0, fnProcessEvents = None): 2107 2107 """ 2108 2108 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. 2109 2112 """ 2110 reporter.log2('openTcpSession(%s, %s, %s, %s, %s)' % \2113 reporter.log2('openTcpSession(%s, %s, %s, %s, %s)' % 2111 2114 (cMsTimeout, sHostname, uPort, fReversedSetup, cMsIdleFudge)); 2112 2115 try: 2113 2116 oTransport = TransportTcp(sHostname, uPort, fReversedSetup); 2114 oSession = Session(oTransport, cMsTimeout, cMsIdleFudge );2117 oSession = Session(oTransport, cMsTimeout, cMsIdleFudge, fnProcessEvents = fnProcessEvents); 2115 2118 except: 2116 2119 reporter.errorXcpt(None, 15); … … 2119 2122 2120 2123 2121 def tryOpenTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0 ):2124 def tryOpenTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0, fnProcessEvents = None): 2122 2125 """ 2123 2126 Tries to open a connection to a Test Execution Service via TCP, given its name. … … 2128 2131 try: 2129 2132 oTransport = TransportTcp(sHostname, uPort, fReversedSetup); 2130 oSession = Session(oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = True );2133 oSession = Session(oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = True, fnProcessEvents = fnProcessEvents); 2131 2134 except: 2132 2135 reporter.errorXcpt(None, 15); -
trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py
r79087 r79245 237 237 except KeyboardInterrupt: raise; 238 238 except: pass; 239 if self.fnProcessEvents: 240 self.fnProcessEvents(); 239 241 reporter.doPollWork('ProgressWrapper.waitForTask'); 240 242 fState = self.pollTask(False); … … 696 698 except KeyboardInterrupt: raise; 697 699 except: pass; 700 if self.fnProcessEvents: 701 self.fnProcessEvents(); 698 702 reporter.doPollWork('SessionWrapper.waitForTask'); 699 703 fState = self.pollTask(False); … … 2978 2982 # Kick off the task. 2979 2983 try: 2980 oTask = TxsConnectTask(self, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup); 2984 oTask = TxsConnectTask(self, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup, 2985 fnProcessEvents = self.oTstDrv.processPendingEvents); 2981 2986 except: 2982 2987 reporter.errorXcpt(); … … 2998 3003 2999 3004 oTxsSession = txsclient.tryOpenTcpSession(cMsTimeout, sHostname, fReversedSetup = fReversed, 3000 cMsIdleFudge = cMsTimeout // 2); 3005 cMsIdleFudge = cMsTimeout // 2, 3006 fnProcessEvents = self.oTstDrv.processPendingEvents); 3001 3007 if oTxsSession is None: 3002 3008 return False; … … 3046 3052 3047 3053 3048 def __init__(self, oSession, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup ):3054 def __init__(self, oSession, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup, fnProcessEvents = None): 3049 3055 TdTaskBase.__init__(self, utils.getCallerName()); 3050 3056 self.cMsTimeout = cMsTimeout; 3057 self.fnProcessEvents = fnProcessEvents; 3051 3058 self.sIpAddr = None; 3052 3059 self.sNextIpAddr = None; … … 3147 3154 self.oCv.acquire(); 3148 3155 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' % 3150 3157 (sIpAddr, uPort if uPort is not None else 0, fReversedSetup)); 3151 3158 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); 3154 3161 self.oTxsSession.setTaskOwner(self); 3155 3162 else:
Note:
See TracChangeset
for help on using the changeset viewer.