1 | #!/usr/bin/env python
|
---|
2 | # -*- coding: utf-8 -*-
|
---|
3 | # $Id: tdGuestOsInstTest1.py 98655 2023-02-20 15:05:40Z vboxsync $
|
---|
4 |
|
---|
5 | """
|
---|
6 | VirtualBox Validation Kit - Guest OS installation tests.
|
---|
7 | """
|
---|
8 |
|
---|
9 | __copyright__ = \
|
---|
10 | """
|
---|
11 | Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
12 |
|
---|
13 | This file is part of VirtualBox base platform packages, as
|
---|
14 | available from https://www.virtualbox.org.
|
---|
15 |
|
---|
16 | This program is free software; you can redistribute it and/or
|
---|
17 | modify it under the terms of the GNU General Public License
|
---|
18 | as published by the Free Software Foundation, in version 3 of the
|
---|
19 | License.
|
---|
20 |
|
---|
21 | This program is distributed in the hope that it will be useful, but
|
---|
22 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
24 | General Public License for more details.
|
---|
25 |
|
---|
26 | You should have received a copy of the GNU General Public License
|
---|
27 | along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
28 |
|
---|
29 | The contents of this file may alternatively be used under the terms
|
---|
30 | of the Common Development and Distribution License Version 1.0
|
---|
31 | (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
32 | in the VirtualBox distribution, in which case the provisions of the
|
---|
33 | CDDL are applicable instead of those of the GPL.
|
---|
34 |
|
---|
35 | You may elect to license modified versions of this file under the
|
---|
36 | terms and conditions of either the GPL or the CDDL or both.
|
---|
37 |
|
---|
38 | SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
39 | """
|
---|
40 | __version__ = "$Revision: 98655 $"
|
---|
41 |
|
---|
42 |
|
---|
43 | # Standard Python imports.
|
---|
44 | import os
|
---|
45 | import sys
|
---|
46 |
|
---|
47 |
|
---|
48 | # Only the main script needs to modify the path.
|
---|
49 | try: __file__ # pylint: disable=used-before-assignment
|
---|
50 | except: __file__ = sys.argv[0]
|
---|
51 | g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
---|
52 | sys.path.append(g_ksValidationKitDir)
|
---|
53 |
|
---|
54 | # Validation Kit imports.
|
---|
55 | from testdriver import vbox;
|
---|
56 | from testdriver import base;
|
---|
57 | from testdriver import reporter;
|
---|
58 | from testdriver import vboxcon;
|
---|
59 | from testdriver import vboxtestvms;
|
---|
60 |
|
---|
61 |
|
---|
62 | class InstallTestVm(vboxtestvms.TestVm):
|
---|
63 | """ Installation test VM. """
|
---|
64 |
|
---|
65 | ## @name The primary controller, to which the disk will be attached.
|
---|
66 | ## @{
|
---|
67 | ksScsiController = 'SCSI Controller'
|
---|
68 | ksSataController = 'SATA Controller'
|
---|
69 | ksIdeController = 'IDE Controller'
|
---|
70 | ## @}
|
---|
71 |
|
---|
72 | ## @name VM option flags (OR together).
|
---|
73 | ## @{
|
---|
74 | kf32Bit = 0x01;
|
---|
75 | kf64Bit = 0x02;
|
---|
76 | # most likely for ancient Linux kernels assuming that AMD processors have always an I/O-APIC
|
---|
77 | kfReqIoApic = 0x10;
|
---|
78 | kfReqIoApicSmp = 0x20;
|
---|
79 | kfReqPae = 0x40;
|
---|
80 | kfIdeIrqDelay = 0x80;
|
---|
81 | kfUbuntuNewAmdBug = 0x100;
|
---|
82 | kfNoWin81Paravirt = 0x200;
|
---|
83 | ## @}
|
---|
84 |
|
---|
85 | ## IRQ delay extra data config for win2k VMs.
|
---|
86 | kasIdeIrqDelay = [ 'VBoxInternal/Devices/piix3ide/0/Config/IRQDelay:1', ];
|
---|
87 |
|
---|
88 | ## Install ISO path relative to the testrsrc root.
|
---|
89 | ksIsoPathBase = os.path.join('4.2', 'isos');
|
---|
90 |
|
---|
91 |
|
---|
92 | def __init__(self, oSet, sVmName, sKind, sInstallIso, sHdCtrlNm, cGbHdd, fFlags):
|
---|
93 | vboxtestvms.TestVm.__init__(self, sVmName, oSet = oSet, sKind = sKind, sHddControllerType = sHdCtrlNm,
|
---|
94 | fRandomPvPMode = (fFlags & self.kfNoWin81Paravirt) == 0);
|
---|
95 | self.sDvdImage = os.path.join(self.ksIsoPathBase, sInstallIso);
|
---|
96 | self.cGbHdd = cGbHdd;
|
---|
97 | self.fInstVmFlags = fFlags;
|
---|
98 | if fFlags & self.kfReqPae:
|
---|
99 | self.fPae = True;
|
---|
100 | if fFlags & (self.kfReqIoApic | self.kfReqIoApicSmp):
|
---|
101 | self.fIoApic = True;
|
---|
102 |
|
---|
103 | # Tweaks
|
---|
104 | self.iOptRamAdjust = 0;
|
---|
105 | self.asExtraData = [];
|
---|
106 | if fFlags & self.kfIdeIrqDelay:
|
---|
107 | self.asExtraData = self.kasIdeIrqDelay;
|
---|
108 |
|
---|
109 | def detatchAndDeleteHd(self, oTestDrv):
|
---|
110 | """
|
---|
111 | Detaches and deletes the HD.
|
---|
112 | Returns success indicator, error info logged.
|
---|
113 | """
|
---|
114 | fRc = False;
|
---|
115 | oVM = oTestDrv.getVmByName(self.sVmName);
|
---|
116 | if oVM is not None:
|
---|
117 | oSession = oTestDrv.openSession(oVM);
|
---|
118 | if oSession is not None:
|
---|
119 | (fRc, oHd) = oSession.detachHd(self.sHddControllerType, iPort = 0, iDevice = 0);
|
---|
120 | if fRc is True and oHd is not None:
|
---|
121 | fRc = oSession.saveSettings();
|
---|
122 | fRc = fRc and oTestDrv.oVBox.deleteHdByMedium(oHd);
|
---|
123 | fRc = fRc and oSession.saveSettings(); # Necessary for media reg?
|
---|
124 | fRc = oSession.close() and fRc;
|
---|
125 | return fRc;
|
---|
126 |
|
---|
127 | def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode = None):
|
---|
128 | #
|
---|
129 | # Do the standard reconfig in the base class first, it'll figure out
|
---|
130 | # if we can run the VM as requested.
|
---|
131 | #
|
---|
132 | (fRc, oVM) = vboxtestvms.TestVm.getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode);
|
---|
133 |
|
---|
134 | #
|
---|
135 | # Make sure there is no HD from the previous run attached nor taking
|
---|
136 | # up storage on the host.
|
---|
137 | #
|
---|
138 | if fRc is True:
|
---|
139 | fRc = self.detatchAndDeleteHd(oTestDrv);
|
---|
140 |
|
---|
141 | #
|
---|
142 | # Check for ubuntu installer vs. AMD host CPU.
|
---|
143 | #
|
---|
144 | if fRc is True and (self.fInstVmFlags & self.kfUbuntuNewAmdBug):
|
---|
145 | if self.isHostCpuAffectedByUbuntuNewAmdBug(oTestDrv):
|
---|
146 | return (None, None); # (skip)
|
---|
147 |
|
---|
148 | #
|
---|
149 | # Make adjustments to the default config, and adding a fresh HD.
|
---|
150 | #
|
---|
151 | if fRc is True:
|
---|
152 | oSession = oTestDrv.openSession(oVM);
|
---|
153 | if oSession is not None:
|
---|
154 | if self.sHddControllerType == self.ksSataController:
|
---|
155 | fRc = fRc and oSession.setStorageControllerType(vboxcon.StorageControllerType_IntelAhci,
|
---|
156 | self.sHddControllerType);
|
---|
157 | fRc = fRc and oSession.setStorageControllerPortCount(self.sHddControllerType, 1);
|
---|
158 | elif self.sHddControllerType == self.ksScsiController:
|
---|
159 | fRc = fRc and oSession.setStorageControllerType(vboxcon.StorageControllerType_LsiLogic,
|
---|
160 | self.sHddControllerType);
|
---|
161 | try:
|
---|
162 | sHddPath = os.path.join(os.path.dirname(oVM.settingsFilePath),
|
---|
163 | '%s-%s-%s.vdi' % (self.sVmName, sVirtMode, cCpus,));
|
---|
164 | except:
|
---|
165 | reporter.errorXcpt();
|
---|
166 | sHddPath = None;
|
---|
167 | fRc = False;
|
---|
168 |
|
---|
169 | fRc = fRc and oSession.createAndAttachHd(sHddPath,
|
---|
170 | cb = self.cGbHdd * 1024*1024*1024,
|
---|
171 | sController = self.sHddControllerType,
|
---|
172 | iPort = 0,
|
---|
173 | fImmutable = False);
|
---|
174 |
|
---|
175 | # Set proper boot order
|
---|
176 | fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk)
|
---|
177 | fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_DVD)
|
---|
178 |
|
---|
179 | # Adjust memory if requested.
|
---|
180 | if self.iOptRamAdjust != 0:
|
---|
181 | fRc = fRc and oSession.setRamSize(oSession.o.machine.memorySize + self.iOptRamAdjust);
|
---|
182 |
|
---|
183 | # Set extra data
|
---|
184 | for sExtraData in self.asExtraData:
|
---|
185 | try:
|
---|
186 | sKey, sValue = sExtraData.split(':')
|
---|
187 | except ValueError:
|
---|
188 | raise base.InvalidOption('Invalid extradata specified: %s' % sExtraData)
|
---|
189 | reporter.log('Set extradata: %s => %s' % (sKey, sValue))
|
---|
190 | fRc = fRc and oSession.setExtraData(sKey, sValue)
|
---|
191 |
|
---|
192 | # Other variations?
|
---|
193 |
|
---|
194 | # Save the settings.
|
---|
195 | fRc = fRc and oSession.saveSettings()
|
---|
196 | fRc = oSession.close() and fRc;
|
---|
197 | else:
|
---|
198 | fRc = False;
|
---|
199 | if fRc is not True:
|
---|
200 | oVM = None;
|
---|
201 |
|
---|
202 | # Done.
|
---|
203 | return (fRc, oVM)
|
---|
204 |
|
---|
205 |
|
---|
206 |
|
---|
207 |
|
---|
208 |
|
---|
209 | class tdGuestOsInstTest1(vbox.TestDriver):
|
---|
210 | """
|
---|
211 | Guest OS installation tests.
|
---|
212 |
|
---|
213 | Scenario:
|
---|
214 | - Create new VM that corresponds specified installation ISO image.
|
---|
215 | - Create HDD that corresponds to OS type that will be installed.
|
---|
216 | - Boot VM from ISO image (i.e. install guest OS).
|
---|
217 | - Wait for incomming TCP connection (guest should initiate such a
|
---|
218 | connection in case installation has been completed successfully).
|
---|
219 | """
|
---|
220 |
|
---|
221 |
|
---|
222 | def __init__(self):
|
---|
223 | """
|
---|
224 | Reinitialize child class instance.
|
---|
225 | """
|
---|
226 | vbox.TestDriver.__init__(self)
|
---|
227 | self.fLegacyOptions = False;
|
---|
228 | assert self.fEnableVrdp; # in parent driver.
|
---|
229 |
|
---|
230 | #
|
---|
231 | # Our install test VM set.
|
---|
232 | #
|
---|
233 | oSet = vboxtestvms.TestVmSet(self.oTestVmManager, fIgnoreSkippedVm = True);
|
---|
234 | oSet.aoTestVms.extend([
|
---|
235 | # pylint: disable=line-too-long
|
---|
236 | InstallTestVm(oSet, 'tst-fedora4', 'Fedora', 'fedora4-txs.iso', InstallTestVm.ksIdeController, 8, InstallTestVm.kf32Bit),
|
---|
237 | InstallTestVm(oSet, 'tst-fedora5', 'Fedora', 'fedora5-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApicSmp),
|
---|
238 | InstallTestVm(oSet, 'tst-fedora6', 'Fedora', 'fedora6-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqIoApic),
|
---|
239 | InstallTestVm(oSet, 'tst-fedora7', 'Fedora', 'fedora7-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqIoApic),
|
---|
240 | InstallTestVm(oSet, 'tst-fedora9', 'Fedora', 'fedora9-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
|
---|
241 | InstallTestVm(oSet, 'tst-fedora18-64', 'Fedora_64', 'fedora18-x64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
|
---|
242 | InstallTestVm(oSet, 'tst-fedora18', 'Fedora', 'fedora18-txs.iso', InstallTestVm.ksScsiController, 8, InstallTestVm.kf32Bit),
|
---|
243 | InstallTestVm(oSet, 'tst-ols6', 'Oracle', 'ols6-i386-txs.iso', InstallTestVm.ksSataController, 12, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
|
---|
244 | InstallTestVm(oSet, 'tst-ols6-64', 'Oracle_64', 'ols6-x86_64-txs.iso', InstallTestVm.ksSataController, 12, InstallTestVm.kf64Bit),
|
---|
245 | InstallTestVm(oSet, 'tst-rhel5', 'RedHat', 'rhel5-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApic),
|
---|
246 | InstallTestVm(oSet, 'tst-suse102', 'OpenSUSE', 'opensuse102-txs.iso', InstallTestVm.ksIdeController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqIoApic),
|
---|
247 | ## @todo InstallTestVm(oSet, 'tst-ubuntu606', 'Ubuntu', 'ubuntu606-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
|
---|
248 | ## @todo InstallTestVm(oSet, 'tst-ubuntu710', 'Ubuntu', 'ubuntu710-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
|
---|
249 | InstallTestVm(oSet, 'tst-ubuntu804', 'Ubuntu', 'ubuntu804-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApic),
|
---|
250 | InstallTestVm(oSet, 'tst-ubuntu804-64', 'Ubuntu_64', 'ubuntu804-amd64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
|
---|
251 | InstallTestVm(oSet, 'tst-ubuntu904', 'Ubuntu', 'ubuntu904-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae),
|
---|
252 | InstallTestVm(oSet, 'tst-ubuntu904-64', 'Ubuntu_64', 'ubuntu904-amd64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
|
---|
253 | #InstallTestVm(oSet, 'tst-ubuntu1404', 'Ubuntu', 'ubuntu1404-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae), bird: Is 14.04 one of the 'older ones'?
|
---|
254 | InstallTestVm(oSet, 'tst-ubuntu1404', 'Ubuntu', 'ubuntu1404-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
|
---|
255 | InstallTestVm(oSet, 'tst-ubuntu1404-64','Ubuntu_64', 'ubuntu1404-amd64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
|
---|
256 | InstallTestVm(oSet, 'tst-debian7', 'Debian', 'debian-7.0.0-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
|
---|
257 | InstallTestVm(oSet, 'tst-debian7-64', 'Debian_64', 'debian-7.0.0-x64-txs.iso', InstallTestVm.ksScsiController, 8, InstallTestVm.kf64Bit),
|
---|
258 | InstallTestVm(oSet, 'tst-vista-64', 'WindowsVista_64', 'vista-x64-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
|
---|
259 | InstallTestVm(oSet, 'tst-vista-32', 'WindowsVista', 'vista-x86-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
|
---|
260 | InstallTestVm(oSet, 'tst-w7-64', 'Windows7_64', 'win7-x64-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
|
---|
261 | InstallTestVm(oSet, 'tst-w7-32', 'Windows7', 'win7-x86-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
|
---|
262 | InstallTestVm(oSet, 'tst-w2k3', 'Windows2003', 'win2k3ent-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit),
|
---|
263 | InstallTestVm(oSet, 'tst-w2k', 'Windows2000', 'win2ksp0-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit | InstallTestVm.kfIdeIrqDelay),
|
---|
264 | InstallTestVm(oSet, 'tst-w2ksp4', 'Windows2000', 'win2ksp4-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit | InstallTestVm.kfIdeIrqDelay),
|
---|
265 | InstallTestVm(oSet, 'tst-wxp', 'WindowsXP', 'winxppro-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit),
|
---|
266 | InstallTestVm(oSet, 'tst-wxpsp2', 'WindowsXP', 'winxpsp2-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit),
|
---|
267 | InstallTestVm(oSet, 'tst-wxp64', 'WindowsXP_64', 'winxp64-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf64Bit),
|
---|
268 | ## @todo disable paravirt for Windows 8.1 guests as long as it's not fixed in the code
|
---|
269 | InstallTestVm(oSet, 'tst-w81-32', 'Windows81', 'win81-x86-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
|
---|
270 | InstallTestVm(oSet, 'tst-w81-64', 'Windows81_64', 'win81-x64-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
|
---|
271 | InstallTestVm(oSet, 'tst-w10-32', 'Windows10', 'win10-x86-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
|
---|
272 | InstallTestVm(oSet, 'tst-w10-64', 'Windows10_64', 'win10-x64-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
|
---|
273 | # pylint: enable=line-too-long
|
---|
274 | ]);
|
---|
275 | self.oTestVmSet = oSet;
|
---|
276 |
|
---|
277 |
|
---|
278 |
|
---|
279 | #
|
---|
280 | # Overridden methods.
|
---|
281 | #
|
---|
282 |
|
---|
283 | def showUsage(self):
|
---|
284 | """
|
---|
285 | Extend usage info
|
---|
286 | """
|
---|
287 | rc = vbox.TestDriver.showUsage(self)
|
---|
288 | reporter.log('');
|
---|
289 | reporter.log('tdGuestOsInstTest1 options:');
|
---|
290 | reporter.log(' --ioapic, --no-ioapic');
|
---|
291 | reporter.log(' Enable or disable the I/O apic.');
|
---|
292 | reporter.log(' Default: --ioapic');
|
---|
293 | reporter.log(' --pae, --no-pae');
|
---|
294 | reporter.log(' Enable or disable PAE support for 32-bit guests.');
|
---|
295 | reporter.log(' Default: Guest dependent.');
|
---|
296 | reporter.log(' --ram-adjust <MBs>')
|
---|
297 | reporter.log(' Adjust the VM ram size by the given delta. Both negative and positive');
|
---|
298 | reporter.log(' values are accepted.');
|
---|
299 | reporter.log(' --set-extradata <key>:value')
|
---|
300 | reporter.log(' Set VM extra data. This command line option might be used multiple times.')
|
---|
301 | reporter.log('obsolete:');
|
---|
302 | reporter.log(' --nested-paging, --no-nested-paging');
|
---|
303 | reporter.log(' --raw-mode');
|
---|
304 | reporter.log(' --cpus <# CPUs>');
|
---|
305 | reporter.log(' --install-iso <ISO file name>');
|
---|
306 |
|
---|
307 | return rc
|
---|
308 |
|
---|
309 | def parseOption(self, asArgs, iArg):
|
---|
310 | """
|
---|
311 | Extend standard options set
|
---|
312 | """
|
---|
313 |
|
---|
314 | if False is True: # placeholder. pylint: disable=comparison-of-constants
|
---|
315 | pass;
|
---|
316 | elif asArgs[iArg] == '--ioapic':
|
---|
317 | for oTestVm in self.oTestVmSet.aoTestVms:
|
---|
318 | oTestVm.fIoApic = True;
|
---|
319 | elif asArgs[iArg] == '--no-ioapic':
|
---|
320 | for oTestVm in self.oTestVmSet.aoTestVms:
|
---|
321 | oTestVm.fIoApic = False;
|
---|
322 | elif asArgs[iArg] == '--pae':
|
---|
323 | for oTestVm in self.oTestVmSet.aoTestVms:
|
---|
324 | oTestVm.fPae = True;
|
---|
325 | elif asArgs[iArg] == '--no-pae':
|
---|
326 | for oTestVm in self.oTestVmSet.aoTestVms:
|
---|
327 | oTestVm.fPae = False;
|
---|
328 | elif asArgs[iArg] == '--ram-adjust':
|
---|
329 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
330 | for oTestVm in self.oTestVmSet.aoTestVms:
|
---|
331 | oTestVm.iOptRamAdjust = int(asArgs[iArg]);
|
---|
332 | elif asArgs[iArg] == '--set-extradata':
|
---|
333 | iArg = self.requireMoreArgs(1, asArgs, iArg)
|
---|
334 | for oTestVm in self.oTestVmSet.aoTestVms:
|
---|
335 | oTestVm.asExtraData.append(asArgs[iArg]);
|
---|
336 |
|
---|
337 | # legacy, to be removed once TM is reconfigured.
|
---|
338 | elif asArgs[iArg] == '--install-iso':
|
---|
339 | self.legacyOptions();
|
---|
340 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
341 | for oTestVm in self.oTestVmSet.aoTestVms:
|
---|
342 | oTestVm.fSkip = os.path.basename(oTestVm.sDvdImage) != asArgs[iArg];
|
---|
343 | elif asArgs[iArg] == '--cpus':
|
---|
344 | self.legacyOptions();
|
---|
345 | iArg = self.requireMoreArgs(1, asArgs, iArg);
|
---|
346 | self.oTestVmSet.acCpus = [ int(asArgs[iArg]), ];
|
---|
347 | elif asArgs[iArg] == '--raw-mode':
|
---|
348 | self.legacyOptions();
|
---|
349 | self.oTestVmSet.asVirtModes = [ 'raw', ];
|
---|
350 | elif asArgs[iArg] == '--nested-paging':
|
---|
351 | self.legacyOptions();
|
---|
352 | self.oTestVmSet.asVirtModes = [ 'hwvirt-np', ];
|
---|
353 | elif asArgs[iArg] == '--no-nested-paging':
|
---|
354 | self.legacyOptions();
|
---|
355 | self.oTestVmSet.asVirtModes = [ 'hwvirt', ];
|
---|
356 | else:
|
---|
357 | return vbox.TestDriver.parseOption(self, asArgs, iArg)
|
---|
358 |
|
---|
359 | return iArg + 1
|
---|
360 |
|
---|
361 | def legacyOptions(self):
|
---|
362 | """ Enables legacy option mode. """
|
---|
363 | if not self.fLegacyOptions:
|
---|
364 | self.fLegacyOptions = True;
|
---|
365 | self.oTestVmSet.asVirtModes = [ 'hwvirt', ];
|
---|
366 | self.oTestVmSet.acCpus = [ 1, ];
|
---|
367 | return True;
|
---|
368 |
|
---|
369 | def actionConfig(self):
|
---|
370 | if not self.importVBoxApi(): # So we can use the constant below.
|
---|
371 | return False;
|
---|
372 | return self.oTestVmSet.actionConfig(self, eNic0AttachType = vboxcon.NetworkAttachmentType_NAT);
|
---|
373 |
|
---|
374 | def actionExecute(self):
|
---|
375 | """
|
---|
376 | Execute the testcase.
|
---|
377 | """
|
---|
378 | return self.oTestVmSet.actionExecute(self, self.testOneVmConfig)
|
---|
379 |
|
---|
380 | def testOneVmConfig(self, oVM, oTestVm):
|
---|
381 | """
|
---|
382 | Install guest OS and wait for result
|
---|
383 | """
|
---|
384 |
|
---|
385 | self.logVmInfo(oVM)
|
---|
386 | reporter.testStart('Installing %s' % (oTestVm.sVmName,))
|
---|
387 |
|
---|
388 | cMsTimeout = 40*60000;
|
---|
389 | if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
|
---|
390 | cMsTimeout = 180 * 60000; # will be adjusted down.
|
---|
391 |
|
---|
392 | oSession, _ = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
|
---|
393 | if oSession is not None:
|
---|
394 | # The guest has connected to TXS, so we're done (for now anyways).
|
---|
395 | reporter.log('Guest reported success')
|
---|
396 | ## @todo Do save + restore.
|
---|
397 |
|
---|
398 | reporter.testDone()
|
---|
399 | fRc = self.terminateVmBySession(oSession)
|
---|
400 | return fRc is True
|
---|
401 |
|
---|
402 | reporter.error('Installation of %s has failed' % (oTestVm.sVmName,))
|
---|
403 | oTestVm.detatchAndDeleteHd(self); # Save space.
|
---|
404 | reporter.testDone()
|
---|
405 | return False
|
---|
406 |
|
---|
407 | if __name__ == '__main__':
|
---|
408 | sys.exit(tdGuestOsInstTest1().main(sys.argv))
|
---|
409 |
|
---|