Changeset 84185 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- May 7, 2020 12:29:49 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddBasic1.py
r84180 r84185 81 81 reporter.log('onAdditionsStateChange'); 82 82 self.oTstDrv.fGAStatusCallbackFired = True; 83 self.oTstDrv. iGAStatusCallbackRunlevel = self.oGuest.additionsRunLevel;83 self.oTstDrv.eGAStatusCallbackRunlevel = self.oGuest.additionsRunLevel; 84 84 self.oVBoxMgr.interruptWaitEvents(); 85 85 return None; … … 106 106 107 107 self.fGAStatusCallbackFired = False; 108 self. iGAStatusCallbackRunlevel = 0;108 self.eGAStatusCallbackRunlevel = 0; 109 109 110 110 # … … 249 249 """ 250 250 # No need to wait as we already reached the run level? 251 if eRunLevel == oGuest.additionsRunLevel: 251 eRunLevelCur = oGuest.additionsRunLevel; 252 if eRunLevelCur == eRunLevel: 252 253 reporter.log('Already reached run level %s' % eRunLevel); 253 254 return True; 254 255 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)); 256 258 257 259 oConsoleCallbacks = oSession.registerDerivedEventHandler(tdAddBasicConsoleCallbacks, \ … … 266 268 break; 267 269 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: 270 273 fRc = True; 271 274 break; 272 275 self.fGAStatusCallbackFired = False; 273 276 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)); 275 278 else: 276 279 reporter.error('Guest Additions run level not reached'); … … 278 281 # cleanup. 279 282 oConsoleCallbacks.unregister(); 283 else: 284 reporter.error('Registering derived event handler failed'); 280 285 281 286 if not fRc: … … 295 300 (oTestVm.sKind, oTestVm.sVmName,)); 296 301 fRc = False; 302 fRc = True; 297 303 298 304 # … … 308 314 return (False, oTxsSession); 309 315 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 310 321 # Check the additionsVersion attribute. It must not be empty. 311 322 reporter.testStart('IGuest::additionsVersion'); 312 323 fRc = self.testIGuest_additionsVersion(oGuest); 313 324 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); 320 329 reporter.testDone(); 321 if not fRc:322 return (False, oTxsSession);323 324 ## @todo test IAdditionsFacilities.325 330 326 331 return (fRc, oTxsSession); … … 471 476 return (fRc, oTxsSession); 472 477 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 473 493 def testIGuest_additionsVersion(self, oGuest): 474 494 """ … … 498 518 return True; 499 519 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; 506 536 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; 510 592 511 593 def testGuestProperties(self, oSession, oTxsSession, oTestVm):
Note:
See TracChangeset
for help on using the changeset viewer.