VirtualBox

Changeset 78830 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
May 28, 2019 4:11:23 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130930
Message:

tdGuestOsUnattendedInst1.py: Work in progress

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/installation/tdGuestOsUnattendedInst1.py

    r78807 r78830  
    44
    55"""
    6 VirtualBox Validation Kit - Guest OS installation tests.
     6VirtualBox Validation Kit - Guest OS unattended installation tests.
    77"""
    88
     
    5050
    5151
    52 class InstallTestVm(vboxtestvms.TestVm):
    53     """ Installation test VM. """
    54 
    55     ## @name The primary controller, to which the disk will be attached.
    56     ## @{
    57     ksScsiController = 'SCSI Controller'
    58     ksSataController = 'SATA Controller'
    59     ksIdeController  = 'IDE Controller'
    60     ## @}
     52class UnattendedVm(vboxtestvms.TestVm):
     53    """ Unattended Installation test VM. """
    6154
    6255    ## @name VM option flags (OR together).
    6356    ## @{
    64     kf32Bit                 = 0x01;
    65     kf64Bit                 = 0x02;
    66     # most likely for ancient Linux kernels assuming that AMD processors have always an I/O-APIC
    67     kfReqIoApic             = 0x10;
    68     kfReqIoApicSmp          = 0x20;
    69     kfReqPae                = 0x40;
    70     kfIdeIrqDelay           = 0x80;
    71     kfUbuntuNewAmdBug       = 0x100;
    72     kfNoWin81Paravirt       = 0x200;
     57    kfIdeIrqDelay           = 0x1;
     58    kfUbuntuNewAmdBug       = 0x2;
     59    kfNoWin81Paravirt       = 0x4;
    7360    ## @}
    7461
     
    7663    kasIdeIrqDelay   = [ 'VBoxInternal/Devices/piix3ide/0/Config/IRQDelay:1', ];
    7764
    78     ## Install ISO path relative to the testrsrc root.
    79     ksIsoPathBase    = os.path.join('4.2', 'isos');
    80 
    81 
    82     def __init__(self, oSet, sVmName, sKind, sInstallIso, sHdCtrlNm, cGbHdd, fFlags):
    83         vboxtestvms.TestVm.__init__(self, sVmName, oSet = oSet, sKind = sKind, sHddControllerType = sHdCtrlNm,
    84                                     fRandomPvPMode = (fFlags & self.kfNoWin81Paravirt) == 0);
    85         self.sDvdImage    = os.path.join(self.ksIsoPathBase, sInstallIso);
    86         self.cGbHdd       = cGbHdd;
    87         self.fInstVmFlags = fFlags;
    88         if fFlags & self.kfReqPae:
    89             self.fPae     = True;
    90         if fFlags & (self.kfReqIoApic | self.kfReqIoApicSmp):
    91             self.fIoApic  = True;
    92 
    93         # Tweaks
     65    ## Install ISO paths relative to the testrsrc root.
     66    kasIosPathBases  = [ os.path.join('6.0', 'isos'), os.path.join('6.1', 'isos'), ];
     67
     68    def __init__(self, oSet, sVmName, sKind, sInstallIso, fFlags = 0):
     69        vboxtestvms.TestVm.__init__(self, sVmName, oSet = oSet, sKind = sKind,
     70                                    fRandomPvPMode = False, sFirmwareType = None, sChipsetType = None,
     71                                    sHddControllerType = None, sDvdControllerType = None);
     72        self.sInstallIso    = sInstallIso;
     73        self.fInstVmFlags   = fFlags;
     74
     75        # Adjustments over the defaults.
    9476        self.iOptRamAdjust  = 0;
     77        self.fOptIoApic     = None;
     78        self.fOptPae        = None;
    9579        self.asExtraData    = [];
    9680        if fFlags & self.kfIdeIrqDelay:
    97             self.asExtraData = self.kasIdeIrqDelay;
     81            self.asOptExtraData = self.kasIdeIrqDelay;
     82
     83    ## @todo split TestVm.
     84    def createVmInner(self, oTestDrv, eNic0AttachType, sDvdImage):
     85        """ Overloaded from TestVm to create using defaults rather than a set complicated config properties. """
     86
    9887
    9988    def detatchAndDeleteHd(self, oTestDrv):
     
    172161
    173162                # Set extra data
    174                 for sExtraData in self.asExtraData:
     163                for sExtraData in self.asOptExtraData:
    175164                    try:
    176165                        sKey, sValue = sExtraData.split(':')
     
    193182        return (fRc, oVM)
    194183
    195     def isHostCpuAffectedByUbuntuNewAmdBug(self, oTestDrv):
    196         """
    197         Checks if the host OS is affected by older ubuntu installers being very
    198         picky about which families of AMD CPUs it would run on.
    199 
    200         The installer checks for family 15, later 16, later 20, and in 11.10
    201         they remove the family check for AMD CPUs.
    202         """
    203         if not oTestDrv.isHostCpuAmd():
    204             return False;
    205         try:
    206             (uMaxExt, _, _, _) = oTestDrv.oVBox.host.getProcessorCPUIDLeaf(0, 0x80000000, 0);
    207             (uFamilyModel, _, _, _) = oTestDrv.oVBox.host.getProcessorCPUIDLeaf(0, 0x80000001, 0);
    208         except:
    209             reporter.logXcpt();
    210             return False;
    211         if uMaxExt < 0x80000001 or uMaxExt > 0x8000ffff:
    212             return False;
    213 
    214         uFamily = (uFamilyModel >> 8) & 0xf
    215         if uFamily == 0xf:
    216             uFamily = ((uFamilyModel >> 20) & 0x7f) + 0xf;
    217         ## @todo Break this down into which old ubuntu release supports exactly
    218         ##       which AMD family, if we care.
    219         if uFamily <= 15:
    220             return False;
    221         reporter.log('Skipping "%s" because host CPU is a family %u AMD, which may cause trouble for the guest OS installer.'
    222                      % (self.sVmName, uFamily,));
    223         return True;
    224 
    225 
    226184
    227185
     
    254212        oSet.aoTestVms.extend([
    255213            # pylint: disable=C0301
    256             InstallTestVm(oSet, 'tst-fedora4',      'Fedora',           'fedora4-txs.iso',          InstallTestVm.ksIdeController,   8, InstallTestVm.kf32Bit),
    257             InstallTestVm(oSet, 'tst-fedora5',      'Fedora',           'fedora5-txs.iso',          InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApicSmp),
    258             InstallTestVm(oSet, 'tst-fedora6',      'Fedora',           'fedora6-txs.iso',          InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfReqIoApic),
    259             InstallTestVm(oSet, 'tst-fedora7',      'Fedora',           'fedora7-txs.iso',          InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqIoApic),
    260             InstallTestVm(oSet, 'tst-fedora9',      'Fedora',           'fedora9-txs.iso',          InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
    261             InstallTestVm(oSet, 'tst-fedora18-64',  'Fedora_64',        'fedora18-x64-txs.iso',     InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
    262             InstallTestVm(oSet, 'tst-fedora18',     'Fedora',           'fedora18-txs.iso',         InstallTestVm.ksScsiController,  8, InstallTestVm.kf32Bit),
    263             InstallTestVm(oSet, 'tst-ols6',         'Oracle',           'ols6-i386-txs.iso',        InstallTestVm.ksSataController, 12, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
    264             InstallTestVm(oSet, 'tst-ols6-64',      'Oracle_64',        'ols6-x86_64-txs.iso',      InstallTestVm.ksSataController, 12, InstallTestVm.kf64Bit),
    265             InstallTestVm(oSet, 'tst-rhel5',        'RedHat',           'rhel5-txs.iso',            InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApic),
    266             InstallTestVm(oSet, 'tst-suse102',      'OpenSUSE',         'opensuse102-txs.iso',      InstallTestVm.ksIdeController,   8, InstallTestVm.kf32Bit | InstallTestVm.kfReqIoApic),
    267             ## @todo InstallTestVm(oSet, 'tst-ubuntu606',    'Ubuntu',           'ubuntu606-txs.iso',        InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
    268             ## @todo InstallTestVm(oSet, 'tst-ubuntu710',    'Ubuntu',           'ubuntu710-txs.iso',        InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
    269             InstallTestVm(oSet, 'tst-ubuntu804',    'Ubuntu',           'ubuntu804-txs.iso',        InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApic),
    270             InstallTestVm(oSet, 'tst-ubuntu804-64', 'Ubuntu_64',        'ubuntu804-amd64-txs.iso',  InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
    271             InstallTestVm(oSet, 'tst-ubuntu904',    'Ubuntu',           'ubuntu904-txs.iso',        InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae),
    272             InstallTestVm(oSet, 'tst-ubuntu904-64', 'Ubuntu_64',        'ubuntu904-amd64-txs.iso',  InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
    273             #InstallTestVm(oSet, 'tst-ubuntu1404',   'Ubuntu',           'ubuntu1404-txs.iso',       InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae), bird: Is 14.04 one of the 'older ones'?
    274             InstallTestVm(oSet, 'tst-ubuntu1404',   'Ubuntu',           'ubuntu1404-txs.iso',       InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
    275             InstallTestVm(oSet, 'tst-ubuntu1404-64','Ubuntu_64',        'ubuntu1404-amd64-txs.iso', InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
    276             InstallTestVm(oSet, 'tst-debian7',      'Debian',           'debian-7.0.0-txs.iso',     InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
    277             InstallTestVm(oSet, 'tst-debian7-64',   'Debian_64',        'debian-7.0.0-x64-txs.iso', InstallTestVm.ksScsiController,  8, InstallTestVm.kf64Bit),
    278             InstallTestVm(oSet, 'tst-vista-64',     'WindowsVista_64',  'vista-x64-txs.iso',        InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
    279             InstallTestVm(oSet, 'tst-vista-32',     'WindowsVista',     'vista-x86-txs.iso',        InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
    280             InstallTestVm(oSet, 'tst-w7-64',        'Windows7_64',      'win7-x64-txs.iso',         InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
    281             InstallTestVm(oSet, 'tst-w7-32',        'Windows7',         'win7-x86-txs.iso',         InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
    282             InstallTestVm(oSet, 'tst-w2k3',         'Windows2003',      'win2k3ent-txs.iso',        InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit),
    283             InstallTestVm(oSet, 'tst-w2k',          'Windows2000',      'win2ksp0-txs.iso',         InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit | InstallTestVm.kfIdeIrqDelay),
    284             InstallTestVm(oSet, 'tst-w2ksp4',       'Windows2000',      'win2ksp4-txs.iso',         InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit | InstallTestVm.kfIdeIrqDelay),
    285             InstallTestVm(oSet, 'tst-wxp',          'WindowsXP',        'winxppro-txs.iso',         InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit),
    286             InstallTestVm(oSet, 'tst-wxpsp2',       'WindowsXP',        'winxpsp2-txs.iso',         InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit),
    287             InstallTestVm(oSet, 'tst-wxp64',        'WindowsXP_64',     'winxp64-txs.iso',          InstallTestVm.ksIdeController,  25, InstallTestVm.kf64Bit),
    288             ## @todo disable paravirt for Windows 8.1 guests as long as it's not fixed in the code
    289             InstallTestVm(oSet, 'tst-w81-32',       'Windows81',        'win81-x86-txs.iso',        InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
    290             InstallTestVm(oSet, 'tst-w81-64',       'Windows81_64',     'win81-x64-txs.iso',        InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
    291             InstallTestVm(oSet, 'tst-w10-32',       'Windows10',        'win10-x86-txs.iso',        InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
    292             InstallTestVm(oSet, 'tst-w10-64',       'Windows10_64',     'win10-x64-txs.iso',        InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
     214            UnattendedVm(oSet, 'tst-w7-32', 'Windows7', 'en_windows_7_enterprise_x86_dvd_x15-70745.iso'),
    293215            # pylint: enable=C0301
    294216        ]);
    295217        self.oTestVmSet = oSet;
    296218
    297 
     219        # For option parsing:
     220        self.aoSelectedVms = oSet.aoTestVms # type: list(UnattendedVm)
     221
     222        # Number of VMs to test in parallel:
     223        self.cInParallel = 1;
    298224
    299225    #
     
    307233        rc = vbox.TestDriver.showUsage(self)
    308234        reporter.log('');
    309         reporter.log('tdGuestOsInstTest1 options:');
    310         reporter.log('  --ioapic, --no-ioapic');
    311         reporter.log('      Enable or disable the I/O apic.');
    312         reporter.log('      Default: --ioapic');
    313         reporter.log('  --pae, --no-pae');
    314         reporter.log('      Enable or disable PAE support for 32-bit guests.');
    315         reporter.log('      Default: Guest dependent.');
    316         reporter.log('  --ram-adjust <MBs>')
     235        reporter.log('tdGuestOsUnattendedInst1 options:');
     236        reporter.log('  --parallel <num>');
     237        reporter.log('      Number of VMs to test in parallel.');
     238        reporter.log('      Default: 1');
     239        reporter.log('');
     240        reporter.log('  Options for working on selected test VMs:');
     241        reporter.log('  --select <vm1[:vm2[:..]]>');
     242        reporter.log('      Selects a test VM for the following configuration alterations.');
     243        reporter.log('      Default: All possible test VMs');
     244        reporter.log('  --copy <old-vm>=<new-vm>');
     245        reporter.log('      Creates and selects <new-vm> as a copy of <old-vm>.');
     246        reporter.log('  --guest-type <guest-os-type>');
     247        reporter.log('      Sets the guest-os type of the currently selected test VM.');
     248        reporter.log('  --install-iso <ISO file name>');
     249        reporter.log('      Sets ISO image to use for the selected test VM.');
     250        reporter.log('  --ram-adjust <MBs>');
    317251        reporter.log('      Adjust the VM ram size by the given delta.  Both negative and positive');
    318252        reporter.log('      values are accepted.');
    319         reporter.log('  --set-extradata <key>:value')
    320         reporter.log('      Set VM extra data. This command line option might be used multiple times.')
    321         reporter.log('obsolete:');
    322         reporter.log('  --nested-paging, --no-nested-paging');
    323         reporter.log('  --raw-mode');
    324         reporter.log('  --cpus <# CPUs>');
    325         reporter.log('  --install-iso <ISO file name>');
    326 
     253        reporter.log('  --max-cpus <# CPUs>');
     254        reporter.log('      Sets the maximum number of guest CPUs for the selected VM.');
     255        reporter.log('  --set-extradata <key>:value');
     256        reporter.log('      Set VM extra data for the selected VM. Can be repeated.');
     257        reporter.log('  --ioapic, --no-ioapic');
     258        reporter.log('      Enable or disable the I/O apic for the selected VM.');
     259        reporter.log('  --pae, --no-pae');
     260        reporter.log('      Enable or disable PAE support (32-bit guests only) for the selected VM.');
    327261        return rc
    328262
     
    332266        """
    333267
    334         if False is True:
    335             pass;
    336         elif asArgs[iArg] == '--ioapic':
    337             for oTestVm in self.oTestVmSet.aoTestVms:
    338                 oTestVm.fIoApic = True;
    339         elif asArgs[iArg] == '--no-ioapic':
    340             for oTestVm in self.oTestVmSet.aoTestVms:
    341                 oTestVm.fIoApic = False;
    342         elif asArgs[iArg] == '--pae':
    343             for oTestVm in self.oTestVmSet.aoTestVms:
    344                 oTestVm.fPae = True;
    345         elif asArgs[iArg] == '--no-pae':
    346             for oTestVm in self.oTestVmSet.aoTestVms:
    347                 oTestVm.fPae = False;
     268        if asArgs[iArg] == '--parallel':
     269            iArg = self.requireMoreArgs(1, asArgs, iArg);
     270            self.cInParallel = int(asArgs[iArg]);
     271            if self.cInParallel <= 0:
     272                self.cInParallel = 1;
     273        elif asArgs[iArg] == '--select':
     274            iArg = self.requireMoreArgs(1, asArgs, iArg);
     275            self.aoSelectedVms = [];
     276            for sTestVm in asArgs[iArg].split(':'):
     277                oTestVm = self.oTestVmSet.findTestVmByName(sTestVm);
     278                if not oTestVm:
     279                    raise base.InvalidOption('Unknown test VM: %s'  % (sTestVm,));
     280                self.aoSelectedVms.append(oTestVm);
     281        elif asArgs[iArg] == '--copy':
     282            iArg = self.requireMoreArgs(1, asArgs, iArg);
     283            asNames = asArgs[iArg].split('=');
     284            if len(asNames) != 2 or len(asNames[0]) == 0 or len(asNames[1]) == 0:
     285                raise base.InvalidOption('The --copy option expects value on the form "old=new": %s'  % (asArgs[iArg],));
     286            oOldTestVm = self.oTestVmSet.findTestVmByName(asNames[0]);
     287            if not oOldTestVm:
     288                raise base.InvalidOption('Unknown test VM: %s'  % (asNames[0],));
     289            oNewTestVm = copy.deepcopy(oOldTestVm);
     290            oNewTestVm.sVmName = asNames[1];
     291            self.oTestVmSet.aoTestVms.append(oNewTestVm);
     292            self.aoSelectedVms = [oNewTestVm];
     293        elif asArgs[iArg] == '--guest-type':
     294            iArg = self.requireMoreArgs(1, asArgs, iArg);
     295            for oTestVm in self.aoSelectedVms:
     296                oTestVm.sKind = asArgs[iArg];
     297        elif asArgs[iArg] == '--install-iso':
     298            iArg = self.requireMoreArgs(1, asArgs, iArg);
     299            for oTestVm in self.aoSelectedVms:
     300                oTestVm.sInstallIso = asArgs[iArg];
    348301        elif asArgs[iArg] == '--ram-adjust':
    349302            iArg = self.requireMoreArgs(1, asArgs, iArg);
    350             for oTestVm in self.oTestVmSet.aoTestVms:
     303            for oTestVm in self.aoSelectedVms:
    351304                oTestVm.iOptRamAdjust = int(asArgs[iArg]);
     305        elif asArgs[iArg] == '--max-cpus':
     306            iArg = self.requireMoreArgs(1, asArgs, iArg);
     307            for oTestVm in self.aoSelectedVms:
     308                oTestVm.iOptMaxCpus = int(asArgs[iArg]);
    352309        elif asArgs[iArg] == '--set-extradata':
    353310            iArg = self.requireMoreArgs(1, asArgs, iArg)
    354             for oTestVm in self.oTestVmSet.aoTestVms:
    355                 oTestVm.asExtraData.append(asArgs[iArg]);
    356 
    357         # legacy, to be removed once TM is reconfigured.
    358         elif asArgs[iArg] == '--install-iso':
    359             self.legacyOptions();
    360             iArg = self.requireMoreArgs(1, asArgs, iArg);
    361             for oTestVm in self.oTestVmSet.aoTestVms:
    362                 oTestVm.fSkip = os.path.basename(oTestVm.sDvdImage) != asArgs[iArg];
    363         elif asArgs[iArg] == '--cpus':
    364             self.legacyOptions();
    365             iArg = self.requireMoreArgs(1, asArgs, iArg);
    366             self.oTestVmSet.acCpus = [ int(asArgs[iArg]), ];
    367         elif asArgs[iArg] == '--raw-mode':
    368             self.legacyOptions();
    369             self.oTestVmSet.asVirtModes = [ 'raw', ];
    370         elif asArgs[iArg] == '--nested-paging':
    371             self.legacyOptions();
    372             self.oTestVmSet.asVirtModes = [ 'hwvirt-np', ];
    373         elif asArgs[iArg] == '--no-nested-paging':
    374             self.legacyOptions();
    375             self.oTestVmSet.asVirtModes = [ 'hwvirt', ];
     311            for oTestVm in self.aoSelectedVms:
     312                oTestVm.asOptExtraData.append(asArgs[iArg]);
     313        elif asArgs[iArg] == '--ioapic':
     314            for oTestVm in self.aoSelectedVms:
     315                oTestVm.fOptIoApic = True;
     316        elif asArgs[iArg] == '--no-ioapic':
     317            for oTestVm in self.aoSelectedVms:
     318                oTestVm.fOptIoApic = False;
     319        elif asArgs[iArg] == '--pae':
     320            for oTestVm in self.aoSelectedVms:
     321                oTestVm.fOptPae = True;
     322        elif asArgs[iArg] == '--no-pae':
     323            for oTestVm in self.aoSelectedVms:
     324                oTestVm.fOptPae = False;
    376325        else:
    377             return vbox.TestDriver.parseOption(self, asArgs, iArg)
    378 
    379         return iArg + 1
    380 
    381     def legacyOptions(self):
    382         """ Enables legacy option mode. """
    383         if not self.fLegacyOptions:
    384             self.fLegacyOptions = True;
    385             self.oTestVmSet.asVirtModes = [ 'hwvirt', ];
    386             self.oTestVmSet.acCpus      = [ 1, ];
    387         return True;
     326            return vbox.TestDriver.parseOption(self, asArgs, iArg);
     327        return iArg + 1;
    388328
    389329    def actionConfig(self):
Note: See TracChangeset for help on using the changeset viewer.

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