VirtualBox

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

最後變更 在這個檔案從107879是 107879,由 vboxsync 提交於 2 月 前

ValidationKit/tests/installation/tdGuestOsUnattendedInst1.py: Try fixing the unattended testcase after r167085 which removed the default password, bugref:9781

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

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