Changeset 53580 in vbox for trunk/src/VBox
- Timestamp:
- Dec 19, 2014 8:57:54 PM (10 years ago)
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vboxtestvms.py
r53136 r53580 30 30 31 31 # Standard Python imports. 32 import re 33 import random 32 import re; 33 import random; 34 34 35 35 # Validation Kit imports. … … 99 99 ]; 100 100 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 ## @{ 104 g_ksGuestOsTypeDarwin = 'darwin'; 105 g_ksGuestOsTypeFreeBSD = 'freebsd'; 106 g_ksGuestOsTypeLinux = 'linux'; 107 g_ksGuestOsTypeOS2 = 'os2'; 108 g_ksGuestOsTypeSolaris = 'solaris'; 109 g_ksGuestOsTypeWindows = 'windows'; 110 ## @} 111 112 ## @name String constants for paravirtualization providers. 113 ## @{ 114 g_ksParavirtProviderNone = 'none'; 115 g_ksParavirtProviderDefault = 'default'; 116 g_ksParavirtProviderLegacy = 'legacy'; 117 g_ksParavirtProviderMinimal = 'minimal'; 118 g_ksParavirtProviderHyperV = 'hyperv'; 119 ## @} 120 121 ## Valid paravirtualization providers. 122 g_kasParavirtProviders = ( g_ksParavirtProviderNone, g_ksParavirtProviderDefault, g_ksParavirtProviderLegacy, 123 g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV ); 115 124 116 125 # Mapping for support of paravirtualisation providers per guest OS. … … 160 169 def __init__(self, oSet, sVmName, sHd = None, sKind = None, acCpusSup = None, asVirtModesSup = None, # pylint: disable=R0913 161 170 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): 163 173 self.oSet = oSet; 164 174 self.sVmName = sVmName; … … 166 176 self.acCpusSup = acCpusSup; 167 177 self.asVirtModesSup = asVirtModesSup; 178 self.asParavirtModesSup = asParavirtModesSup; 168 179 self.sKind = sKind; 169 180 self.sGuestOsType = None; … … 177 188 self.fVmmDevTestingMmio = fVmmDevTestingMmio; 178 189 179 self.fSnapshotRestoreCurrent = False; # Whether to restore execution on the current snapshot.190 self.fSnapshotRestoreCurrent = False; # Whether to restore execution on the current snapshot. 180 191 self.fSkip = False; # All VMs are included in the configured set by default. 181 192 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); 193 194 194 195 def _mkCanonicalGuestOSType(self, sType): … … 211 212 raise base.GenError(sWhat="unknown guest OS kind: %s" % str(sType)) 212 213 213 def _guessStuff(self ):214 def _guessStuff(self, fRandomPvPMode): 214 215 """ 215 216 Used by the constructor to guess stuff. … … 271 272 else: 272 273 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),); 273 283 274 284 return True; … … 300 310 fRc = fRc and oSession.setCpuCount(cCpus); 301 311 302 if oSession.fpApiVer >= 4.4 and sParavirtMode is not None:312 if sParavirtMode is not None and oSession.fpApiVer >= 4.4: 303 313 adParavirtProviders = { 304 314 g_ksParavirtProviderNone : vboxcon.ParavirtProvider_None, … … 309 319 }; 310 320 fRc = fRc and oSession.setParavirtProvider(adParavirtProviders[sParavirtMode]); 311 reporter.log('Set paravirtualization provider [%s].' % sParavirtMode);312 321 313 322 fCfg64Bit = self.is64bitRequired() or (self.is64bit() and fHostSupports64bit and sVirtMode != 'raw'); … … 424 433 self.aoTestVms = []; 425 434 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. 427 436 428 437 def findTestVmByName(self, sVmName): … … 470 479 reporter.log(' --snapshot-restore-current'); 471 480 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".'); 485 484 ## @todo Add more options for controlling individual VMs. 486 485 return True; … … 577 576 raise base.InvalidOption('The "--paravirt-modes" takes a colon separated list of modes'); 578 577 579 # Check and remember specified paravirtualisation providers list.580 578 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; 586 585 587 586 else: … … 611 610 """ 612 611 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 620 612 for oTestVm in self.aoTestVms: 621 613 if oTestVm.fSkip: 622 614 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.asParavirtModes631 615 632 616 if oTestVm.fSnapshotRestoreCurrent: … … 715 699 acCpusSup = [cCpus for cCpus in oTestVm.acCpusSup if cCpus in self.acCpus]; 716 700 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 717 711 for cCpus in acCpusSup: 718 712 if cCpus == 1: … … 728 722 if sVirtMode == 'raw' and cCpus > 1: 729 723 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, ) ); 734 731 735 732 # Reconfigure the VM. 736 733 try: 737 (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode =sParavirtMode);734 (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode = sParavirtMode); 738 735 except KeyboardInterrupt: 739 736 raise; … … 742 739 rc2 = False; 743 740 if rc2 is True: 741 # Do the testing. 744 742 try: 745 743 rc2 = fnCallback(oVM, oTestVm); … … 757 755 758 756 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); 760 761 761 762 reporter.testDone(fSkipped = cTests == 0); -
trunk/src/VBox/ValidationKit/tests/installation/tdGuestOsInstTest1.py
r53572 r53580 76 76 77 77 def __init__(self, oSet, sVmName, sKind, sInstallIso, sHdCtrlNm, cGbHdd, fFlags): 78 fUseParavirtProvider = True;79 if fFlags & self.kfNoWin81Paravirt:80 fUseParavirtProvider = False;81 78 vboxtestvms.TestVm.__init__(self, oSet, sVmName, sKind = sKind, sHddControllerType = sHdCtrlNm, 82 f UseParavirtProvider = fUseParavirtProvider); # pylint: disable=C030179 fRandomPvPMode = (fFlags & self.kfNoWin81Paravirt) != 0); 83 80 self.sDvdImage = os.path.join(self.ksIsoPathBase, sInstallIso); 84 81 self.cGbHdd = cGbHdd;
Note:
See TracChangeset
for help on using the changeset viewer.