VirtualBox

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

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

ValidationKit: Add tst-arch to the set of standard test VMs

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

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