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