VirtualBox

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

Last change on this file since 79924 was 79924, checked in by vboxsync, 6 years ago

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

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