1 | # -*- coding: utf-8 -*-
|
---|
2 | # $Id: vboxtestvms.py 67747 2017-07-03 08:08:19Z vboxsync $
|
---|
3 |
|
---|
4 | """
|
---|
5 | VirtualBox Test VMs
|
---|
6 | """
|
---|
7 |
|
---|
8 | __copyright__ = \
|
---|
9 | """
|
---|
10 | Copyright (C) 2010-2016 Oracle Corporation
|
---|
11 |
|
---|
12 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | available from http://www.virtualbox.org. This file is free software;
|
---|
14 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | General Public License (GPL) as published by the Free Software
|
---|
16 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
17 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
18 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 |
|
---|
20 | The contents of this file may alternatively be used under the terms
|
---|
21 | of the Common Development and Distribution License Version 1.0
|
---|
22 | (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
23 | VirtualBox OSE distribution, in which case the provisions of the
|
---|
24 | CDDL are applicable instead of those of the GPL.
|
---|
25 |
|
---|
26 | You may elect to license modified versions of this file under the
|
---|
27 | terms and conditions of either the GPL or the CDDL or both.
|
---|
28 | """
|
---|
29 | __version__ = "$Revision: 67747 $"
|
---|
30 |
|
---|
31 | # Standard Python imports.
|
---|
32 | import re;
|
---|
33 | import random;
|
---|
34 | import socket;
|
---|
35 |
|
---|
36 | # Validation Kit imports.
|
---|
37 | from testdriver import base;
|
---|
38 | from testdriver import reporter;
|
---|
39 | from testdriver import vboxcon;
|
---|
40 |
|
---|
41 |
|
---|
42 | # All virtualization modes.
|
---|
43 | g_asVirtModes = ['hwvirt', 'hwvirt-np', 'raw',];
|
---|
44 | # All virtualization modes except for raw-mode.
|
---|
45 | g_asVirtModesNoRaw = ['hwvirt', 'hwvirt-np',];
|
---|
46 | # Dictionary mapping the virtualization mode mnemonics to a little less cryptic
|
---|
47 | # strings used in test descriptions.
|
---|
48 | g_dsVirtModeDescs = {
|
---|
49 | 'raw' : 'Raw-mode',
|
---|
50 | 'hwvirt' : 'HwVirt',
|
---|
51 | 'hwvirt-np' : 'NestedPaging'
|
---|
52 | };
|
---|
53 |
|
---|
54 | ## @name Flags.
|
---|
55 | ## @{
|
---|
56 | g_k32 = 32; # pylint: disable=C0103
|
---|
57 | g_k64 = 64; # pylint: disable=C0103
|
---|
58 | g_k32_64 = 96; # pylint: disable=C0103
|
---|
59 | g_kiArchMask = 96;
|
---|
60 | g_kiNoRaw = 128; ##< No raw mode.
|
---|
61 | ## @}
|
---|
62 |
|
---|
63 | # Array indexes.
|
---|
64 | g_iGuestOsType = 0;
|
---|
65 | g_iKind = 1;
|
---|
66 | g_iFlags = 2;
|
---|
67 | g_iMinCpu = 3;
|
---|
68 | g_iMaxCpu = 4;
|
---|
69 | g_iRegEx = 5;
|
---|
70 |
|
---|
71 | # Table translating from VM name core to a more detailed guest info.
|
---|
72 | # pylint: disable=C0301
|
---|
73 | g_aaNameToDetails = \
|
---|
74 | [
|
---|
75 | [ 'WindowsNT4', 'WindowsNT4', g_k32, 1, 32, ['nt4', 'nt4sp[0-9]']], # max cpus??
|
---|
76 | [ 'Windows2000', 'Windows2000', g_k32, 1, 32, ['w2k', 'w2ksp[0-9]', 'win2k', 'win2ksp[0-9]']], # max cpus??
|
---|
77 | [ 'WindowsXP', 'WindowsXP', g_k32, 1, 32, ['xp', 'xpsp[0-9]']],
|
---|
78 | [ 'WindowsXP_64', 'WindowsXP_64', g_k64, 1, 32, ['xp64', 'xp64sp[0-9]']],
|
---|
79 | [ 'Windows2003', 'Windows2003', g_k32, 1, 32, ['w2k3', 'w2k3sp[0-9]', 'win2k3', 'win2k3sp[0-9]']],
|
---|
80 | [ 'WindowsVista', 'WindowsVista', g_k32, 1, 32, ['vista', 'vistasp[0-9]']],
|
---|
81 | [ 'WindowsVista_64','WindowsVista_64', g_k64, 1, 64, ['vista-64', 'vistasp[0-9]-64',]], # max cpus/cores??
|
---|
82 | [ 'Windows2008', 'Windows2008', g_k32, 1, 64, ['w2k8', 'w2k8sp[0-9]', 'win2k8', 'win2k8sp[0-9]']], # max cpus/cores??
|
---|
83 | [ 'Windows2008_64', 'Windows2008_64', g_k64, 1, 64, ['w2k8r2', 'w2k8r2sp[0-9]', 'win2k8r2', 'win2k8r2sp[0-9]']], # max cpus/cores??
|
---|
84 | [ 'Windows7', 'Windows7', g_k32, 1, 32, ['w7', 'w7sp[0-9]', 'win7',]], # max cpus/cores??
|
---|
85 | [ 'Windows7_64', 'Windows7_64', g_k64, 1, 64, ['w7-64', 'w7sp[0-9]-64', 'win7-64',]], # max cpus/cores??
|
---|
86 | [ 'Windows8', 'Windows8', g_k32 | g_kiNoRaw, 1, 32, ['w8', 'w8sp[0-9]', 'win8',]], # max cpus/cores??
|
---|
87 | [ 'Windows8_64', 'Windows8_64', g_k64, 1, 64, ['w8-64', 'w8sp[0-9]-64', 'win8-64',]], # max cpus/cores??
|
---|
88 | [ 'Windows81', 'Windows81', g_k32 | g_kiNoRaw, 1, 32, ['w81', 'w81sp[0-9]', 'win81',]], # max cpus/cores??
|
---|
89 | [ 'Windows81_64', 'Windows81_64', g_k64, 1, 64, ['w81-64', 'w81sp[0-9]-64', 'win81-64',]], # max cpus/cores??
|
---|
90 | [ 'Windows10', 'Windows10', g_k32 | g_kiNoRaw, 1, 32, ['w10', 'w10sp[0-9]', 'win10',]], # max cpus/cores??
|
---|
91 | [ 'Windows10_64', 'Windows10_64', g_k64, 1, 64, ['w10-64', 'w10sp[0-9]-64', 'win10-64',]], # max cpus/cores??
|
---|
92 | [ 'Linux', 'Debian', g_k32, 1, 256, ['deb[0-9]*', 'debian[0-9]*', ]],
|
---|
93 | [ 'Linux_64', 'Debian_64', g_k64, 1, 256, ['deb[0-9]*-64', 'debian[0-9]*-64', ]],
|
---|
94 | [ 'Linux', 'RedHat', g_k32, 1, 256, ['rhel', 'rhel[0-9]', 'rhel[0-9]u[0-9]']],
|
---|
95 | [ 'Linux', 'Fedora', g_k32, 1, 256, ['fedora', 'fedora[0-9]*', ]],
|
---|
96 | [ 'Linux_64', 'Fedora_64', g_k64, 1, 256, ['fedora-64', 'fedora[0-9]*-64', ]],
|
---|
97 | [ 'Linux', 'Oracle', g_k32, 1, 256, ['ols[0-9]*', 'oel[0-9]*', ]],
|
---|
98 | [ 'Linux_64', 'Oracle_64', g_k64, 1, 256, ['ols[0-9]*-64', 'oel[0-9]*-64', ]],
|
---|
99 | [ 'Linux', 'OpenSUSE', g_k32, 1, 256, ['opensuse[0-9]*', 'suse[0-9]*', ]],
|
---|
100 | [ 'Linux_64', 'OpenSUSE_64', g_k64, 1, 256, ['opensuse[0-9]*-64', 'suse[0-9]*-64', ]],
|
---|
101 | [ 'Linux', 'Ubuntu', g_k32, 1, 256, ['ubuntu[0-9]*', ]],
|
---|
102 | [ 'Linux_64', 'Ubuntu_64', g_k64, 1, 256, ['ubuntu[0-9]*-64', ]],
|
---|
103 | [ 'Solaris', 'Solaris', g_k32, 1, 256, ['sol10', 'sol10u[0-9]']],
|
---|
104 | [ 'Solaris_64', 'Solaris_64', g_k64, 1, 256, ['sol10-64', 'sol10u-64[0-9]']],
|
---|
105 | [ 'Solaris_64', 'Solaris11_64', g_k64, 1, 256, ['sol11u1']],
|
---|
106 | [ 'BSD', 'FreeBSD_64', g_k32_64, 1, 1, ['bs-.*']], # boot sectors, wanted 64-bit type.
|
---|
107 | ];
|
---|
108 |
|
---|
109 |
|
---|
110 | ## @name Guest OS type string constants.
|
---|
111 | ## @{
|
---|
112 | g_ksGuestOsTypeDarwin = 'darwin';
|
---|
113 | g_ksGuestOsTypeFreeBSD = 'freebsd';
|
---|
114 | g_ksGuestOsTypeLinux = 'linux';
|
---|
115 | g_ksGuestOsTypeOS2 = 'os2';
|
---|
116 | g_ksGuestOsTypeSolaris = 'solaris';
|
---|
117 | g_ksGuestOsTypeWindows = 'windows';
|
---|
118 | ## @}
|
---|
119 |
|
---|
120 | ## @name String constants for paravirtualization providers.
|
---|
121 | ## @{
|
---|
122 | g_ksParavirtProviderNone = 'none';
|
---|
123 | g_ksParavirtProviderDefault = 'default';
|
---|
124 | g_ksParavirtProviderLegacy = 'legacy';
|
---|
125 | g_ksParavirtProviderMinimal = 'minimal';
|
---|
126 | g_ksParavirtProviderHyperV = 'hyperv';
|
---|
127 | g_ksParavirtProviderKVM = 'kvm';
|
---|
128 | ## @}
|
---|
129 |
|
---|
130 | ## Valid paravirtualization providers.
|
---|
131 | g_kasParavirtProviders = ( g_ksParavirtProviderNone, g_ksParavirtProviderDefault, g_ksParavirtProviderLegacy,
|
---|
132 | g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM );
|
---|
133 |
|
---|
134 | # Mapping for support of paravirtualisation providers per guest OS.
|
---|
135 | #g_kdaParavirtProvidersSupported = {
|
---|
136 | # g_ksGuestOsTypeDarwin : ( g_ksParavirtProviderMinimal, ),
|
---|
137 | # g_ksGuestOsTypeFreeBSD : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, ),
|
---|
138 | # g_ksGuestOsTypeLinux : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM),
|
---|
139 | # g_ksGuestOsTypeOS2 : ( g_ksParavirtProviderNone, ),
|
---|
140 | # g_ksGuestOsTypeSolaris : ( g_ksParavirtProviderNone, ),
|
---|
141 | # g_ksGuestOsTypeWindows : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, )
|
---|
142 | #}
|
---|
143 | # Temporary tweak:
|
---|
144 | # since for the most guests g_ksParavirtProviderNone is almost the same as g_ksParavirtProviderMinimal,
|
---|
145 | # g_ksParavirtProviderMinimal is removed from the list in order to get maximum number of unique choices
|
---|
146 | # during independent test runs when paravirt provider is taken randomly.
|
---|
147 | g_kdaParavirtProvidersSupported = {
|
---|
148 | g_ksGuestOsTypeDarwin : ( g_ksParavirtProviderMinimal, ),
|
---|
149 | g_ksGuestOsTypeFreeBSD : ( g_ksParavirtProviderNone, ),
|
---|
150 | g_ksGuestOsTypeLinux : ( g_ksParavirtProviderNone, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM),
|
---|
151 | g_ksGuestOsTypeOS2 : ( g_ksParavirtProviderNone, ),
|
---|
152 | g_ksGuestOsTypeSolaris : ( g_ksParavirtProviderNone, ),
|
---|
153 | g_ksGuestOsTypeWindows : ( g_ksParavirtProviderNone, g_ksParavirtProviderHyperV, )
|
---|
154 | }
|
---|
155 |
|
---|
156 |
|
---|
157 | # pylint: enable=C0301
|
---|
158 |
|
---|
159 | def _intersects(asSet1, asSet2):
|
---|
160 | """
|
---|
161 | Checks if any of the strings in set 1 matches any of the regular
|
---|
162 | expressions in set 2.
|
---|
163 | """
|
---|
164 | for sStr1 in asSet1:
|
---|
165 | for sRx2 in asSet2:
|
---|
166 | if re.match(sStr1, sRx2 + '$'):
|
---|
167 | return True;
|
---|
168 | return False;
|
---|
169 |
|
---|
170 |
|
---|
171 | class TestVm(object):
|
---|
172 | """
|
---|
173 | A Test VM - name + VDI/whatever.
|
---|
174 |
|
---|
175 | This is just a data object.
|
---|
176 | """
|
---|
177 |
|
---|
178 | def __init__(self, oSet, sVmName, sHd = None, sKind = None, acCpusSup = None, asVirtModesSup = None, # pylint: disable=R0913
|
---|
179 | fIoApic = None, fPae = None, sNic0AttachType = None, sHddControllerType = 'IDE Controller',
|
---|
180 | sFloppy = None, fVmmDevTestingPart = None, fVmmDevTestingMmio = False, asParavirtModesSup = None,
|
---|
181 | fRandomPvPMode = False, sFirmwareType = 'bios', sChipsetType = 'piix3'):
|
---|
182 | self.oSet = oSet;
|
---|
183 | self.sVmName = sVmName;
|
---|
184 | self.sHd = sHd; # Relative to the testrsrc root.
|
---|
185 | self.acCpusSup = acCpusSup;
|
---|
186 | self.asVirtModesSup = asVirtModesSup;
|
---|
187 | self.asParavirtModesSup = asParavirtModesSup;
|
---|
188 | self.asParavirtModesSupOrg = asParavirtModesSup; # HACK ALERT! Trick to make the 'effing random mess not get in the
|
---|
189 | # way of actively selecting virtualization modes.
|
---|
190 | self.sKind = sKind;
|
---|
191 | self.sGuestOsType = None;
|
---|
192 | self.sDvdImage = None; # Relative to the testrsrc root.
|
---|
193 | self.fIoApic = fIoApic;
|
---|
194 | self.fPae = fPae;
|
---|
195 | self.sNic0AttachType = sNic0AttachType;
|
---|
196 | self.sHddControllerType = sHddControllerType;
|
---|
197 | self.sFloppy = sFloppy; # Relative to the testrsrc root, except when it isn't...
|
---|
198 | self.fVmmDevTestingPart = fVmmDevTestingPart;
|
---|
199 | self.fVmmDevTestingMmio = fVmmDevTestingMmio;
|
---|
200 | self.sFirmwareType = sFirmwareType;
|
---|
201 | self.sChipsetType = sChipsetType;
|
---|
202 |
|
---|
203 | self.fSnapshotRestoreCurrent = False; # Whether to restore execution on the current snapshot.
|
---|
204 | self.fSkip = False; # All VMs are included in the configured set by default.
|
---|
205 | self.aInfo = None;
|
---|
206 | self._guessStuff(fRandomPvPMode);
|
---|
207 |
|
---|
208 | def _mkCanonicalGuestOSType(self, sType):
|
---|
209 | """
|
---|
210 | Convert guest OS type into constant representation.
|
---|
211 | Raise exception if specified @param sType is unknown.
|
---|
212 | """
|
---|
213 | if sType.lower().startswith('darwin'):
|
---|
214 | return g_ksGuestOsTypeDarwin
|
---|
215 | if sType.lower().startswith('bsd'):
|
---|
216 | return g_ksGuestOsTypeFreeBSD
|
---|
217 | if sType.lower().startswith('linux'):
|
---|
218 | return g_ksGuestOsTypeLinux
|
---|
219 | if sType.lower().startswith('os2'):
|
---|
220 | return g_ksGuestOsTypeOS2
|
---|
221 | if sType.lower().startswith('solaris'):
|
---|
222 | return g_ksGuestOsTypeSolaris
|
---|
223 | if sType.lower().startswith('windows'):
|
---|
224 | return g_ksGuestOsTypeWindows
|
---|
225 | raise base.GenError(sWhat="unknown guest OS kind: %s" % str(sType))
|
---|
226 |
|
---|
227 | def _guessStuff(self, fRandomPvPMode):
|
---|
228 | """
|
---|
229 | Used by the constructor to guess stuff.
|
---|
230 | """
|
---|
231 |
|
---|
232 | sNm = self.sVmName.lower().strip();
|
---|
233 | asSplit = sNm.replace('-', ' ').split(' ');
|
---|
234 |
|
---|
235 | if self.sKind is None:
|
---|
236 | # From name.
|
---|
237 | for aInfo in g_aaNameToDetails:
|
---|
238 | if _intersects(asSplit, aInfo[g_iRegEx]):
|
---|
239 | self.aInfo = aInfo;
|
---|
240 | self.sGuestOsType = self._mkCanonicalGuestOSType(aInfo[g_iGuestOsType])
|
---|
241 | self.sKind = aInfo[g_iKind];
|
---|
242 | break;
|
---|
243 | if self.sKind is None:
|
---|
244 | reporter.fatal('The OS of test VM "%s" cannot be guessed' % (self.sVmName,));
|
---|
245 |
|
---|
246 | # Check for 64-bit, if required and supported.
|
---|
247 | if (self.aInfo[g_iFlags] & g_kiArchMask) == g_k32_64 and _intersects(asSplit, ['64', 'amd64']):
|
---|
248 | self.sKind = self.sKind + '_64';
|
---|
249 | else:
|
---|
250 | # Lookup the kind.
|
---|
251 | for aInfo in g_aaNameToDetails:
|
---|
252 | if self.sKind == aInfo[g_iKind]:
|
---|
253 | self.aInfo = aInfo;
|
---|
254 | break;
|
---|
255 | if self.aInfo is None:
|
---|
256 | reporter.fatal('The OS of test VM "%s" with sKind="%s" cannot be guessed' % (self.sVmName, self.sKind));
|
---|
257 |
|
---|
258 | # Translate sKind into sGuest OS Type.
|
---|
259 | if self.sGuestOsType is None:
|
---|
260 | if self.aInfo is not None:
|
---|
261 | self.sGuestOsType = self._mkCanonicalGuestOSType(self.aInfo[g_iGuestOsType])
|
---|
262 | elif self.sKind.find("Windows") >= 0:
|
---|
263 | self.sGuestOsType = g_ksGuestOsTypeWindows
|
---|
264 | elif self.sKind.find("Linux") >= 0:
|
---|
265 | self.sGuestOsType = g_ksGuestOsTypeLinux;
|
---|
266 | elif self.sKind.find("Solaris") >= 0:
|
---|
267 | self.sGuestOsType = g_ksGuestOsTypeSolaris;
|
---|
268 | else:
|
---|
269 | reporter.fatal('The OS of test VM "%s", sKind="%s" cannot be guessed' % (self.sVmName, self.sKind));
|
---|
270 |
|
---|
271 | # Restrict modes and such depending on the OS.
|
---|
272 | if self.asVirtModesSup is None:
|
---|
273 | self.asVirtModesSup = list(g_asVirtModes);
|
---|
274 | if self.sGuestOsType in (g_ksGuestOsTypeOS2, g_ksGuestOsTypeDarwin) \
|
---|
275 | or self.sKind.find('_64') > 0 \
|
---|
276 | or (self.aInfo is not None and (self.aInfo[g_iFlags] & g_kiNoRaw)):
|
---|
277 | self.asVirtModesSup = [sVirtMode for sVirtMode in self.asVirtModesSup if sVirtMode != 'raw'];
|
---|
278 | # TEMPORARY HACK - START
|
---|
279 | sHostName = socket.getfqdn();
|
---|
280 | if sHostName.startswith('testboxpile1'):
|
---|
281 | self.asVirtModesSup = [sVirtMode for sVirtMode in self.asVirtModesSup if sVirtMode != 'raw'];
|
---|
282 | # TEMPORARY HACK - END
|
---|
283 |
|
---|
284 | # Restrict the CPU count depending on the OS and/or percieved SMP readiness.
|
---|
285 | if self.acCpusSup is None:
|
---|
286 | if _intersects(asSplit, ['uni']):
|
---|
287 | self.acCpusSup = [1];
|
---|
288 | elif self.aInfo is not None:
|
---|
289 | self.acCpusSup = [i for i in range(self.aInfo[g_iMinCpu], self.aInfo[g_iMaxCpu]) ];
|
---|
290 | else:
|
---|
291 | self.acCpusSup = [1];
|
---|
292 |
|
---|
293 | # Figure relevant PV modes based on the OS.
|
---|
294 | if self.asParavirtModesSup is None:
|
---|
295 | self.asParavirtModesSup = g_kdaParavirtProvidersSupported[self.sGuestOsType];
|
---|
296 | ## @todo Remove this hack as soon as we've got around to explictly configure test variations
|
---|
297 | ## on the server side. Client side random is interesting but not the best option.
|
---|
298 | self.asParavirtModesSupOrg = self.asParavirtModesSup;
|
---|
299 | if fRandomPvPMode:
|
---|
300 | random.seed();
|
---|
301 | self.asParavirtModesSup = (random.choice(self.asParavirtModesSup),);
|
---|
302 |
|
---|
303 | return True;
|
---|
304 |
|
---|
305 | def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode = None):
|
---|
306 | """
|
---|
307 | actionExecute worker that finds and reconfigure a test VM.
|
---|
308 |
|
---|
309 | Returns (fRc, oVM) where fRc is True, None or False and oVM is a
|
---|
310 | VBox VM object that is only present when rc is True.
|
---|
311 | """
|
---|
312 |
|
---|
313 | fRc = False;
|
---|
314 | oVM = oTestDrv.getVmByName(self.sVmName);
|
---|
315 | if oVM is not None:
|
---|
316 | if self.fSnapshotRestoreCurrent is True:
|
---|
317 | fRc = True;
|
---|
318 | else:
|
---|
319 | fHostSupports64bit = oTestDrv.hasHostLongMode();
|
---|
320 | if self.is64bitRequired() and not fHostSupports64bit:
|
---|
321 | fRc = None; # Skip the test.
|
---|
322 | elif self.isViaIncompatible() and oTestDrv.isHostCpuVia():
|
---|
323 | fRc = None; # Skip the test.
|
---|
324 | elif self.isP4Incompatible() and oTestDrv.isHostCpuP4():
|
---|
325 | fRc = None; # Skip the test.
|
---|
326 | else:
|
---|
327 | oSession = oTestDrv.openSession(oVM);
|
---|
328 | if oSession is not None:
|
---|
329 | fRc = oSession.enableVirtEx(sVirtMode != 'raw');
|
---|
330 | fRc = fRc and oSession.enableNestedPaging(sVirtMode == 'hwvirt-np');
|
---|
331 | fRc = fRc and oSession.setCpuCount(cCpus);
|
---|
332 | if cCpus > 1:
|
---|
333 | fRc = fRc and oSession.enableIoApic(True);
|
---|
334 |
|
---|
335 | if sParavirtMode is not None and oSession.fpApiVer >= 5.0:
|
---|
336 | adParavirtProviders = {
|
---|
337 | g_ksParavirtProviderNone : vboxcon.ParavirtProvider_None,
|
---|
338 | g_ksParavirtProviderDefault: vboxcon.ParavirtProvider_Default,
|
---|
339 | g_ksParavirtProviderLegacy : vboxcon.ParavirtProvider_Legacy,
|
---|
340 | g_ksParavirtProviderMinimal: vboxcon.ParavirtProvider_Minimal,
|
---|
341 | g_ksParavirtProviderHyperV : vboxcon.ParavirtProvider_HyperV,
|
---|
342 | g_ksParavirtProviderKVM : vboxcon.ParavirtProvider_KVM,
|
---|
343 | };
|
---|
344 | fRc = fRc and oSession.setParavirtProvider(adParavirtProviders[sParavirtMode]);
|
---|
345 |
|
---|
346 | fCfg64Bit = self.is64bitRequired() or (self.is64bit() and fHostSupports64bit and sVirtMode != 'raw');
|
---|
347 | fRc = fRc and oSession.enableLongMode(fCfg64Bit);
|
---|
348 | if fCfg64Bit: # This is to avoid GUI pedantic warnings in the GUI. Sigh.
|
---|
349 | oOsType = oSession.getOsType();
|
---|
350 | if oOsType is not None:
|
---|
351 | if oOsType.is64Bit and sVirtMode == 'raw':
|
---|
352 | assert(oOsType.id[-3:] == '_64');
|
---|
353 | fRc = fRc and oSession.setOsType(oOsType.id[:-3]);
|
---|
354 | elif not oOsType.is64Bit and sVirtMode != 'raw':
|
---|
355 | fRc = fRc and oSession.setOsType(oOsType.id + '_64');
|
---|
356 |
|
---|
357 | fRc = fRc and oSession.saveSettings();
|
---|
358 | if not oSession.close():
|
---|
359 | fRc = False;
|
---|
360 | if fRc is True:
|
---|
361 | return (True, oVM);
|
---|
362 | return (fRc, None);
|
---|
363 |
|
---|
364 |
|
---|
365 | def isWindows(self):
|
---|
366 | """ Checks if it's a Windows VM. """
|
---|
367 | return self.sGuestOsType == g_ksGuestOsTypeWindows;
|
---|
368 |
|
---|
369 | def isOS2(self):
|
---|
370 | """ Checks if it's an OS/2 VM. """
|
---|
371 | return self.sGuestOsType == g_ksGuestOsTypeOS2;
|
---|
372 |
|
---|
373 | def is64bit(self):
|
---|
374 | """ Checks if it's a 64-bit VM. """
|
---|
375 | return self.sKind.find('_64') >= 0;
|
---|
376 |
|
---|
377 | def is64bitRequired(self):
|
---|
378 | """ Check if 64-bit is required or not. """
|
---|
379 | return (self.aInfo[g_iFlags] & g_k64) != 0;
|
---|
380 |
|
---|
381 | def isLoggedOntoDesktop(self):
|
---|
382 | """ Checks if the test VM is logging onto a graphical desktop by default. """
|
---|
383 | if self.isWindows():
|
---|
384 | return True;
|
---|
385 | if self.isOS2():
|
---|
386 | return True;
|
---|
387 | if self.sVmName.find('-desktop'):
|
---|
388 | return True;
|
---|
389 | return False;
|
---|
390 |
|
---|
391 | def isViaIncompatible(self):
|
---|
392 | """
|
---|
393 | Identifies VMs that doesn't work on VIA.
|
---|
394 |
|
---|
395 | Returns True if NOT supported on VIA, False if it IS supported.
|
---|
396 | """
|
---|
397 | # Oracle linux doesn't like VIA in our experience
|
---|
398 | if self.aInfo[g_iKind] in ['Oracle', 'Oracle_64']:
|
---|
399 | return True;
|
---|
400 | # OS/2: "The system detected an internal processing error at location
|
---|
401 | # 0168:fff1da1f - 000e:ca1f. 0a8606fd
|
---|
402 | if self.isOS2():
|
---|
403 | return True;
|
---|
404 | # Windows NT4 before SP4 won't work because of cmpxchg8b not being
|
---|
405 | # detected, leading to a STOP 3e(80,0,0,0).
|
---|
406 | if self.aInfo[g_iKind] == 'WindowsNT4':
|
---|
407 | if self.sVmName.find('sp') < 0:
|
---|
408 | return True; # no service pack.
|
---|
409 | if self.sVmName.find('sp0') >= 0 \
|
---|
410 | or self.sVmName.find('sp1') >= 0 \
|
---|
411 | or self.sVmName.find('sp2') >= 0 \
|
---|
412 | or self.sVmName.find('sp3') >= 0:
|
---|
413 | return True;
|
---|
414 | # XP x64 on a phyical VIA box hangs exactly like a VM.
|
---|
415 | if self.aInfo[g_iKind] in ['WindowsXP_64', 'Windows2003_64']:
|
---|
416 | return True;
|
---|
417 | # Vista 64 throws BSOD 0x5D (UNSUPPORTED_PROCESSOR)
|
---|
418 | if self.aInfo[g_iKind] in ['WindowsVista_64']:
|
---|
419 | return True;
|
---|
420 | # Solaris 11 hangs on VIA, tested on a physical box (testboxvqc)
|
---|
421 | if self.aInfo[g_iKind] in ['Solaris11_64']:
|
---|
422 | return True;
|
---|
423 | return False;
|
---|
424 |
|
---|
425 | def isP4Incompatible(self):
|
---|
426 | """
|
---|
427 | Identifies VMs that doesn't work on Pentium 4 / Pentium D.
|
---|
428 |
|
---|
429 | Returns True if NOT supported on P4, False if it IS supported.
|
---|
430 | """
|
---|
431 | # Stupid 1 kHz timer. Too much for antique CPUs.
|
---|
432 | if self.sVmName.find('rhel5') >= 0:
|
---|
433 | return True;
|
---|
434 | # Due to the boot animation the VM takes forever to boot.
|
---|
435 | if self.aInfo[g_iKind] == 'Windows2000':
|
---|
436 | return True;
|
---|
437 | return False;
|
---|
438 |
|
---|
439 |
|
---|
440 | class BootSectorTestVm(TestVm):
|
---|
441 | """
|
---|
442 | A Boot Sector Test VM.
|
---|
443 | """
|
---|
444 |
|
---|
445 | def __init__(self, oSet, sVmName, sFloppy = None, asVirtModesSup = None, f64BitRequired = False):
|
---|
446 | self.f64BitRequired = f64BitRequired;
|
---|
447 | if asVirtModesSup is None:
|
---|
448 | asVirtModesSup = list(g_asVirtModes);
|
---|
449 | TestVm.__init__(self, oSet, sVmName,
|
---|
450 | acCpusSup = [1,],
|
---|
451 | sFloppy = sFloppy,
|
---|
452 | asVirtModesSup = asVirtModesSup,
|
---|
453 | fPae = True,
|
---|
454 | fIoApic = True,
|
---|
455 | fVmmDevTestingPart = True,
|
---|
456 | fVmmDevTestingMmio = True,
|
---|
457 | );
|
---|
458 |
|
---|
459 | def is64bitRequired(self):
|
---|
460 | return self.f64BitRequired;
|
---|
461 |
|
---|
462 |
|
---|
463 |
|
---|
464 | class TestVmSet(object):
|
---|
465 | """
|
---|
466 | A set of Test VMs.
|
---|
467 | """
|
---|
468 |
|
---|
469 | def __init__(self, oTestVmManager = None, acCpus = None, asVirtModes = None, fIgnoreSkippedVm = False):
|
---|
470 | self.oTestVmManager = oTestVmManager;
|
---|
471 | if acCpus is None:
|
---|
472 | acCpus = [1, 2];
|
---|
473 | self.acCpusDef = acCpus;
|
---|
474 | self.acCpus = acCpus;
|
---|
475 | if asVirtModes is None:
|
---|
476 | asVirtModes = list(g_asVirtModes);
|
---|
477 | self.asVirtModesDef = asVirtModes;
|
---|
478 | self.asVirtModes = asVirtModes;
|
---|
479 | self.aoTestVms = [];
|
---|
480 | self.fIgnoreSkippedVm = fIgnoreSkippedVm;
|
---|
481 | self.asParavirtModes = None; ##< If None, use the first PV mode of the test VM, otherwise all modes in this list.
|
---|
482 |
|
---|
483 | def findTestVmByName(self, sVmName):
|
---|
484 | """
|
---|
485 | Returns the TestVm object with the given name.
|
---|
486 | Returns None if not found.
|
---|
487 | """
|
---|
488 | for oTestVm in self.aoTestVms:
|
---|
489 | if oTestVm.sVmName == sVmName:
|
---|
490 | return oTestVm;
|
---|
491 | return None;
|
---|
492 |
|
---|
493 | def getAllVmNames(self, sSep = ':'):
|
---|
494 | """
|
---|
495 | Returns names of all the test VMs in the set separated by
|
---|
496 | sSep (defaults to ':').
|
---|
497 | """
|
---|
498 | sVmNames = '';
|
---|
499 | for oTestVm in self.aoTestVms:
|
---|
500 | if sVmNames == '':
|
---|
501 | sVmNames = oTestVm.sVmName;
|
---|
502 | else:
|
---|
503 | sVmNames = sVmNames + sSep + oTestVm.sVmName;
|
---|
504 | return sVmNames;
|
---|
505 |
|
---|
506 | def showUsage(self):
|
---|
507 | """
|
---|
508 | Invoked by vbox.TestDriver.
|
---|
509 | """
|
---|
510 | reporter.log('');
|
---|
511 | reporter.log('Test VM selection and general config options:');
|
---|
512 | reporter.log(' --virt-modes <m1[:m2[:]]');
|
---|
513 | reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
|
---|
514 | reporter.log(' --skip-virt-modes <m1[:m2[:]]');
|
---|
515 | reporter.log(' Use this to avoid hwvirt or hwvirt-np when not supported by the host');
|
---|
516 | reporter.log(' since we cannot detect it using the main API. Use after --virt-modes.');
|
---|
517 | reporter.log(' --cpu-counts <c1[:c2[:]]');
|
---|
518 | reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
|
---|
519 | reporter.log(' --test-vms <vm1[:vm2[:...]]>');
|
---|
520 | reporter.log(' Test the specified VMs in the given order. Use this to change');
|
---|
521 | reporter.log(' the execution order or limit the choice of VMs');
|
---|
522 | reporter.log(' Default: %s (all)' % (self.getAllVmNames(),));
|
---|
523 | reporter.log(' --skip-vms <vm1[:vm2[:...]]>');
|
---|
524 | reporter.log(' Skip the specified VMs when testing.');
|
---|
525 | reporter.log(' --snapshot-restore-current');
|
---|
526 | reporter.log(' Restores the current snapshot and resumes execution.');
|
---|
527 | reporter.log(' --paravirt-modes <pv1[:pv2[:]]>');
|
---|
528 | reporter.log(' Set of paravirtualized providers (modes) to tests. Intersected with what the test VM supports.');
|
---|
529 | reporter.log(' Default is the first PV mode the test VMs support, generally same as "legacy".');
|
---|
530 | ## @todo Add more options for controlling individual VMs.
|
---|
531 | return True;
|
---|
532 |
|
---|
533 | def parseOption(self, asArgs, iArg):
|
---|
534 | """
|
---|
535 | Parses the set test vm set options (--test-vms and --skip-vms), modifying the set
|
---|
536 | Invoked by the testdriver method with the same name.
|
---|
537 |
|
---|
538 | Keyword arguments:
|
---|
539 | asArgs -- The argument vector.
|
---|
540 | iArg -- The index of the current argument.
|
---|
541 |
|
---|
542 | Returns iArg if the option was not recognized and the caller should handle it.
|
---|
543 | Returns the index of the next argument when something is consumed.
|
---|
544 |
|
---|
545 | In the event of a syntax error, a InvalidOption or QuietInvalidOption
|
---|
546 | is thrown.
|
---|
547 | """
|
---|
548 |
|
---|
549 | if asArgs[iArg] == '--virt-modes':
|
---|
550 | iArg += 1;
|
---|
551 | if iArg >= len(asArgs):
|
---|
552 | raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
|
---|
553 |
|
---|
554 | self.asVirtModes = asArgs[iArg].split(':');
|
---|
555 | for s in self.asVirtModes:
|
---|
556 | if s not in self.asVirtModesDef:
|
---|
557 | raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
|
---|
558 | % (s, ' '.join(self.asVirtModesDef)));
|
---|
559 |
|
---|
560 | elif asArgs[iArg] == '--skip-virt-modes':
|
---|
561 | iArg += 1;
|
---|
562 | if iArg >= len(asArgs):
|
---|
563 | raise base.InvalidOption('The "--skip-virt-modes" takes a colon separated list of modes');
|
---|
564 |
|
---|
565 | for s in asArgs[iArg].split(':'):
|
---|
566 | if s not in self.asVirtModesDef:
|
---|
567 | raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
|
---|
568 | % (s, ' '.join(self.asVirtModesDef)));
|
---|
569 | if s in self.asVirtModes:
|
---|
570 | self.asVirtModes.remove(s);
|
---|
571 |
|
---|
572 | elif asArgs[iArg] == '--cpu-counts':
|
---|
573 | iArg += 1;
|
---|
574 | if iArg >= len(asArgs):
|
---|
575 | raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
|
---|
576 |
|
---|
577 | self.acCpus = [];
|
---|
578 | for s in asArgs[iArg].split(':'):
|
---|
579 | try: c = int(s);
|
---|
580 | except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
|
---|
581 | if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
|
---|
582 | self.acCpus.append(c);
|
---|
583 |
|
---|
584 | elif asArgs[iArg] == '--test-vms':
|
---|
585 | iArg += 1;
|
---|
586 | if iArg >= len(asArgs):
|
---|
587 | raise base.InvalidOption('The "--test-vms" takes colon separated list');
|
---|
588 |
|
---|
589 | for oTestVm in self.aoTestVms:
|
---|
590 | oTestVm.fSkip = True;
|
---|
591 |
|
---|
592 | asTestVMs = asArgs[iArg].split(':');
|
---|
593 | for s in asTestVMs:
|
---|
594 | oTestVm = self.findTestVmByName(s);
|
---|
595 | if oTestVm is None:
|
---|
596 | raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
|
---|
597 | % (s, self.getAllVmNames(' ')));
|
---|
598 | oTestVm.fSkip = False;
|
---|
599 |
|
---|
600 | elif asArgs[iArg] == '--skip-vms':
|
---|
601 | iArg += 1;
|
---|
602 | if iArg >= len(asArgs):
|
---|
603 | raise base.InvalidOption('The "--skip-vms" takes colon separated list');
|
---|
604 |
|
---|
605 | asTestVMs = asArgs[iArg].split(':');
|
---|
606 | for s in asTestVMs:
|
---|
607 | oTestVm = self.findTestVmByName(s);
|
---|
608 | if oTestVm is None:
|
---|
609 | reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s,));
|
---|
610 | else:
|
---|
611 | oTestVm.fSkip = True;
|
---|
612 |
|
---|
613 | elif asArgs[iArg] == '--snapshot-restore-current':
|
---|
614 | for oTestVm in self.aoTestVms:
|
---|
615 | if oTestVm.fSkip is False:
|
---|
616 | oTestVm.fSnapshotRestoreCurrent = True;
|
---|
617 | reporter.log('VM "%s" will be restored.' % (oTestVm.sVmName));
|
---|
618 |
|
---|
619 | elif asArgs[iArg] == '--paravirt-modes':
|
---|
620 | iArg += 1
|
---|
621 | if iArg >= len(asArgs):
|
---|
622 | raise base.InvalidOption('The "--paravirt-modes" takes a colon separated list of modes');
|
---|
623 |
|
---|
624 | self.asParavirtModes = asArgs[iArg].split(':')
|
---|
625 | for sPvMode in self.asParavirtModes:
|
---|
626 | if sPvMode not in g_kasParavirtProviders:
|
---|
627 | raise base.InvalidOption('The "--paravirt-modes" value "%s" is not valid; valid values are: %s'
|
---|
628 | % (sPvMode, ', '.join(g_kasParavirtProviders),));
|
---|
629 | if not self.asParavirtModes:
|
---|
630 | self.asParavirtModes = None;
|
---|
631 |
|
---|
632 | # HACK ALERT! Reset the random paravirt selection for members.
|
---|
633 | for oTestVm in self.aoTestVms:
|
---|
634 | oTestVm.asParavirtModesSup = oTestVm.asParavirtModesSupOrg;
|
---|
635 |
|
---|
636 | else:
|
---|
637 | return iArg;
|
---|
638 | return iArg + 1;
|
---|
639 |
|
---|
640 | def getResourceSet(self):
|
---|
641 | """
|
---|
642 | Implements base.TestDriver.getResourceSet
|
---|
643 | """
|
---|
644 | asResources = [];
|
---|
645 | for oTestVm in self.aoTestVms:
|
---|
646 | if not oTestVm.fSkip:
|
---|
647 | if oTestVm.sHd is not None:
|
---|
648 | asResources.append(oTestVm.sHd);
|
---|
649 | if oTestVm.sDvdImage is not None:
|
---|
650 | asResources.append(oTestVm.sDvdImage);
|
---|
651 | return asResources;
|
---|
652 |
|
---|
653 | def actionConfig(self, oTestDrv, eNic0AttachType = None, sDvdImage = None):
|
---|
654 | """
|
---|
655 | For base.TestDriver.actionConfig. Configure the VMs with defaults and
|
---|
656 | a few tweaks as per arguments.
|
---|
657 |
|
---|
658 | Returns True if successful.
|
---|
659 | Returns False if not.
|
---|
660 | """
|
---|
661 |
|
---|
662 | for oTestVm in self.aoTestVms:
|
---|
663 | if oTestVm.fSkip:
|
---|
664 | continue;
|
---|
665 |
|
---|
666 | if oTestVm.fSnapshotRestoreCurrent:
|
---|
667 | # If we want to restore a VM we don't need to create
|
---|
668 | # the machine anymore -- so just add it to the test VM list.
|
---|
669 | oVM = oTestDrv.addTestMachine(oTestVm.sVmName);
|
---|
670 | else:
|
---|
671 | ## @todo This could possibly be moved to the TestVM object.
|
---|
672 | if sDvdImage is not None:
|
---|
673 | sMyDvdImage = sDvdImage;
|
---|
674 | else:
|
---|
675 | sMyDvdImage = oTestVm.sDvdImage;
|
---|
676 |
|
---|
677 | if eNic0AttachType is not None:
|
---|
678 | eMyNic0AttachType = eNic0AttachType;
|
---|
679 | elif oTestVm.sNic0AttachType is None:
|
---|
680 | eMyNic0AttachType = None;
|
---|
681 | elif oTestVm.sNic0AttachType == 'nat':
|
---|
682 | eMyNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
|
---|
683 | elif oTestVm.sNic0AttachType == 'bridged':
|
---|
684 | eMyNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
|
---|
685 | else:
|
---|
686 | assert False, oTestVm.sNic0AttachType;
|
---|
687 |
|
---|
688 | oVM = oTestDrv.createTestVM(oTestVm.sVmName, 1, \
|
---|
689 | sHd = oTestVm.sHd, \
|
---|
690 | sKind = oTestVm.sKind, \
|
---|
691 | fIoApic = oTestVm.fIoApic, \
|
---|
692 | fPae = oTestVm.fPae, \
|
---|
693 | eNic0AttachType = eMyNic0AttachType, \
|
---|
694 | sDvdImage = sMyDvdImage, \
|
---|
695 | sHddControllerType = oTestVm.sHddControllerType,
|
---|
696 | sFloppy = oTestVm.sFloppy,
|
---|
697 | fVmmDevTestingPart = oTestVm.fVmmDevTestingPart,
|
---|
698 | fVmmDevTestingMmio = oTestVm.fVmmDevTestingPart,
|
---|
699 | sFirmwareType = oTestVm.sFirmwareType,
|
---|
700 | sChipsetType = oTestVm.sChipsetType);
|
---|
701 | if oVM is None:
|
---|
702 | return False;
|
---|
703 |
|
---|
704 | return True;
|
---|
705 |
|
---|
706 | def _removeUnsupportedVirtModes(self, oTestDrv):
|
---|
707 | """
|
---|
708 | Removes unsupported virtualization modes.
|
---|
709 | """
|
---|
710 | if 'hwvirt' in self.asVirtModes and not oTestDrv.hasHostHwVirt():
|
---|
711 | reporter.log('Hardware assisted virtualization is not available on the host, skipping it.');
|
---|
712 | self.asVirtModes.remove('hwvirt');
|
---|
713 |
|
---|
714 | if 'hwvirt-np' in self.asVirtModes and not oTestDrv.hasHostNestedPaging():
|
---|
715 | reporter.log('Nested paging not supported by the host, skipping it.');
|
---|
716 | self.asVirtModes.remove('hwvirt-np');
|
---|
717 |
|
---|
718 | if 'raw' in self.asVirtModes and not oTestDrv.hasRawModeSupport():
|
---|
719 | reporter.log('Raw-mode virtualization is not available in this build (or perhaps for this host), skipping it.');
|
---|
720 | self.asVirtModes.remove('raw');
|
---|
721 |
|
---|
722 | return True;
|
---|
723 |
|
---|
724 | def actionExecute(self, oTestDrv, fnCallback): # pylint: disable=R0914
|
---|
725 | """
|
---|
726 | For base.TestDriver.actionExecute. Calls the callback function for
|
---|
727 | each of the VMs and basic configuration variations (virt-mode and cpu
|
---|
728 | count).
|
---|
729 |
|
---|
730 | Returns True if all fnCallback calls returned True, otherwise False.
|
---|
731 |
|
---|
732 | The callback can return True, False or None. The latter is for when the
|
---|
733 | test is skipped. (True is for success, False is for failure.)
|
---|
734 | """
|
---|
735 |
|
---|
736 | self._removeUnsupportedVirtModes(oTestDrv);
|
---|
737 | cMaxCpus = oTestDrv.getHostCpuCount();
|
---|
738 |
|
---|
739 | #
|
---|
740 | # The test loop.
|
---|
741 | #
|
---|
742 | fRc = True;
|
---|
743 | for oTestVm in self.aoTestVms:
|
---|
744 | if oTestVm.fSkip and self.fIgnoreSkippedVm:
|
---|
745 | reporter.log2('Ignoring VM %s (fSkip = True).' % (oTestVm.sVmName,));
|
---|
746 | continue;
|
---|
747 | reporter.testStart(oTestVm.sVmName);
|
---|
748 | if oTestVm.fSkip:
|
---|
749 | reporter.testDone(fSkipped = True);
|
---|
750 | continue;
|
---|
751 |
|
---|
752 | # Intersect the supported modes and the ones being testing.
|
---|
753 | asVirtModesSup = [sMode for sMode in oTestVm.asVirtModesSup if sMode in self.asVirtModes];
|
---|
754 |
|
---|
755 | # Ditto for CPUs.
|
---|
756 | acCpusSup = [cCpus for cCpus in oTestVm.acCpusSup if cCpus in self.acCpus];
|
---|
757 |
|
---|
758 | # Ditto for paravirtualization modes, except if not specified we got a less obvious default.
|
---|
759 | if self.asParavirtModes is not None and oTestDrv.fpApiVer >= 5.0:
|
---|
760 | asParavirtModes = [sPvMode for sPvMode in oTestVm.asParavirtModesSup if sPvMode in self.asParavirtModes];
|
---|
761 | assert None not in asParavirtModes;
|
---|
762 | elif oTestDrv.fpApiVer >= 5.0:
|
---|
763 | asParavirtModes = (oTestVm.asParavirtModesSup[0],);
|
---|
764 | assert asParavirtModes[0] is not None;
|
---|
765 | else:
|
---|
766 | asParavirtModes = (None,);
|
---|
767 |
|
---|
768 | for cCpus in acCpusSup:
|
---|
769 | if cCpus == 1:
|
---|
770 | reporter.testStart('1 cpu');
|
---|
771 | else:
|
---|
772 | reporter.testStart('%u cpus' % (cCpus));
|
---|
773 | if cCpus > cMaxCpus:
|
---|
774 | reporter.testDone(fSkipped = True);
|
---|
775 | continue;
|
---|
776 |
|
---|
777 | cTests = 0;
|
---|
778 | for sVirtMode in asVirtModesSup:
|
---|
779 | if sVirtMode == 'raw' and cCpus > 1:
|
---|
780 | continue;
|
---|
781 | reporter.testStart('%s' % ( g_dsVirtModeDescs[sVirtMode], ) );
|
---|
782 | cStartTests = cTests;
|
---|
783 |
|
---|
784 | for sParavirtMode in asParavirtModes:
|
---|
785 | if sParavirtMode is not None:
|
---|
786 | assert oTestDrv.fpApiVer >= 5.0;
|
---|
787 | reporter.testStart('%s' % ( sParavirtMode, ) );
|
---|
788 |
|
---|
789 | # Reconfigure the VM.
|
---|
790 | try:
|
---|
791 | (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode = sParavirtMode);
|
---|
792 | except KeyboardInterrupt:
|
---|
793 | raise;
|
---|
794 | except:
|
---|
795 | reporter.errorXcpt(cFrames = 9);
|
---|
796 | rc2 = False;
|
---|
797 | if rc2 is True:
|
---|
798 | # Do the testing.
|
---|
799 | try:
|
---|
800 | rc2 = fnCallback(oVM, oTestVm);
|
---|
801 | except KeyboardInterrupt:
|
---|
802 | raise;
|
---|
803 | except:
|
---|
804 | reporter.errorXcpt(cFrames = 9);
|
---|
805 | rc2 = False;
|
---|
806 | if rc2 is False:
|
---|
807 | reporter.maybeErr(reporter.testErrorCount() == 0, 'fnCallback failed');
|
---|
808 | elif rc2 is False:
|
---|
809 | reporter.log('getReconfiguredVm failed');
|
---|
810 | if rc2 is False:
|
---|
811 | fRc = False;
|
---|
812 |
|
---|
813 | cTests = cTests + (rc2 is not None);
|
---|
814 | if sParavirtMode is not None:
|
---|
815 | reporter.testDone(fSkipped = (rc2 is None));
|
---|
816 |
|
---|
817 | reporter.testDone(fSkipped = cTests == cStartTests);
|
---|
818 |
|
---|
819 | reporter.testDone(fSkipped = cTests == 0);
|
---|
820 |
|
---|
821 | _, cErrors = reporter.testDone();
|
---|
822 | if cErrors > 0:
|
---|
823 | fRc = False;
|
---|
824 | return fRc;
|
---|
825 |
|
---|
826 | def enumerateTestVms(self, fnCallback):
|
---|
827 | """
|
---|
828 | Enumerates all the 'active' VMs.
|
---|
829 |
|
---|
830 | Returns True if all fnCallback calls returned True.
|
---|
831 | Returns False if any returned False.
|
---|
832 | Returns None immediately if fnCallback returned None.
|
---|
833 | """
|
---|
834 | fRc = True;
|
---|
835 | for oTestVm in self.aoTestVms:
|
---|
836 | if not oTestVm.fSkip:
|
---|
837 | fRc2 = fnCallback(oTestVm);
|
---|
838 | if fRc2 is None:
|
---|
839 | return fRc2;
|
---|
840 | fRc = fRc and fRc2;
|
---|
841 | return fRc;
|
---|
842 |
|
---|
843 |
|
---|
844 |
|
---|
845 | class TestVmManager(object):
|
---|
846 | """
|
---|
847 | Test VM manager.
|
---|
848 | """
|
---|
849 |
|
---|
850 | def __init__(self, sResourcePath):
|
---|
851 | self.sResourcePath = sResourcePath;
|
---|
852 |
|
---|
853 |
|
---|
854 | def getStandardVmSet(self, sTxsTransport):
|
---|
855 | """
|
---|
856 | Gets the set of standard test VMs.
|
---|
857 |
|
---|
858 | This is supposed to do something seriously clever, like searching the
|
---|
859 | testrsrc tree for usable VMs, but for the moment it's all hard coded. :-)
|
---|
860 | """
|
---|
861 |
|
---|
862 | oSet = TestVmSet(oTestVmManager = self);
|
---|
863 |
|
---|
864 | oTestVm = TestVm(oSet, 'tst-win10-efi', sHd = '4.2/efi/win10-efi-x86.vdi',
|
---|
865 | sKind = 'Windows10', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi');
|
---|
866 | oSet.aoTestVms.append(oTestVm);
|
---|
867 |
|
---|
868 | oTestVm = TestVm(oSet, 'tst-win10-64-efi', sHd = '4.2/efi/win10-efi-amd64.vdi',
|
---|
869 | sKind = 'Windows10_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi');
|
---|
870 | oSet.aoTestVms.append(oTestVm);
|
---|
871 |
|
---|
872 | #oTestVm = TestVm(oSet, 'tst-win10-64-efi-ich9', sHd = '4.2/efi/win10-efi-amd64.vdi',
|
---|
873 | # sKind = 'Windows10_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi',
|
---|
874 | # sChipsetType = 'ich9');
|
---|
875 | #oSet.aoTestVms.append(oTestVm);
|
---|
876 |
|
---|
877 | oTestVm = TestVm(oSet, 'tst-ubuntu-15_10-64-efi', sHd = '4.2/efi/ubuntu-15_10-efi-amd64.vdi',
|
---|
878 | sKind = 'Ubuntu_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi');
|
---|
879 | oSet.aoTestVms.append(oTestVm);
|
---|
880 |
|
---|
881 | oTestVm = TestVm(oSet, 'tst-nt4sp1', sHd = '4.2/' + sTxsTransport + '/nt4sp1/t-nt4sp1.vdi',
|
---|
882 | sKind = 'WindowsNT4', acCpusSup = [1]);
|
---|
883 | oSet.aoTestVms.append(oTestVm);
|
---|
884 |
|
---|
885 | oTestVm = TestVm(oSet, 'tst-xppro', sHd = '4.2/' + sTxsTransport + '/xppro/t-xppro.vdi',
|
---|
886 | sKind = 'WindowsXP', acCpusSup = range(1, 33));
|
---|
887 | oSet.aoTestVms.append(oTestVm);
|
---|
888 |
|
---|
889 | oTestVm = TestVm(oSet, 'tst-nt4sp6', sHd = '4.2/nt4sp6/t-nt4sp6.vdi',
|
---|
890 | sKind = 'WindowsNT4', acCpusSup = range(1, 33));
|
---|
891 | oSet.aoTestVms.append(oTestVm);
|
---|
892 |
|
---|
893 | oTestVm = TestVm(oSet, 'tst-2ksp4', sHd = '4.2/win2ksp4/t-win2ksp4.vdi',
|
---|
894 | sKind = 'Windows2000', acCpusSup = range(1, 33));
|
---|
895 | oSet.aoTestVms.append(oTestVm);
|
---|
896 |
|
---|
897 | oTestVm = TestVm(oSet, 'tst-xpsp2', sHd = '4.2/xpsp2/t-winxpsp2.vdi',
|
---|
898 | sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
|
---|
899 | oSet.aoTestVms.append(oTestVm);
|
---|
900 |
|
---|
901 | oTestVm = TestVm(oSet, 'tst-xpsp2-halaacpi', sHd = '4.2/xpsp2/t-winxp-halaacpi.vdi',
|
---|
902 | sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
|
---|
903 | oSet.aoTestVms.append(oTestVm);
|
---|
904 |
|
---|
905 | oTestVm = TestVm(oSet, 'tst-xpsp2-halacpi', sHd = '4.2/xpsp2/t-winxp-halacpi.vdi',
|
---|
906 | sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
|
---|
907 | oSet.aoTestVms.append(oTestVm);
|
---|
908 |
|
---|
909 | oTestVm = TestVm(oSet, 'tst-xpsp2-halapic', sHd = '4.2/xpsp2/t-winxp-halapic.vdi',
|
---|
910 | sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
|
---|
911 | oSet.aoTestVms.append(oTestVm);
|
---|
912 |
|
---|
913 | oTestVm = TestVm(oSet, 'tst-xpsp2-halmacpi', sHd = '4.2/xpsp2/t-winxp-halmacpi.vdi',
|
---|
914 | sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
|
---|
915 | oSet.aoTestVms.append(oTestVm);
|
---|
916 |
|
---|
917 | oTestVm = TestVm(oSet, 'tst-xpsp2-halmps', sHd = '4.2/xpsp2/t-winxp-halmps.vdi',
|
---|
918 | sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
|
---|
919 | oSet.aoTestVms.append(oTestVm);
|
---|
920 |
|
---|
921 | oTestVm = TestVm(oSet, 'tst-win7', sHd = '4.2/win7-32/t-win7.vdi',
|
---|
922 | sKind = 'Windows7', acCpusSup = range(1, 33), fIoApic = True);
|
---|
923 | oSet.aoTestVms.append(oTestVm);
|
---|
924 |
|
---|
925 | oTestVm = TestVm(oSet, 'tst-win8-64', sHd = '4.2/win8-64/t-win8-64.vdi',
|
---|
926 | sKind = 'Windows8_64', acCpusSup = range(1, 33), fIoApic = True);
|
---|
927 | oSet.aoTestVms.append(oTestVm);
|
---|
928 |
|
---|
929 | #oTestVm = TestVm(oSet, 'tst-win8-64-ich9', sHd = '4.2/win8-64/t-win8-64.vdi',
|
---|
930 | # sKind = 'Windows8_64', acCpusSup = range(1, 33), fIoApic = True, sChipsetType = 'ich9');
|
---|
931 | #oSet.aoTestVms.append(oTestVm);
|
---|
932 |
|
---|
933 | return oSet;
|
---|
934 |
|
---|
935 | def getSmokeVmSet(self):
|
---|
936 | """
|
---|
937 | Gets a representative set of VMs for smoke testing.
|
---|
938 | """
|
---|
939 |
|
---|
940 | oSet = TestVmSet(oTestVmManager = self);
|
---|
941 |
|
---|
942 | oTestVm = TestVm(oSet, 'tst-win10-efi', sHd = '4.2/efi/win10-efi-x86.vdi',
|
---|
943 | sKind = 'Windows10', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi');
|
---|
944 | oSet.aoTestVms.append(oTestVm);
|
---|
945 |
|
---|
946 | oTestVm = TestVm(oSet, 'tst-win10-64-efi', sHd = '4.2/efi/win10-efi-amd64.vdi',
|
---|
947 | sKind = 'Windows10_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi');
|
---|
948 | oSet.aoTestVms.append(oTestVm);
|
---|
949 |
|
---|
950 | #oTestVm = TestVm(oSet, 'tst-win10-64-efi-ich9', sHd = '4.2/efi/win10-efi-amd64.vdi',
|
---|
951 | # sKind = 'Windows10_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi',
|
---|
952 | # sChipsetType = 'ich9');
|
---|
953 | #oSet.aoTestVms.append(oTestVm);
|
---|
954 |
|
---|
955 | oTestVm = TestVm(oSet, 'tst-ubuntu-15_10-64-efi', sHd = '4.2/efi/ubuntu-15_10-efi-amd64.vdi',
|
---|
956 | sKind = 'Ubuntu_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi',
|
---|
957 | asParavirtModesSup = [g_ksParavirtProviderKVM,]);
|
---|
958 | oSet.aoTestVms.append(oTestVm);
|
---|
959 |
|
---|
960 | oTestVm = TestVm(oSet, 'tst-nt4sp1', sHd = '4.2/nat/nt4sp1/t-nt4sp1.vdi',
|
---|
961 | sKind = 'WindowsNT4', acCpusSup = [1], sNic0AttachType = 'nat');
|
---|
962 | oSet.aoTestVms.append(oTestVm);
|
---|
963 |
|
---|
964 | oTestVm = TestVm(oSet, 'tst-xppro', sHd = '4.2/nat/xppro/t-xppro.vdi',
|
---|
965 | sKind = 'WindowsXP', acCpusSup = range(1, 33), sNic0AttachType = 'nat');
|
---|
966 | oSet.aoTestVms.append(oTestVm);
|
---|
967 |
|
---|
968 | oTestVm = TestVm(oSet, 'tst-rhel5', sHd = '3.0/tcp/rhel5.vdi',
|
---|
969 | sKind = 'RedHat', acCpusSup = range(1, 33), fIoApic = True, sNic0AttachType = 'nat');
|
---|
970 | oSet.aoTestVms.append(oTestVm);
|
---|
971 |
|
---|
972 | oTestVm = TestVm(oSet, 'tst-win2k3ent', sHd = '3.0/tcp/win2k3ent-acpi.vdi',
|
---|
973 | sKind = 'Windows2003', acCpusSup = range(1, 33), fPae = True, sNic0AttachType = 'bridged');
|
---|
974 | oSet.aoTestVms.append(oTestVm);
|
---|
975 |
|
---|
976 | oTestVm = TestVm(oSet, 'tst-sol10', sHd = '3.0/tcp/solaris10.vdi',
|
---|
977 | sKind = 'Solaris', acCpusSup = range(1, 33), fPae = True, sNic0AttachType = 'bridged');
|
---|
978 | oSet.aoTestVms.append(oTestVm);
|
---|
979 |
|
---|
980 | oTestVm = TestVm(oSet, 'tst-sol10-64', sHd = '3.0/tcp/solaris10.vdi',
|
---|
981 | sKind = 'Solaris_64', acCpusSup = range(1, 33), sNic0AttachType = 'bridged');
|
---|
982 | oSet.aoTestVms.append(oTestVm);
|
---|
983 |
|
---|
984 | oTestVm = TestVm(oSet, 'tst-sol11u1', sHd = '4.2/nat/sol11u1/t-sol11u1.vdi',
|
---|
985 | sKind = 'Solaris11_64', acCpusSup = range(1, 33), sNic0AttachType = 'nat',
|
---|
986 | fIoApic = True, sHddControllerType = 'SATA Controller');
|
---|
987 | oSet.aoTestVms.append(oTestVm);
|
---|
988 |
|
---|
989 | #oTestVm = TestVm(oSet, 'tst-sol11u1-ich9', sHd = '4.2/nat/sol11u1/t-sol11u1.vdi',
|
---|
990 | # sKind = 'Solaris11_64', acCpusSup = range(1, 33), sNic0AttachType = 'nat',
|
---|
991 | # fIoApic = True, sHddControllerType = 'SATA Controller', sChipsetType = 'ich9');
|
---|
992 | #oSet.aoTestVms.append(oTestVm);
|
---|
993 |
|
---|
994 | oTestVm = TestVm(oSet, 'tst-nt4sp6', sHd = '4.2/nt4sp6/t-nt4sp6.vdi',
|
---|
995 | sKind = 'WindowsNT4', acCpusSup = range(1, 33));
|
---|
996 | oSet.aoTestVms.append(oTestVm);
|
---|
997 |
|
---|
998 | oTestVm = TestVm(oSet, 'tst-2ksp4', sHd = '4.2/win2ksp4/t-win2ksp4.vdi',
|
---|
999 | sKind = 'Windows2000', acCpusSup = range(1, 33));
|
---|
1000 | oSet.aoTestVms.append(oTestVm);
|
---|
1001 |
|
---|
1002 | oTestVm = TestVm(oSet, 'tst-xpsp2', sHd = '4.2/xpsp2/t-winxpsp2.vdi',
|
---|
1003 | sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
|
---|
1004 | oSet.aoTestVms.append(oTestVm);
|
---|
1005 |
|
---|
1006 | oTestVm = TestVm(oSet, 'tst-xpsp2-halaacpi', sHd = '4.2/xpsp2/t-winxp-halaacpi.vdi',
|
---|
1007 | sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
|
---|
1008 | oSet.aoTestVms.append(oTestVm);
|
---|
1009 |
|
---|
1010 | oTestVm = TestVm(oSet, 'tst-xpsp2-halacpi', sHd = '4.2/xpsp2/t-winxp-halacpi.vdi',
|
---|
1011 | sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
|
---|
1012 | oSet.aoTestVms.append(oTestVm);
|
---|
1013 |
|
---|
1014 | oTestVm = TestVm(oSet, 'tst-xpsp2-halapic', sHd = '4.2/xpsp2/t-winxp-halapic.vdi',
|
---|
1015 | sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
|
---|
1016 | oSet.aoTestVms.append(oTestVm);
|
---|
1017 |
|
---|
1018 | oTestVm = TestVm(oSet, 'tst-xpsp2-halmacpi', sHd = '4.2/xpsp2/t-winxp-halmacpi.vdi',
|
---|
1019 | sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
|
---|
1020 | oSet.aoTestVms.append(oTestVm);
|
---|
1021 |
|
---|
1022 | oTestVm = TestVm(oSet, 'tst-xpsp2-halmps', sHd = '4.2/xpsp2/t-winxp-halmps.vdi',
|
---|
1023 | sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
|
---|
1024 | oSet.aoTestVms.append(oTestVm);
|
---|
1025 |
|
---|
1026 | oTestVm = TestVm(oSet, 'tst-win7', sHd = '4.2/win7-32/t-win7.vdi',
|
---|
1027 | sKind = 'Windows7', acCpusSup = range(1, 33), fIoApic = True);
|
---|
1028 | oSet.aoTestVms.append(oTestVm);
|
---|
1029 |
|
---|
1030 | oTestVm = TestVm(oSet, 'tst-win8-64', sHd = '4.2/win8-64/t-win8-64.vdi',
|
---|
1031 | sKind = 'Windows8_64', acCpusSup = range(1, 33), fIoApic = True);
|
---|
1032 | oSet.aoTestVms.append(oTestVm);
|
---|
1033 |
|
---|
1034 | #oTestVm = TestVm(oSet, 'tst-win8-64-ich9', sHd = '4.2/win8-64/t-win8-64.vdi',
|
---|
1035 | # sKind = 'Windows8_64', acCpusSup = range(1, 33), fIoApic = True, sChipsetType = 'ich9');
|
---|
1036 | #oSet.aoTestVms.append(oTestVm);
|
---|
1037 |
|
---|
1038 | return oSet;
|
---|
1039 |
|
---|
1040 | def shutUpPyLint(self):
|
---|
1041 | """ Shut up already! """
|
---|
1042 | return self.sResourcePath;
|
---|
1043 |
|
---|