VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/tests/installation/tdGuestOsUnattendedInst1.py@ 103068

Last change on this file since 103068 was 103044, checked in by vboxsync, 12 months ago

ValidationKit/tdGuestOsUnattendedInst1.py: Avoid any networking and skip installing the GAs

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 39.1 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdGuestOsUnattendedInst1.py 103044 2024-01-24 19:30:24Z vboxsync $
4
5"""
6VirtualBox Validation Kit - Guest OS unattended installation tests.
7"""
8
9__copyright__ = \
10"""
11Copyright (C) 2010-2023 Oracle and/or its affiliates.
12
13This file is part of VirtualBox base platform packages, as
14available from https://www.virtualbox.org.
15
16This program is free software; you can redistribute it and/or
17modify it under the terms of the GNU General Public License
18as published by the Free Software Foundation, in version 3 of the
19License.
20
21This program is distributed in the hope that it will be useful, but
22WITHOUT ANY WARRANTY; without even the implied warranty of
23MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24General Public License for more details.
25
26You should have received a copy of the GNU General Public License
27along with this program; if not, see <https://www.gnu.org/licenses>.
28
29The contents of this file may alternatively be used under the terms
30of the Common Development and Distribution License Version 1.0
31(CDDL), a copy of it is provided in the "COPYING.CDDL" file included
32in the VirtualBox distribution, in which case the provisions of the
33CDDL are applicable instead of those of the GPL.
34
35You may elect to license modified versions of this file under the
36terms and conditions of either the GPL or the CDDL or both.
37
38SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
39"""
40__version__ = "$Revision: 103044 $"
41
42
43# Standard Python imports.
44import copy;
45import os;
46import sys;
47
48
49# Only the main script needs to modify the path.
50try: __file__ # pylint: disable=used-before-assignment
51except: __file__ = sys.argv[0]
52g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
53sys.path.append(g_ksValidationKitDir)
54
55# Validation Kit imports.
56from testdriver import vbox;
57from testdriver import base;
58from testdriver import reporter;
59from testdriver import vboxcon;
60from testdriver import vboxtestvms;
61from common import utils;
62
63# Sub-test driver imports.
64sys.path.append(os.path.join(g_ksValidationKitDir, 'tests', 'additions'));
65from tdAddGuestCtrl import SubTstDrvAddGuestCtrl;
66from tdAddSharedFolders1 import SubTstDrvAddSharedFolders1;
67
68
69class 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, sPlatformArchitecture = 'x86'):
92 vboxtestvms.BaseTestVm.__init__(self, sVmName, sPlatformArchitecture, 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', '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 if oTestDrv.fpApiVer >= 7.1: # Since 7.1 we offer different passwords for user and admin/root accounts.
225 asAttribs.extend( [ 'userPassword', 'adminPassword' ] );
226 else:
227 asAttribs.append('password')
228 for sAttrib in asAttribs:
229 try:
230 oValue = getattr(oIUnattended, sAttrib);
231 except:
232 fRc = reporter.errorXcpt('sAttrib=%s' % sAttrib);
233 else:
234 reporter.log('%s: %s' % (sAttrib.rjust(32), oValue,));
235 oTestDrv.processPendingEvents();
236 return fRc;
237
238
239 #
240 # Overriden methods.
241 #
242
243 def getResourceSet(self):
244 asRet = [];
245 if not os.path.isabs(self.sInstallIso):
246 asRet.append(self.sInstallIso);
247 if self.fInstVmFlags & UnattendedVm.kfKeyFile:
248 asRet.append(self.sInstallIso + '.key');
249 return asRet;
250
251 def _createVmDoIt(self, oTestDrv, eNic0AttachType, sDvdImage):
252 #
253 # Use HostOnly networking for ubuntu and debian VMs to prevent them from
254 # downloading updates and doing database updates during installation.
255 # We want predicable results.
256 #
257 # On macOS however this will result in HostOnly networking being used
258 # with an incompatible IP address, resulting in the TXS service not being
259 # able to contact the host. Until this is fixed properly just get along
260 # with inconsistent results, still better than completely failing testcases.
261 #
262 if eNic0AttachType is None:
263 if utils.getHostOs() != 'darwin' \
264 and oTestDrv.fpApiVer < 7.0 \
265 and self.isLinux() \
266 and ( 'ubuntu' in self.sKind.lower()
267 or 'debian' in self.sKind.lower()):
268 eNic0AttachType = vboxcon.NetworkAttachmentType_HostOnly;
269
270 # Also use it for windows xp to prevent it from ever going online.
271 if self.sKind in ('WindowsXP','WindowsXP_64',):
272 eNic0AttachType = vboxcon.NetworkAttachmentType_HostOnly;
273
274 #
275 # Use host-only networks instead of host-only adapters for trunk builds on Mac OS.
276 #
277 if eNic0AttachType == vboxcon.NetworkAttachmentType_HostOnly \
278 and utils.getHostOs() == 'darwin' \
279 and oTestDrv.fpApiVer >= 7.0:
280 eNic0AttachType = vboxcon.NetworkAttachmentType_HostOnlyNetwork;
281
282 return vboxtestvms.BaseTestVm._createVmDoIt(self, oTestDrv, eNic0AttachType, sDvdImage); # pylint: disable=protected-access
283
284
285 def _createVmPost(self, oTestDrv, oVM, eNic0AttachType, sDvdImage):
286 #
287 # Adjust the ram, I/O APIC and stuff.
288 #
289 oSession = oTestDrv.openSession(oVM);
290 if oSession is None:
291 return None;
292
293 fRc = True;
294
295 ## Set proper boot order - IUnattended::reconfigureVM does this, doesn't it?
296 #fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk)
297 #fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_DVD)
298
299 # Adjust memory if requested.
300 if self.iOptRamAdjust != 0:
301 try: cMbRam = oSession.o.machine.memorySize;
302 except: fRc = reporter.errorXcpt();
303 else:
304 fRc = oSession.setRamSize(cMbRam + self.iOptRamAdjust) and fRc;
305
306 # I/O APIC:
307 if self.fOptIoApic is not None:
308 fRc = oSession.enableIoApic(self.fOptIoApic) and fRc;
309
310 # I/O APIC:
311 if self.fOptPae is not None:
312 fRc = oSession.enablePaeX86(self.fOptPae) and fRc;
313
314 # Set extra data
315 for sExtraData in self.asOptExtraData:
316 sKey, sValue = sExtraData.split(':');
317 reporter.log('Set extradata: %s => %s' % (sKey, sValue))
318 fRc = oSession.setExtraData(sKey, sValue) and fRc;
319
320 # Save the settings.
321 fRc = fRc and oSession.saveSettings()
322 fRc = oSession.close() and fRc;
323
324 return oVM if fRc else None;
325
326 def _skipVmTest(self, oTestDrv, oVM):
327 _ = oVM;
328 #
329 # Check for ubuntu installer vs. AMD host CPU.
330 #
331 if self.fInstVmFlags & self.kfUbuntuNewAmdBug:
332 if self.isHostCpuAffectedByUbuntuNewAmdBug(oTestDrv):
333 return True;
334
335 return vboxtestvms.BaseTestVm._skipVmTest(self, oTestDrv, oVM); # pylint: disable=protected-access
336
337
338 def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode = None):
339 #
340 # Do the standard reconfig in the base class first, it'll figure out
341 # if we can run the VM as requested.
342 #
343 (fRc, oVM) = vboxtestvms.BaseTestVm.getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode);
344 if fRc is True:
345 #
346 # Make sure there is no HD from the previous run attached nor taking
347 # up storage on the host.
348 #
349 fRc = self.recreateRecommendedHdd(oVM, oTestDrv);
350 if fRc is True:
351 #
352 # Set up unattended installation.
353 #
354 try:
355 oIUnattended = oTestDrv.oVBox.createUnattendedInstaller();
356 except:
357 fRc = reporter.errorXcpt();
358 if fRc is True:
359 fRc = self.unattendedDetectOs(oIUnattended, oTestDrv);
360 if fRc is True:
361 fRc = self._unattendedConfigure(oIUnattended, oTestDrv);
362 if fRc is True:
363 fRc = self._unattendedDoIt(oIUnattended, oVM, oTestDrv);
364
365 # Done.
366 return (fRc, oVM)
367
368 def isLoggedOntoDesktop(self):
369 #
370 # Normally all unattended installations should end up on the desktop.
371 # An exception is a minimal install, but we currently don't support that.
372 #
373 return True;
374
375 def getTestUser(self):
376 # Default unattended installation user (parent knowns its password).
377 return 'vboxuser';
378
379
380 #
381 # Our methods.
382 #
383
384 def unattendedDetectOs(self, oIUnattended, oTestDrv): # type: (Any, vbox.TestDriver) -> bool
385 """
386 Does the detectIsoOS operation and checks that the detect OSTypeId matches.
387
388 Returns True on success, False w/ errors logged on failure.
389 """
390
391 #
392 # Point the installer at the ISO and do the detection.
393 #
394 sInstallIso = self.sInstallIso
395 if not os.path.isabs(sInstallIso):
396 sInstallIso = os.path.join(oTestDrv.sResourcePath, sInstallIso);
397
398 try:
399 oIUnattended.isoPath = sInstallIso;
400 except:
401 return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
402
403 try:
404 oIUnattended.detectIsoOS();
405 except:
406 if oTestDrv.oVBoxMgr.xcptIsNotEqual(None, oTestDrv.oVBoxMgr.statuses.E_NOTIMPL):
407 return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
408
409 #
410 # Get and log the result.
411 #
412 # Note! Current (6.0.97) fails with E_NOTIMPL even if it does some work.
413 #
414 try:
415 sDetectedOSTypeId = oIUnattended.detectedOSTypeId;
416 sDetectedOSVersion = oIUnattended.detectedOSVersion;
417 sDetectedOSFlavor = oIUnattended.detectedOSFlavor;
418 sDetectedOSLanguages = oIUnattended.detectedOSLanguages;
419 sDetectedOSHints = oIUnattended.detectedOSHints;
420 except:
421 return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
422
423 reporter.log('detectIsoOS result for "%s" (vm %s):' % (sInstallIso, self.sVmName));
424 reporter.log(' DetectedOSTypeId: %s' % (sDetectedOSTypeId,));
425 reporter.log(' DetectedOSVersion: %s' % (sDetectedOSVersion,));
426 reporter.log(' DetectedOSFlavor: %s' % (sDetectedOSFlavor,));
427 reporter.log(' DetectedOSLanguages: %s' % (sDetectedOSLanguages,));
428 reporter.log(' DetectedOSHints: %s' % (sDetectedOSHints,));
429
430 #
431 # Check if the OS type matches.
432 #
433 if self.sKind != sDetectedOSTypeId:
434 return reporter.error('sInstallIso=%s: DetectedOSTypeId is %s, expected %s'
435 % (sInstallIso, sDetectedOSTypeId, self.sKind));
436
437 return True;
438
439
440class tdGuestOsInstTest1(vbox.TestDriver):
441 """
442 Unattended Guest OS installation tests using IUnattended.
443
444 Scenario:
445 - Create a new VM with default settings using IMachine::applyDefaults.
446 - Setup unattended installation using IUnattended.
447 - Start the VM and do the installation.
448 - Wait for TXS to report for service.
449 - If installing GAs:
450 - Wait for GAs to report operational runlevel.
451 - Save & restore state.
452 - If installing GAs:
453 - Test guest properties (todo).
454 - Test guest controls.
455 - Test shared folders.
456 """
457
458
459 def __init__(self):
460 """
461 Reinitialize child class instance.
462 """
463 vbox.TestDriver.__init__(self)
464 self.fLegacyOptions = False;
465 assert self.fEnableVrdp; # in parent driver.
466
467 #
468 # Our install test VM set.
469 #
470 oSet = vboxtestvms.TestVmSet(self.oTestVmManager, fIgnoreSkippedVm = True);
471 # pylint: disable=line-too-long
472 oSet.aoTestVms.extend([
473 #
474 #
475 # x86/amd64 VMs
476 #
477 #
478
479 #
480 # Windows. The older windows ISOs requires a keyfile (for xp sp3
481 # pick a key from the PID.INF file on the ISO).
482 #
483 UnattendedVm(oSet, 'tst-xp-32', 'WindowsXP', '6.0/uaisos/en_winxp_pro_x86_build2600_iso.img', UnattendedVm.kfKeyFile), # >=2GiB
484 UnattendedVm(oSet, 'tst-xpsp2-32', 'WindowsXP', '6.0/uaisos/en_winxp_pro_with_sp2.iso', UnattendedVm.kfKeyFile), # >=2GiB
485 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
486 UnattendedVm(oSet, 'tst-xp-64', 'WindowsXP_64', '6.0/uaisos/en_win_xp_pro_x64_vl.iso', UnattendedVm.kfKeyFile), # >=3GiB
487 UnattendedVm(oSet, 'tst-xpsp2-64', 'WindowsXP_64', '6.0/uaisos/en_win_xp_pro_x64_with_sp2_vl_x13-41611.iso', UnattendedVm.kfKeyFile), # >=3GiB
488 #fixme: UnattendedVm(oSet, 'tst-xpchk-64', 'WindowsXP_64', '6.0/uaisos/en_windows_xp_professional_x64_chk.iso', UnattendedVm.kfKeyFile | UnattendedVm.kfNeedCom1), # >=3GiB
489 # No key files needed:
490 UnattendedVm(oSet, 'tst-vista-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_ee_x86_dvd_vl_x13-17271.iso'), # >=6GiB
491 UnattendedVm(oSet, 'tst-vista-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_x64_dvd_vl_x13-17316.iso'), # >=8GiB
492 UnattendedVm(oSet, 'tst-vistasp1-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_enterprise_with_service_pack_1_x86_dvd_x14-55954.iso'), # >=6GiB
493 UnattendedVm(oSet, 'tst-vistasp1-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_with_service_pack_1_x64_dvd_x14-55934.iso'), # >=9GiB
494 UnattendedVm(oSet, 'tst-vistasp2-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_enterprise_sp2_x86_dvd_342329.iso'), # >=7GiB
495 UnattendedVm(oSet, 'tst-vistasp2-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_sp2_x64_dvd_342332.iso'), # >=10GiB
496 UnattendedVm(oSet, 'tst-w7-32', 'Windows7', '6.0/uaisos/en_windows_7_enterprise_x86_dvd_x15-70745.iso'), # >=6GiB
497 UnattendedVm(oSet, 'tst-w7-64', 'Windows7_64', '6.0/uaisos/en_windows_7_enterprise_x64_dvd_x15-70749.iso'), # >=10GiB
498 UnattendedVm(oSet, 'tst-w7sp1-32', 'Windows7', '6.0/uaisos/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso'), # >=6GiB
499 UnattendedVm(oSet, 'tst-w7sp1-64', 'Windows7_64', '6.0/uaisos/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso'), # >=8GiB
500 UnattendedVm(oSet, 'tst-w8-32', 'Windows8', '6.0/uaisos/en_windows_8_enterprise_x86_dvd_917587.iso'), # >=6GiB
501 UnattendedVm(oSet, 'tst-w8-64', 'Windows8_64', '6.0/uaisos/en_windows_8_enterprise_x64_dvd_917522.iso'), # >=9GiB
502 UnattendedVm(oSet, 'tst-w81-32', 'Windows81', '6.0/uaisos/en_windows_8_1_enterprise_x86_dvd_2791510.iso'), # >=5GiB
503 UnattendedVm(oSet, 'tst-w81-64', 'Windows81_64', '6.0/uaisos/en_windows_8_1_enterprise_x64_dvd_2791088.iso'), # >=8GiB
504 UnattendedVm(oSet, 'tst-w10-1507-32', 'Windows10', '6.0/uaisos/en_windows_10_pro_10240_x86_dvd.iso'), # >=6GiB
505 UnattendedVm(oSet, 'tst-w10-1507-64', 'Windows10_64', '6.0/uaisos/en_windows_10_pro_10240_x64_dvd.iso'), # >=9GiB
506 UnattendedVm(oSet, 'tst-w10-1511-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1511_updated_feb_2016_x86_dvd_8378870.iso'), # >=7GiB
507 UnattendedVm(oSet, 'tst-w10-1511-64', 'Windows10_64', '6.0/uaisos/en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso'), # >=9GiB
508 UnattendedVm(oSet, 'tst-w10-1607-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1607_updated_jul_2016_x86_dvd_9060097.iso'), # >=7GiB
509 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
510 UnattendedVm(oSet, 'tst-w10-1703-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1703_updated_march_2017_x86_dvd_10188981.iso'), # >=7GiB
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 UnattendedVm(oSet, 'tst-w10-1903-32', 'Windows10', '6.0/uaisos/en_windows_10_business_editions_version_1903_x86_dvd_ca4f0f49.iso'), # >=7GiB
519 UnattendedVm(oSet, 'tst-w10-1903-64', 'Windows10_64', '6.0/uaisos/en_windows_10_business_editions_version_1903_x64_dvd_37200948.iso'), # >=10GiB
520 #
521 # Ubuntu
522 #
523 ## @todo 15.10 fails with grub install error.
524 #UnattendedVm(oSet, 'tst-ubuntu-15.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-15.10-desktop-amd64.iso'),
525 UnattendedVm(oSet, 'tst-ubuntu-16.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04-desktop-amd64.iso', # ~5GiB
526 UnattendedVm.kfUbuntuAvx2Crash),
527 UnattendedVm(oSet, 'tst-ubuntu-16.04-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04-desktop-i386.iso'), # >=4.5GiB
528 UnattendedVm(oSet, 'tst-ubuntu-16.04.1-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.1-desktop-amd64.iso'), # >=5GiB
529 UnattendedVm(oSet, 'tst-ubuntu-16.04.1-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.1-desktop-i386.iso'), # >=4.5GiB
530 UnattendedVm(oSet, 'tst-ubuntu-16.04.2-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.2-desktop-amd64.iso'), # >=5GiB
531 UnattendedVm(oSet, 'tst-ubuntu-16.04.2-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.2-desktop-i386.iso'), # >=4.5GiB
532 UnattendedVm(oSet, 'tst-ubuntu-16.04.3-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.3-desktop-amd64.iso'), # >=5GiB
533 UnattendedVm(oSet, 'tst-ubuntu-16.04.3-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.3-desktop-i386.iso'), # >=4.5GiB
534 UnattendedVm(oSet, 'tst-ubuntu-16.04.4-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.4-desktop-amd64.iso'), # >=5GiB
535 UnattendedVm(oSet, 'tst-ubuntu-16.04.4-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.4-desktop-i386.iso'), # >=4.5GiB
536 UnattendedVm(oSet, 'tst-ubuntu-16.04.5-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.5-desktop-amd64.iso'), # >=5GiB
537 UnattendedVm(oSet, 'tst-ubuntu-16.04.5-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.5-desktop-i386.iso'), # >=4.5GiB
538 UnattendedVm(oSet, 'tst-ubuntu-16.04.6-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.6-desktop-amd64.iso'), # >=5GiB
539 UnattendedVm(oSet, 'tst-ubuntu-16.04.6-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.6-desktop-i386.iso'), # >=4.5GiB
540 UnattendedVm(oSet, 'tst-ubuntu-16.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.10-desktop-amd64.iso'), # >=5.5GiB
541 ## @todo 16.10-32 doesn't ask for an IP, so it always fails.
542 #UnattendedVm(oSet, 'tst-ubuntu-16.10-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.10-desktop-i386.iso'), # >=5.5GiB?
543 UnattendedVm(oSet, 'tst-ubuntu-17.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-17.04-desktop-amd64.iso'), # >=5GiB
544 UnattendedVm(oSet, 'tst-ubuntu-17.04-32', 'Ubuntu', '6.0/uaisos/ubuntu-17.04-desktop-i386.iso'), # >=4.5GiB
545 ## @todo ubuntu 17.10, 18.04 & 18.10 do not work. They misses all the the build tools (make, gcc, perl, ++)
546 ## and has signed kmods:
547 UnattendedVm(oSet, 'tst-ubuntu-17.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-17.10-desktop-amd64.iso', # >=4Gib
548 UnattendedVm.kfNoGAs),
549 UnattendedVm(oSet, 'tst-ubuntu-18.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-18.04-desktop-amd64.iso', # >=6GiB
550 UnattendedVm.kfNoGAs),
551 # 18.10 hangs reading install DVD during "starting partitioner..."
552 #UnattendedVm(oSet, 'tst-ubuntu-18.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-18.10-desktop-amd64.iso',
553 # UnattendedVm.kfNoGAs),
554 UnattendedVm(oSet, 'tst-ubuntu-19.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-19.04-desktop-amd64.iso', # >=6GiB
555 UnattendedVm.kfNoGAs),
556 UnattendedVm(oSet, 'tst-ubuntu-22.04-64', 'Ubuntu_64', '7.0/uaisos/ubuntu-22.04.3-desktop-amd64.iso', # >=6GiB ?
557 UnattendedVm.kfNoGAs),
558 UnattendedVm(oSet, 'tst-ubuntu-23.10-64', 'Ubuntu_64', '7.0/uaisos/ubuntu-23.10.1-desktop-amd64.iso', # >=6GiB ?
559 UnattendedVm.kfNoGAs),
560 UnattendedVm(oSet, 'tst-ubuntu-server-23.10-64', 'Ubuntu_64', '7.1/uaisos/ubuntu-23.10-live-server-amd64.iso',
561 UnattendedVm.kfNoGAs),
562
563 #
564 # Debian
565 #
566 UnattendedVm(oSet, 'tst-debian-9.3-64', 'Debian_64', '6.0/uaisos/debian-9.3.0-amd64-DVD-1.iso', # >=6GiB?
567 UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs),
568 UnattendedVm(oSet, 'tst-debian-9.4-64', 'Debian_64', '6.0/uaisos/debian-9.4.0-amd64-DVD-1.iso', # >=6GiB?
569 UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs),
570 UnattendedVm(oSet, 'tst-debian-10.0-64', 'Debian_64', '6.0/uaisos/debian-10.0.0-amd64-DVD-1.iso', # >=6GiB?
571 UnattendedVm.kfAvoidNetwork),
572
573 #
574 # Fedora
575 #
576 UnattendedVm(oSet, 'tst-fedora-39-64', 'Fedora_64', '7.0/uaisos/Fedora-Workstation-Live-x86_64-39-1.5.iso',
577 UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs),
578
579 #
580 # OracleLinux
581 #
582 UnattendedVm(oSet, 'tst-ol-9_2-amd64', 'Oracle_64', '7.1/uaisos/OracleLinux-R9-U2-x86_64-dvd.iso',
583 UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs),
584
585 #
586 # OS/2.
587 #
588 UnattendedVm(oSet, 'tst-acp2', 'OS2Warp45', '7.0/uaisos/acp2_us_cd2.iso'), # ~400MiB
589 ## @todo mcp2 too?
590
591
592 #
593 #
594 # ARM VMs
595 #
596 #
597
598 #
599 # Debian
600 #
601 UnattendedVm(oSet, 'tst-debian-11.8-arm64', 'Debian_arm64', '7.1/uaisos/debian-11.8.0-arm64-DVD-1.iso', # >=6GiB?
602 UnattendedVm.kfAvoidNetwork, "ARM"),
603
604 #
605 # OracleLinux
606 #
607 UnattendedVm(oSet, 'tst-ol-9_2-arm64', 'Oracle_arm64', '7.1/uaisos/OracleLinux-R9-U2-aarch64-dvd.iso',
608 UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs, "ARM"),
609 ]);
610 # pylint: enable=line-too-long
611 self.oTestVmSet = oSet;
612
613 # For option parsing:
614 self.aoSelectedVms = oSet.aoTestVms # type: list(UnattendedVm)
615
616 # Number of VMs to test in parallel:
617 self.cInParallel = 1;
618
619 # Whether to do the save-and-restore test.
620 self.fTestSaveAndRestore = True;
621
622 #
623 # Sub-test drivers.
624 #
625 self.addSubTestDriver(SubTstDrvAddSharedFolders1(self));
626 self.addSubTestDriver(SubTstDrvAddGuestCtrl(self));
627
628
629 #
630 # Overridden methods.
631 #
632
633 def showUsage(self):
634 """
635 Extend usage info
636 """
637 rc = vbox.TestDriver.showUsage(self)
638 reporter.log('');
639 reporter.log('tdGuestOsUnattendedInst1 options:');
640 reporter.log(' --parallel <num>');
641 reporter.log(' Number of VMs to test in parallel.');
642 reporter.log(' Default: 1');
643 reporter.log('');
644 reporter.log(' Options for working on selected test VMs:');
645 reporter.log(' --select <vm1[:vm2[:..]]>');
646 reporter.log(' Selects a test VM for the following configuration alterations.');
647 reporter.log(' Default: All possible test VMs');
648 reporter.log(' --copy <old-vm>=<new-vm>');
649 reporter.log(' Creates and selects <new-vm> as a copy of <old-vm>.');
650 reporter.log(' --guest-type <guest-os-type>');
651 reporter.log(' Sets the guest-os type of the currently selected test VM.');
652 reporter.log(' --install-iso <ISO file name>');
653 reporter.log(' Sets ISO image to use for the selected test VM.');
654 reporter.log(' --ram-adjust <MBs>');
655 reporter.log(' Adjust the VM ram size by the given delta. Both negative and positive');
656 reporter.log(' values are accepted.');
657 reporter.log(' --max-cpus <# CPUs>');
658 reporter.log(' Sets the maximum number of guest CPUs for the selected VM.');
659 reporter.log(' --set-extradata <key>:value');
660 reporter.log(' Set VM extra data for the selected VM. Can be repeated.');
661 reporter.log(' --ioapic, --no-ioapic');
662 reporter.log(' Enable or disable the I/O apic for the selected VM.');
663 reporter.log(' --pae, --no-pae');
664 reporter.log(' Enable or disable PAE support (32-bit guests only) for the selected VM.');
665 return rc
666
667 def parseOption(self, asArgs, iArg):
668 """
669 Extend standard options set
670 """
671
672 if asArgs[iArg] == '--parallel':
673 iArg = self.requireMoreArgs(1, asArgs, iArg);
674 self.cInParallel = int(asArgs[iArg]);
675 if self.cInParallel <= 0:
676 self.cInParallel = 1;
677 elif asArgs[iArg] == '--select':
678 iArg = self.requireMoreArgs(1, asArgs, iArg);
679 self.aoSelectedVms = [];
680 for sTestVm in asArgs[iArg].split(':'):
681 oTestVm = self.oTestVmSet.findTestVmByName(sTestVm);
682 if not oTestVm:
683 raise base.InvalidOption('Unknown test VM: %s' % (sTestVm,));
684 self.aoSelectedVms.append(oTestVm);
685 elif asArgs[iArg] == '--copy':
686 iArg = self.requireMoreArgs(1, asArgs, iArg);
687 asNames = asArgs[iArg].split('=');
688 if len(asNames) != 2 or not asNames[0] or not asNames[1]:
689 raise base.InvalidOption('The --copy option expects value on the form "old=new": %s' % (asArgs[iArg],));
690 oOldTestVm = self.oTestVmSet.findTestVmByName(asNames[0]);
691 if not oOldTestVm:
692 raise base.InvalidOption('Unknown test VM: %s' % (asNames[0],));
693 oNewTestVm = copy.deepcopy(oOldTestVm);
694 oNewTestVm.sVmName = asNames[1];
695 self.oTestVmSet.aoTestVms.append(oNewTestVm);
696 self.aoSelectedVms = [oNewTestVm];
697 elif asArgs[iArg] == '--guest-type':
698 iArg = self.requireMoreArgs(1, asArgs, iArg);
699 for oTestVm in self.aoSelectedVms:
700 oTestVm.sKind = asArgs[iArg];
701 elif asArgs[iArg] == '--install-iso':
702 iArg = self.requireMoreArgs(1, asArgs, iArg);
703 for oTestVm in self.aoSelectedVms:
704 oTestVm.sInstallIso = asArgs[iArg];
705 elif asArgs[iArg] == '--ram-adjust':
706 iArg = self.requireMoreArgs(1, asArgs, iArg);
707 for oTestVm in self.aoSelectedVms:
708 oTestVm.iOptRamAdjust = int(asArgs[iArg]);
709 elif asArgs[iArg] == '--max-cpus':
710 iArg = self.requireMoreArgs(1, asArgs, iArg);
711 for oTestVm in self.aoSelectedVms:
712 oTestVm.iOptMaxCpus = int(asArgs[iArg]);
713 elif asArgs[iArg] == '--set-extradata':
714 iArg = self.requireMoreArgs(1, asArgs, iArg)
715 sExtraData = asArgs[iArg];
716 try: _, _ = sExtraData.split(':');
717 except: raise base.InvalidOption('Invalid extradata specified: %s' % (sExtraData, ));
718 for oTestVm in self.aoSelectedVms:
719 oTestVm.asOptExtraData.append(sExtraData);
720 elif asArgs[iArg] == '--ioapic':
721 for oTestVm in self.aoSelectedVms:
722 oTestVm.fOptIoApic = True;
723 elif asArgs[iArg] == '--no-ioapic':
724 for oTestVm in self.aoSelectedVms:
725 oTestVm.fOptIoApic = False;
726 elif asArgs[iArg] == '--pae':
727 for oTestVm in self.aoSelectedVms:
728 oTestVm.fOptPae = True;
729 elif asArgs[iArg] == '--no-pae':
730 for oTestVm in self.aoSelectedVms:
731 oTestVm.fOptPae = False;
732 elif asArgs[iArg] == '--install-additions':
733 for oTestVm in self.aoSelectedVms:
734 oTestVm.fOptInstallAdditions = True;
735 elif asArgs[iArg] == '--no-install-additions':
736 for oTestVm in self.aoSelectedVms:
737 oTestVm.fOptInstallAdditions = False;
738 else:
739 return vbox.TestDriver.parseOption(self, asArgs, iArg);
740 return iArg + 1;
741
742 def actionConfig(self):
743 if not self.importVBoxApi(): # So we can use the constant below.
744 return False;
745 return self.oTestVmSet.actionConfig(self);
746
747 def actionExecute(self):
748 """
749 Execute the testcase.
750 """
751 return self.oTestVmSet.actionExecute(self, self.testOneVmConfig)
752
753 def testOneVmConfig(self, oVM, oTestVm): # type: (Any, UnattendedVm) -> bool
754 """
755 Install guest OS and wait for result
756 """
757
758 self.logVmInfo(oVM)
759 reporter.testStart('Installing %s%s' % (oTestVm.sVmName, ' with GAs' if oTestVm.fOptInstallAdditions else ''))
760
761 cMsTimeout = 40*60000;
762 if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
763 cMsTimeout = 180 * 60000; # will be adjusted down.
764
765 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
766 #oSession = self.startVmByName(oTestVm.sVmName); # (for quickly testing waitForGAs)
767 if oSession is not None:
768 # The guest has connected to TXS.
769 reporter.log('Guest reported success via TXS.');
770 reporter.testDone();
771
772 fRc = True;
773 # Kudge: GAs doesn't come up correctly, so we have to reboot the guest first:
774 # Looks like VBoxService isn't there.
775 if oTestVm.fOptInstallAdditions:
776 reporter.testStart('Rebooting');
777 fRc, oTxsSession = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession);
778 reporter.testDone();
779
780 # If we're installing GAs, wait for them to come online:
781 if oTestVm.fOptInstallAdditions and fRc is True:
782 reporter.testStart('Guest additions');
783 aenmRunLevels = [vboxcon.AdditionsRunLevelType_Userland,];
784 if oTestVm.isLoggedOntoDesktop():
785 aenmRunLevels.append(vboxcon.AdditionsRunLevelType_Desktop);
786 fRc = self.waitForGAs(oSession, cMsTimeout = cMsTimeout / 2, aenmWaitForRunLevels = aenmRunLevels,
787 aenmWaitForActive = (vboxcon.AdditionsFacilityType_VBoxGuestDriver,
788 vboxcon.AdditionsFacilityType_VBoxService,));
789 reporter.testDone();
790
791 # Now do a save & restore test:
792 if fRc is True and self.fTestSaveAndRestore:
793 fRc, oSession, oTxsSession = self.testSaveAndRestore(oSession, oTxsSession, oTestVm);
794
795 # Test GAs if requested:
796 if oTestVm.fOptInstallAdditions and fRc is True:
797 for oSubTstDrv in self.aoSubTstDrvs:
798 if oSubTstDrv.fEnabled:
799 reporter.testStart(oSubTstDrv.sTestName);
800 fRc2, oTxsSession = oSubTstDrv.testIt(oTestVm, oSession, oTxsSession);
801 reporter.testDone(fRc2 is None);
802 if fRc2 is False:
803 fRc = False;
804
805 if oSession is not None:
806 fRc = self.terminateVmBySession(oSession) and fRc;
807 return fRc is True
808
809 reporter.error('Installation of %s has failed' % (oTestVm.sVmName,))
810 #oTestVm.detatchAndDeleteHd(self); # Save space.
811 reporter.testDone()
812 return False
813
814 def testSaveAndRestore(self, oSession, oTxsSession, oTestVm):
815 """
816 Tests saving and restoring the VM.
817 """
818 _ = oTestVm;
819 reporter.testStart('Save');
820 ## @todo
821 reporter.testDone();
822 reporter.testStart('Restore');
823 ## @todo
824 reporter.testDone();
825 return (True, oSession, oTxsSession);
826
827if __name__ == '__main__':
828 sys.exit(tdGuestOsInstTest1().main(sys.argv))
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette