Ejemplo n.º 1
0
    def testOneCfg(self, oVM, oTestVm):
        """
        Runs the specified VM thru the tests.

        Returns a success indicator on the general test execution. This is not
        the actual test result.
        """
        fRc = False

        sXmlFile = self.prepareResultFile()
        asEnv = ['IPRT_TEST_FILE=' + sXmlFile]

        self.logVmInfo(oVM)
        oSession = self.startVm(oVM, sName=oTestVm.sVmName, asEnv=asEnv)
        if oSession is not None:
            cMsTimeout = 15 * 60 * 1000
            if not reporter.isLocal(
            ):  ## @todo need to figure a better way of handling timeouts on the testboxes ...
                cMsTimeout = self.adjustTimeoutMs(180 * 60000)

            oRc = self.waitForTasks(cMsTimeout)
            if oRc == oSession:
                fRc = oSession.assertPoweredOff()
            else:
                reporter.error('oRc=%s, expected %s' % (oRc, oSession))

            reporter.addSubXmlFile(sXmlFile)
            self.terminateVmBySession(oSession)
        return fRc
    def testOneVmConfig(self, oVM, oTestVm):
        """
        Install guest OS and wait for result
        """

        self.logVmInfo(oVM)
        reporter.testStart('Installing %s' % (oTestVm.sVmName,))

        cMsTimeout = 40*60000;
        if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
            cMsTimeout = 180 * 60000; # will be adjusted down.

        oSession, _ = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
        if oSession is not None:
            # The guest has connected to TXS, so we're done (for now anyways).
            reporter.log('Guest reported success')
            ## @todo Do save + restore.

            reporter.testDone()
            fRc = self.terminateVmBySession(oSession)
            return fRc is True

        reporter.error('Installation of %s has failed' % (oTestVm.sVmName,))
        oTestVm.detatchAndDeleteHd(self); # Save space.
        reporter.testDone()
        return False
Ejemplo n.º 3
0
    def testOneVmConfig(self, oVM, oTestVm):
        """
        Install guest OS and wait for result
        """

        self.logVmInfo(oVM)
        reporter.testStart('Installing %s' % (oTestVm.sVmName, ))

        cMsTimeout = 40 * 60000
        if not reporter.isLocal(
        ):  ## @todo need to figure a better way of handling timeouts on the testboxes ...
            cMsTimeout = 180 * 60000
            # will be adjusted down.

        oSession, _ = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName,
                                                        fCdWait=False,
                                                        cMsTimeout=cMsTimeout)
        if oSession is not None:
            # The guest has connected to TXS, so we're done (for now anyways).
            reporter.log('Guest reported success')
            ## @todo Do save + restore.

            reporter.testDone()
            fRc = self.terminateVmBySession(oSession)
            return fRc is True

        reporter.error('Installation of %s has failed' % (oTestVm.sVmName, ))
        oTestVm.detatchAndDeleteHd(self)
        # Save space.
        reporter.testDone()
        return False
Ejemplo n.º 4
0
    def testDoInstallGuestOs(self):
        """
        Install guest OS and wait for result
        """

        self.logVmInfo(self.oVM)
        reporter.testStart('Installing %s' % (os.path.basename(self.sIso), ))

        cMsTimeout = 40 * 60000
        if not reporter.isLocal(
        ):  ## @todo need to figure a better way of handling timeouts on the testboxes ...
            cMsTimeout = 180 * 60000
            # will be adjusted down.

        oSession, _ = self.startVmAndConnectToTxsViaTcp(self.sVmName,
                                                        fCdWait=False,
                                                        cMsTimeout=cMsTimeout)
        if oSession is not None:
            # Wait until guest reported success
            reporter.log('Guest reported success')
            reporter.testDone()
            fRc = self.terminateVmBySession(oSession)
            return fRc is True
        reporter.error('Installation of %s has failed' % (self.sIso, ))
        reporter.testDone()
        return False
Ejemplo n.º 5
0
    def testOneCfg(self, oVM, oTestVm):
        """
        Runs the specified VM thru the tests.

        Returns a success indicator on the general test execution. This is not
        the actual test result.
        """
        fRc = False;

        sXmlFile = self.prepareResultFile();
        asEnv = [ 'IPRT_TEST_FILE=' + sXmlFile];

        self.logVmInfo(oVM);
        oSession = self.startVm(oVM, sName = oTestVm.sVmName, asEnv = asEnv);
        if oSession is not None:
            self.addTask(oSession);

            cMsTimeout = 15*60*1000;
            if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
                cMsTimeout = self.adjustTimeoutMs(180 * 60000);

            oRc = self.waitForTasks(cMsTimeout);
            self.removeTask(oSession);
            if oRc == oSession:
                fRc = oSession.assertPoweredOff();
            else:
                reporter.error('oRc=%s, expected %s' % (oRc, oSession));

            reporter.addSubXmlFile(sXmlFile);
            self.terminateVmBySession(oSession);
        return fRc;
Ejemplo n.º 6
0
    def testOneVmConfig(self, oVM, oTestVm): # type: (Any, UnattendedVm) -> bool
        """
        Install guest OS and wait for result
        """

        self.logVmInfo(oVM)
        reporter.testStart('Installing %s%s' % (oTestVm.sVmName, ' with GAs' if oTestVm.fOptInstallAdditions else ''))

        cMsTimeout = 40*60000;
        if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
            cMsTimeout = 180 * 60000; # will be adjusted down.

        oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
        #oSession = self.startVmByName(oTestVm.sVmName); # (for quickly testing waitForGAs)
        if oSession is not None:
            # The guest has connected to TXS.
            reporter.log('Guest reported success via TXS.');
            reporter.testDone();

            fRc = True;
            # Kudge: GAs doesn't come up correctly, so we have to reboot the guest first:
            #        Looks like VBoxService isn't there.
            if oTestVm.fOptInstallAdditions:
                reporter.testStart('Rebooting');
                fRc, oTxsSession = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession);
                reporter.testDone();

            # If we're installing GAs, wait for them to come online:
            if oTestVm.fOptInstallAdditions and fRc is True:
                reporter.testStart('Guest additions');
                aenmRunLevels = [vboxcon.AdditionsRunLevelType_Userland,];
                if oTestVm.isLoggedOntoDesktop():
                    aenmRunLevels.append(vboxcon.AdditionsRunLevelType_Desktop);
                fRc = self.waitForGAs(oSession, cMsTimeout = cMsTimeout / 2, aenmWaitForRunLevels = aenmRunLevels,
                                      aenmWaitForActive = (vboxcon.AdditionsFacilityType_VBoxGuestDriver,
                                                           vboxcon.AdditionsFacilityType_VBoxService,));
                reporter.testDone();

            # Now do a save & restore test:
            if fRc is True and self.fTestSaveAndRestore:
                fRc, oSession, oTxsSession = self.testSaveAndRestore(oSession, oTxsSession, oTestVm);

            # Test GAs if requested:
            if oTestVm.fOptInstallAdditions and fRc is True:
                for oSubTstDrv in self.aoSubTstDrvs:
                    if oSubTstDrv.fEnabled:
                        reporter.testStart(oSubTstDrv.sTestName);
                        fRc2, oTxsSession = oSubTstDrv.testIt(oTestVm, oSession, oTxsSession);
                        reporter.testDone(fRc2 is None);
                        if fRc2 is False:
                            fRc = False;

            if oSession is not None:
                fRc = self.terminateVmBySession(oSession) and fRc;
            return fRc is True

        reporter.error('Installation of %s has failed' % (oTestVm.sVmName,))
        #oTestVm.detatchAndDeleteHd(self); # Save space.
        reporter.testDone()
        return False
    def testDoInstallGuestOs(self):
        """
        Install guest OS and wait for result
        """
        reporter.testStart('Installing %s' % (os.path.basename(self.sIso),))

        cMsTimeout = 40*60000;
        if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
            cMsTimeout = 180 * 60000; # will be adjusted down.

        oSession, _ = self.startVmAndConnectToTxsViaTcp(self.sVmName, fCdWait = False, cMsTimeout = cMsTimeout)
        if oSession is not None:
            # Wait until guest reported success
            reporter.log('Guest reported success')
            reporter.testDone()
            fRc = self.terminateVmBySession(oSession)
            return fRc is True
        reporter.error('Installation of %s has failed' % (self.sIso,))
        reporter.testDone()
        return False
Ejemplo n.º 8
0
    def testOneCfg(self, oVM, oTestVm):
        """
        Runs the specified VM thru the tests.

        Returns a success indicator on the general test execution. This is not
        the actual test result.
        """
        fRc = False

        #
        # Determin the RAM configurations we want to test.
        #
        cMbMaxGuestRam = self.oVBox.systemProperties.maxGuestRAM
        cMbHostAvail = self.oVBox.host.memoryAvailable
        cMbHostTotal = self.oVBox.host.memorySize
        reporter.log('cMbMaxGuestRam=%s cMbHostAvail=%s cMbHostTotal=%s' % (
            cMbMaxGuestRam,
            cMbHostAvail,
            cMbHostTotal,
        ))

        cMbHostAvail -= cMbHostAvail // 7
        # Rough 14% safety/overhead margin.
        if cMbMaxGuestRam < cMbHostAvail:
            # Currently: 2048 GiB, 1536 GiB, 1024 GiB, 512 GiB, 256 GiB, 128 GiB, 64 GiB, 32 GiB
            acMbRam = [
                cMbMaxGuestRam, cMbMaxGuestRam // 4 * 3, cMbMaxGuestRam // 2,
                cMbMaxGuestRam // 4, cMbMaxGuestRam // 8, cMbMaxGuestRam // 16
            ]
            if acMbRam[-1] > 64 * 1024:
                acMbRam.append(64 * 1024)
            if acMbRam[-1] > 32 * 1024:
                acMbRam.append(32 * 1024)
        elif cMbHostAvail > 8 * 1024:
            # First entry is available memory rounded down to the nearest 8 GiB
            cMbHostAvail = cMbHostAvail & ~(8 * 1024 - 1)
            acMbRam = [
                cMbHostAvail,
            ]

            # The remaining entries are powers of two below that, up to 6 of these stopping at 16 GiB.
            cMb = 8 * 1024
            while cMb < cMbHostAvail:
                cMb *= 2
            while len(acMbRam) < 7 and cMb > 16 * 1024:
                cMb //= 2
                acMbRam.append(cMb)
        elif cMbHostAvail >= 16000 and cMbHostAvail > 7168:
            # Desperate attempt at getting some darwin testruns too.  We've got two
            # with 16 GiB and they usually end up with just short of 8GiB of free RAM.
            acMbRam = [
                7168,
            ]
        else:
            reporter.log(
                "Less than 8GB of host RAM available for VMs, skipping test")
            return None
        reporter.log("RAM configurations: %s" % (acMbRam))

        # Large pages only work with nested paging.
        afLargePages = [
            False,
        ]
        try:
            if oVM.getHWVirtExProperty(
                    vboxcon.HWVirtExPropertyType_NestedPaging):
                afLargePages = [True, False]
        except:
            return reporter.errorXcpt(
                "Failed to get HWVirtExPropertyType_NestedPaging")

        #
        # Test the RAM configurations.
        #
        for fLargePages in afLargePages:
            sLargePages = 'large pages' if fLargePages is True else 'no large pages'
            for cMbRam in acMbRam:
                reporter.testStart('%s MiB, %s' % (cMbRam, sLargePages))

                # Reconfigure the VM:
                fRc = False
                oSession = self.openSession(oVM)
                if oSession:
                    fRc = oSession.setRamSize(cMbRam)
                    fRc = oSession.setLargePages(fLargePages) and fRc
                    if fRc:
                        fRc = oSession.saveSettings()
                    if not fRc:
                        oSession.discardSettings(True)
                    oSession.close()
                if fRc:
                    # Set up the result file
                    sXmlFile = self.prepareResultFile()
                    asEnv = [
                        'IPRT_TEST_FILE=' + sXmlFile,
                    ]

                    # Do the test:
                    self.logVmInfo(oVM)
                    oSession = self.startVm(oVM,
                                            sName=oTestVm.sVmName,
                                            asEnv=asEnv)
                    if oSession is not None:
                        cMsTimeout = 15 * 60000 + cMbRam // 168
                        if not reporter.isLocal(
                        ):  ## @todo need to figure a better way of handling timeouts on the testboxes ...
                            cMsTimeout = self.adjustTimeoutMs(180 * 60000 +
                                                              cMbRam // 168)

                        oRc = self.waitForTasks(cMsTimeout)
                        if oRc == oSession:
                            fRc = oSession.assertPoweredOff()
                        else:
                            reporter.error('oRc=%s, expected %s' %
                                           (oRc, oSession))

                        reporter.addSubXmlFile(sXmlFile)
                        self.terminateVmBySession(oSession)
                else:
                    reporter.errorXcpt(
                        "Failed to set memory size to %s MiB or setting largePages to %s"
                        % (cMbRam, fLargePages))
                reporter.testDone()

        return fRc