Changeset 79056 in vbox for trunk/src/VBox/ValidationKit/tests/installation
- Timestamp:
- Jun 9, 2019 8:55:56 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131214
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/installation/tdGuestOsUnattendedInst1.py
r79046 r79056 77 77 self.fOptIoApic = None; 78 78 self.fOptPae = None; 79 self.fOptInstallGAs = False; 79 80 self.asOptExtraData = []; 80 81 if fFlags & self.kfIdeIrqDelay: 81 82 self.asOptExtraData = self.kasIdeIrqDelay; 83 84 def _unattendedConfigure(self, oIUnattended, oTestDrv): # type: (Any, vbox.TestDriver) -> bool 85 """ 86 Configures the unattended install object. 87 88 The ISO attribute has been set and detectIsoOS has been done, the rest of the 89 setup is done here. 90 91 Returns True on success, False w/ errors logged on failure. 92 """ 93 94 # 95 # Make it install the TXS. 96 # 97 try: oIUnattended.installTestExecService = True; 98 except: return reporter.errorXcpt(); 99 try: oIUnattended.validationKitIsoPath = oTestDrv.sVBoxValidationKitIso; 100 except: return reporter.errorXcpt(); 101 oTestDrv.processPendingEvents(); 102 103 # 104 # Install GAs? 105 # 106 if self.fOptInstallGAs: 107 try: oIUnattended.installGuestAdditions = True; 108 except: return reporter.errorXcpt(); 109 try: oIUnattended.additionsIsoPath = oTestDrv.getGuestAdditionsIso(); 110 except: return reporter.errorXcpt(); 111 oTestDrv.processPendingEvents(); 112 113 return True; 114 115 def _unattendedDoIt(self, oIUnattended, oVM, oTestDrv): # type: (Any, Any, vbox.TestDriver) -> bool 116 """ 117 Does the unattended installation preparing, media construction and VM reconfiguration. 118 119 Returns True on success, False w/ errors logged on failure. 120 """ 121 122 # Associate oVM with the installer: 123 try: 124 oIUnattended.machine = oVM; 125 except: 126 return reporter.errorXcpt(); 127 oTestDrv.processPendingEvents(); 128 129 # Prepare and log it: 130 try: 131 oIUnattended.prepare(); 132 except: 133 return reporter.errorXcpt("IUnattended.prepare failed"); 134 oTestDrv.processPendingEvents(); 135 136 reporter.log('IUnattended attributes after prepare():'); 137 self._unattendedLogIt(oIUnattended, oTestDrv); 138 139 # Create media: 140 try: 141 oIUnattended.constructMedia(); 142 except: 143 return reporter.errorXcpt("IUnattended.constructMedia failed"); 144 oTestDrv.processPendingEvents(); 145 146 # Reconfigure the VM: 147 try: 148 oIUnattended.reconfigureVM(); 149 except: 150 return reporter.errorXcpt("IUnattended.reconfigureVM failed"); 151 oTestDrv.processPendingEvents(); 152 153 return True; 154 155 def _unattendedLogIt(self, oIUnattended, oTestDrv): 156 """ 157 Logs the attributes of the unattended installation object. 158 """ 159 fRc = True; 160 asAttribs = ( 'isoPath', 'user', 'password', 'fullUserName', 'productKey', 'additionsIsoPath', 'installGuestAdditions', 161 'validationKitIsoPath', 'installTestExecService', 'timeZone', 'locale', 'language', 'country', 'proxy', 162 'packageSelectionAdjustments', 'hostname', 'auxiliaryBasePath', 'imageIndex', 'machine', 163 'scriptTemplatePath', 'postInstallScriptTemplatePath', 'postInstallCommand', 164 'extraInstallKernelParameters', 'detectedOSTypeId', 'detectedOSVersion', 'detectedOSLanguages', 165 'detectedOSFlavor', 'detectedOSHints', ); 166 for sAttrib in asAttribs: 167 try: 168 oValue = getattr(oIUnattended, sAttrib); 169 except: 170 fRc = reporter.errorXcpt('sAttrib=%s' % sAttrib); 171 else: 172 reporter.log('%s: %s' % (sAttrib.rjust(32), oValue,)); 173 oTestDrv.processPendingEvents(); 174 return fRc; 82 175 83 176 … … 172 265 return (fRc, oVM) 173 266 267 def isLoggedOntoDesktop(self): 268 # 269 # Normally all unattended installations should end up on the desktop. 270 # An exception is a minimal install, but we currently don't support that. 271 # 272 return True; 273 174 274 # 175 275 # Our methods. … … 226 326 227 327 return True; 228 229 def _unattendedConfigure(self, oIUnattended, oTestDrv): # type: (Any, vbox.TestDriver) -> bool230 """231 Configures the unattended install object.232 233 The ISO attribute has been set and detectIsoOS has been done, the rest of the234 setup is done here.235 236 Returns True on success, False w/ errors logged on failure.237 """238 239 #240 # Make it install the TXS.241 #242 try: oIUnattended.installTestExecService = True;243 except: return reporter.errorXcpt();244 try: oIUnattended.validationKitIsoPath = oTestDrv.sVBoxValidationKitIso;245 except: return reporter.errorXcpt();246 247 return True;248 249 def _unattendedDoIt(self, oIUnattended, oVM, oTestDrv): # type: (Any, Any, vbox.TestDriver) -> bool250 """251 Does the unattended installation preparing, media construction and VM reconfiguration.252 253 Returns True on success, False w/ errors logged on failure.254 """255 256 # Associate oVM with the installer:257 try:258 oIUnattended.machine = oVM;259 except:260 return reporter.errorXcpt();261 oTestDrv.processPendingEvents();262 263 # Prepare:264 try:265 oIUnattended.prepare();266 except:267 return reporter.errorXcpt("IUnattended.prepare failed");268 oTestDrv.processPendingEvents();269 270 # Create media:271 try:272 oIUnattended.constructMedia();273 except:274 return reporter.errorXcpt("IUnattended.constructMedia failed");275 oTestDrv.processPendingEvents();276 277 # Reconfigure the VM:278 try:279 oIUnattended.reconfigureVM();280 except:281 return reporter.errorXcpt("IUnattended.reconfigureVM failed");282 oTestDrv.processPendingEvents();283 284 return True;285 286 def _unattendedLogIt(self, oIUnattended):287 """288 Logs the attributes of the unattended installation object.289 """290 fRc = True;291 asAttribs = ( 'isoPath', 'user', 'password ', 'fullUserName', 'productKey', 'additionsIsoPath', 'installGuestAdditions',292 'validationKitIsoPath', 'installTestExecService', 'timeZone', 'locale', 'language', 'country', 'proxy',293 'packageSelectionAdjustments', 'hostname', 'auxiliaryBasePath', 'imageIndex', 'machine',294 'scriptTemplatePath', 'postInstallScriptTemplatePath', 'postInstallCommand',295 'extraInstallKernelParameters', 'detectedOSTypeId', 'detectedOSVersion', 'detectedOSLanguages',296 'detectedOSFlavor', 'detectedOSHints', );297 for sAttrib in asAttribs:298 try:299 oValue = getattr(oIUnattended, sAttrib);300 except:301 fRc = reporter.errorXcpt('sAttrib=%s' % sAttrib);302 else:303 reporter.log('%s: %s' % (sAttrib.rjust(32), oValue,));304 return fRc;305 328 306 329 … … 441 464 for oTestVm in self.aoSelectedVms: 442 465 oTestVm.fOptPae = False; 466 elif asArgs[iArg] == '--install-additions': 467 for oTestVm in self.aoSelectedVms: 468 oTestVm.fOptInstallGAs = True; 469 elif asArgs[iArg] == '--no-install-additions': 470 for oTestVm in self.aoSelectedVms: 471 oTestVm.fOptInstallGAs = False; 443 472 else: 444 473 return vbox.TestDriver.parseOption(self, asArgs, iArg); … … 456 485 return self.oTestVmSet.actionExecute(self, self.testOneVmConfig) 457 486 458 def testOneVmConfig(self, oVM, oTestVm): 487 def testOneVmConfig(self, oVM, oTestVm): # type: (Any, UnattendedVm) -> bool 459 488 """ 460 489 Install guest OS and wait for result … … 462 491 463 492 self.logVmInfo(oVM) 464 reporter.testStart('Installing %s ' % (oTestVm.sVmName,))493 reporter.testStart('Installing %s%s' % (oTestVm.sVmName, ' with GAs' if oTestVm.fOptInstallGAs else '')) 465 494 466 495 cMsTimeout = 40*60000; … … 469 498 470 499 oSession, _ = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout); 500 #oSession = self.startVmByName(oTestVm.sVmName); # (for quickly testing waitForGAs) 471 501 if oSession is not None: 472 # The guest has connected to TXS, so we're done (for now anyways). 473 reporter.log('Guest reported success') 474 ## @todo Do save + restore. 502 # The guest has connected to TXS. 503 reporter.log('Guest reported success via TXS.'); 504 #reporter.log('VM started...'); # (for quickly testing waitForGAs) 505 506 # If we're installing GAs, wait for them to come online: 507 fRc = True; 508 if oTestVm.fOptInstallGAs: 509 aenmRunLevels = [vboxcon.AdditionsRunLevelType_Userland,]; 510 if oTestVm.isLoggedOntoDesktop(): 511 aenmRunLevels.append(vboxcon.AdditionsRunLevelType_Desktop); 512 fRc = self.waitForGAs(oSession, cMsTimeout = cMsTimeout / 2, aenmWaitForRunLevels = aenmRunLevels); 513 514 # Now do a save & restore test: 515 if fRc is True: 516 pass; ## @todo Do save + restore. 517 518 # Test GAs if requested: 519 if oTestVm.fOptInstallGAs and fRc is True: 520 pass; 475 521 476 522 reporter.testDone() 477 fRc = self.terminateVmBySession(oSession) 523 fRc = self.terminateVmBySession(oSession) and fRc; 478 524 return fRc is True 479 525 480 526 reporter.error('Installation of %s has failed' % (oTestVm.sVmName,)) 481 oTestVm.detatchAndDeleteHd(self); # Save space.527 #oTestVm.detatchAndDeleteHd(self); # Save space. 482 528 reporter.testDone() 483 529 return False
Note:
See TracChangeset
for help on using the changeset viewer.