VirtualBox

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

Last change on this file since 102163 was 101702, checked in by vboxsync, 17 months ago

ValidationKit/tdGuestOsUnattendedInst1: Add OracleLinux 9 arm64 to the list of unattended install testcases, bugref:10542

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 37.3 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdGuestOsUnattendedInst1.py 101702 2023-11-01 15:29:30Z 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: 101702 $"
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', '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); # pylint: disable=protected-access
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.enablePaeX86(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); # pylint: disable=protected-access
325
326
327 def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode = None):
328 #
329 # Do the standard reconfig in the base class first, it'll figure out
330 # if we can run the VM as requested.
331 #
332 (fRc, oVM) = vboxtestvms.BaseTestVm.getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode);
333 if fRc is True:
334 #
335 # Make sure there is no HD from the previous run attached nor taking
336 # up storage on the host.
337 #
338 fRc = self.recreateRecommendedHdd(oVM, oTestDrv);
339 if fRc is True:
340 #
341 # Set up unattended installation.
342 #
343 try:
344 oIUnattended = oTestDrv.oVBox.createUnattendedInstaller();
345 except:
346 fRc = reporter.errorXcpt();
347 if fRc is True:
348 fRc = self.unattendedDetectOs(oIUnattended, oTestDrv);
349 if fRc is True:
350 fRc = self._unattendedConfigure(oIUnattended, oTestDrv);
351 if fRc is True:
352 fRc = self._unattendedDoIt(oIUnattended, oVM, oTestDrv);
353
354 # Done.
355 return (fRc, oVM)
356
357 def isLoggedOntoDesktop(self):
358 #
359 # Normally all unattended installations should end up on the desktop.
360 # An exception is a minimal install, but we currently don't support that.
361 #
362 return True;
363
364 def getTestUser(self):
365 # Default unattended installation user (parent knowns its password).
366 return 'vboxuser';
367
368
369 #
370 # Our methods.
371 #
372
373 def unattendedDetectOs(self, oIUnattended, oTestDrv): # type: (Any, vbox.TestDriver) -> bool
374 """
375 Does the detectIsoOS operation and checks that the detect OSTypeId matches.
376
377 Returns True on success, False w/ errors logged on failure.
378 """
379
380 #
381 # Point the installer at the ISO and do the detection.
382 #
383 sInstallIso = self.sInstallIso
384 if not os.path.isabs(sInstallIso):
385 sInstallIso = os.path.join(oTestDrv.sResourcePath, sInstallIso);
386
387 try:
388 oIUnattended.isoPath = sInstallIso;
389 except:
390 return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
391
392 try:
393 oIUnattended.detectIsoOS();
394 except:
395 if oTestDrv.oVBoxMgr.xcptIsNotEqual(None, oTestDrv.oVBoxMgr.statuses.E_NOTIMPL):
396 return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
397
398 #
399 # Get and log the result.
400 #
401 # Note! Current (6.0.97) fails with E_NOTIMPL even if it does some work.
402 #
403 try:
404 sDetectedOSTypeId = oIUnattended.detectedOSTypeId;
405 sDetectedOSVersion = oIUnattended.detectedOSVersion;
406 sDetectedOSFlavor = oIUnattended.detectedOSFlavor;
407 sDetectedOSLanguages = oIUnattended.detectedOSLanguages;
408 sDetectedOSHints = oIUnattended.detectedOSHints;
409 except:
410 return reporter.errorXcpt('sInstallIso=%s' % (sInstallIso,));
411
412 reporter.log('detectIsoOS result for "%s" (vm %s):' % (sInstallIso, self.sVmName));
413 reporter.log(' DetectedOSTypeId: %s' % (sDetectedOSTypeId,));
414 reporter.log(' DetectedOSVersion: %s' % (sDetectedOSVersion,));
415 reporter.log(' DetectedOSFlavor: %s' % (sDetectedOSFlavor,));
416 reporter.log(' DetectedOSLanguages: %s' % (sDetectedOSLanguages,));
417 reporter.log(' DetectedOSHints: %s' % (sDetectedOSHints,));
418
419 #
420 # Check if the OS type matches.
421 #
422 if self.sKind != sDetectedOSTypeId:
423 return reporter.error('sInstallIso=%s: DetectedOSTypeId is %s, expected %s'
424 % (sInstallIso, sDetectedOSTypeId, self.sKind));
425
426 return True;
427
428
429class tdGuestOsInstTest1(vbox.TestDriver):
430 """
431 Unattended Guest OS installation tests using IUnattended.
432
433 Scenario:
434 - Create a new VM with default settings using IMachine::applyDefaults.
435 - Setup unattended installation using IUnattended.
436 - Start the VM and do the installation.
437 - Wait for TXS to report for service.
438 - If installing GAs:
439 - Wait for GAs to report operational runlevel.
440 - Save & restore state.
441 - If installing GAs:
442 - Test guest properties (todo).
443 - Test guest controls.
444 - Test shared folders.
445 """
446
447
448 def __init__(self):
449 """
450 Reinitialize child class instance.
451 """
452 vbox.TestDriver.__init__(self)
453 self.fLegacyOptions = False;
454 assert self.fEnableVrdp; # in parent driver.
455
456 #
457 # Our install test VM set.
458 #
459 oSet = vboxtestvms.TestVmSet(self.oTestVmManager, fIgnoreSkippedVm = True);
460 # pylint: disable=line-too-long
461 oSet.aoTestVms.extend([
462 #
463 # Windows. The older windows ISOs requires a keyfile (for xp sp3
464 # pick a key from the PID.INF file on the ISO).
465 #
466 UnattendedVm(oSet, 'tst-xp-32', 'WindowsXP', '6.0/uaisos/en_winxp_pro_x86_build2600_iso.img', UnattendedVm.kfKeyFile), # >=2GiB
467 UnattendedVm(oSet, 'tst-xpsp2-32', 'WindowsXP', '6.0/uaisos/en_winxp_pro_with_sp2.iso', UnattendedVm.kfKeyFile), # >=2GiB
468 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
469 UnattendedVm(oSet, 'tst-xp-64', 'WindowsXP_64', '6.0/uaisos/en_win_xp_pro_x64_vl.iso', UnattendedVm.kfKeyFile), # >=3GiB
470 UnattendedVm(oSet, 'tst-xpsp2-64', 'WindowsXP_64', '6.0/uaisos/en_win_xp_pro_x64_with_sp2_vl_x13-41611.iso', UnattendedVm.kfKeyFile), # >=3GiB
471 #fixme: UnattendedVm(oSet, 'tst-xpchk-64', 'WindowsXP_64', '6.0/uaisos/en_windows_xp_professional_x64_chk.iso', UnattendedVm.kfKeyFile | UnattendedVm.kfNeedCom1), # >=3GiB
472 # No key files needed:
473 UnattendedVm(oSet, 'tst-vista-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_ee_x86_dvd_vl_x13-17271.iso'), # >=6GiB
474 UnattendedVm(oSet, 'tst-vista-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_x64_dvd_vl_x13-17316.iso'), # >=8GiB
475 UnattendedVm(oSet, 'tst-vistasp1-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_enterprise_with_service_pack_1_x86_dvd_x14-55954.iso'), # >=6GiB
476 UnattendedVm(oSet, 'tst-vistasp1-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_with_service_pack_1_x64_dvd_x14-55934.iso'), # >=9GiB
477 UnattendedVm(oSet, 'tst-vistasp2-32', 'WindowsVista', '6.0/uaisos/en_windows_vista_enterprise_sp2_x86_dvd_342329.iso'), # >=7GiB
478 UnattendedVm(oSet, 'tst-vistasp2-64', 'WindowsVista_64', '6.0/uaisos/en_windows_vista_enterprise_sp2_x64_dvd_342332.iso'), # >=10GiB
479 UnattendedVm(oSet, 'tst-w7-32', 'Windows7', '6.0/uaisos/en_windows_7_enterprise_x86_dvd_x15-70745.iso'), # >=6GiB
480 UnattendedVm(oSet, 'tst-w7-64', 'Windows7_64', '6.0/uaisos/en_windows_7_enterprise_x64_dvd_x15-70749.iso'), # >=10GiB
481 UnattendedVm(oSet, 'tst-w7sp1-32', 'Windows7', '6.0/uaisos/en_windows_7_enterprise_with_sp1_x86_dvd_u_677710.iso'), # >=6GiB
482 UnattendedVm(oSet, 'tst-w7sp1-64', 'Windows7_64', '6.0/uaisos/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso'), # >=8GiB
483 UnattendedVm(oSet, 'tst-w8-32', 'Windows8', '6.0/uaisos/en_windows_8_enterprise_x86_dvd_917587.iso'), # >=6GiB
484 UnattendedVm(oSet, 'tst-w8-64', 'Windows8_64', '6.0/uaisos/en_windows_8_enterprise_x64_dvd_917522.iso'), # >=9GiB
485 UnattendedVm(oSet, 'tst-w81-32', 'Windows81', '6.0/uaisos/en_windows_8_1_enterprise_x86_dvd_2791510.iso'), # >=5GiB
486 UnattendedVm(oSet, 'tst-w81-64', 'Windows81_64', '6.0/uaisos/en_windows_8_1_enterprise_x64_dvd_2791088.iso'), # >=8GiB
487 UnattendedVm(oSet, 'tst-w10-1507-32', 'Windows10', '6.0/uaisos/en_windows_10_pro_10240_x86_dvd.iso'), # >=6GiB
488 UnattendedVm(oSet, 'tst-w10-1507-64', 'Windows10_64', '6.0/uaisos/en_windows_10_pro_10240_x64_dvd.iso'), # >=9GiB
489 UnattendedVm(oSet, 'tst-w10-1511-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1511_updated_feb_2016_x86_dvd_8378870.iso'), # >=7GiB
490 UnattendedVm(oSet, 'tst-w10-1511-64', 'Windows10_64', '6.0/uaisos/en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso'), # >=9GiB
491 UnattendedVm(oSet, 'tst-w10-1607-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1607_updated_jul_2016_x86_dvd_9060097.iso'), # >=7GiB
492 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
493 UnattendedVm(oSet, 'tst-w10-1703-32', 'Windows10', '6.0/uaisos/en_windows_10_enterprise_version_1703_updated_march_2017_x86_dvd_10188981.iso'), # >=7GiB
494 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
495 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
496 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
497 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
498 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
499 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
500 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
501 UnattendedVm(oSet, 'tst-w10-1903-32', 'Windows10', '6.0/uaisos/en_windows_10_business_editions_version_1903_x86_dvd_ca4f0f49.iso'), # >=7GiB
502 UnattendedVm(oSet, 'tst-w10-1903-64', 'Windows10_64', '6.0/uaisos/en_windows_10_business_editions_version_1903_x64_dvd_37200948.iso'), # >=10GiB
503 #
504 # Ubuntu
505 #
506 ## @todo 15.10 fails with grub install error.
507 #UnattendedVm(oSet, 'tst-ubuntu-15.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-15.10-desktop-amd64.iso'),
508 UnattendedVm(oSet, 'tst-ubuntu-16.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04-desktop-amd64.iso', # ~5GiB
509 UnattendedVm.kfUbuntuAvx2Crash),
510 UnattendedVm(oSet, 'tst-ubuntu-16.04-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04-desktop-i386.iso'), # >=4.5GiB
511 UnattendedVm(oSet, 'tst-ubuntu-16.04.1-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.1-desktop-amd64.iso'), # >=5GiB
512 UnattendedVm(oSet, 'tst-ubuntu-16.04.1-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.1-desktop-i386.iso'), # >=4.5GiB
513 UnattendedVm(oSet, 'tst-ubuntu-16.04.2-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.2-desktop-amd64.iso'), # >=5GiB
514 UnattendedVm(oSet, 'tst-ubuntu-16.04.2-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.2-desktop-i386.iso'), # >=4.5GiB
515 UnattendedVm(oSet, 'tst-ubuntu-16.04.3-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.3-desktop-amd64.iso'), # >=5GiB
516 UnattendedVm(oSet, 'tst-ubuntu-16.04.3-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.3-desktop-i386.iso'), # >=4.5GiB
517 UnattendedVm(oSet, 'tst-ubuntu-16.04.4-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.4-desktop-amd64.iso'), # >=5GiB
518 UnattendedVm(oSet, 'tst-ubuntu-16.04.4-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.4-desktop-i386.iso'), # >=4.5GiB
519 UnattendedVm(oSet, 'tst-ubuntu-16.04.5-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.5-desktop-amd64.iso'), # >=5GiB
520 UnattendedVm(oSet, 'tst-ubuntu-16.04.5-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.5-desktop-i386.iso'), # >=4.5GiB
521 UnattendedVm(oSet, 'tst-ubuntu-16.04.6-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.04.6-desktop-amd64.iso'), # >=5GiB
522 UnattendedVm(oSet, 'tst-ubuntu-16.04.6-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.04.6-desktop-i386.iso'), # >=4.5GiB
523 UnattendedVm(oSet, 'tst-ubuntu-16.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-16.10-desktop-amd64.iso'), # >=5.5GiB
524 ## @todo 16.10-32 doesn't ask for an IP, so it always fails.
525 #UnattendedVm(oSet, 'tst-ubuntu-16.10-32', 'Ubuntu', '6.0/uaisos/ubuntu-16.10-desktop-i386.iso'), # >=5.5GiB?
526 UnattendedVm(oSet, 'tst-ubuntu-17.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-17.04-desktop-amd64.iso'), # >=5GiB
527 UnattendedVm(oSet, 'tst-ubuntu-17.04-32', 'Ubuntu', '6.0/uaisos/ubuntu-17.04-desktop-i386.iso'), # >=4.5GiB
528 ## @todo ubuntu 17.10, 18.04 & 18.10 do not work. They misses all the the build tools (make, gcc, perl, ++)
529 ## and has signed kmods:
530 UnattendedVm(oSet, 'tst-ubuntu-17.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-17.10-desktop-amd64.iso', # >=4Gib
531 UnattendedVm.kfNoGAs),
532 UnattendedVm(oSet, 'tst-ubuntu-18.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-18.04-desktop-amd64.iso', # >=6GiB
533 UnattendedVm.kfNoGAs),
534 # 18.10 hangs reading install DVD during "starting partitioner..."
535 #UnattendedVm(oSet, 'tst-ubuntu-18.10-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-18.10-desktop-amd64.iso',
536 # UnattendedVm.kfNoGAs),
537 UnattendedVm(oSet, 'tst-ubuntu-19.04-64', 'Ubuntu_64', '6.0/uaisos/ubuntu-19.04-desktop-amd64.iso', # >=6GiB
538 UnattendedVm.kfNoGAs),
539 UnattendedVm(oSet, 'tst-debian-9.3-64', 'Debian_64', '6.0/uaisos/debian-9.3.0-amd64-DVD-1.iso', # >=6GiB?
540 UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs),
541 UnattendedVm(oSet, 'tst-debian-9.4-64', 'Debian_64', '6.0/uaisos/debian-9.4.0-amd64-DVD-1.iso', # >=6GiB?
542 UnattendedVm.kfAvoidNetwork | UnattendedVm.kfNoGAs),
543 UnattendedVm(oSet, 'tst-debian-10.0-64', 'Debian_64', '6.0/uaisos/debian-10.0.0-amd64-DVD-1.iso', # >=6GiB?
544 UnattendedVm.kfAvoidNetwork),
545 #
546 # OS/2.
547 #
548 UnattendedVm(oSet, 'tst-acp2', 'OS2Warp45', '7.0/uaisos/acp2_us_cd2.iso'), # ~400MiB
549 ## @todo mcp2 too?
550
551
552 #
553 #
554 # ARM VMs
555 #
556 #
557
558 #
559 # Debian
560 #
561 UnattendedVm(oSet, 'tst-debian-11.8-arm64', 'Debian_arm64', '7.1/uaisos/debian-11.8.0-arm64-DVD-1.iso', # >=6GiB?
562 UnattendedVm.kfAvoidNetwork, "ARM"),
563
564 #
565 # OracleLinux
566 #
567 UnattendedVm(oSet, 'tst-ol-9_2-arm64', 'Oracle_arm64', '7.1/uaisos/OracleLinux-R9-U2-aarch64-dvd.iso',
568 0, "ARM"),
569 ]);
570 # pylint: enable=line-too-long
571 self.oTestVmSet = oSet;
572
573 # For option parsing:
574 self.aoSelectedVms = oSet.aoTestVms # type: list(UnattendedVm)
575
576 # Number of VMs to test in parallel:
577 self.cInParallel = 1;
578
579 # Whether to do the save-and-restore test.
580 self.fTestSaveAndRestore = True;
581
582 #
583 # Sub-test drivers.
584 #
585 self.addSubTestDriver(SubTstDrvAddSharedFolders1(self));
586 self.addSubTestDriver(SubTstDrvAddGuestCtrl(self));
587
588
589 #
590 # Overridden methods.
591 #
592
593 def showUsage(self):
594 """
595 Extend usage info
596 """
597 rc = vbox.TestDriver.showUsage(self)
598 reporter.log('');
599 reporter.log('tdGuestOsUnattendedInst1 options:');
600 reporter.log(' --parallel <num>');
601 reporter.log(' Number of VMs to test in parallel.');
602 reporter.log(' Default: 1');
603 reporter.log('');
604 reporter.log(' Options for working on selected test VMs:');
605 reporter.log(' --select <vm1[:vm2[:..]]>');
606 reporter.log(' Selects a test VM for the following configuration alterations.');
607 reporter.log(' Default: All possible test VMs');
608 reporter.log(' --copy <old-vm>=<new-vm>');
609 reporter.log(' Creates and selects <new-vm> as a copy of <old-vm>.');
610 reporter.log(' --guest-type <guest-os-type>');
611 reporter.log(' Sets the guest-os type of the currently selected test VM.');
612 reporter.log(' --install-iso <ISO file name>');
613 reporter.log(' Sets ISO image to use for the selected test VM.');
614 reporter.log(' --ram-adjust <MBs>');
615 reporter.log(' Adjust the VM ram size by the given delta. Both negative and positive');
616 reporter.log(' values are accepted.');
617 reporter.log(' --max-cpus <# CPUs>');
618 reporter.log(' Sets the maximum number of guest CPUs for the selected VM.');
619 reporter.log(' --set-extradata <key>:value');
620 reporter.log(' Set VM extra data for the selected VM. Can be repeated.');
621 reporter.log(' --ioapic, --no-ioapic');
622 reporter.log(' Enable or disable the I/O apic for the selected VM.');
623 reporter.log(' --pae, --no-pae');
624 reporter.log(' Enable or disable PAE support (32-bit guests only) for the selected VM.');
625 return rc
626
627 def parseOption(self, asArgs, iArg):
628 """
629 Extend standard options set
630 """
631
632 if asArgs[iArg] == '--parallel':
633 iArg = self.requireMoreArgs(1, asArgs, iArg);
634 self.cInParallel = int(asArgs[iArg]);
635 if self.cInParallel <= 0:
636 self.cInParallel = 1;
637 elif asArgs[iArg] == '--select':
638 iArg = self.requireMoreArgs(1, asArgs, iArg);
639 self.aoSelectedVms = [];
640 for sTestVm in asArgs[iArg].split(':'):
641 oTestVm = self.oTestVmSet.findTestVmByName(sTestVm);
642 if not oTestVm:
643 raise base.InvalidOption('Unknown test VM: %s' % (sTestVm,));
644 self.aoSelectedVms.append(oTestVm);
645 elif asArgs[iArg] == '--copy':
646 iArg = self.requireMoreArgs(1, asArgs, iArg);
647 asNames = asArgs[iArg].split('=');
648 if len(asNames) != 2 or not asNames[0] or not asNames[1]:
649 raise base.InvalidOption('The --copy option expects value on the form "old=new": %s' % (asArgs[iArg],));
650 oOldTestVm = self.oTestVmSet.findTestVmByName(asNames[0]);
651 if not oOldTestVm:
652 raise base.InvalidOption('Unknown test VM: %s' % (asNames[0],));
653 oNewTestVm = copy.deepcopy(oOldTestVm);
654 oNewTestVm.sVmName = asNames[1];
655 self.oTestVmSet.aoTestVms.append(oNewTestVm);
656 self.aoSelectedVms = [oNewTestVm];
657 elif asArgs[iArg] == '--guest-type':
658 iArg = self.requireMoreArgs(1, asArgs, iArg);
659 for oTestVm in self.aoSelectedVms:
660 oTestVm.sKind = asArgs[iArg];
661 elif asArgs[iArg] == '--install-iso':
662 iArg = self.requireMoreArgs(1, asArgs, iArg);
663 for oTestVm in self.aoSelectedVms:
664 oTestVm.sInstallIso = asArgs[iArg];
665 elif asArgs[iArg] == '--ram-adjust':
666 iArg = self.requireMoreArgs(1, asArgs, iArg);
667 for oTestVm in self.aoSelectedVms:
668 oTestVm.iOptRamAdjust = int(asArgs[iArg]);
669 elif asArgs[iArg] == '--max-cpus':
670 iArg = self.requireMoreArgs(1, asArgs, iArg);
671 for oTestVm in self.aoSelectedVms:
672 oTestVm.iOptMaxCpus = int(asArgs[iArg]);
673 elif asArgs[iArg] == '--set-extradata':
674 iArg = self.requireMoreArgs(1, asArgs, iArg)
675 sExtraData = asArgs[iArg];
676 try: _, _ = sExtraData.split(':');
677 except: raise base.InvalidOption('Invalid extradata specified: %s' % (sExtraData, ));
678 for oTestVm in self.aoSelectedVms:
679 oTestVm.asOptExtraData.append(sExtraData);
680 elif asArgs[iArg] == '--ioapic':
681 for oTestVm in self.aoSelectedVms:
682 oTestVm.fOptIoApic = True;
683 elif asArgs[iArg] == '--no-ioapic':
684 for oTestVm in self.aoSelectedVms:
685 oTestVm.fOptIoApic = False;
686 elif asArgs[iArg] == '--pae':
687 for oTestVm in self.aoSelectedVms:
688 oTestVm.fOptPae = True;
689 elif asArgs[iArg] == '--no-pae':
690 for oTestVm in self.aoSelectedVms:
691 oTestVm.fOptPae = False;
692 elif asArgs[iArg] == '--install-additions':
693 for oTestVm in self.aoSelectedVms:
694 oTestVm.fOptInstallAdditions = True;
695 elif asArgs[iArg] == '--no-install-additions':
696 for oTestVm in self.aoSelectedVms:
697 oTestVm.fOptInstallAdditions = False;
698 else:
699 return vbox.TestDriver.parseOption(self, asArgs, iArg);
700 return iArg + 1;
701
702 def actionConfig(self):
703 if not self.importVBoxApi(): # So we can use the constant below.
704 return False;
705 return self.oTestVmSet.actionConfig(self);
706
707 def actionExecute(self):
708 """
709 Execute the testcase.
710 """
711 return self.oTestVmSet.actionExecute(self, self.testOneVmConfig)
712
713 def testOneVmConfig(self, oVM, oTestVm): # type: (Any, UnattendedVm) -> bool
714 """
715 Install guest OS and wait for result
716 """
717
718 self.logVmInfo(oVM)
719 reporter.testStart('Installing %s%s' % (oTestVm.sVmName, ' with GAs' if oTestVm.fOptInstallAdditions else ''))
720
721 cMsTimeout = 40*60000;
722 if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
723 cMsTimeout = 180 * 60000; # will be adjusted down.
724
725 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
726 #oSession = self.startVmByName(oTestVm.sVmName); # (for quickly testing waitForGAs)
727 if oSession is not None:
728 # The guest has connected to TXS.
729 reporter.log('Guest reported success via TXS.');
730 reporter.testDone();
731
732 fRc = True;
733 # Kudge: GAs doesn't come up correctly, so we have to reboot the guest first:
734 # Looks like VBoxService isn't there.
735 if oTestVm.fOptInstallAdditions:
736 reporter.testStart('Rebooting');
737 fRc, oTxsSession = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession);
738 reporter.testDone();
739
740 # If we're installing GAs, wait for them to come online:
741 if oTestVm.fOptInstallAdditions and fRc is True:
742 reporter.testStart('Guest additions');
743 aenmRunLevels = [vboxcon.AdditionsRunLevelType_Userland,];
744 if oTestVm.isLoggedOntoDesktop():
745 aenmRunLevels.append(vboxcon.AdditionsRunLevelType_Desktop);
746 fRc = self.waitForGAs(oSession, cMsTimeout = cMsTimeout / 2, aenmWaitForRunLevels = aenmRunLevels,
747 aenmWaitForActive = (vboxcon.AdditionsFacilityType_VBoxGuestDriver,
748 vboxcon.AdditionsFacilityType_VBoxService,));
749 reporter.testDone();
750
751 # Now do a save & restore test:
752 if fRc is True and self.fTestSaveAndRestore:
753 fRc, oSession, oTxsSession = self.testSaveAndRestore(oSession, oTxsSession, oTestVm);
754
755 # Test GAs if requested:
756 if oTestVm.fOptInstallAdditions and fRc is True:
757 for oSubTstDrv in self.aoSubTstDrvs:
758 if oSubTstDrv.fEnabled:
759 reporter.testStart(oSubTstDrv.sTestName);
760 fRc2, oTxsSession = oSubTstDrv.testIt(oTestVm, oSession, oTxsSession);
761 reporter.testDone(fRc2 is None);
762 if fRc2 is False:
763 fRc = False;
764
765 if oSession is not None:
766 fRc = self.terminateVmBySession(oSession) and fRc;
767 return fRc is True
768
769 reporter.error('Installation of %s has failed' % (oTestVm.sVmName,))
770 #oTestVm.detatchAndDeleteHd(self); # Save space.
771 reporter.testDone()
772 return False
773
774 def testSaveAndRestore(self, oSession, oTxsSession, oTestVm):
775 """
776 Tests saving and restoring the VM.
777 """
778 _ = oTestVm;
779 reporter.testStart('Save');
780 ## @todo
781 reporter.testDone();
782 reporter.testStart('Restore');
783 ## @todo
784 reporter.testDone();
785 return (True, oSession, oTxsSession);
786
787if __name__ == '__main__':
788 sys.exit(tdGuestOsInstTest1().main(sys.argv))
Note: See TracBrowser for help on using the repository browser.

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