VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testdriver/vboxtestvms.py@ 72319

Last change on this file since 72319 was 72319, checked in by vboxsync, 7 years ago

ValidationKit/testdriver: Use 5.3 directory for the upcoming (still disabled) nested hw.virt smoke test.

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

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