VirtualBox

Changeset 53580 in vbox


Ignore:
Timestamp:
Dec 19, 2014 8:57:54 PM (10 years ago)
Author:
vboxsync
Message:

tdGuestOSInstTest1.py,vboxtestvms.py: Untested revision of the --paravirt-modes code.

Location:
trunk/src/VBox/ValidationKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/vboxtestvms.py

    r53136 r53580  
    3030
    3131# Standard Python imports.
    32 import re
    33 import random
     32import re;
     33import random;
    3434
    3535# Validation Kit imports.
     
    9999];
    100100
    101 # Guest OS type string constants.
    102 g_ksGuestOsTypeDarwin  = 'darwin'
    103 g_ksGuestOsTypeFreeBSD = 'freebsd'
    104 g_ksGuestOsTypeLinux   = 'linux'
    105 g_ksGuestOsTypeOS2     = 'os2'
    106 g_ksGuestOsTypeSolaris = 'solaris'
    107 g_ksGuestOsTypeWindows = 'windows'
    108 
    109 # String constants for hypervisor types.
    110 g_ksParavirtProviderNone    = 'none'
    111 g_ksParavirtProviderDefault = 'default'
    112 g_ksParavirtProviderLegacy  = 'legacy'
    113 g_ksParavirtProviderMinimal = 'minimal'
    114 g_ksParavirtProviderHyperV  = 'hyperv'
     101
     102## @name Guest OS type string constants.
     103## @{
     104g_ksGuestOsTypeDarwin  = 'darwin';
     105g_ksGuestOsTypeFreeBSD = 'freebsd';
     106g_ksGuestOsTypeLinux   = 'linux';
     107g_ksGuestOsTypeOS2     = 'os2';
     108g_ksGuestOsTypeSolaris = 'solaris';
     109g_ksGuestOsTypeWindows = 'windows';
     110## @}
     111
     112## @name String constants for paravirtualization providers.
     113## @{
     114g_ksParavirtProviderNone    = 'none';
     115g_ksParavirtProviderDefault = 'default';
     116g_ksParavirtProviderLegacy  = 'legacy';
     117g_ksParavirtProviderMinimal = 'minimal';
     118g_ksParavirtProviderHyperV  = 'hyperv';
     119## @}
     120
     121## Valid paravirtualization providers.
     122g_kasParavirtProviders = ( g_ksParavirtProviderNone, g_ksParavirtProviderDefault, g_ksParavirtProviderLegacy,
     123                           g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV );
    115124
    116125# Mapping for support of paravirtualisation providers per guest OS.
     
    160169    def __init__(self, oSet, sVmName, sHd = None, sKind = None, acCpusSup = None, asVirtModesSup = None, # pylint: disable=R0913
    161170                 fIoApic = None, fPae = None, sNic0AttachType = None, sHddControllerType = 'IDE Controller',
    162                  sFloppy = None, fVmmDevTestingPart = None, fVmmDevTestingMmio = False, fUseParavirtProvider = False):
     171                 sFloppy = None, fVmmDevTestingPart = None, fVmmDevTestingMmio = False, asParavirtModesSup = None,
     172                 fRandomPvPMode = False):
    163173        self.oSet                    = oSet;
    164174        self.sVmName                 = sVmName;
     
    166176        self.acCpusSup               = acCpusSup;
    167177        self.asVirtModesSup          = asVirtModesSup;
     178        self.asParavirtModesSup      = asParavirtModesSup;
    168179        self.sKind                   = sKind;
    169180        self.sGuestOsType            = None;
     
    177188        self.fVmmDevTestingMmio      = fVmmDevTestingMmio;
    178189
    179         self.fSnapshotRestoreCurrent = False;       # Whether to restore execution on the current snapshot.
     190        self.fSnapshotRestoreCurrent = False;        # Whether to restore execution on the current snapshot.
    180191        self.fSkip                   = False;        # All VMs are included in the configured set by default.
    181192        self.aInfo                   = None;
    182         self._guessStuff();
    183 
    184         # Assign all available paravirt providers for current VM type if fUseParavirtProvider allows to do that.
    185         # The list might be overwritten later once --paravirt-modes option is specified.
    186         #
    187         # Temporary solution: in order to do not overload testboxes, the only one provider is enabled by default (a random one).
    188         if fUseParavirtProvider:
    189             random.seed()
    190             self.asParavirtModes = (random.choice(g_kdaParavirtProvidersSupported[self.sGuestOsType]),)
    191         else:
    192             self.asParavirtModes = (None,)
     193        self._guessStuff(fRandomPvPMode);
    193194
    194195    def _mkCanonicalGuestOSType(self, sType):
     
    211212        raise base.GenError(sWhat="unknown guest OS kind: %s" % str(sType))
    212213
    213     def _guessStuff(self):
     214    def _guessStuff(self, fRandomPvPMode):
    214215        """
    215216        Used by the constructor to guess stuff.
     
    271272            else:
    272273                self.acCpusSup = [1];
     274
     275        # Figure relevant PV modes based on the OS.
     276        if self.asParavirtModesSup is None:
     277            self.asParavirtModesSup = g_kdaParavirtProvidersSupported[self.sGuestOsType];
     278            ## @todo Remove this hack as soon as we've got around to explictly configure test variations
     279            ## on the server side. Client side random is interesting but not the best option.
     280            if fRandomPvPMode:
     281                random.seed();
     282                self.asParavirtModesSup = (random.choice(self.asParavirtModesSup),);
    273283
    274284        return True;
     
    300310                        fRc = fRc and oSession.setCpuCount(cCpus);
    301311
    302                         if oSession.fpApiVer >= 4.4 and sParavirtMode is not None:
     312                        if sParavirtMode is not None and oSession.fpApiVer >= 4.4:
    303313                            adParavirtProviders = {
    304314                                g_ksParavirtProviderNone   : vboxcon.ParavirtProvider_None,
     
    309319                            };
    310320                            fRc = fRc and oSession.setParavirtProvider(adParavirtProviders[sParavirtMode]);
    311                             reporter.log('Set paravirtualization provider [%s].' % sParavirtMode);
    312321
    313322                        fCfg64Bit = self.is64bitRequired() or (self.is64bit() and fHostSupports64bit and sVirtMode != 'raw');
     
    424433        self.aoTestVms      = [];
    425434        self.fIgnoreSkippedVm = fIgnoreSkippedVm;
    426         self.asParavirtModes = None
     435        self.asParavirtModes = None; ##< If None, use the first PV mode of the test VM, otherwise all modes in this list.
    427436
    428437    def findTestVmByName(self, sVmName):
     
    470479        reporter.log('  --snapshot-restore-current');
    471480        reporter.log('      Restores the current snapshot and resumes execution.');
    472         reporter.log('  --paravirt-modes   <m1[:m2[:]]')
    473         reporter.log('      Default for OS X guests   : %s' % (':'.join(str(m) for m in g_kdaParavirtProvidersSupported[g_ksGuestOsTypeDarwin  ]))) # pylint: disable=C0301
    474         reporter.log('      Default for FreeBSD guests: %s' % (':'.join(str(m) for m in g_kdaParavirtProvidersSupported[g_ksGuestOsTypeFreeBSD ]))) # pylint: disable=C0301
    475         reporter.log('      Default for Linux guests  : %s' % (':'.join(str(m) for m in g_kdaParavirtProvidersSupported[g_ksGuestOsTypeLinux   ]))) # pylint: disable=C0301
    476         reporter.log('      Default for OS/2 guests   : %s' % (':'.join(str(m) for m in g_kdaParavirtProvidersSupported[g_ksGuestOsTypeOS2     ]))) # pylint: disable=C0301
    477         reporter.log('      Default for Solaris guests: %s' % (':'.join(str(m) for m in g_kdaParavirtProvidersSupported[g_ksGuestOsTypeSolaris ]))) # pylint: disable=C0301
    478         reporter.log('      Default for Windows guests: %s' % (':'.join(str(m) for m in g_kdaParavirtProvidersSupported[g_ksGuestOsTypeWindows ]))) # pylint: disable=C0301
    479         reporter.log('      NOTE: this option can be applied only in case if VM set contains')
    480         reporter.log('            the only one VM because different VMs might not support all')
    481         reporter.log('            the specified paravirtualisation providers. If the option not')
    482         reporter.log('            specified, default set of paravirtualisation providers assigned')
    483         reporter.log('            to VM according to its type.')
    484 
     481        reporter.log('  --paravirt-modes   <pv1[:pv2[:]]>');
     482        reporter.log('      Set of paravirtualized providers (modes) to tests. Intersected with what the test VM supports.');
     483        reporter.log('      Default is the first PV mode the test VMs support, generally same as "legacy".');
    485484        ## @todo Add more options for controlling individual VMs.
    486485        return True;
     
    577576                raise base.InvalidOption('The "--paravirt-modes" takes a colon separated list of modes');
    578577
    579             # Check and remember specified paravirtualisation providers list.
    580578            self.asParavirtModes = asArgs[iArg].split(':')
    581 
    582             for sMode in self.asParavirtModes:
    583                 if sMode not in (g_ksParavirtProviderNone, g_ksParavirtProviderDefault,
    584                                  g_ksParavirtProviderLegacy, g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV):
    585                     raise base.InvalidOption('Bad paravirtualisation provider specified: %s' % sMode);
     579            for sPvMode in self.asParavirtModes:
     580                if sPvMode not in g_kasParavirtProviders:
     581                    raise base.InvalidOption('The "--paravirt-modes" value "%s" is not valid; valid values are: %s'
     582                                             % (sPvMode, ', '.join(g_kasParavirtProviders),));
     583            if len(self.asParavirtModes) == 0:
     584                self.asParavirtModes = None;
    586585
    587586        else:
     
    611610        """
    612611
    613         # Check if --paravirt-modes option was specified and it meets requirements.
    614         if self.asParavirtModes is not None:
    615             iNumberOfActivatedVMs = len([item for item in self.aoTestVms if item.fSkip is not True])
    616             if iNumberOfActivatedVMs != 1:
    617                 raise base.InvalidOption('The --paravirt-modes option assumes that the only one VM '
    618                                          'is activated in test VMs set while %d are active.' % iNumberOfActivatedVMs)
    619 
    620612        for oTestVm in self.aoTestVms:
    621613            if oTestVm.fSkip:
    622614                continue;
    623 
    624             # At this point we know that if --paravirt-modes option was specified, there is only one VM in set.
    625             if self.asParavirtModes is not None:
    626                 for sMode in self.asParavirtModes:
    627                     if sMode not in g_kdaParavirtProvidersSupported[oTestVm.sGuestOsType]:
    628                         raise base.InvalidOption('Paravirtualisation provider "%s" is not supported by current guest OS.' % sMode)
    629                 # At this point oTestVm' asParavirtModes might be safely overwritten.
    630                 oTestVm.asParavirtModes = self.asParavirtModes
    631615
    632616            if oTestVm.fSnapshotRestoreCurrent:
     
    715699            acCpusSup      = [cCpus for cCpus in oTestVm.acCpusSup      if cCpus in self.acCpus];
    716700
     701            # Ditto for paravirtualization modes, except if not specified we got a less obvious default.
     702            if self.asParavirtModes is not None  and  oTestDrv.fpApiVer >= 4.4:
     703                asParavirtModes = [sPvMode for sPvMode in oTestVm.asParavirtModesSup if sPvMode in self.asParavirtModes];
     704                assert None not in asParavirtModes;
     705            elif oTestDrv.fpApiVer >= 4.4:
     706                asParavirtModes = oTestVm.asParavirtModesSup[0];
     707                assert None not in asParavirtModes;
     708            else:
     709                asParavirtModes = (None,);
     710
    717711            for cCpus in acCpusSup:
    718712                if cCpus == 1:
     
    728722                    if sVirtMode == 'raw' and cCpus > 1:
    729723                        continue;
    730 
    731                     for sParavirtMode in oTestVm.asParavirtModes:
    732 
    733                         reporter.testStart("%s/%s" % (g_dsVirtModeDescs[sVirtMode], sParavirtMode if sParavirtMode is not None else "[paravirtualisation provider not set]")); # pylint: disable=C0301
     724                    reporter.testStart('%s' % ( g_dsVirtModeDescs[sVirtMode], ) );
     725                    cStartTests = cTests;
     726
     727                    for sParavirtMode in asParavirtModes:
     728                        if sParavirtMode is not None:
     729                            assert oTestDrv.fpApiVer >= 4.4;
     730                            reporter.testStart('%s' % ( sParavirtMode, ) );
    734731
    735732                        # Reconfigure the VM.
    736733                        try:
    737                             (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode=sParavirtMode);
     734                            (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode = sParavirtMode);
    738735                        except KeyboardInterrupt:
    739736                            raise;
     
    742739                            rc2 = False;
    743740                        if rc2 is True:
     741                            # Do the testing.
    744742                            try:
    745743                                rc2 = fnCallback(oVM, oTestVm);
     
    757755
    758756                        cTests = cTests + (rc2 is not None);
    759                         reporter.testDone(fSkipped = (rc2 is None));
     757                        if sParavirtMode is not None:
     758                            reporter.testDone(fSkipped = (rc2 is None));
     759
     760                    reporter.testDone(fSkipped = cTests == cStartTests);
    760761
    761762                reporter.testDone(fSkipped = cTests == 0);
  • trunk/src/VBox/ValidationKit/tests/installation/tdGuestOsInstTest1.py

    r53572 r53580  
    7676
    7777    def __init__(self, oSet, sVmName, sKind, sInstallIso, sHdCtrlNm, cGbHdd, fFlags):
    78         fUseParavirtProvider = True;
    79         if fFlags & self.kfNoWin81Paravirt:
    80             fUseParavirtProvider = False;
    8178        vboxtestvms.TestVm.__init__(self, oSet, sVmName, sKind = sKind, sHddControllerType = sHdCtrlNm,
    82                                     fUseParavirtProvider = fUseParavirtProvider); # pylint: disable=C0301
     79                                    fRandomPvPMode = (fFlags & self.kfNoWin81Paravirt) != 0);
    8380        self.sDvdImage    = os.path.join(self.ksIsoPathBase, sInstallIso);
    8481        self.cGbHdd       = cGbHdd;
Note: See TracChangeset for help on using the changeset viewer.

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