Changeset 79067 in vbox for trunk/src/VBox/ValidationKit/tests/installation
- Timestamp:
- Jun 10, 2019 10:56:46 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131227
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/installation/tdGuestOsUnattendedInst1.py
r79056 r79067 50 50 from testdriver import vboxtestvms; 51 51 52 # Sub-test driver imports. 53 sys.path.append(os.path.join(g_ksValidationKitDir, 'tests', 'additions')); 54 from tdAddGuestCtrl import SubTstDrvAddGuestCtrl; 55 from tdAddSharedFolders1 import SubTstDrvAddSharedFolders1; 56 52 57 53 58 class UnattendedVm(vboxtestvms.BaseTestVm): … … 64 69 kasIdeIrqDelay = [ 'VBoxInternal/Devices/piix3ide/0/Config/IRQDelay:1', ]; 65 70 66 ## Install ISO paths relative to the testrsrc root.67 kasIosPathBases = [ os.path.join('6.0', 'isos'), os.path.join('6.1', 'isos'), ];68 69 71 def __init__(self, oSet, sVmName, sKind, sInstallIso, fFlags = 0): 70 72 vboxtestvms.BaseTestVm.__init__(self, sVmName, oSet = oSet, sKind = sKind, 71 73 fRandomPvPModeCrap = False if (fFlags & self.kfNoWin81Paravirt) else True); 72 self.sInstallIso = sInstallIso;73 self.fInstVmFlags = fFlags;74 self.sInstallIso = sInstallIso; 75 self.fInstVmFlags = fFlags; 74 76 75 77 # Adjustments over the defaults. 76 self.iOptRamAdjust = 0;77 self.fOptIoApic = None;78 self.fOptPae = None;79 self.fOptInstall GAs= False;80 self.asOptExtraData = [];78 self.iOptRamAdjust = 0; 79 self.fOptIoApic = None; 80 self.fOptPae = None; 81 self.fOptInstallAdditions = False; 82 self.asOptExtraData = []; 81 83 if fFlags & self.kfIdeIrqDelay: 82 self.asOptExtraData = self.kasIdeIrqDelay;84 self.asOptExtraData = self.kasIdeIrqDelay; 83 85 84 86 def _unattendedConfigure(self, oIUnattended, oTestDrv): # type: (Any, vbox.TestDriver) -> bool … … 104 106 # Install GAs? 105 107 # 106 if self.fOptInstall GAs:108 if self.fOptInstallAdditions: 107 109 try: oIUnattended.installGuestAdditions = True; 108 110 except: return reporter.errorXcpt(); … … 179 181 # 180 182 183 def getResourceSet(self): 184 if not os.path.isabs(self.sInstallIso): 185 return [self.sInstallIso,]; 186 return []; 187 181 188 def _createVmPost(self, oTestDrv, oVM, eNic0AttachType, sDvdImage): 182 189 # … … 190 197 fRc = True; 191 198 192 # Set proper boot order (needed?)193 fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk)194 fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_DVD)199 ## Set proper boot order - IUnattended::reconfigureVM does this, doesn't it? 200 #fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk) 201 #fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_DVD) 195 202 196 203 # Adjust memory if requested. 197 204 if self.iOptRamAdjust != 0: 198 205 try: cMbRam = oSession.o.machine.memorySize; 199 except: fRc = reporter.errorXcpt();206 except: fRc = reporter.errorXcpt(); 200 207 else: 201 fRc = fRc and oSession.setRamSize(cMbRam + self.iOptRamAdjust);208 fRc = oSession.setRamSize(cMbRam + self.iOptRamAdjust) and fRc; 202 209 203 210 # I/O APIC: 204 211 if self.fOptIoApic is not None: 205 fRc = fRc and oSession.enableIoApic(self.fOptIoApic);212 fRc = oSession.enableIoApic(self.fOptIoApic) and fRc; 206 213 207 214 # I/O APIC: 208 215 if self.fOptPae is not None: 209 fRc = fRc and oSession.enablePae(self.fOptPae);216 fRc = oSession.enablePae(self.fOptPae) and fRc; 210 217 211 218 # Set extra data 212 219 for sExtraData in self.asOptExtraData: 213 try: 214 sKey, sValue = sExtraData.split(':') 215 except ValueError: 216 raise base.InvalidOption('Invalid extradata specified: %s' % sExtraData) 220 sKey, sValue = sExtraData.split(':'); 217 221 reporter.log('Set extradata: %s => %s' % (sKey, sValue)) 218 fRc = fRc and oSession.setExtraData(sKey, sValue)222 fRc = oSession.setExtraData(sKey, sValue) and fRc; 219 223 220 224 # Save the settings. … … 272 276 return True; 273 277 278 274 279 # 275 280 # Our methods. … … 330 335 class tdGuestOsInstTest1(vbox.TestDriver): 331 336 """ 332 Guest OS installation tests.337 Unattended Guest OS installation tests using IUnattended. 333 338 334 339 Scenario: 335 - Create new VM that corresponds specified installation ISO image. 336 - Create HDD that corresponds to OS type that will be installed. 337 - Boot VM from ISO image (i.e. install guest OS). 338 - Wait for incomming TCP connection (guest should initiate such a 339 connection in case installation has been completed successfully). 340 - Create a new VM with default settings using IMachine::applyDefaults. 341 - Setup unattended installation using IUnattended. 342 - Start the VM and do the installation. 343 - Wait for TXS to report for service. 344 - If installing GAs: 345 - Wait for GAs to report operational runlevel. 346 - Save & restore state. 347 - If installing GAs: 348 - Test guest properties (todo). 349 - Test guest controls. 350 - Test shared folders. 340 351 """ 341 352 … … 349 360 assert self.fEnableVrdp; # in parent driver. 350 361 362 351 363 # 352 364 # Our install test VM set. … … 354 366 oSet = vboxtestvms.TestVmSet(self.oTestVmManager, fIgnoreSkippedVm = True); 355 367 oSet.aoTestVms.extend([ 356 UnattendedVm(oSet, 'tst-w7-32', 'Windows7', ' en_windows_7_enterprise_x86_dvd_x15-70745.iso'),368 UnattendedVm(oSet, 'tst-w7-32', 'Windows7', '6.0/uaisos/en_windows_7_enterprise_x86_dvd_x15-70745.iso'), 357 369 ]); 358 370 self.oTestVmSet = oSet; … … 363 375 # Number of VMs to test in parallel: 364 376 self.cInParallel = 1; 377 378 # Whether to do the save-and-restore test. 379 self.fTestSaveAndRestore = True; 380 381 # 382 # Sub-test drivers. 383 # 384 self.addSubTestDriver(SubTstDrvAddSharedFolders1(self)); 385 self.addSubTestDriver(SubTstDrvAddGuestCtrl(self)); 386 365 387 366 388 # … … 450 472 elif asArgs[iArg] == '--set-extradata': 451 473 iArg = self.requireMoreArgs(1, asArgs, iArg) 452 for oTestVm in self.aoSelectedVms: 453 oTestVm.asOptExtraData.append(asArgs[iArg]); 474 sExtraData = asArgs[iArg]; 475 try: _, _ = sExtraData.split(':'); 476 except: raise base.InvalidOption('Invalid extradata specified: %s' % (sExtraData, )); 477 for oTestVm in self.aoSelectedVms: 478 oTestVm.asOptExtraData.append(sExtraData); 454 479 elif asArgs[iArg] == '--ioapic': 455 480 for oTestVm in self.aoSelectedVms: … … 466 491 elif asArgs[iArg] == '--install-additions': 467 492 for oTestVm in self.aoSelectedVms: 468 oTestVm.fOptInstall GAs = True;493 oTestVm.fOptInstallAdditions = True; 469 494 elif asArgs[iArg] == '--no-install-additions': 470 495 for oTestVm in self.aoSelectedVms: 471 oTestVm.fOptInstall GAs = False;496 oTestVm.fOptInstallAdditions = False; 472 497 else: 473 498 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 491 516 492 517 self.logVmInfo(oVM) 493 reporter.testStart('Installing %s%s' % (oTestVm.sVmName, ' with GAs' if oTestVm.fOptInstall GAs else ''))518 reporter.testStart('Installing %s%s' % (oTestVm.sVmName, ' with GAs' if oTestVm.fOptInstallAdditions else '')) 494 519 495 520 cMsTimeout = 40*60000; … … 497 522 cMsTimeout = 180 * 60000; # will be adjusted down. 498 523 499 oSession, _= self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);524 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout); 500 525 #oSession = self.startVmByName(oTestVm.sVmName); # (for quickly testing waitForGAs) 501 526 if oSession is not None: 502 527 # The guest has connected to TXS. 503 528 reporter.log('Guest reported success via TXS.'); 504 #reporter.log('VM started...'); # (for quickly testing waitForGAs)529 reporter.testDone(); 505 530 506 531 # If we're installing GAs, wait for them to come online: 507 532 fRc = True; 508 if oTestVm.fOptInstallGAs: 533 if oTestVm.fOptInstallAdditions: 534 reporter.testStart('Guest additions'); 509 535 aenmRunLevels = [vboxcon.AdditionsRunLevelType_Userland,]; 510 536 if oTestVm.isLoggedOntoDesktop(): 511 537 aenmRunLevels.append(vboxcon.AdditionsRunLevelType_Desktop); 512 538 fRc = self.waitForGAs(oSession, cMsTimeout = cMsTimeout / 2, aenmWaitForRunLevels = aenmRunLevels); 539 reporter.testDone(); 513 540 514 541 # Now do a save & restore test: 515 if fRc is True :516 pass; ## @todo Do save + restore.542 if fRc is True and self.fTestSaveAndRestore: 543 fRc, oSession, oTxsSession = self.testSaveAndRestore(oSession, oTxsSession, oTestVm); 517 544 518 545 # Test GAs if requested: 519 if oTestVm.fOptInstallGAs and fRc is True: 520 pass; 521 522 reporter.testDone() 523 fRc = self.terminateVmBySession(oSession) and fRc; 546 if oTestVm.fOptInstallAdditions and fRc is True: 547 for oSubTstDrv in self.aoSubTstDrvs: 548 if oSubTstDrv.fEnabled: 549 reporter.testStart(oSubTstDrv.sTestName); 550 fRc2, oTxsSession = oSubTstDrv.testIt(oTestVm, oSession, oTxsSession); 551 reporter.testDone(fRc2 is None); 552 if fRc2 is False: 553 fRc = False; 554 555 if oSession is not None: 556 fRc = self.terminateVmBySession(oSession) and fRc; 524 557 return fRc is True 525 558 … … 529 562 return False 530 563 564 def testSaveAndRestore(self, oSession, oTxsSession, oTestVm): 565 """ 566 Tests saving and restoring the VM. 567 """ 568 _ = oTestVm; 569 reporter.testStart('Save'); 570 ## @todo 571 reporter.testDone(); 572 reporter.testStart('Restore'); 573 ## @todo 574 reporter.testDone(); 575 return (True, oSession, oTxsSession); 576 531 577 if __name__ == '__main__': 532 578 sys.exit(tdGuestOsInstTest1().main(sys.argv))
Note:
See TracChangeset
for help on using the changeset viewer.