VirtualBox

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

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

ValidationKit/tests/tdGuestOsUnattendedInst1.py: Need to enable PAE for 32-bit Ubuntu 16.04.xx guests or the kernel will not start

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