cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# -*- coding: utf-8 -*-
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox Validation Kit - Guest OS installation tests.
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# Only the main script needs to modify the path.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncg_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Validation Kit imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Installation test VM. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## @name The primary controller, to which the disk will be attached.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## @name VM option flags (OR together).
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## IRQ delay extra data config for win2k VMs.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync kasIdeIrqDelay = [ 'VBoxInternal/Devices/piix3ide/0/Config/IRQDelay:1', ];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## Install ISO path relative to the testrsrc root.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def __init__(self, oSet, sVmName, sKind, sInstallIso, sHdCtrlNm, cGbHdd, fFlags):
dafe301ef1f0570931a0cfbdae10556163d54ac3vboxsync vboxtestvms.TestVm.__init__(self, oSet, sVmName, sKind = sKind, sHddControllerType = sHdCtrlNm,
6943863c190e951f08adf261d420e888375052c0vboxsync fRandomPvPMode = (fFlags & self.kfNoWin81Paravirt) == 0);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.sDvdImage = os.path.join(self.ksIsoPathBase, sInstallIso);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if fFlags & (self.kfReqIoApic | self.kfReqIoApicSmp):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Detaches and deletes the HD.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns success indicator, error info logged.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oVM is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (fRc, oHd) = oSession.detachHd(self.sHddControllerType, iPort = 0, iDevice = 0);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oTestDrv.oVBox.deleteHdByMedium(oHd);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.saveSettings(); # Necessary for media reg?
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode=None):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Do the standard reconfig in the base class first, it'll figure out
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # if we can run the VM as requested.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (fRc, oVM) = vboxtestvms.TestVm.getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Make sure there is no HD from the previous run attached nor taking
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # up storage on the host.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Check for ubuntu installer vs. AMD host CPU.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if fRc is True and (self.fInstVmFlags & self.kfUbuntuNewAmdBug):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if self.isHostCpuAffectedByUbuntuNewAmdBug(oTestDrv):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return (None, None); # (skip)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Make adjustments to the default config, and adding a fresh HD.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if self.sHddControllerType == self.ksSataController:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setStorageControllerType(vboxcon.StorageControllerType_IntelAhci,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setStorageControllerPortCount(self.sHddControllerType, 1)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sHddPath = os.path.join(os.path.dirname(oVM.settingsFilePath),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync '%s-%s-%s.vdi' % (self.sVmName, sVirtMode, cCpus,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Set proper boot order
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_DVD)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Adjust memory if requested.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setRamSize(oSession.o.machine.memorySize + self.iOptRamAdjust);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Set extra data
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('Invalid extradata specified: %s' % sExtraData)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('Set extradata: %s => %s' % (sKey, sValue))
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Other variations?
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Save the settings.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def isHostCpuAffectedByUbuntuNewAmdBug(self, oTestDrv):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Checks if the host OS is affected by older ubuntu installers being very
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync picky about which families of AMD CPUs it would run on.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync The installer checks for family 15, later 16, later 20, and in 11.10
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync they remove the family check for AMD CPUs.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (uMaxExt, _, _, _) = oTestDrv.oVBox.host.getProcessorCPUIDLeaf(0, 0x80000000, 0);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync (uFamilyModel, _, _, _) = oTestDrv.oVBox.host.getProcessorCPUIDLeaf(0, 0x80000001, 0);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## @todo Break this down into which old ubuntu release supports exactly
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## which AMD family, if we care.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('Skipping "%s" because host CPU is a family %u AMD, which may cause trouble for the guest OS installer.'
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Guest OS installation tests.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync - Create new VM that corresponds specified installation ISO image.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync - Create HDD that corresponds to OS type that will be installed.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync - Boot VM from ISO image (i.e. install guest OS).
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync - Wait for incomming TCP connection (guest should initiate such a
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync connection in case installation has been completed successfully).
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Reinitialize child class instance.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Our install test VM set.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSet = vboxtestvms.TestVmSet(self.oTestVmManager, fIgnoreSkippedVm = True);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # pylint: disable=C0301
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-fedora4', 'Fedora', 'fedora4-txs.iso', InstallTestVm.ksIdeController, 8, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-fedora5', 'Fedora', 'fedora5-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApicSmp),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-fedora6', 'Fedora', 'fedora6-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqIoApic),
455a01392c80ad663ad5337713754940b113b0a7vboxsync InstallTestVm(oSet, 'tst-fedora7', 'Fedora', 'fedora7-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqIoApic),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-fedora9', 'Fedora', 'fedora9-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-fedora18-64', 'Fedora_64', 'fedora18-x64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-fedora18', 'Fedora', 'fedora18-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-ols6', 'Oracle', 'ols6-i386-txs.iso', InstallTestVm.ksSataController, 12, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-ols6-64', 'Oracle_64', 'ols6-x86_64-txs.iso', InstallTestVm.ksSataController, 12, InstallTestVm.kf64Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-rhel5', 'RedHat', 'rhel5-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApic),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-suse102', 'OpenSUSE', 'opensuse102-txs.iso', InstallTestVm.ksIdeController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqIoApic),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## @todo InstallTestVm(oSet, 'tst-ubuntu606', 'Ubuntu', 'ubuntu606-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## @todo InstallTestVm(oSet, 'tst-ubuntu710', 'Ubuntu', 'ubuntu710-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-ubuntu804', 'Ubuntu', 'ubuntu804-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApic),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-ubuntu804-64', 'Ubuntu_64', 'ubuntu804-amd64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-ubuntu904', 'Ubuntu', 'ubuntu904-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-ubuntu904-64', 'Ubuntu_64', 'ubuntu904-amd64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
3daed950597e4ad86ca38b69143be9ccfbc98623vboxsync #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'?
3daed950597e4ad86ca38b69143be9ccfbc98623vboxsync InstallTestVm(oSet, 'tst-ubuntu1404', 'Ubuntu', 'ubuntu1404-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
05c797375242f4095ab04bdedb86de02d428782fvboxsync InstallTestVm(oSet, 'tst-ubuntu1404-64','Ubuntu_64', 'ubuntu1404-amd64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-debian7', 'Debian', 'debian-7.0.0-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-debian7-64', 'Debian_64', 'debian-7.0.0-x64-txs.iso', InstallTestVm.ksSataController, 8, InstallTestVm.kf64Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-w7-64', 'Windows7_64', 'win7-x64-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
11934657a00c86ea151d16dfca74cd928c717871vboxsync InstallTestVm(oSet, 'tst-w7-32', 'Windows7', 'win7-x86-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-w2k3', 'Windows2003', 'win2k3ent-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-w2k', 'Windows2000', 'win2ksp0-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit | InstallTestVm.kfIdeIrqDelay),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-w2ksp4', 'Windows2000', 'win2ksp4-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit | InstallTestVm.kfIdeIrqDelay),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-wxp', 'WindowsXP', 'winxppro-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-wxpsp2', 'WindowsXP', 'winxpsp2-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf32Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync InstallTestVm(oSet, 'tst-wxp64', 'WindowsXP_64', 'winxp64-txs.iso', InstallTestVm.ksIdeController, 25, InstallTestVm.kf64Bit),
dafe301ef1f0570931a0cfbdae10556163d54ac3vboxsync ## @todo disable paravirt for Windows 8.1 guests as long as it's not fixed in the code
ac6e97abf8de101792be6d8ae2aba0f362dd3b4fvboxsync InstallTestVm(oSet, 'tst-w81-32', 'Windows81', 'win81-x86-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
ac6e97abf8de101792be6d8ae2aba0f362dd3b4fvboxsync InstallTestVm(oSet, 'tst-w81-64', 'Windows81_64', 'win81-x64-txs.iso', InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # pylint: enable=C0301
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Overridden methods.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Extend usage info
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Enable or disable PAE support for 32-bit guests.');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Adjust the VM ram size by the given delta. Both negative and positive');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Set VM extra data. This command line option might be used multiple times.')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' --nested-paging, --no-nested-paging');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Extend standard options set
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # legacy, to be removed once TM is reconfigured.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oTestVm.fSkip = os.path.basename(oTestVm.sDvdImage) != asArgs[iArg];
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return vbox.TestDriver.parseOption(self, asArgs, iArg)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Enables legacy option mode. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not self.importVBoxApi(): # So we can use the constant below.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return self.oTestVmSet.actionConfig(self, eNic0AttachType = vboxcon.NetworkAttachmentType_NAT);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Execute the testcase.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return self.oTestVmSet.actionExecute(self, self.testOneVmConfig)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Install guest OS and wait for result
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testStart('Installing %s' % (oTestVm.sVmName,))
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oSession, _ = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # The guest has connected to TXS, so we're done (for now anyways).
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ## @todo Do save + restore.