VirtualBox

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

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

vboxtestvms.py: upates

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