Changeset 84137 in vbox
- Timestamp:
- May 4, 2020 1:36:02 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137732
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddBasic1.py
r84113 r84137 52 52 from tdAddSharedFolders1 import SubTstDrvAddSharedFolders1; 53 53 54 55 56 class tdAddBasicConsoleCallbacks(vbox.ConsoleEventHandlerBase): 57 """ 58 For catching the Guest Additions change state events. 59 """ 60 def __init__(self, dArgs): 61 oTstDrv = dArgs['oTstDrv']; 62 oVBoxMgr = dArgs['oVBoxMgr']; _ = oVBoxMgr; 63 oGuest = dArgs['oGuest']; 64 65 vbox.ConsoleEventHandlerBase.__init__(self, dArgs, 'tdAddBasic1'); 66 self.oTstDrv = oTstDrv; 67 self.oGuest = oGuest; 68 69 def handleEvent(self, oEvt): 70 try: 71 oEvtBase = self.oVBoxMgr.queryInterface(oEvt, 'IEvent'); 72 eType = oEvtBase.type; 73 except: 74 reporter.logXcpt(); 75 return None; 76 if eType == vboxcon.VBoxEventType_OnAdditionsStateChanged: 77 return self.onAdditionsStateChanged(); 78 return None; 79 80 def onAdditionsStateChanged(self): 81 reporter.log('onAdditionsStateChange'); 82 self.oTstDrv.fGAStatusCallbackFired = True; 83 self.oTstDrv.iGAStatusCallbackRunlevel = self.oGuest.additionsRunLevel; 84 self.oVBoxMgr.interruptWaitEvents(); 85 return None; 54 86 55 87 class tdAddBasic1(vbox.TestDriver): # pylint: disable=too-many-instance-attributes … … 72 104 self.addSubTestDriver(SubTstDrvAddGuestCtrl(self)); 73 105 self.addSubTestDriver(SubTstDrvAddSharedFolders1(self)); 106 107 self.fGAStatusCallbackFired = False; 108 self.iGAStatusCallbackRunlevel = 0; 74 109 75 110 # … … 207 242 return fRc; 208 243 244 def waitForGuestAdditionsRunLevel(self, oSession, oGuest, cMsTimeout, iRunLevel): 245 """ 246 Waits for the Guest Additions to reach a specific run level. 247 248 Returns success status. 249 """ 250 # No need to wait as we already reached the run level? 251 if iRunLevel == oGuest.additionsRunLevel: 252 reporter.log('Already reached run level %s' % iRunLevel); 253 return True; 254 255 reporter.log('Waiting for Guest Additions to reach run level %s ...' % iRunLevel); 256 257 oConsoleCallbacks = oSession.registerDerivedEventHandler(tdAddBasicConsoleCallbacks, \ 258 {'oTstDrv':self, 'oGuest':oGuest, }); 259 fRc = False; 260 if oConsoleCallbacks is not None: 261 # Wait for 5 minutes max. 262 tsStart = base.timestampMilli(); 263 while base.timestampMilli() - tsStart < cMsTimeout: 264 oTask = self.waitForTasks(1000); 265 if oTask is not None: 266 break; 267 if self.fGAStatusCallbackFired: 268 reporter.log('Reached new run level %s' % iRunLevel); 269 if iRunLevel == self.iGAStatusCallbackRunlevel: 270 fRc = True; 271 break; 272 self.fGAStatusCallbackFired = False; 273 if not fRc: 274 reporter.testFailure('Guest Additions status did not change to required level'); 275 276 # cleanup. 277 oConsoleCallbacks.unregister(); 278 279 reporter.log('Waiting for Guest Additions to reach run level %s ended with %s' % (iRunLevel, fRc)); 280 return fRc; 281 209 282 def testInstallAdditions(self, oSession, oTxsSession, oTestVm): 210 283 """ … … 223 296 # Verify installation of Guest Additions using commmon bits. 224 297 # 225 if fRc is True: 226 # 227 # Wait for the GAs to come up. 228 # 229 230 ## @todo need to signed up for a OnAdditionsStateChanged and wait runlevel to 231 # at least reach Userland. 232 298 if fRc: 233 299 # 234 300 # Check if the additions are operational. … … 237 303 except: 238 304 reporter.errorXcpt('Getting IGuest failed.'); 305 return (False, oTxsSession); 306 307 # 308 # Wait for the GAs to come up. 309 # 310 fRc = self.waitForGuestAdditionsRunLevel(oSession, oGuest, 5 * 60 * 1000, vboxcon.AdditionsRunLevelType_Userland); 311 if not fRc: 239 312 return (False, oTxsSession); 240 313
Note:
See TracChangeset
for help on using the changeset viewer.