VirtualBox

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

Last change on this file since 82903 was 79970, checked in by vboxsync, 5 years ago

ValKit/tdGuestOsUnattendedInst1.py: XP tests. bugref:9151

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