VirtualBox

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

Last change on this file since 78362 was 78312, checked in by vboxsync, 6 years ago

Shared Clipboard/URI: Rerverted r130275 (committed wrong file).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 56.5 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: vboxtestvms.py 78312 2019-04-26 07:16:14Z vboxsync $
3
4"""
5VirtualBox Test VMs
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2010-2019 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: 78312 $"
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.isShanghaiIncompatible() and oTestDrv.isHostCpuShanghai():
446 fRc = None; # Skip the test.
447 elif self.isP4Incompatible() and oTestDrv.isHostCpuP4():
448 fRc = None; # Skip the test.
449 else:
450 oSession = oTestDrv.openSession(oVM);
451 if oSession is not None:
452 fRc = oSession.enableVirtEx(sVirtMode != 'raw');
453 fRc = fRc and oSession.enableNestedPaging(sVirtMode == 'hwvirt-np');
454 fRc = fRc and oSession.setCpuCount(cCpus);
455 if cCpus > 1:
456 fRc = fRc and oSession.enableIoApic(True);
457
458 if sParavirtMode is not None and oSession.fpApiVer >= 5.0:
459 adParavirtProviders = {
460 g_ksParavirtProviderNone : vboxcon.ParavirtProvider_None,
461 g_ksParavirtProviderDefault: vboxcon.ParavirtProvider_Default,
462 g_ksParavirtProviderLegacy : vboxcon.ParavirtProvider_Legacy,
463 g_ksParavirtProviderMinimal: vboxcon.ParavirtProvider_Minimal,
464 g_ksParavirtProviderHyperV : vboxcon.ParavirtProvider_HyperV,
465 g_ksParavirtProviderKVM : vboxcon.ParavirtProvider_KVM,
466 };
467 fRc = fRc and oSession.setParavirtProvider(adParavirtProviders[sParavirtMode]);
468
469 fCfg64Bit = self.is64bitRequired() or (self.is64bit() and fHostSupports64bit and sVirtMode != 'raw');
470 fRc = fRc and oSession.enableLongMode(fCfg64Bit);
471 if fCfg64Bit: # This is to avoid GUI pedantic warnings in the GUI. Sigh.
472 oOsType = oSession.getOsType();
473 if oOsType is not None:
474 if oOsType.is64Bit and sVirtMode == 'raw':
475 assert(oOsType.id[-3:] == '_64');
476 fRc = fRc and oSession.setOsType(oOsType.id[:-3]);
477 elif not oOsType.is64Bit and sVirtMode != 'raw':
478 fRc = fRc and oSession.setOsType(oOsType.id + '_64');
479
480 # New serial raw file.
481 if fRc and self.fCom1RawFile:
482 self.sCom1RawFile = self._generateRawPortFilename(oTestDrv, '-com1-', '.out');
483 utils.noxcptDeleteFile(self.sCom1RawFile);
484 fRc = oSession.setupSerialToRawFile(0, self.sCom1RawFile);
485
486 # Make life simpler for child classes.
487 if fRc:
488 fRc = self._childVmReconfig(oTestDrv, oVM, oSession);
489
490 fRc = fRc and oSession.saveSettings();
491 if not oSession.close():
492 fRc = False;
493 if fRc is True:
494 return (True, oVM);
495 return (fRc, None);
496
497 def _childVmReconfig(self, oTestDrv, oVM, oSession):
498 """ Hook into getReconfiguredVm() for children. """
499 _ = oTestDrv; _ = oVM; _ = oSession;
500 return True;
501
502 def isWindows(self):
503 """ Checks if it's a Windows VM. """
504 return self.sGuestOsType == g_ksGuestOsTypeWindows;
505
506 def isOS2(self):
507 """ Checks if it's an OS/2 VM. """
508 return self.sGuestOsType == g_ksGuestOsTypeOS2;
509
510 def isLinux(self):
511 """ Checks if it's an Linux VM. """
512 return self.sGuestOsType == g_ksGuestOsTypeLinux;
513
514 def is64bit(self):
515 """ Checks if it's a 64-bit VM. """
516 return self.sKind.find('_64') >= 0;
517
518 def is64bitRequired(self):
519 """ Check if 64-bit is required or not. """
520 return (self.aInfo[g_iFlags] & g_k64) != 0;
521
522 def isLoggedOntoDesktop(self):
523 """ Checks if the test VM is logging onto a graphical desktop by default. """
524 if self.isWindows():
525 return True;
526 if self.isOS2():
527 return True;
528 if self.sVmName.find('-desktop'):
529 return True;
530 return False;
531
532 def isViaIncompatible(self):
533 """
534 Identifies VMs that doesn't work on VIA.
535
536 Returns True if NOT supported on VIA, False if it IS supported.
537 """
538 # Oracle linux doesn't like VIA in our experience
539 if self.aInfo[g_iKind] in ['Oracle', 'Oracle_64']:
540 return True;
541 # OS/2: "The system detected an internal processing error at location
542 # 0168:fff1da1f - 000e:ca1f. 0a8606fd
543 if self.isOS2():
544 return True;
545 # Windows NT4 before SP4 won't work because of cmpxchg8b not being
546 # detected, leading to a STOP 3e(80,0,0,0).
547 if self.aInfo[g_iKind] == 'WindowsNT4':
548 if self.sVmName.find('sp') < 0:
549 return True; # no service pack.
550 if self.sVmName.find('sp0') >= 0 \
551 or self.sVmName.find('sp1') >= 0 \
552 or self.sVmName.find('sp2') >= 0 \
553 or self.sVmName.find('sp3') >= 0:
554 return True;
555 # XP x64 on a physical VIA box hangs exactly like a VM.
556 if self.aInfo[g_iKind] in ['WindowsXP_64', 'Windows2003_64']:
557 return True;
558 # Vista 64 throws BSOD 0x5D (UNSUPPORTED_PROCESSOR)
559 if self.aInfo[g_iKind] in ['WindowsVista_64']:
560 return True;
561 # Solaris 11 hangs on VIA, tested on a physical box (testboxvqc)
562 if self.aInfo[g_iKind] in ['Solaris11_64']:
563 return True;
564 return False;
565
566 def isShanghaiIncompatible(self):
567 """
568 Identifies VMs that doesn't work on Shanghai.
569
570 Returns True if NOT supported on Shanghai, False if it IS supported.
571 """
572 # For now treat it just like VIA, to be adjusted later
573 return self.isViaIncompatible()
574
575 def isP4Incompatible(self):
576 """
577 Identifies VMs that doesn't work on Pentium 4 / Pentium D.
578
579 Returns True if NOT supported on P4, False if it IS supported.
580 """
581 # Stupid 1 kHz timer. Too much for antique CPUs.
582 if self.sVmName.find('rhel5') >= 0:
583 return True;
584 # Due to the boot animation the VM takes forever to boot.
585 if self.aInfo[g_iKind] == 'Windows2000':
586 return True;
587 return False;
588
589
590class BootSectorTestVm(TestVm):
591 """
592 A Boot Sector Test VM.
593 """
594
595 def __init__(self, oSet, sVmName, sFloppy = None, asVirtModesSup = None, f64BitRequired = False):
596 self.f64BitRequired = f64BitRequired;
597 if asVirtModesSup is None:
598 asVirtModesSup = list(g_asVirtModes);
599 TestVm.__init__(self, sVmName,
600 oSet = oSet,
601 acCpusSup = [1,],
602 sFloppy = sFloppy,
603 asVirtModesSup = asVirtModesSup,
604 fPae = True,
605 fIoApic = True,
606 fVmmDevTestingPart = True,
607 fVmmDevTestingMmio = True,
608 );
609
610 def is64bitRequired(self):
611 return self.f64BitRequired;
612
613
614class AncientTestVm(TestVm):
615 """
616 A ancient Test VM, using the serial port for communicating results.
617
618 We're looking for 'PASSED' and 'FAILED' lines in the COM1 output.
619 """
620
621
622 def __init__(self, # pylint: disable=R0913
623 sVmName, # type: str
624 fGrouping = g_kfGrpAncient | g_kfGrpNoTxs, # type: int
625 sHd = None, # type: str
626 sKind = None, # type: str
627 acCpusSup = None, # type: List[int]
628 asVirtModesSup = None, # type: List[str]
629 sNic0AttachType = None, # type: str
630 sFloppy = None, # type: str
631 sFirmwareType = 'bios', # type: str
632 sChipsetType = 'piix3', # type: str
633 sHddControllerName = 'IDE Controller', # type: str
634 sDvdControllerName = 'IDE Controller', # type: str
635 cMBRamMax = None, # type: int
636 ):
637 TestVm.__init__(self,
638 sVmName,
639 fGrouping = fGrouping,
640 sHd = sHd,
641 sKind = sKind,
642 acCpusSup = [1] if acCpusSup is None else acCpusSup,
643 asVirtModesSup = asVirtModesSup,
644 sNic0AttachType = sNic0AttachType,
645 sFloppy = sFloppy,
646 sFirmwareType = sFirmwareType,
647 sChipsetType = sChipsetType,
648 sHddControllerType = sHddControllerName,
649 sDvdControllerType = sDvdControllerName,
650 asParavirtModesSup = (g_ksParavirtProviderNone,)
651 );
652 self.fCom1RawFile = True;
653 self.cMBRamMax= cMBRamMax;
654
655
656 def _childVmReconfig(self, oTestDrv, oVM, oSession):
657 _ = oVM; _ = oTestDrv;
658 fRc = True;
659
660 # DOS 4.01 doesn't like the default 32MB of memory.
661 if fRc and self.cMBRamMax is not None:
662 try:
663 cMBRam = oSession.o.machine.memorySize;
664 except:
665 cMBRam = self.cMBRamMax + 4;
666 if self.cMBRamMax < cMBRam:
667 fRc = oSession.setRamSize(self.cMBRamMax);
668
669 return fRc;
670
671
672class TestVmSet(object):
673 """
674 A set of Test VMs.
675 """
676
677 def __init__(self, oTestVmManager = None, acCpus = None, asVirtModes = None, fIgnoreSkippedVm = False):
678 self.oTestVmManager = oTestVmManager;
679 if acCpus is None:
680 acCpus = [1, 2];
681 self.acCpusDef = acCpus;
682 self.acCpus = acCpus;
683 if asVirtModes is None:
684 asVirtModes = list(g_asVirtModes);
685 self.asVirtModesDef = asVirtModes;
686 self.asVirtModes = asVirtModes;
687 self.aoTestVms = [];
688 self.fIgnoreSkippedVm = fIgnoreSkippedVm;
689 self.asParavirtModes = None; ##< If None, use the first PV mode of the test VM, otherwise all modes in this list.
690
691 def findTestVmByName(self, sVmName):
692 """
693 Returns the TestVm object with the given name.
694 Returns None if not found.
695 """
696
697 # The 'tst-' prefix is optional.
698 sAltName = sVmName if sVmName.startswith('tst-') else 'tst-' + sVmName;
699
700 for oTestVm in self.aoTestVms:
701 if oTestVm.sVmName == sVmName or oTestVm.sVmName == sAltName:
702 return oTestVm;
703 return None;
704
705 def getAllVmNames(self, sSep = ':'):
706 """
707 Returns names of all the test VMs in the set separated by
708 sSep (defaults to ':').
709 """
710 sVmNames = '';
711 for oTestVm in self.aoTestVms:
712 sName = oTestVm.sVmName;
713 if sName.startswith('tst-'):
714 sName = sName[4:];
715 if sVmNames == '':
716 sVmNames = sName;
717 else:
718 sVmNames = sVmNames + sSep + sName;
719 return sVmNames;
720
721 def showUsage(self):
722 """
723 Invoked by vbox.TestDriver.
724 """
725 reporter.log('');
726 reporter.log('Test VM selection and general config options:');
727 reporter.log(' --virt-modes <m1[:m2[:...]]>');
728 reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
729 reporter.log(' --skip-virt-modes <m1[:m2[:...]]>');
730 reporter.log(' Use this to avoid hwvirt or hwvirt-np when not supported by the host');
731 reporter.log(' since we cannot detect it using the main API. Use after --virt-modes.');
732 reporter.log(' --cpu-counts <c1[:c2[:...]]>');
733 reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
734 reporter.log(' --test-vms <vm1[:vm2[:...]]>');
735 reporter.log(' Test the specified VMs in the given order. Use this to change');
736 reporter.log(' the execution order or limit the choice of VMs');
737 reporter.log(' Default: %s (all)' % (self.getAllVmNames(),));
738 reporter.log(' --skip-vms <vm1[:vm2[:...]]>');
739 reporter.log(' Skip the specified VMs when testing.');
740 reporter.log(' --snapshot-restore-current');
741 reporter.log(' Restores the current snapshot and resumes execution.');
742 reporter.log(' --paravirt-modes <pv1[:pv2[:...]]>');
743 reporter.log(' Set of paravirtualized providers (modes) to tests. Intersected with what the test VM supports.');
744 reporter.log(' Default is the first PV mode the test VMs support, generally same as "legacy".');
745 reporter.log(' --with-nested-hwvirt-only');
746 reporter.log(' Test VMs using nested hardware-virtualization only.');
747 reporter.log(' --without-nested-hwvirt-only');
748 reporter.log(' Test VMs not using nested hardware-virtualization only.');
749 ## @todo Add more options for controlling individual VMs.
750 return True;
751
752 def parseOption(self, asArgs, iArg):
753 """
754 Parses the set test vm set options (--test-vms and --skip-vms), modifying the set
755 Invoked by the testdriver method with the same name.
756
757 Keyword arguments:
758 asArgs -- The argument vector.
759 iArg -- The index of the current argument.
760
761 Returns iArg if the option was not recognized and the caller should handle it.
762 Returns the index of the next argument when something is consumed.
763
764 In the event of a syntax error, a InvalidOption or QuietInvalidOption
765 is thrown.
766 """
767
768 if asArgs[iArg] == '--virt-modes':
769 iArg += 1;
770 if iArg >= len(asArgs):
771 raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
772
773 self.asVirtModes = asArgs[iArg].split(':');
774 for s in self.asVirtModes:
775 if s not in self.asVirtModesDef:
776 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
777 % (s, ' '.join(self.asVirtModesDef)));
778
779 elif asArgs[iArg] == '--skip-virt-modes':
780 iArg += 1;
781 if iArg >= len(asArgs):
782 raise base.InvalidOption('The "--skip-virt-modes" takes a colon separated list of modes');
783
784 for s in asArgs[iArg].split(':'):
785 if s not in self.asVirtModesDef:
786 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
787 % (s, ' '.join(self.asVirtModesDef)));
788 if s in self.asVirtModes:
789 self.asVirtModes.remove(s);
790
791 elif asArgs[iArg] == '--cpu-counts':
792 iArg += 1;
793 if iArg >= len(asArgs):
794 raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
795
796 self.acCpus = [];
797 for s in asArgs[iArg].split(':'):
798 try: c = int(s);
799 except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
800 if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
801 self.acCpus.append(c);
802
803 elif asArgs[iArg] == '--test-vms':
804 iArg += 1;
805 if iArg >= len(asArgs):
806 raise base.InvalidOption('The "--test-vms" takes colon separated list');
807
808 for oTestVm in self.aoTestVms:
809 oTestVm.fSkip = True;
810
811 asTestVMs = asArgs[iArg].split(':');
812 for s in asTestVMs:
813 oTestVm = self.findTestVmByName(s);
814 if oTestVm is None:
815 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
816 % (s, self.getAllVmNames(' ')));
817 oTestVm.fSkip = False;
818
819 elif asArgs[iArg] == '--skip-vms':
820 iArg += 1;
821 if iArg >= len(asArgs):
822 raise base.InvalidOption('The "--skip-vms" takes colon separated list');
823
824 asTestVMs = asArgs[iArg].split(':');
825 for s in asTestVMs:
826 oTestVm = self.findTestVmByName(s);
827 if oTestVm is None:
828 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s,));
829 else:
830 oTestVm.fSkip = True;
831
832 elif asArgs[iArg] == '--snapshot-restore-current':
833 for oTestVm in self.aoTestVms:
834 if oTestVm.fSkip is False:
835 oTestVm.fSnapshotRestoreCurrent = True;
836 reporter.log('VM "%s" will be restored.' % (oTestVm.sVmName));
837
838 elif asArgs[iArg] == '--paravirt-modes':
839 iArg += 1
840 if iArg >= len(asArgs):
841 raise base.InvalidOption('The "--paravirt-modes" takes a colon separated list of modes');
842
843 self.asParavirtModes = asArgs[iArg].split(':')
844 for sPvMode in self.asParavirtModes:
845 if sPvMode not in g_kasParavirtProviders:
846 raise base.InvalidOption('The "--paravirt-modes" value "%s" is not valid; valid values are: %s'
847 % (sPvMode, ', '.join(g_kasParavirtProviders),));
848 if not self.asParavirtModes:
849 self.asParavirtModes = None;
850
851 # HACK ALERT! Reset the random paravirt selection for members.
852 for oTestVm in self.aoTestVms:
853 oTestVm.asParavirtModesSup = oTestVm.asParavirtModesSupOrg;
854
855 elif asArgs[iArg] == '--with-nested-hwvirt-only':
856 for oTestVm in self.aoTestVms:
857 if oTestVm.fNstHwVirt is False:
858 oTestVm.fSkip = True;
859
860 elif asArgs[iArg] == '--without-nested-hwvirt-only':
861 for oTestVm in self.aoTestVms:
862 if oTestVm.fNstHwVirt is True:
863 oTestVm.fSkip = True;
864
865 else:
866 return iArg;
867 return iArg + 1;
868
869 def getResourceSet(self):
870 """
871 Implements base.TestDriver.getResourceSet
872 """
873 asResources = [];
874 for oTestVm in self.aoTestVms:
875 if not oTestVm.fSkip:
876 if oTestVm.sHd is not None:
877 asResources.append(oTestVm.sHd);
878 if oTestVm.sDvdImage is not None:
879 asResources.append(oTestVm.sDvdImage);
880 return asResources;
881
882 def actionConfig(self, oTestDrv, eNic0AttachType = None, sDvdImage = None):
883 """
884 For base.TestDriver.actionConfig. Configure the VMs with defaults and
885 a few tweaks as per arguments.
886
887 Returns True if successful.
888 Returns False if not.
889 """
890
891 for oTestVm in self.aoTestVms:
892 if oTestVm.fSkip:
893 continue;
894
895 if oTestVm.fSnapshotRestoreCurrent:
896 # If we want to restore a VM we don't need to create
897 # the machine anymore -- so just add it to the test VM list.
898 oVM = oTestDrv.addTestMachine(oTestVm.sVmName);
899 else:
900 oVM = oTestVm.createVm(oTestDrv, eNic0AttachType, sDvdImage);
901 if oVM is None:
902 return False;
903
904 return True;
905
906 def _removeUnsupportedVirtModes(self, oTestDrv):
907 """
908 Removes unsupported virtualization modes.
909 """
910 if 'hwvirt' in self.asVirtModes and not oTestDrv.hasHostHwVirt():
911 reporter.log('Hardware assisted virtualization is not available on the host, skipping it.');
912 self.asVirtModes.remove('hwvirt');
913
914 if 'hwvirt-np' in self.asVirtModes and not oTestDrv.hasHostNestedPaging():
915 reporter.log('Nested paging not supported by the host, skipping it.');
916 self.asVirtModes.remove('hwvirt-np');
917
918 if 'raw' in self.asVirtModes and not oTestDrv.hasRawModeSupport():
919 reporter.log('Raw-mode virtualization is not available in this build (or perhaps for this host), skipping it.');
920 self.asVirtModes.remove('raw');
921
922 return True;
923
924 def actionExecute(self, oTestDrv, fnCallback): # pylint: disable=R0914
925 """
926 For base.TestDriver.actionExecute. Calls the callback function for
927 each of the VMs and basic configuration variations (virt-mode and cpu
928 count).
929
930 Returns True if all fnCallback calls returned True, otherwise False.
931
932 The callback can return True, False or None. The latter is for when the
933 test is skipped. (True is for success, False is for failure.)
934 """
935
936 self._removeUnsupportedVirtModes(oTestDrv);
937 cMaxCpus = oTestDrv.getHostCpuCount();
938
939 #
940 # The test loop.
941 #
942 fRc = True;
943 for oTestVm in self.aoTestVms:
944 if oTestVm.fNstHwVirt and not oTestDrv.isHostCpuAmd():
945 reporter.log('Ignoring VM %s (Nested hardware-virtualization only supported on AMD CPUs).' % (oTestVm.sVmName,));
946 continue;
947 if oTestVm.fSkip and self.fIgnoreSkippedVm:
948 reporter.log2('Ignoring VM %s (fSkip = True).' % (oTestVm.sVmName,));
949 continue;
950 reporter.testStart(oTestVm.sVmName);
951 if oTestVm.fSkip:
952 reporter.testDone(fSkipped = True);
953 continue;
954
955 # Intersect the supported modes and the ones being testing.
956 asVirtModesSup = [sMode for sMode in oTestVm.asVirtModesSup if sMode in self.asVirtModes];
957
958 # Ditto for CPUs.
959 acCpusSup = [cCpus for cCpus in oTestVm.acCpusSup if cCpus in self.acCpus];
960
961 # Ditto for paravirtualization modes, except if not specified we got a less obvious default.
962 if self.asParavirtModes is not None and oTestDrv.fpApiVer >= 5.0:
963 asParavirtModes = [sPvMode for sPvMode in oTestVm.asParavirtModesSup if sPvMode in self.asParavirtModes];
964 assert None not in asParavirtModes;
965 elif oTestDrv.fpApiVer >= 5.0:
966 asParavirtModes = (oTestVm.asParavirtModesSup[0],);
967 assert asParavirtModes[0] is not None;
968 else:
969 asParavirtModes = (None,);
970
971 for cCpus in acCpusSup:
972 if cCpus == 1:
973 reporter.testStart('1 cpu');
974 else:
975 reporter.testStart('%u cpus' % (cCpus));
976 if cCpus > cMaxCpus:
977 reporter.testDone(fSkipped = True);
978 continue;
979
980 cTests = 0;
981 for sVirtMode in asVirtModesSup:
982 if sVirtMode == 'raw' and cCpus > 1:
983 continue;
984 reporter.testStart('%s' % ( g_dsVirtModeDescs[sVirtMode], ) );
985 cStartTests = cTests;
986
987 for sParavirtMode in asParavirtModes:
988 if sParavirtMode is not None:
989 assert oTestDrv.fpApiVer >= 5.0;
990 reporter.testStart('%s' % ( sParavirtMode, ) );
991
992 # Reconfigure the VM.
993 try:
994 (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode = sParavirtMode);
995 except KeyboardInterrupt:
996 raise;
997 except:
998 reporter.errorXcpt(cFrames = 9);
999 rc2 = False;
1000 if rc2 is True:
1001 # Do the testing.
1002 try:
1003 rc2 = fnCallback(oVM, oTestVm);
1004 except KeyboardInterrupt:
1005 raise;
1006 except:
1007 reporter.errorXcpt(cFrames = 9);
1008 rc2 = False;
1009 if rc2 is False:
1010 reporter.maybeErr(reporter.testErrorCount() == 0, 'fnCallback failed');
1011 elif rc2 is False:
1012 reporter.log('getReconfiguredVm failed');
1013 if rc2 is False:
1014 fRc = False;
1015
1016 cTests = cTests + (rc2 is not None);
1017 if sParavirtMode is not None:
1018 reporter.testDone(fSkipped = (rc2 is None));
1019
1020 reporter.testDone(fSkipped = cTests == cStartTests);
1021
1022 reporter.testDone(fSkipped = cTests == 0);
1023
1024 _, cErrors = reporter.testDone();
1025 if cErrors > 0:
1026 fRc = False;
1027 return fRc;
1028
1029 def enumerateTestVms(self, fnCallback):
1030 """
1031 Enumerates all the 'active' VMs.
1032
1033 Returns True if all fnCallback calls returned True.
1034 Returns False if any returned False.
1035 Returns None immediately if fnCallback returned None.
1036 """
1037 fRc = True;
1038 for oTestVm in self.aoTestVms:
1039 if not oTestVm.fSkip:
1040 fRc2 = fnCallback(oTestVm);
1041 if fRc2 is None:
1042 return fRc2;
1043 fRc = fRc and fRc2;
1044 return fRc;
1045
1046
1047
1048class TestVmManager(object):
1049 """
1050 Test VM manager.
1051 """
1052
1053 ## @name VM grouping flags
1054 ## @{
1055 kfGrpSmoke = g_kfGrpSmoke;
1056 kfGrpStandard = g_kfGrpStandard;
1057 kfGrpStdSmoke = g_kfGrpStdSmoke;
1058 kfGrpWithGAs = g_kfGrpWithGAs;
1059 kfGrpNoTxs = g_kfGrpNoTxs;
1060 kfGrpAncient = g_kfGrpAncient;
1061 kfGrpExotic = g_kfGrpExotic;
1062 ## @}
1063
1064 kaTestVMs = (
1065 # Linux
1066 TestVm('tst-ubuntu-15_10-64-efi', kfGrpStdSmoke, sHd = '4.2/efi/ubuntu-15_10-efi-amd64.vdi',
1067 sKind = 'Ubuntu_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi',
1068 asParavirtModesSup = [g_ksParavirtProviderKVM,]),
1069 TestVm('tst-rhel5', kfGrpSmoke, sHd = '3.0/tcp/rhel5.vdi',
1070 sKind = 'RedHat', acCpusSup = range(1, 33), fIoApic = True, sNic0AttachType = 'nat'),
1071 TestVm('tst-arch', kfGrpStandard, sHd = '4.2/usb/tst-arch.vdi',
1072 sKind = 'ArchLinux_64', acCpusSup = range(1, 33), fIoApic = True, sNic0AttachType = 'nat'),
1073 # disabled 2019-03-08 klaus - fails all over the place and pollutes the test results
1074 #TestVm('tst-ubuntu-1804-64', kfGrpStdSmoke, sHd = '4.2/ubuntu-1804/t-ubuntu-1804-64.vdi',
1075 # sKind = 'Ubuntu_64', acCpusSup = range(1, 33), fIoApic = True),
1076 TestVm('tst-ol76-64', kfGrpStdSmoke, sHd = '4.2/ol76/t-ol76-64.vdi',
1077 sKind = 'Oracle_64', acCpusSup = range(1, 33), fIoApic = True),
1078
1079 # Solaris
1080 TestVm('tst-sol10', kfGrpSmoke, sHd = '3.0/tcp/solaris10.vdi',
1081 sKind = 'Solaris', acCpusSup = range(1, 33), fPae = True, sNic0AttachType = 'bridged'),
1082 TestVm('tst-sol10-64', kfGrpSmoke, sHd = '3.0/tcp/solaris10.vdi',
1083 sKind = 'Solaris_64', acCpusSup = range(1, 33), sNic0AttachType = 'bridged'),
1084 TestVm('tst-sol11u1', kfGrpSmoke, sHd = '4.2/nat/sol11u1/t-sol11u1.vdi',
1085 sKind = 'Solaris11_64', acCpusSup = range(1, 33), sNic0AttachType = 'nat', fIoApic = True,
1086 sHddControllerType = 'SATA Controller'),
1087 #TestVm('tst-sol11u1-ich9', kfGrpSmoke, sHd = '4.2/nat/sol11u1/t-sol11u1.vdi',
1088 # sKind = 'Solaris11_64', acCpusSup = range(1, 33), sNic0AttachType = 'nat', fIoApic = True,
1089 # sHddControllerType = 'SATA Controller', sChipsetType = 'ich9'),
1090
1091 # NT 3.x
1092 TestVm('tst-nt310', kfGrpAncient, sHd = '5.2/great-old-ones/t-nt310/t-nt310.vdi',
1093 sKind = 'WindowsNT3x', acCpusSup = [1], sHddControllerType = 'BusLogic SCSI Controller',
1094 sDvdControllerType = 'BusLogic SCSI Controller'),
1095 TestVm('tst-nt350', kfGrpAncient, sHd = '5.2/great-old-ones/t-nt350/t-nt350.vdi',
1096 sKind = 'WindowsNT3x', acCpusSup = [1], sHddControllerType = 'BusLogic SCSI Controller',
1097 sDvdControllerType = 'BusLogic SCSI Controller'),
1098 TestVm('tst-nt351', kfGrpAncient, sHd = '5.2/great-old-ones/t-nt350/t-nt351.vdi',
1099 sKind = 'WindowsNT3x', acCpusSup = [1], sHddControllerType = 'BusLogic SCSI Controller',
1100 sDvdControllerType = 'BusLogic SCSI Controller'),
1101
1102 # NT 4
1103 TestVm('tst-nt4sp1', kfGrpStdSmoke, sHd = '4.2/nat/nt4sp1/t-nt4sp1.vdi',
1104 sKind = 'WindowsNT4', acCpusSup = [1], sNic0AttachType = 'nat'),
1105
1106 TestVm('tst-nt4sp6', kfGrpStdSmoke, sHd = '4.2/nt4sp6/t-nt4sp6.vdi',
1107 sKind = 'WindowsNT4', acCpusSup = range(1, 33)),
1108
1109 # W2K
1110 TestVm('tst-2ksp4', kfGrpStdSmoke, sHd = '4.2/win2ksp4/t-win2ksp4.vdi',
1111 sKind = 'Windows2000', acCpusSup = range(1, 33)),
1112
1113 # XP
1114 TestVm('tst-xppro', kfGrpStdSmoke, sHd = '4.2/nat/xppro/t-xppro.vdi',
1115 sKind = 'WindowsXP', acCpusSup = range(1, 33), sNic0AttachType = 'nat'),
1116 TestVm('tst-xpsp2', kfGrpStdSmoke, sHd = '4.2/xpsp2/t-winxpsp2.vdi',
1117 sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True),
1118 TestVm('tst-xpsp2-halaacpi', kfGrpStdSmoke, sHd = '4.2/xpsp2/t-winxp-halaacpi.vdi',
1119 sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True),
1120 TestVm('tst-xpsp2-halacpi', kfGrpStdSmoke, sHd = '4.2/xpsp2/t-winxp-halacpi.vdi',
1121 sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True),
1122 TestVm('tst-xpsp2-halapic', kfGrpStdSmoke, sHd = '4.2/xpsp2/t-winxp-halapic.vdi',
1123 sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True),
1124 TestVm('tst-xpsp2-halmacpi', kfGrpStdSmoke, sHd = '4.2/xpsp2/t-winxp-halmacpi.vdi',
1125 sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True),
1126 TestVm('tst-xpsp2-halmps', kfGrpStdSmoke, sHd = '4.2/xpsp2/t-winxp-halmps.vdi',
1127 sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True),
1128
1129 # W2K3
1130 TestVm('tst-win2k3ent', kfGrpSmoke, sHd = '3.0/tcp/win2k3ent-acpi.vdi',
1131 sKind = 'Windows2003', acCpusSup = range(1, 33), fPae = True, sNic0AttachType = 'bridged'),
1132
1133 # W7
1134 TestVm('tst-win7', kfGrpStdSmoke, sHd = '4.2/win7-32/t-win7.vdi',
1135 sKind = 'Windows7', acCpusSup = range(1, 33), fIoApic = True),
1136
1137 # W8
1138 TestVm('tst-win8-64', kfGrpStdSmoke, sHd = '4.2/win8-64/t-win8-64.vdi',
1139 sKind = 'Windows8_64', acCpusSup = range(1, 33), fIoApic = True),
1140 #TestVm('tst-win8-64-ich9', kfGrpStdSmoke, sHd = '4.2/win8-64/t-win8-64.vdi',
1141 # sKind = 'Windows8_64', acCpusSup = range(1, 33), fIoApic = True, sChipsetType = 'ich9'),
1142
1143 # W10
1144 TestVm('tst-win10-efi', kfGrpStdSmoke, sHd = '4.2/efi/win10-efi-x86.vdi',
1145 sKind = 'Windows10', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi'),
1146 TestVm('tst-win10-64-efi', kfGrpStdSmoke, sHd = '4.2/efi/win10-efi-amd64.vdi',
1147 sKind = 'Windows10_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi'),
1148 #TestVm('tst-win10-64-efi-ich9', kfGrpStdSmoke, sHd = '4.2/efi/win10-efi-amd64.vdi',
1149 # sKind = 'Windows10_64', acCpusSup = range(1, 33), fIoApic = True, sFirmwareType = 'efi', sChipsetType = 'ich9'),
1150
1151 # Nested hardware-virtualization
1152 TestVm('tst-nsthwvirt-ubuntu-64', kfGrpStdSmoke, sHd = '5.3/nat/nsthwvirt-ubuntu64/t-nsthwvirt-ubuntu64.vdi',
1153 sKind = 'Ubuntu_64', acCpusSup = range(1, 2), asVirtModesSup = ['hwvirt-np',], fIoApic = True, fNstHwVirt = True,
1154 sNic0AttachType = 'nat'),
1155
1156 # DOS and Old Windows.
1157 AncientTestVm('tst-dos20', sKind = 'DOS',
1158 sHd = '5.2/great-old-ones/t-dos20/t-dos20.vdi'),
1159 AncientTestVm('tst-dos401-win30me', sKind = 'DOS',
1160 sHd = '5.2/great-old-ones/t-dos401-win30me/t-dos401-win30me.vdi', cMBRamMax = 4),
1161 AncientTestVm('tst-dos401-emm386-win30me', sKind = 'DOS',
1162 sHd = '5.2/great-old-ones/t-dos401-emm386-win30me/t-dos401-emm386-win30me.vdi', cMBRamMax = 4),
1163 AncientTestVm('tst-dos50-win31', sKind = 'DOS',
1164 sHd = '5.2/great-old-ones/t-dos50-win31/t-dos50-win31.vdi'),
1165 AncientTestVm('tst-dos50-emm386-win31', sKind = 'DOS',
1166 sHd = '5.2/great-old-ones/t-dos50-emm386-win31/t-dos50-emm386-win31.vdi'),
1167 AncientTestVm('tst-dos622', sKind = 'DOS',
1168 sHd = '5.2/great-old-ones/t-dos622/t-dos622.vdi'),
1169 AncientTestVm('tst-dos622-emm386', sKind = 'DOS',
1170 sHd = '5.2/great-old-ones/t-dos622-emm386/t-dos622-emm386.vdi'),
1171 AncientTestVm('tst-dos71', sKind = 'DOS',
1172 sHd = '5.2/great-old-ones/t-dos71/t-dos71.vdi'),
1173
1174 #AncientTestVm('tst-dos5-win311a', sKind = 'DOS', sHd = '5.2/great-old-ones/t-dos5-win311a/t-dos5-win311a.vdi'),
1175 );
1176
1177
1178 def __init__(self, sResourcePath):
1179 self.sResourcePath = sResourcePath;
1180
1181 def selectSet(self, fGrouping, sTxsTransport = None, fCheckResources = True):
1182 """
1183 Returns a VM set with the selected VMs.
1184 """
1185 oSet = TestVmSet(oTestVmManager = self);
1186 for oVm in self.kaTestVMs:
1187 if oVm.fGrouping & fGrouping:
1188 if sTxsTransport is None or oVm.sNic0AttachType is None or sTxsTransport == oVm.sNic0AttachType:
1189 if not fCheckResources or not oVm.getMissingResources(self.sResourcePath):
1190 oCopyVm = copy.deepcopy(oVm);
1191 oCopyVm.oSet = oSet;
1192 oSet.aoTestVms.append(oCopyVm);
1193 return oSet;
1194
1195 def getStandardVmSet(self, sTxsTransport):
1196 """
1197 Gets the set of standard test VMs.
1198
1199 This is supposed to do something seriously clever, like searching the
1200 testrsrc tree for usable VMs, but for the moment it's all hard coded. :-)
1201 """
1202 return self.selectSet(self.kfGrpStandard, sTxsTransport)
1203
1204 def getSmokeVmSet(self, sTxsTransport = None):
1205 """Gets a representative set of VMs for smoke testing. """
1206 return self.selectSet(self.kfGrpSmoke, sTxsTransport);
1207
1208 def shutUpPyLint(self):
1209 """ Shut up already! """
1210 return self.sResourcePath;
1211
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