cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# -*- coding: utf-8 -*-
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox Test VMs
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCopyright (C) 2010-2014 Oracle Corporation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThis file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncavailable from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncyou can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncGeneral Public License (GPL) as published by the Free Software
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncFoundation, in version 2 as it comes in the "COPYING" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution. VirtualBox OSE is distributed in the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynchope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThe contents of this file may alternatively be used under the terms
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncof the Common Development and Distribution License Version 1.0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync(CDDL) only, as it comes in the "COPYING.CDDL" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution, in which case the provisions of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCDDL are applicable instead of those of the GPL.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncYou may elect to license modified versions of this file under the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncterms and conditions of either the GPL or the CDDL or both.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Standard Python imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Validation Kit imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# All virtualization modes.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# All virtualization modes except for raw-mode.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Dictionary mapping the virtualization mode mnemonics to a little less cryptic
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# strings used in test descriptions.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Arch constants.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Array indexes.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Table translating from VM name core to a more detailed guest info.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# pylint: disable=C0301
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'WindowsNT4', 'WindowsNT4', g_k32, 1, 32, ['nt4', 'nt4sp[0-9]']], # max cpus??
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Windows2000', 'Windows2000', g_k32, 1, 32, ['w2k', 'w2ksp[0-9]', 'win2k', 'win2ksp[0-9]']], # max cpus??
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'WindowsXP', 'WindowsXP', g_k32, 1, 32, ['xp', 'xpsp[0-9]']],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'WindowsXP_64', 'WindowsXP_64', g_k64, 1, 32, ['xp64', 'xp64sp[0-9]']],
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Windows2003', 'Windows2003', g_k32, 1, 32, ['w2k3', 'w2k3sp[0-9]', 'win2k3', 'win2k3sp[0-9]']],
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'WindowsVista', 'WindowsVista', g_k32, 1, 32, ['vista', 'vistasp[0-9]']],
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Windows2008', 'Windows2008', g_k32, 1, 64, ['w2k8', 'w2k8sp[0-9]', 'win2k8', 'win2k8sp[0-9]']], # max cpus/cores??
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Windows2008_64', 'Windows2008_64', g_k64, 1, 64, ['w2k8r2', 'w2k8r2sp[0-9]', 'win2k8r2', 'win2k8r2sp[0-9]']], # max cpus/cores??
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Windows7', 'Windows7', g_k32, 1, 32, ['w7', 'w7sp[0-9]', 'win7',]], # max cpus/cores??
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Windows7_64', 'Windows7_64', g_k64, 1, 64, ['w7-64', 'w7sp[0-9]-64', 'win7-64',]], # max cpus/cores??
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Windows8', 'Windows8', g_k32, 1, 32, ['w8', 'w8sp[0-9]', 'win8',]], # max cpus/cores??
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Windows8_64', 'Windows8_64', g_k64, 1, 64, ['w8-64', 'w8sp[0-9]-64', 'win8-64',]], # max cpus/cores??
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Windows81', 'Windows81', g_k32, 1, 32, ['w81', 'w81sp[0-9]', 'win81',]], # max cpus/cores??
849851bf2ca145028b5729e48076e5723140affdvboxsync [ 'Windows81_64', 'Windows81_64', g_k64, 1, 64, ['w81-64', 'w81sp[0-9]-64', 'win81-64',]], # max cpus/cores??
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Linux', 'Debian', g_k32, 1, 256, ['deb[0-9]*', 'debian[0-9]*', ]],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Linux_64', 'Debian_64', g_k64, 1, 256, ['deb[0-9]*-64', 'debian[0-9]*-64', ]],
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Linux', 'RedHat', g_k32, 1, 256, ['rhel', 'rhel[0-9]', 'rhel[0-9]u[0-9]']],
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Linux', 'Fedora', g_k32, 1, 256, ['fedora', 'fedora[0-9]*', ]],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Linux_64', 'Fedora_64', g_k64, 1, 256, ['fedora-64', 'fedora[0-9]*-64', ]],
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Linux', 'Oracle', g_k32, 1, 256, ['ols[0-9]*', 'oel[0-9]*', ]],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Linux_64', 'Oracle_64', g_k64, 1, 256, ['ols[0-9]*-64', 'oel[0-9]*-64', ]],
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Linux', 'OpenSUSE', g_k32, 1, 256, ['opensuse[0-9]*', 'suse[0-9]*', ]],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Linux_64', 'OpenSUSE_64', g_k64, 1, 256, ['opensuse[0-9]*-64', 'suse[0-9]*-64', ]],
2849c1c13746836fae51db4f2a934e0a2de6f120vboxsync [ 'Linux', 'Ubuntu', g_k32, 1, 256, ['ubuntu[0-9]*', ]],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Linux_64', 'Ubuntu_64', g_k64, 1, 256, ['ubuntu[0-9]*-64', ]],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Solaris', 'Solaris', g_k32, 1, 256, ['sol10', 'sol10u[0-9]']],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Solaris_64', 'Solaris_64', g_k64, 1, 256, ['sol10-64', 'sol10u-64[0-9]']],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'Solaris_64', 'Solaris11_64', g_k64, 1, 256, ['sol11u1']],
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync [ 'BSD', 'FreeBSD_64', g_k32_64, 1, 1, ['bs-.*']], # boot sectors, wanted 64-bit type.
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync## @name Guest OS type string constants.
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync## @name String constants for paravirtualization providers.
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync## Valid paravirtualization providers.
fef7670f1122a99df607422af1622eb495f5ba4fvboxsyncg_kasParavirtProviders = ( g_ksParavirtProviderNone, g_ksParavirtProviderDefault, g_ksParavirtProviderLegacy,
42634b0ae449be8d087db91b81384bce7a5c21c3vboxsync g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM );
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Mapping for support of paravirtualisation providers per guest OS.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync#g_kdaParavirtProvidersSupported = {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# g_ksGuestOsTypeDarwin : ( g_ksParavirtProviderMinimal, ),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# g_ksGuestOsTypeFreeBSD : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, ),
42634b0ae449be8d087db91b81384bce7a5c21c3vboxsync# g_ksGuestOsTypeLinux : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# g_ksGuestOsTypeOS2 : ( g_ksParavirtProviderNone, ),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# g_ksGuestOsTypeSolaris : ( g_ksParavirtProviderNone, ),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# g_ksGuestOsTypeWindows : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, )
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Temporary tweak:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# since for the most guests g_ksParavirtProviderNone is almost the same as g_ksParavirtProviderMinimal,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# g_ksParavirtProviderMinimal is removed from the list in order to get maximum number of unique choices
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# during independent test runs when paravirt provider is taken randomly.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksGuestOsTypeDarwin : ( g_ksParavirtProviderMinimal, ),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksGuestOsTypeFreeBSD : ( g_ksParavirtProviderNone, ),
42634b0ae449be8d087db91b81384bce7a5c21c3vboxsync g_ksGuestOsTypeLinux : ( g_ksParavirtProviderNone, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksGuestOsTypeOS2 : ( g_ksParavirtProviderNone, ),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksGuestOsTypeSolaris : ( g_ksParavirtProviderNone, ),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksGuestOsTypeWindows : ( g_ksParavirtProviderNone, g_ksParavirtProviderHyperV, )
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# pylint: enable=C0301
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Checks if any of the strings in set 1 matches any of the regular
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync expressions in set 2.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync A Test VM - name + VDI/whatever.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync This is just a data object.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def __init__(self, oSet, sVmName, sHd = None, sKind = None, acCpusSup = None, asVirtModesSup = None, # pylint: disable=R0913
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fIoApic = None, fPae = None, sNic0AttachType = None, sHddControllerType = 'IDE Controller',
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync sFloppy = None, fVmmDevTestingPart = None, fVmmDevTestingMmio = False, asParavirtModesSup = None,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.sDvdImage = None; # Relative to the testrsrc root.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.sFloppy = sFloppy; # Relative to the testrsrc root, except when it isn't...
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync self.fSnapshotRestoreCurrent = False; # Whether to restore execution on the current snapshot.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.fSkip = False; # All VMs are included in the configured set by default.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Convert guest OS type into constant representation.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Raise exception if specified @param sType is unknown.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.GenError(sWhat="unknown guest OS kind: %s" % str(sType))
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Used by the constructor to guess stuff.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # From name.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.sGuestOsType = self._mkCanonicalGuestOSType(aInfo[g_iGuestOsType])
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.fatal('The OS of test VM "%s" cannot be guessed' % (self.sVmName,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Check for 64-bit, if required and supported.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if self.aInfo[g_iArch] == g_k32_64 and _intersects(asSplit, ['64', 'amd64']):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Lookup the kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.fatal('The OS of test VM "%s" with sKind="%s" cannot be guessed' % (self.sVmName, self.sKind));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Translate sKind into sGuest OS Type.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.sGuestOsType = self._mkCanonicalGuestOSType(self.aInfo[g_iGuestOsType])
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.fatal('The OS of test VM "%s", sKind="%s" cannot be guessed' % (self.sVmName, self.sKind));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Restrict modes and such depending on the OS.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if self.sGuestOsType in (g_ksGuestOsTypeOS2, g_ksGuestOsTypeDarwin):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asVirtModesSup = [sVirtMode for sVirtMode in self.asVirtModesSup if sVirtMode != 'raw'];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asVirtModesSup = [sVirtMode for sVirtMode in self.asVirtModesSup if sVirtMode != 'raw'];
1859e17ebfeca9bb36190ecf145a6d023eae00b4vboxsync # TEMPORARY HACK - START
1859e17ebfeca9bb36190ecf145a6d023eae00b4vboxsync self.asVirtModesSup = [sVirtMode for sVirtMode in self.asVirtModesSup if sVirtMode != 'raw'];
1859e17ebfeca9bb36190ecf145a6d023eae00b4vboxsync # TEMPORARY HACK - END
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Restrict the CPU count depending on the OS and/or percieved SMP readiness.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.acCpusSup = [i for i in range(self.aInfo[g_iMinCpu], self.aInfo[g_iMaxCpu]) ];
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync # Figure relevant PV modes based on the OS.
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync self.asParavirtModesSup = g_kdaParavirtProvidersSupported[self.sGuestOsType];
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync ## @todo Remove this hack as soon as we've got around to explictly configure test variations
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync ## on the server side. Client side random is interesting but not the best option.
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync self.asParavirtModesSup = (random.choice(self.asParavirtModesSup),);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode = None):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync actionExecute worker that finds and reconfigure a test VM.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns (fRc, oVM) where fRc is True, None or False and oVM is a
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync VBox VM object that is only present when rc is True.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oVM is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if self.is64bitRequired() and not fHostSupports64bit:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync elif self.isViaIncompatible() and oTestDrv.isHostCpuVia():
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.enableNestedPaging(sVirtMode == 'hwvirt-np');
580e040eb04ce04ec23c4a2a32ee89445bedcc21vboxsync if sParavirtMode is not None and oSession.fpApiVer >= 5.0:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksParavirtProviderNone : vboxcon.ParavirtProvider_None,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksParavirtProviderDefault: vboxcon.ParavirtProvider_Default,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksParavirtProviderLegacy : vboxcon.ParavirtProvider_Legacy,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksParavirtProviderMinimal: vboxcon.ParavirtProvider_Minimal,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync g_ksParavirtProviderHyperV : vboxcon.ParavirtProvider_HyperV,
42634b0ae449be8d087db91b81384bce7a5c21c3vboxsync g_ksParavirtProviderKVM : vboxcon.ParavirtProvider_KVM,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setParavirtProvider(adParavirtProviders[sParavirtMode]);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fCfg64Bit = self.is64bitRequired() or (self.is64bit() and fHostSupports64bit and sVirtMode != 'raw');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if fCfg64Bit: # This is to avoid GUI pedantic warnings in the GUI. Sigh.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oOsType is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setOsType(oOsType.id + '_64');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return (fRc, None);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Checks if it's a Windows VM. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return self.sGuestOsType == g_ksGuestOsTypeWindows;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Checks if it's an OS/2 VM. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Checks if it's a 64-bit VM. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Check if 64-bit is required or not. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Checks if the test VM is logging onto a graphical desktop by default. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Identifies VMs that doesn't work on VIA.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns True if NOT supported on VIA, False if it IS supported.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Oracle linux doesn't like VIA in our experience
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # OS/2: "The system detected an internal processing error at location
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # 0168:fff1da1f - 000e:ca1f. 0a8606fd
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Windows NT4 before SP4 won't work because of cmpxchg8b not being
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # detected, leading to a STOP 3e(80,0,0,0).
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync A Boot Sector Test VM.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def __init__(self, oSet, sVmName, sFloppy = None, asVirtModesSup = None, f64BitRequired = False):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync A set of Test VMs.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def __init__(self, oTestVmManager = None, acCpus = None, asVirtModes = None, fIgnoreSkippedVm = False):
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync self.asParavirtModes = None; ##< If None, use the first PV mode of the test VM, otherwise all modes in this list.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns the TestVm object with the given name.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns None if not found.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns names of all the test VMs in the set separated by
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sSep (defaults to ':').
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Invoked by vbox.TestDriver.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('Test VM selection and general config options:');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Use this to avoid hwvirt or hwvirt-np when not supported by the host');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' since we cannot detect it using the main API. Use after --virt-modes.');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Test the specified VMs in the given order. Use this to change');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' the execution order or limit the choice of VMs');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s (all)' % (self.getAllVmNames(),));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Skip the specified VMs when testing.');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Restores the current snapshot and resumes execution.');
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync reporter.log(' Set of paravirtualized providers (modes) to tests. Intersected with what the test VM supports.');
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync reporter.log(' Default is the first PV mode the test VMs support, generally same as "legacy".');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## @todo Add more options for controlling individual VMs.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Parses the set test vm set options (--test-vms and --skip-vms), modifying the set
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Invoked by the testdriver method with the same name.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Keyword arguments:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync asArgs -- The argument vector.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync iArg -- The index of the current argument.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns iArg if the option was not recognized and the caller should handle it.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns the index of the next argument when something is consumed.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync In the event of a syntax error, a InvalidOption or QuietInvalidOption
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--skip-virt-modes" takes a colon separated list of modes');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync try: c = int(s);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--test-vms" takes colon separated list');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--skip-vms" takes colon separated list');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('VM "%s" will be restored.' % (oTestVm.sVmName));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--paravirt-modes" takes a colon separated list of modes');
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync raise base.InvalidOption('The "--paravirt-modes" value "%s" is not valid; valid values are: %s'
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Implements base.TestDriver.getResourceSet
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def actionConfig(self, oTestDrv, eNic0AttachType = None, sDvdImage = None):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync For base.TestDriver.actionConfig. Configure the VMs with defaults and
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync a few tweaks as per arguments.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns True if successful.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns False if not.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # If we want to restore a VM we don't need to create
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # the machine anymore -- so just add it to the test VM list.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## @todo This could possibly be moved to the TestVM object.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if sDvdImage is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if eNic0AttachType is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eMyNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync eMyNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oVM is None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Removes unsupported virtualization modes.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if 'hwvirt' in self.asVirtModes and not oTestDrv.hasHostHwVirt():
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('Hardware assisted virtualization is not available on the host, skipping it.');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if 'hwvirt-np' in self.asVirtModes and not oTestDrv.hasHostNestedPaging():
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('Nested paging not supported by the host, skipping it.');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def actionExecute(self, oTestDrv, fnCallback): # pylint: disable=R0914
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync For base.TestDriver.actionExecute. Calls the callback function for
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync each of the VMs and basic configuration variations (virt-mode and cpu
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns True if all fnCallback calls returned True, otherwise False.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync The callback can return True, False or None. The latter is for when the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync test is skipped. (True is for success, False is for failure.)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # The test loop.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log2('Ignoring VM %s (fSkip = True).' % (oTestVm.sVmName,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Intersect the supported modes and the ones being testing.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync asVirtModesSup = [sMode for sMode in oTestVm.asVirtModesSup if sMode in self.asVirtModes];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Ditto for CPUs.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync acCpusSup = [cCpus for cCpus in oTestVm.acCpusSup if cCpus in self.acCpus];
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync # Ditto for paravirtualization modes, except if not specified we got a less obvious default.
580e040eb04ce04ec23c4a2a32ee89445bedcc21vboxsync if self.asParavirtModes is not None and oTestDrv.fpApiVer >= 5.0:
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync asParavirtModes = [sPvMode for sPvMode in oTestVm.asParavirtModesSup if sPvMode in self.asParavirtModes];
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync assert None not in asParavirtModes;
8408ef7882c21890435b6b0d26ba1e39b8d7e3devboxsync asParavirtModes = (oTestVm.asParavirtModesSup[0],);
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync reporter.testStart('%s' % ( g_dsVirtModeDescs[sVirtMode], ) );
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync if sParavirtMode is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Reconfigure the VM.
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode = sParavirtMode);
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync # Do the testing.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.maybeErr(reporter.testErrorCount() == 0, 'fnCallback failed');
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync if sParavirtMode is not None:
fef7670f1122a99df607422af1622eb495f5ba4fvboxsync reporter.testDone(fSkipped = cTests == cStartTests);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Enumerates all the 'active' VMs.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns True if all fnCallback calls returned True.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns False if any returned False.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns None immediately if fnCallback returned None.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if fRc2 is None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Test VM manager.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Gets the set of standard test VMs.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync This is supposed to do something seriously clever, like searching the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync testrsrc tree for usable VMs, but for the moment it's all hard coded. :-)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-nt4sp1', sHd = '4.2/' + sTxsTransport + '/nt4sp1/t-nt4sp1.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xppro', sHd = '4.2/' + sTxsTransport + '/xppro/t-xppro.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-nt4sp6', sHd = '4.2/nt4sp6/t-nt4sp6.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-2ksp4', sHd = '4.2/win2ksp4/t-win2ksp4.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2', sHd = '4.2/xpsp2/t-winxpsp2.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halaacpi', sHd = '4.2/xpsp2/t-winxp-halaacpi.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halacpi', sHd = '4.2/xpsp2/t-winxp-halacpi.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halapic', sHd = '4.2/xpsp2/t-winxp-halapic.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halmacpi', sHd = '4.2/xpsp2/t-winxp-halmacpi.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halmps', sHd = '4.2/xpsp2/t-winxp-halmps.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-win7', sHd = '4.2/win7-32/t-win7.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'Windows7', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-win8', sHd = '4.2/win8-32/t-win8.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'Windows8', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Gets a representative set of VMs for smoke testing.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-nt4sp1', sHd = '4.2/nat/nt4sp1/t-nt4sp1.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsNT4', acCpusSup = [1], sNic0AttachType = 'nat');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xppro', sHd = '4.2/nat/xppro/t-xppro.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), sNic0AttachType = 'nat');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-rhel5', sHd = '3.0/tcp/rhel5.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'RedHat', acCpusSup = range(1, 33), fIoApic = True, sNic0AttachType = 'nat');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-win2k3ent', sHd = '3.0/tcp/win2k3ent-acpi.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'Windows2003', acCpusSup = range(1, 33), fPae = True, sNic0AttachType = 'bridged');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-sol10', sHd = '3.0/tcp/solaris10.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'Solaris', acCpusSup = range(1, 33), fPae = True, sNic0AttachType = 'bridged');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-sol10-64', sHd = '3.0/tcp/solaris10.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'Solaris_64', acCpusSup = range(1, 33), sNic0AttachType = 'bridged');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-sol11u1', sHd = '4.2/nat/sol11u1/t-sol11u1.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'Solaris11_64', acCpusSup = range(1, 33), sNic0AttachType = 'nat',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fIoApic = True, sHddControllerType = 'SATA Controller');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-nt4sp6', sHd = '4.2/nt4sp6/t-nt4sp6.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-2ksp4', sHd = '4.2/win2ksp4/t-win2ksp4.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2', sHd = '4.2/xpsp2/t-winxpsp2.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halaacpi', sHd = '4.2/xpsp2/t-winxp-halaacpi.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halacpi', sHd = '4.2/xpsp2/t-winxp-halacpi.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halapic', sHd = '4.2/xpsp2/t-winxp-halapic.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halmacpi', sHd = '4.2/xpsp2/t-winxp-halmacpi.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-xpsp2-halmps', sHd = '4.2/xpsp2/t-winxp-halmps.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-win7', sHd = '4.2/win7-32/t-win7.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'Windows7', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm = TestVm(oSet, 'tst-win8', sHd = '4.2/win8-32/t-win8.vdi',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sKind = 'Windows8', acCpusSup = range(1, 33), fIoApic = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Shut up already! """