VirtualBox

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

Last change on this file since 93354 was 93152, checked in by vboxsync, 3 years ago

ValKit/tdGuestOsUnattendedInst1.py: Added tst-acp2 (OS2).

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