1 | #!/usr/bin/env python
|
---|
2 | # -*- coding: utf-8 -*-
|
---|
3 | # $Id: tdGuestOsUnattendedInst1.py 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
4 |
|
---|
5 | """
|
---|
6 | VirtualBox Validation Kit - Guest OS unattended installation tests.
|
---|
7 | """
|
---|
8 |
|
---|
9 | __copyright__ = \
|
---|
10 | """
|
---|
11 | Copyright (C) 2010-2022 Oracle and/or its affiliates.
|
---|
12 |
|
---|
13 | This file is part of VirtualBox base platform packages, as
|
---|
14 | available from https://www.virtualbox.org.
|
---|
15 |
|
---|
16 | This program is free software; you can redistribute it and/or
|
---|
17 | modify it under the terms of the GNU General Public License
|
---|
18 | as published by the Free Software Foundation, in version 3 of the
|
---|
19 | License.
|
---|
20 |
|
---|
21 | This program is distributed in the hope that it will be useful, but
|
---|
22 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
24 | General Public License for more details.
|
---|
25 |
|
---|
26 | You should have received a copy of the GNU General Public License
|
---|
27 | along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
28 |
|
---|
29 | The contents of this file may alternatively be used under the terms
|
---|
30 | of the Common Development and Distribution License Version 1.0
|
---|
31 | (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
32 | in the VirtualBox distribution, in which case the provisions of the
|
---|
33 | CDDL are applicable instead of those of the GPL.
|
---|
34 |
|
---|
35 | You may elect to license modified versions of this file under the
|
---|
36 | terms and conditions of either the GPL or the CDDL or both.
|
---|
37 |
|
---|
38 | SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
39 | """
|
---|
40 | __version__ = "$Revision: 96407 $"
|
---|
41 |
|
---|
42 |
|
---|
43 | # Standard Python imports.
|
---|
44 | import copy;
|
---|
45 | import os;
|
---|
46 | import sys;
|
---|
47 |
|
---|
48 |
|
---|
49 | # Only the main script needs to modify the path.
|
---|
50 | try: __file__
|
---|
51 | except: __file__ = sys.argv[0]
|
---|
52 | g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
---|
53 | sys.path.append(g_ksValidationKitDir)
|
---|
54 |
|
---|
55 | # Validation Kit imports.
|
---|
56 | from testdriver import vbox;
|
---|
57 | from testdriver import base;
|
---|
58 | from testdriver import reporter;
|
---|
59 | from testdriver import vboxcon;
|
---|
60 | from testdriver import vboxtestvms;
|
---|
61 | from common import utils;
|
---|
62 |
|
---|
63 | # Sub-test driver imports.
|
---|
64 | sys.path.append(os.path.join(g_ksValidationKitDir, 'tests', 'additions'));
|
---|
65 | from tdAddGuestCtrl import SubTstDrvAddGuestCtrl;
|
---|
66 | from tdAddSharedFolders1 import SubTstDrvAddSharedFolders1;
|
---|
67 |
|
---|
68 |
|
---|
69 | class UnattendedVm(vboxtestvms.BaseTestVm):
|
---|
70 | """ Unattended Installation test VM. """
|
---|
71 |
|
---|
72 | ## @name VM option flags (OR together).
|
---|
73 | ## @{
|
---|
74 | kfUbuntuAvx2Crash = 0x0001; ##< Disables AVX2 as ubuntu 16.04 think it means AVX512 is available and compiz crashes.
|
---|
75 | kfNoGAs = 0x0002; ##< No guest additions installation possible.
|
---|
76 | kfKeyFile = 0x0004; ##< ISO requires a .key file containing the product key.
|
---|
77 | kfNeedCom1 = 0x0008; ##< Need serial port, typically for satifying the windows kernel debugger.
|
---|
78 |
|
---|
79 | kfIdeIrqDelay = 0x1000;
|
---|
80 | kfUbuntuNewAmdBug = 0x2000;
|
---|
81 | kfNoWin81Paravirt = 0x4000;
|
---|
82 | kfAvoidNetwork = 0x8000;
|
---|
83 | ## @}
|
---|
84 |
|
---|
85 | ## kfUbuntuAvx2Crash: Extra data that disables AVX2.
|
---|
86 | kasUbuntuAvx2Crash = [ '/CPUM/IsaExts/AVX2:0', ];
|
---|
87 |
|
---|
88 | ## IRQ delay extra data config for win2k VMs.
|
---|
89 | kasIdeIrqDelay = [ 'VBoxInternal/Devices/piix3ide/0/Config/IRQDelay:1', ];
|
---|
90 |
|
---|
91 | def __init__(self, oSet, sVmName, sKind, sInstallIso, fFlags = 0):
|
---|
92 | vboxtestvms.BaseTestVm.__init__(self, sVmName, oSet = oSet, sKind = sKind,
|
---|
93 | fRandomPvPModeCrap = (fFlags & self.kfNoWin81Paravirt) == 0);
|
---|
94 | self.sInstallIso = sInstallIso;
|
---|
95 | self.fInstVmFlags = fFlags;
|
---|
96 |
|
---|
97 | # Adjustments over the defaults.
|
---|
98 | self.iOptRamAdjust = 0;
|
---|
99 | self.fOptIoApic = None;
|
---|
100 | self.fOptPae = None;
|
---|
101 | self.fOptInstallAdditions = False;
|
---|
102 | self.asOptExtraData = [];
|
---|
103 | if fFlags & self.kfUbuntuAvx2Crash:
|
---|
104 | self.asOptExtraData += self.kasUbuntuAvx2Crash;
|
---|
105 | if fFlags & self.kfIdeIrqDelay:
|
---|
106 | self.asOptExtraData += self.kasIdeIrqDelay;
|
---|
107 | if fFlags & self.kfNeedCom1:
|
---|
108 | self.fCom1RawFile = True;
|
---|
109 |
|
---|
110 | def _unattendedConfigure(self, oIUnattended, oTestDrv): # type: (Any, vbox.TestDriver) -> bool
|
---|
111 | """
|
---|
112 | Configures the unattended install object.
|
---|
113 |
|
---|
114 | The ISO attribute has been set and detectIsoOS has been done, the rest of the
|
---|
115 | setup is done here.
|
---|
116 |
|
---|
117 | Returns True on success, False w/ errors logged on failure.
|
---|
118 | """
|
---|
119 |
|
---|
120 | #
|
---|
121 | # Make it install the TXS.
|
---|
122 | #
|
---|
123 | try: oIUnattended.installTestExecService = True;
|
---|
124 | except: return reporter.errorXcpt();
|
---|
125 | try: oIUnattended.validationKitIsoPath = oTestDrv.sVBoxValidationKitIso;
|
---|
126 | except: return reporter.errorXcpt();
|
---|
127 | oTestDrv.processPendingEvents();
|
---|
128 |
|
---|
129 | #
|
---|
130 | # Avoid using network during unattended install (stalls Debian installs).
|
---|
131 | #
|
---|
132 | if self.fInstVmFlags & UnattendedVm.kfAvoidNetwork:
|
---|
133 | try: oIUnattended.avoidUpdatesOverNetwork = True;
|
---|
134 | except: return reporter.errorXcpt();
|
---|
135 |
|
---|
136 | #
|
---|
137 | # Install GAs?
|
---|
138 | #
|
---|
139 | if self.fOptInstallAdditions:
|
---|
140 | if (self.fInstVmFlags & self.kfNoGAs) == 0:
|
---|
141 | try: oIUnattended.installGuestAdditions = True;
|
---|
142 | except: return reporter.errorXcpt();
|
---|
143 | try: oIUnattended.additionsIsoPath = oTestDrv.getGuestAdditionsIso();
|
---|
144 | except: return reporter.errorXcpt();
|
---|
145 | oTestDrv.processPendingEvents();
|
---|
146 | else:
|
---|
147 | reporter.log("Warning! Ignoring request to install Guest Additions as kfNoGAs is set!");
|
---|
148 |
|
---|
149 | #
|
---|
150 | # Product key?
|
---|
151 | #
|
---|
152 | if self.fInstVmFlags & UnattendedVm.kfKeyFile:
|
---|
153 | sKeyFile = '';
|
---|
154 | sKey = '';
|
---|
155 | try:
|
---|
156 | sKeyFile = oIUnattended.isoPath + '.key';
|
---|
157 | oFile = utils.openNoInherit(sKeyFile);
|
---|
158 | for sLine in oFile:
|
---|
159 | sLine = sLine.strip();
|
---|
160 | if sLine and not sLine.startswith(';') and not sLine.startswith('#') and not sLine.startswith('//'):
|
---|
161 | sKey = sLine;
|
---|
162 | break;
|
---|
163 | oFile.close();
|
---|
164 | except:
|
---|
165 | return reporter.errorXcpt('sKeyFile=%s' % (sKeyFile,));
|
---|
166 | if not sKey:
|
---|
167 | return reporter.error('No key in keyfile (%s)!' % (sKeyFile,));
|
---|
168 | try: oIUnattended.productKey = sKey;
|
---|
169 | except: return reporter.errorXcpt();
|
---|
170 |
|
---|
171 | return True;
|
---|
172 |
|
---|
173 | def _unattendedDoIt(self, oIUnattended, oVM, oTestDrv): # type: (Any, Any, vbox.TestDriver) -> bool
|
---|
174 | """
|
---|
175 | Does the unattended installation preparing, media construction and VM reconfiguration.
|
---|
176 |
|
---|
177 | Returns True on success, False w/ errors logged on failure.
|
---|
178 | """
|
---|
179 |
|
---|
180 | # Associate oVM with the installer:
|
---|
181 | try:
|
---|
182 | oIUnattended.machine = oVM;
|
---|
183 | except:
|
---|
184 | return reporter.errorXcpt();
|
---|
185 | oTestDrv.processPendingEvents();
|
---|
186 |
|
---|
187 | # Prepare and log it:
|
---|
188 | try:
|
---|
189 | oIUnattended.prepare();
|
---|
190 | except:
|
---|
191 | return reporter.errorXcpt("IUnattended.prepare failed");
|
---|
192 | oTestDrv.processPendingEvents();
|
---|
193 |
|
---|
194 | reporter.log('IUnattended attributes after prepare():');
|
---|
195 | self._unattendedLogIt(oIUnattended, oTestDrv);
|
---|
196 |
|
---|
197 | # Create media:
|
---|
198 | try:
|
---|
199 | oIUnattended.constructMedia();
|
---|
200 | except:
|
---|
201 | return reporter.errorXcpt("IUnattended.constructMedia failed");
|
---|
202 | oTestDrv.processPendingEvents();
|
---|
203 |
|
---|
204 | # Reconfigure the VM:
|
---|
205 | try:
|
---|
206 | oIUnattended.reconfigureVM();
|
---|
207 | except:
|
---|
208 | return reporter.errorXcpt("IUnattended.reconfigureVM failed");
|
---|
209 | oTestDrv.processPendingEvents();
|
---|
210 |
|
---|
211 | return True;
|
---|
212 |
|
---|
213 | def _unattendedLogIt(self, oIUnattended, oTestDrv):
|
---|
214 | """
|
---|
215 | Logs the attributes of the unattended installation object.
|
---|
216 | """
|
---|
217 | fRc = True;
|
---|
218 | asAttribs = ( 'isoPath', 'user', 'password', 'fullUserName', 'productKey', 'additionsIsoPath', 'installGuestAdditions',
|
---|
219 | 'validationKitIsoPath', 'installTestExecService', 'timeZone', 'locale', 'language', 'country', 'proxy',
|
---|
220 | 'packageSelectionAdjustments', 'hostname', 'auxiliaryBasePath', 'imageIndex', 'machine',
|
---|
221 | 'scriptTemplatePath', 'postInstallScriptTemplatePath', 'postInstallCommand',
|
---|
222 | 'extraInstallKernelParameters', 'detectedOSTypeId', 'detectedOSVersion', 'detectedOSLanguages',
|
---|
223 | 'detectedOSFlavor', 'detectedOSHints', );
|
---|
224 | for sAttrib in asAttribs:
|
---|
225 | try:
|
---|
226 | oValue = getattr(oIUnattended, sAttrib);
|
---|
227 | except:
|
---|
228 | fRc = reporter.errorXcpt('sAttrib=%s' % sAttrib);
|
---|
229 | else:
|
---|
230 | reporter.log('%s: %s' % (sAttrib.rjust(32), oValue,));
|
---|
231 | oTestDrv.processPendingEvents();
|
---|
232 | return fRc;
|
---|
233 |
|
---|
234 |
|
---|
235 | #
|
---|
236 | # Overriden methods.
|
---|
237 | #
|
---|
238 |
|
---|
239 | def getResourceSet(self):
|
---|
240 | asRet = [];
|
---|
241 | if not os.path.isabs(self.sInstallIso):
|
---|
242 | asRet.append(self.sInstallIso);
|
---|
243 | if self.fInstVmFlags & UnattendedVm.kfKeyFile:
|
---|
244 | asRet.append(self.sInstallIso + '.key');
|
---|
245 | return asRet;
|
---|
246 |
|
---|
247 | def _createVmDoIt(self, oTestDrv, eNic0AttachType, sDvdImage):
|
---|
248 | #
|
---|
249 | # Use HostOnly networking for ubuntu and debian VMs to prevent them from
|
---|
250 | # downloading updates and doing database updates during installation.
|
---|
251 | # We want predicable results.
|
---|
252 | #
|
---|
253 | if eNic0AttachType is None:
|
---|
254 | if self.isLinux() \
|
---|
255 | and ( 'ubuntu' in self.sKind.lower()
|
---|
256 | or 'debian' in self.sKind.lower()):
|
---|
257 | eNic0AttachType = vboxcon.NetworkAttachmentType_HostOnly;
|
---|
258 |
|
---|
259 | # Also use it for windows xp to prevent it from ever going online.
|
---|
260 | if self.sKind in ('WindowsXP','WindowsXP_64',):
|
---|
261 | eNic0AttachType = vboxcon.NetworkAttachmentType_HostOnly;
|
---|
262 |
|
---|
263 | #
|
---|
264 | # Use host-only networks instead of host-only adapters for trunk builds on Mac OS.
|
---|
265 | #
|
---|
266 | if eNic0AttachType == vboxcon.NetworkAttachmentType_HostOnly \
|
---|
267 | and utils.getHostOs() == 'darwin' \
|
---|
268 | and oTestDrv.fpApiVer >= 7.0:
|
---|
269 | eNic0AttachType = vboxcon.NetworkAttachmentType_HostOnlyNetwork;
|
---|
270 |
|
---|
271 | return vboxtestvms.BaseTestVm._createVmDoIt(self, oTestDrv, eNic0AttachType, sDvdImage);
|
---|
272 |
|
---|
273 |
|
---|
274 | def _createVmPost(self, oTestDrv, oVM, eNic0AttachType, sDvdImage):
|
---|
275 | #
|
---|
276 | # Adjust the ram, I/O APIC and stuff.
|
---|
277 | #
|
---|
278 | oSession = oTestDrv.openSession(oVM);
|
---|
279 | if oSession is None:
|
---|
280 | return None;
|
---|
281 |
|
---|
282 | fRc = True;
|
---|
283 |
|
---|
284 | ## Set proper boot order - IUnattended::reconfigureVM does this, doesn't it?
|
---|
285 | #fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk)
|
---|
286 | #fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_DVD)
|
---|
287 |
|
---|
288 | # Adjust memory if requested.
|
---|
289 | if self.iOptRamAdjust != 0:
|
---|
290 | try: cMbRam = oSession.o.machine.memorySize;
|
---|
291 | except: fRc = reporter.errorXcpt();
|
---|
292 | else:
|
---|
293 | fRc = oSession.setRamSize(cMbRam + self.iOptRamAdjust) and fRc;
|
---|
294 |
|
---|
295 | # I/O APIC:
|
---|
296 | if self.fOptIoApic is not None:
|
---|
297 | fRc = oSession.enableIoApic(self.fOptIoApic) and fRc;
|
---|
298 |
|
---|
299 | # I/O APIC:
|
---|
300 | if self.fOptPae is not None:
|
---|
301 | fRc = oSession.enablePae(self.fOptPae) and fRc;
|
---|
302 |
|
---|
303 | # Set extra data
|
---|
304 | for sExtraData in self.asOptExtraData:
|
---|
305 | sKey, sValue = sExtraData.split(':');
|
---|
306 | reporter.log('Set extradata: %s => %s' % (sKey, sValue))
|
---|
307 | fRc = oSession.setExtraData(sKey, sValue) and fRc;
|
---|
308 |
|
---|
309 | # Save the settings.
|
---|
310 | fRc = fRc and oSession.saveSettings()
|
---|
311 | fRc = oSession.close() and fRc;
|
---|
312 |
|
---|
313 | return oVM if fRc else None;
|
---|
314 |
|
---|
315 | def _skipVmTest(self, oTestDrv, oVM):
|
---|
316 | _ = oVM;
|
---|
317 | #
|
---|
318 | # Check for ubuntu installer vs. AMD host CPU.
|
---|
319 | #
|
---|
320 | if self.fInstVmFlags & self.kfUbuntuNewAmdBug:
|
---|
321 | if self.isHostCpuAffectedByUbuntuNewAmdBug(oTestDrv):
|
---|
322 | return True;
|
---|
323 |
|
---|
324 | return vboxtestvms.BaseTestVm._skipVmTest(self, oTestDrv, oVM);
|
---|
325 |
|
---|
326 | def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode = None):
|
---|
327 | #
|
---|
328 | # Do the standard reconfig in the base class first, it'll figure out
|
---|
329 | # if we can run the VM as requested.
|
---|
330 | #
|
---|
331 | (fRc, oVM) = vboxtestvms.BaseTestVm.getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode);
|
---|
332 | if fRc is True:
|
---|
333 | #
|
---|
334 | # Make sure there is no HD from the previous run attached nor taking
|
---|
335 | # up storage on the host.
|
---|
336 | #
|
---|
337 | fRc = self.recreateRecommendedHdd(oVM, oTestDrv);
|
---|
338 | if fRc is True:
|
---|
339 | #
|
---|
340 | # Set up unattended installation.
|
---|
341 | #
|
---|
342 | try:
|
---|
343 | oIUnattended = oTestDrv.oVBox.createUnattendedInstaller();
|
---|
344 | except:
|
---|
345 | fRc = reporter.errorXcpt();
|
---|
346 | if fRc is True:
|
---|
347 | fRc = self.unattendedDetectOs(oIUnattended, oTestDrv);
|
---|
348 | if fRc is True:
|
---|
349 | fRc = self._unattendedConfigure(oIUnattended, oTestDrv);
|
---|
350 | if fRc is True:
|
---|
351 | fRc = self._unattendedDoIt(oIUnattended, oVM, oTestDrv);
|
---|
352 |
|
---|
353 | # Done.
|
---|
354 | return (fRc, oVM)
|
---|
355 |
|
---|
356 | def isLoggedOntoDesktop(self):
|
---|
357 | #
|
---|
358 | # Normally all unattended installations should end up on the desktop.
|
---|
359 | # An exception is a minimal install, but we currently don't support that.
|
---|
360 | #
|
---|
361 | return True;
|
---|
362 |
|
---|
363 | def getTestUser(self):
|
---|
364 | # Default unattended installation user (parent knowns its password).
|
---|
365 | return 'vboxuser';
|
---|
366 |
|
---|
367 |
|
---|
368 | #
|
---|
369 | # Our methods.
|
---|
370 | #
|
---|
371 |
|
---|
372 | def unattendedDetectOs(self, oIUnattended, oTestDrv): # type: (Any, vbox.TestDriver) -> bool
|
---|
373 | """
|
---|
374 | Does the detectIsoOS operation and checks that the detect OSTypeId matches.
|
---|
375 |
|
---|
376 | Returns True on success, False w/ errors logged on failure.
|
---|
377 | """
|
---|
378 |
|
---|
379 | #
|
---|
380 | # Point the installer at the ISO and do the detection.
|
---|
381 | #
|
---|
382 | sInstallIso = self.sInstallIso
|
---|
383 | if not os.path.isabs(sInstallIso):
|
---|
384 | sInstallIso = os.path.join(oTestDrv.sResourcePath, sInstallIso);
|
---|
385 |
|
---|
386 | try:
|
---|
387 | oIUnattended.isoPath = sInstallIso;
|
---|
388 | except:
|
---|
389 | return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
|
---|
390 |
|
---|
391 | try:
|
---|
392 | oIUnattended.detectIsoOS();
|
---|
393 | except:
|
---|
394 | if oTestDrv.oVBoxMgr.xcptIsNotEqual(None, oTestDrv.oVBoxMgr.statuses.E_NOTIMPL):
|
---|
395 | return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
|
---|
396 |
|
---|
397 | #
|
---|
398 | # Get and log the result.
|
---|
399 | #
|
---|
400 | # Note! Current (6.0.97) fails with E_NOTIMPL even if it does some work.
|
---|
401 | #
|
---|
402 | try:
|
---|
403 | sDetectedOSTypeId = oIUnattended.detectedOSTypeId;
|
---|
404 | sDetectedOSVersion = oIUnattended.detectedOSVersion;
|
---|
405 | sDetectedOSFlavor = oIUnattended.detectedOSFlavor;
|
---|
406 | sDetectedOSLanguages = oIUnattended.detectedOSLanguages;
|
---|
407 | sDetectedOSHints = oIUnattended.detectedOSHints;
|
---|
408 | except:
|
---|
409 | return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
|
---|
410 |
|
---|
411 | reporter.log('detectIsoOS result for "%s" (vm %s):' % (sInstallIso, self.sVmName));
|
---|
412 | reporter.log(' DetectedOSTypeId: %s' % (sDetectedOSTypeId,));
|
---|
413 | reporter.log(' DetectedOSVersion: %s' % (sDetectedOSVersion,));
|
---|
414 | reporter.log(' DetectedOSFlavor: %s' % (sDetectedOSFlavor,));
|
---|
415 | reporter.log(' DetectedOSLanguages: %s' % (sDetectedOSLanguages,));
|
---|
416 | reporter.log(' DetectedOSHints: %s' % (sDetectedOSHints,));
|
---|
417 |
|
---|
418 | #
|
---|
419 | # Check if the OS type matches.
|
---|
420 | #
|
---|
421 | if self.sKind != sDetectedOSTypeId:
|
---|
422 | return reporter.error('sInstallIso=%s: DetectedOSTypeId is %s, expected %s'
|
---|
423 | % (sInstallIso, sDetectedOSTypeId, self.sKind));
|
---|
424 |
|
---|
425 | return True;
|
---|
426 |
|
---|
427 |
|
---|
428 | class tdGuestOsInstTest1(vbox.TestDriver):
|
---|
429 | """
|
---|
430 | Unattended Guest OS installation tests using IUnattended.
|
---|
431 |
|
---|
432 | Scenario:
|
---|
433 | - Create a new VM with default settings using IMachine::applyDefaults.
|
---|
434 | - Setup unattended installation using IUnattended.
|
---|
435 | - Start the VM and do the installation.
|
---|
436 | - Wait for TXS to report for service.
|
---|
437 | - If installing GAs:
|
---|
438 | - Wait for GAs to report operational runlevel.
|
---|
439 | - Save & restore state.
|
---|
440 | - If installing GAs:
|
---|
441 | - Test guest properties (todo).
|
---|
442 | - Test guest controls.
|
---|
443 | - Test shared folders.
|
---|
444 | """
|
---|
445 |
|
---|
446 |
|
---|
447 | def __init__(self):
|
---|
448 | """
|
---|
449 | Reinitialize child class instance.
|
---|
450 | """
|
---|
451 | vbox.TestDriver.__init__(self)
|
---|
452 | self.fLegacyOptions = False;
|
---|
453 | assert self.fEnableVrdp; # in parent driver.
|
---|
454 |
|
---|
455 | #
|
---|
456 | # Our install test VM set.
|
---|
457 | #
|
---|
458 | oSet = vboxtestvms.TestVmSet(self.oTestVmManager, fIgnoreSkippedVm = True);
|
---|
459 | # pylint: disable=line-too-long
|
---|
460 | oSet.aoTestVms.extend([
|
---|
461 | #
|
---|
462 | # Windows. The older windows ISOs requires a keyfile (for xp sp3
|
---|
463 | # pick a key from the PID.INF file on the ISO).
|
---|
464 | #
|
---|
465 | UnattendedVm(oSet, 'tst-xp-32', 'WindowsXP', '6.0/uaisos/en_winxp_pro_x86_build2600_iso.img', UnattendedVm.kfKeyFile), # >=2GiB
|
---|
466 | UnattendedVm(oSet, 'tst-xpsp2-32', 'WindowsXP', '6.0/uaisos/en_winxp_pro_with_sp2.iso', UnattendedVm.kfKeyFile), # >=2GiB
|
---|
467 | UnattendedVm(oSet, 'tst-xpsp3-32', 'WindowsXP', '6.0/uaisos/en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso', UnattendedVm.kfKeyFile), # >=2GiB
|
---|
468 | UnattendedVm(oSet, 'tst-xp-64', 'WindowsXP_64', '6.0/uaisos/en_win_xp_pro_x64_vl.iso', UnattendedVm.kfKeyFile), # >=3GiB
|
---|
469 | UnattendedVm(oSet, 'tst-xpsp2-64', 'WindowsXP_64', '6.0/uaisos/en_win_xp_pro_x64_with_sp2_vl_x13-41611.iso', UnattendedVm.kfKeyFile), # >=3GiB
|
---|
470 | #fixme: UnattendedVm(oSet, 'tst-xpchk-64', 'WindowsXP_64', '6.0/uaisos/en_windows_xp_professional_x64_chk.iso', UnattendedVm.kfKeyFile | UnattendedVm.kfNeedCom1), # >=3GiB
|
---|
471 | # No key files needed:
|
---|
472 | UnattendedVm(oSet, 'tst-vista-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_ee_x86_dvd_vl_x13-17271.iso'), # >=6GiB
|
---|
473 | UnattendedVm(oSet, 'tst-vista-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_x64_dvd_vl_x13-17316.iso'), # >=8GiB
|
---|
474 | UnattendedVm(oSet, 'tst-vistasp1-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_enterprise_with_service_pack_1_x86_dvd_x14-55954.iso'), # >=6GiB
|
---|
475 | UnattendedVm(oSet, 'tst-vistasp1-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_with_service_pack_1_x64_dvd_x14-55934.iso'), # >=9GiB
|
---|
476 | UnattendedVm(oSet, 'tst-vistasp2-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_enterprise_sp2_x86_dvd_342329.iso'), # >=7GiB
|
---|
477 | UnattendedVm(oSet, 'tst-vistasp2-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_sp2_x64_dvd_342332.iso'), # >=10GiB
|
---|
478 | UnattendedVm(oSet, 'tst-w7-32', 'Windows7', '6.0/uaisos/en_windows_7_enterprise_x86_dvd_x15-70745.iso'), # >=6GiB
|
---|
479 | UnattendedVm(oSet, 'tst-w7-64', 'Windows7_64', '6.0/uaisos/en_windows_7_enterprise_x64_dvd_x15-70749.iso'), # >=10GiB
|
---|
480 | UnattendedVm(oSet, 'tst-w7sp1-32', 'Windows7', '6.0/uaisos/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso'), # >=6GiB
|
---|
481 | UnattendedVm(oSet, 'tst-w7sp1-64', 'Windows7_64', '6.0/uaisos/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso'), # >=8GiB
|
---|
482 | UnattendedVm(oSet, 'tst-w8-32', 'Windows8', '6.0/uaisos/en_windows_8_enterprise_x86_dvd_917587.iso'), # >=6GiB
|
---|
483 | UnattendedVm(oSet, 'tst-w8-64', 'Windows8_64', '6.0/uaisos/en_windows_8_enterprise_x64_dvd_917522.iso'), # >=9GiB
|
---|
484 | UnattendedVm(oSet, 'tst-w81-32', 'Windows81', '6.0/uaisos/en_windows_8_1_enterprise_x86_dvd_2791510.iso'), # >=5GiB
|
---|
485 | UnattendedVm(oSet, 'tst-w81-64', 'Windows81_64', '6.0/uaisos/en_windows_8_1_enterprise_x64_dvd_2791088.iso'), # >=8GiB
|
---|
486 | UnattendedVm(oSet, 'tst-w10-1507-32', 'Windows10', '6.0/uaisos/en_windows_10_pro_10240_x86_dvd.iso'), # >=6GiB
|
---|
487 | UnattendedVm(oSet, 'tst-w10-1507-64', 'Windows10_64', '6.0/uaisos/en_windows_10_pro_10240_x64_dvd.iso'), # >=9GiB
|
---|
488 | UnattendedVm(oSet, 'tst-w10-1511-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1511_updated_feb_2016_x86_dvd_8378870.iso'), # >=7GiB
|
---|
489 | UnattendedVm(oSet, 'tst-w10-1511-64', 'Windows10_64', '6.0/uaisos/en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso'), # >=9GiB
|
---|
490 | UnattendedVm(oSet, 'tst-w10-1607-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1607_updated_jul_2016_x86_dvd_9060097.iso'), # >=7GiB
|
---|
491 | UnattendedVm(oSet, 'tst-w10-1607-64', 'Windows10_64', '6.0/uaisos/en_windows_10_enterprise_version_1607_updated_jul_2016_x64_dvd_9054264.iso'), # >=9GiB
|
---|
492 | UnattendedVm(oSet, 'tst-w10-1703-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1703_updated_march_2017_x86_dvd_10188981.iso'), # >=7GiB
|
---|
493 | UnattendedVm(oSet, 'tst-w10-1703-64', 'Windows10_64', '6.0/uaisos/en_windows_10_enterprise_version_1703_updated_march_2017_x64_dvd_10189290.iso'), # >=10GiB
|
---|
494 | UnattendedVm(oSet, 'tst-w10-1709-32', 'Windows10', '6.0/uaisos/en_windows_10_multi-edition_vl_version_1709_updated_sept_2017_x86_dvd_100090759.iso'), # >=7GiB
|
---|
495 | UnattendedVm(oSet, 'tst-w10-1709-64', 'Windows10_64', '6.0/uaisos/en_windows_10_multi-edition_vl_version_1709_updated_sept_2017_x64_dvd_100090741.iso'), # >=10GiB
|
---|
496 | UnattendedVm(oSet, 'tst-w10-1803-32', 'Windows10', '6.0/uaisos/en_windows_10_business_editions_version_1803_updated_march_2018_x86_dvd_12063341.iso'), # >=7GiB
|
---|
497 | UnattendedVm(oSet, 'tst-w10-1803-64', 'Windows10_64', '6.0/uaisos/en_windows_10_business_editions_version_1803_updated_march_2018_x64_dvd_12063333.iso'), # >=10GiB
|
---|
498 | UnattendedVm(oSet, 'tst-w10-1809-32', 'Windows10', '6.0/uaisos/en_windows_10_business_edition_version_1809_updated_sept_2018_x86_dvd_2f92403b.iso'), # >=7GiB
|
---|
499 | UnattendedVm(oSet, 'tst-w10-1809-64', 'Windows10_64', '6.0/uaisos/en_windows_10_business_edition_version_1809_updated_sept_2018_x64_dvd_f0b7dc68.iso'), # >=10GiB
|
---|
500 | UnattendedVm(oSet, 'tst-w10-1903-32', 'Windows10', '6.0/uaisos/en_windows_10_business_editions_version_1903_x86_dvd_ca4f0f49.iso'), # >=7GiB
|
---|
501 | UnattendedVm(oSet, 'tst-w10-1903-64', 'Windows10_64', '6.0/uaisos/en_windows_10_business_editions_version_1903_x64_dvd_37200948.iso'), # >=10GiB
|
---|
502 | #
|
---|
503 | # Ubuntu
|
---|
504 | #
|
---|
505 | ## @todo 15.10 fails with grub install error.
|
---|
506 | #UnattendedVm(oSet, 'tst-ubuntu-15.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-15.10-desktop-amd64.iso'),
|
---|
507 | UnattendedVm(oSet, 'tst-ubuntu-16.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04-desktop-amd64.iso', # ~5GiB
|
---|
508 | UnattendedVm.kfUbuntuAvx2Crash),
|
---|
509 | UnattendedVm(oSet, 'tst-ubuntu-16.04-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04-desktop-i386.iso'), # >=4.5GiB
|
---|
510 | UnattendedVm(oSet, 'tst-ubuntu-16.04.1-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.1-desktop-amd64.iso'), # >=5GiB
|
---|
511 | UnattendedVm(oSet, 'tst-ubuntu-16.04.1-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.1-desktop-i386.iso'), # >=4.5GiB
|
---|
512 | UnattendedVm(oSet, 'tst-ubuntu-16.04.2-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.2-desktop-amd64.iso'), # >=5GiB
|
---|
513 | UnattendedVm(oSet, 'tst-ubuntu-16.04.2-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.2-desktop-i386.iso'), # >=4.5GiB
|
---|
514 | UnattendedVm(oSet, 'tst-ubuntu-16.04.3-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.3-desktop-amd64.iso'), # >=5GiB
|
---|
515 | UnattendedVm(oSet, 'tst-ubuntu-16.04.3-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.3-desktop-i386.iso'), # >=4.5GiB
|
---|
516 | UnattendedVm(oSet, 'tst-ubuntu-16.04.4-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.4-desktop-amd64.iso'), # >=5GiB
|
---|
517 | UnattendedVm(oSet, 'tst-ubuntu-16.04.4-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.4-desktop-i386.iso'), # >=4.5GiB
|
---|
518 | UnattendedVm(oSet, 'tst-ubuntu-16.04.5-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.5-desktop-amd64.iso'), # >=5GiB
|
---|
519 | UnattendedVm(oSet, 'tst-ubuntu-16.04.5-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.5-desktop-i386.iso'), # >=4.5GiB
|
---|
520 | UnattendedVm(oSet, 'tst-ubuntu-16.04.6-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.6-desktop-amd64.iso'), # >=5GiB
|
---|
521 | UnattendedVm(oSet, 'tst-ubuntu-16.04.6-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.6-desktop-i386.iso'), # >=4.5GiB
|
---|
522 | UnattendedVm(oSet, 'tst-ubuntu-16.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.10-desktop-amd64.iso'), # >=5.5GiB
|
---|
523 | ## @todo 16.10-32 doesn't ask for an IP, so it always fails.
|
---|
524 | #UnattendedVm(oSet, 'tst-ubuntu-16.10-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.10-desktop-i386.iso'), # >=5.5GiB?
|
---|
525 | UnattendedVm(oSet, 'tst-ubuntu-17.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-17.04-desktop-amd64.iso'), # >=5GiB
|
---|
526 | UnattendedVm(oSet, 'tst-ubuntu-17.04-32', 'Ubuntu', '6.0/uaisos/ubuntu-17.04-desktop-i386.iso'), # >=4.5GiB
|
---|
527 | ## @todo ubuntu 17.10, 18.04 & 18.10 do not work. They misses all the the build tools (make, gcc, perl, ++)
|
---|
528 | ## and has signed kmods:
|
---|
529 | UnattendedVm(oSet, 'tst-ubuntu-17.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-17.10-desktop-amd64.iso', # >=4Gib
|
---|
530 | UnattendedVm.kfNoGAs),
|
---|
531 | UnattendedVm(oSet, 'tst-ubuntu-18.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-18.04-desktop-amd64.iso', # >=6GiB
|
---|
532 | UnattendedVm.kfNoGAs),
|
---|
533 | # 18.10 hangs reading install DVD during "starting partitioner..."
|
---|
534 | #UnattendedVm(oSet, 'tst-ubuntu-18.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-18.10-desktop-amd64.iso',
|
---|
535 | # UnattendedVm.kfNoGAs),
|
---|
536 | UnattendedVm(oSet, 'tst-ubuntu-19.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-19.04-desktop-amd64.iso', # >=6GiB
|
---|
537 | UnattendedVm.kfNoGAs),
|
---|
538 | UnattendedVm(oSet, 'tst-debian-9.3-64', 'Debian_64', '6.0/uaisos/debian-9.3.0-amd64-DVD-1.iso', # >=6GiB?
|
---|
539 | UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs),
|
---|
540 | UnattendedVm(oSet, 'tst-debian-9.4-64', 'Debian_64', '6.0/uaisos/debian-9.4.0-amd64-DVD-1.iso', # >=6GiB?
|
---|
541 | UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs),
|
---|
542 | UnattendedVm(oSet, 'tst-debian-10.0-64', 'Debian_64', '6.0/uaisos/debian-10.0.0-amd64-DVD-1.iso', # >=6GiB?
|
---|
543 | UnattendedVm.kfAvoidNetwork),
|
---|
544 | #
|
---|
545 | # OS/2.
|
---|
546 | #
|
---|
547 | UnattendedVm(oSet, 'tst-acp2', 'OS2Warp45', '7.0/uaisos/acp2_us_cd2.iso'), # ~400MiB
|
---|
548 | ## @todo mcp2 too?
|
---|
549 | ]);
|
---|
550 | # pylint: enable=line-too-long
|
---|
551 | self.oTestVmSet = oSet;
|
---|
552 |
|
---|
553 | # For option parsing:
|
---|
554 | self.aoSelectedVms = oSet.aoTestVms # type: list(UnattendedVm)
|
---|
555 |
|
---|
556 | # Number of VMs to test in parallel:
|
---|
557 | self.cInParallel = 1;
|
---|
558 |
|
---|
559 | # Whether to do the save-and-restore test.
|
---|
560 | self.fTestSaveAndRestore = True;
|
---|
561 |
|
---|
562 | #
|
---|
563 | # Sub-test drivers.
|
---|
564 | #
|
---|
565 | self.addSubTestDriver(SubTstDrvAddSharedFolders1(self));
|
---|
566 | self.addSubTestDriver(SubTstDrvAddGuestCtrl(self));
|
---|
567 |
|
---|
568 |
|
---|
569 | #
|
---|
570 | # Overridden methods.
|
---|
571 | #
|
---|
572 |
|
---|
573 | def showUsage(self):
|
---|
574 | """
|
---|
575 | Extend usage info
|
---|
576 | """
|
---|
577 | rc = vbox.TestDriver.showUsage(self)
|
---|
578 | reporter.log('');
|
---|
579 | reporter.log('tdGuestOsUnattendedInst1 options:');
|
---|
580 | reporter.log(' --parallel <num>');
|
---|
581 | reporter.log(' Number of VMs to test in parallel.');
|
---|
582 | reporter.log(' Default: 1');
|
---|
583 | reporter.log('');
|
---|
584 | reporter.log(' Options for working on selected test VMs:');
|
---|
585 | reporter.log(' --select <vm1[:vm2[:..]]>');
|
---|
586 | reporter.log(' Selects a test VM for the following configuration alterations.');
|
---|
587 | reporter.log(' Default: All possible test VMs');
|
---|
588 | reporter.log(' --copy <old-vm>=<new-vm>');
|
---|
589 | reporter.log(' Creates and selects <new-vm> as a copy of <old-vm>.');
|
---|
590 | reporter.log(' --guest-type <guest-os-type>');
|
---|
591 | reporter.log(' Sets the guest-os type of the currently selected test VM.');
|
---|
592 | reporter.log(' --install-iso <ISO file name>');
|
---|
593 | reporter.log(' Sets ISO image to use for the selected test VM.');
|
---|
594 | reporter.log(' --ram-adjust <MBs>');
|
---|
595 | reporter.log(' Adjust the VM ram size by the given delta. Both negative and positive');
|
---|
596 | reporter.log(' values are accepted.');
|
---|
597 | reporter.log(' --max-cpus <# CPUs>');
|
---|
598 | reporter.log(' Sets the maximum number of guest CPUs for the selected VM.');
|
---|
599 | reporter.log(' --set-extradata <key>:value');
|
---|
600 | reporter.log(' Set VM extra data for the selected VM. Can be repeated.');
|
---|
601 | reporter.log(' --ioapic, --no-ioapic');
|
---|
602 | reporter.log(' Enable or disable the I/O apic for the selected VM.');
|
---|
603 | reporter.log(' --pae, --no-pae');
|
---|
604 | reporter.log(' Enable or disable PAE support (32-bit guests only) for the selected VM.');
|
---|
605 | return rc
|
---|
606 |
|
---|
607 | def parseOption(self, asArgs, iArg):
|
---|
608 | """
|
---|
609 | Extend standard options set
|
---|
610 | """
|
---|
611 |
|
---|
612 | if asArgs[iArg] == '--parallel':
|
---|
613 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
614 | self.cInParallel = int(asArgs[iArg]);
|
---|
615 | if self.cInParallel <= 0:
|
---|
616 | self.cInParallel = 1;
|
---|
617 | elif asArgs[iArg] == '--select':
|
---|
618 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
619 | self.aoSelectedVms = [];
|
---|
620 | for sTestVm in asArgs[iArg].split(':'):
|
---|
621 | oTestVm = self.oTestVmSet.findTestVmByName(sTestVm);
|
---|
622 | if not oTestVm:
|
---|
623 | raise base.InvalidOption('Unknown test VM: %s' % (sTestVm,));
|
---|
624 | self.aoSelectedVms.append(oTestVm);
|
---|
625 | elif asArgs[iArg] == '--copy':
|
---|
626 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
627 | asNames = asArgs[iArg].split('=');
|
---|
628 | if len(asNames) != 2 or not asNames[0] or not asNames[1]:
|
---|
629 | raise base.InvalidOption('The --copy option expects value on the form "old=new": %s' % (asArgs[iArg],));
|
---|
630 | oOldTestVm = self.oTestVmSet.findTestVmByName(asNames[0]);
|
---|
631 | if not oOldTestVm:
|
---|
632 | raise base.InvalidOption('Unknown test VM: %s' % (asNames[0],));
|
---|
633 | oNewTestVm = copy.deepcopy(oOldTestVm);
|
---|
634 | oNewTestVm.sVmName = asNames[1];
|
---|
635 | self.oTestVmSet.aoTestVms.append(oNewTestVm);
|
---|
636 | self.aoSelectedVms = [oNewTestVm];
|
---|
637 | elif asArgs[iArg] == '--guest-type':
|
---|
638 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
639 | for oTestVm in self.aoSelectedVms:
|
---|
640 | oTestVm.sKind = asArgs[iArg];
|
---|
641 | elif asArgs[iArg] == '--install-iso':
|
---|
642 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
643 | for oTestVm in self.aoSelectedVms:
|
---|
644 | oTestVm.sInstallIso = asArgs[iArg];
|
---|
645 | elif asArgs[iArg] == '--ram-adjust':
|
---|
646 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
647 | for oTestVm in self.aoSelectedVms:
|
---|
648 | oTestVm.iOptRamAdjust = int(asArgs[iArg]);
|
---|
649 | elif asArgs[iArg] == '--max-cpus':
|
---|
650 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
651 | for oTestVm in self.aoSelectedVms:
|
---|
652 | oTestVm.iOptMaxCpus = int(asArgs[iArg]);
|
---|
653 | elif asArgs[iArg] == '--set-extradata':
|
---|
654 | iArg = self.requireMoreArgs(1, asArgs, iArg)
|
---|
655 | sExtraData = asArgs[iArg];
|
---|
656 | try: _, _ = sExtraData.split(':');
|
---|
657 | except: raise base.InvalidOption('Invalid extradata specified: %s' % (sExtraData, ));
|
---|
658 | for oTestVm in self.aoSelectedVms:
|
---|
659 | oTestVm.asOptExtraData.append(sExtraData);
|
---|
660 | elif asArgs[iArg] == '--ioapic':
|
---|
661 | for oTestVm in self.aoSelectedVms:
|
---|
662 | oTestVm.fOptIoApic = True;
|
---|
663 | elif asArgs[iArg] == '--no-ioapic':
|
---|
664 | for oTestVm in self.aoSelectedVms:
|
---|
665 | oTestVm.fOptIoApic = False;
|
---|
666 | elif asArgs[iArg] == '--pae':
|
---|
667 | for oTestVm in self.aoSelectedVms:
|
---|
668 | oTestVm.fOptPae = True;
|
---|
669 | elif asArgs[iArg] == '--no-pae':
|
---|
670 | for oTestVm in self.aoSelectedVms:
|
---|
671 | oTestVm.fOptPae = False;
|
---|
672 | elif asArgs[iArg] == '--install-additions':
|
---|
673 | for oTestVm in self.aoSelectedVms:
|
---|
674 | oTestVm.fOptInstallAdditions = True;
|
---|
675 | elif asArgs[iArg] == '--no-install-additions':
|
---|
676 | for oTestVm in self.aoSelectedVms:
|
---|
677 | oTestVm.fOptInstallAdditions = False;
|
---|
678 | else:
|
---|
679 | return vbox.TestDriver.parseOption(self, asArgs, iArg);
|
---|
680 | return iArg + 1;
|
---|
681 |
|
---|
682 | def actionConfig(self):
|
---|
683 | if not self.importVBoxApi(): # So we can use the constant below.
|
---|
684 | return False;
|
---|
685 | return self.oTestVmSet.actionConfig(self);
|
---|
686 |
|
---|
687 | def actionExecute(self):
|
---|
688 | """
|
---|
689 | Execute the testcase.
|
---|
690 | """
|
---|
691 | return self.oTestVmSet.actionExecute(self, self.testOneVmConfig)
|
---|
692 |
|
---|
693 | def testOneVmConfig(self, oVM, oTestVm): # type: (Any, UnattendedVm) -> bool
|
---|
694 | """
|
---|
695 | Install guest OS and wait for result
|
---|
696 | """
|
---|
697 |
|
---|
698 | self.logVmInfo(oVM)
|
---|
699 | reporter.testStart('Installing %s%s' % (oTestVm.sVmName, ' with GAs' if oTestVm.fOptInstallAdditions else ''))
|
---|
700 |
|
---|
701 | cMsTimeout = 40*60000;
|
---|
702 | if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
|
---|
703 | cMsTimeout = 180 * 60000; # will be adjusted down.
|
---|
704 |
|
---|
705 | oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
|
---|
706 | #oSession = self.startVmByName(oTestVm.sVmName); # (for quickly testing waitForGAs)
|
---|
707 | if oSession is not None:
|
---|
708 | # The guest has connected to TXS.
|
---|
709 | reporter.log('Guest reported success via TXS.');
|
---|
710 | reporter.testDone();
|
---|
711 |
|
---|
712 | fRc = True;
|
---|
713 | # Kudge: GAs doesn't come up correctly, so we have to reboot the guest first:
|
---|
714 | # Looks like VBoxService isn't there.
|
---|
715 | if oTestVm.fOptInstallAdditions:
|
---|
716 | reporter.testStart('Rebooting');
|
---|
717 | fRc, oTxsSession = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession);
|
---|
718 | reporter.testDone();
|
---|
719 |
|
---|
720 | # If we're installing GAs, wait for them to come online:
|
---|
721 | if oTestVm.fOptInstallAdditions and fRc is True:
|
---|
722 | reporter.testStart('Guest additions');
|
---|
723 | aenmRunLevels = [vboxcon.AdditionsRunLevelType_Userland,];
|
---|
724 | if oTestVm.isLoggedOntoDesktop():
|
---|
725 | aenmRunLevels.append(vboxcon.AdditionsRunLevelType_Desktop);
|
---|
726 | fRc = self.waitForGAs(oSession, cMsTimeout = cMsTimeout / 2, aenmWaitForRunLevels = aenmRunLevels,
|
---|
727 | aenmWaitForActive = (vboxcon.AdditionsFacilityType_VBoxGuestDriver,
|
---|
728 | vboxcon.AdditionsFacilityType_VBoxService,));
|
---|
729 | reporter.testDone();
|
---|
730 |
|
---|
731 | # Now do a save & restore test:
|
---|
732 | if fRc is True and self.fTestSaveAndRestore:
|
---|
733 | fRc, oSession, oTxsSession = self.testSaveAndRestore(oSession, oTxsSession, oTestVm);
|
---|
734 |
|
---|
735 | # Test GAs if requested:
|
---|
736 | if oTestVm.fOptInstallAdditions and fRc is True:
|
---|
737 | for oSubTstDrv in self.aoSubTstDrvs:
|
---|
738 | if oSubTstDrv.fEnabled:
|
---|
739 | reporter.testStart(oSubTstDrv.sTestName);
|
---|
740 | fRc2, oTxsSession = oSubTstDrv.testIt(oTestVm, oSession, oTxsSession);
|
---|
741 | reporter.testDone(fRc2 is None);
|
---|
742 | if fRc2 is False:
|
---|
743 | fRc = False;
|
---|
744 |
|
---|
745 | if oSession is not None:
|
---|
746 | fRc = self.terminateVmBySession(oSession) and fRc;
|
---|
747 | return fRc is True
|
---|
748 |
|
---|
749 | reporter.error('Installation of %s has failed' % (oTestVm.sVmName,))
|
---|
750 | #oTestVm.detatchAndDeleteHd(self); # Save space.
|
---|
751 | reporter.testDone()
|
---|
752 | return False
|
---|
753 |
|
---|
754 | def testSaveAndRestore(self, oSession, oTxsSession, oTestVm):
|
---|
755 | """
|
---|
756 | Tests saving and restoring the VM.
|
---|
757 | """
|
---|
758 | _ = oTestVm;
|
---|
759 | reporter.testStart('Save');
|
---|
760 | ## @todo
|
---|
761 | reporter.testDone();
|
---|
762 | reporter.testStart('Restore');
|
---|
763 | ## @todo
|
---|
764 | reporter.testDone();
|
---|
765 | return (True, oSession, oTxsSession);
|
---|
766 |
|
---|
767 | if __name__ == '__main__':
|
---|
768 | sys.exit(tdGuestOsInstTest1().main(sys.argv))
|
---|