def test1Sub5(self, oVmSrc, oVmDst):
        """
        Test that basic teleporting works.
        xTracker: #4749
        """
        reporter.testStart('Simple teleportation');
        for cSecsX2 in range(0, 10):
            if    self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False) \
              and self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True):
                # Start the target VM.
                oSessionDst, oProgressDst = self.startVmEx(oVmDst, fWait = False);
                if oSessionDst is not None:
                    if oProgressDst.waitForOperation(iOperation = -3) == 0:
                        # Start the source VM.
                        oSessionSrc = self.startVm(oVmSrc);
                        if oSessionSrc is not None:
                            self.sleep(cSecsX2 / 2);
                            # Try teleport.
                            oProgressSrc = oSessionSrc.teleport('localhost', 6502, 'password');
                            if oProgressSrc:
                                oProgressSrc.wait();
                                oProgressDst.wait();

                            self.terminateVmBySession(oSessionSrc, oProgressSrc);
                    self.terminateVmBySession(oSessionDst, oProgressDst);
            else:
                reporter.testFailure('reconfig failed');
        return reporter.testDone()[1] == 0;
    def test1Sub3(self, oVM):
        """
        Test that starting a teleportation target VM will fail if we give it
        a bad address to bind to.
        """
        reporter.testStart('bad IMachine::teleporterAddress');

        # re-configure it with a bad bind-to address.
        fRc = False;
        oSession = self.openSession(oVM);
        if oSession is not None:
            fRc = oSession.setupTeleporter(True, uPort=6502, sAddress='no.such.hostname.should.ever.exist.duh');
            if not oSession.saveSettings(fClose=True): fRc = False;
            oSession = None;
        if fRc:
            # Try start it.
            oSession, oProgress = self.startVmEx(oVM, fWait = False);
            if oSession is not None:
                oProgress.wait();
                ## TODO: exact error code and look for the IPRT right string.
                if not oProgress.isCompleted() or oProgress.getResult() >= 0:
                    reporter.testFailure('%s' % (oProgress.stringifyResult(),));
                self.terminateVmBySession(oSession, oProgress);

            # put back the old teleporter setup.
            self.test1ResetVmConfig(oVM, fTeleporterEnabled = True);
        else:
            reporter.testFailure('reconfig #1 failed');
        return reporter.testDone()[1] == 0;
    def test1(self):
        """
        Executes test #1 - Negative API testing.

        ASSUMES that the VMs are
        """
        reporter.testStart('Test 1');

        # Get the VMs.
        #oVmHwVirt1 = self.getVmByName('tst-empty-hwvirt-1');
        #oVmHwVirt2 = self.getVmByName('tst-empty-hwvirt-2');
        oVmRaw1    = self.getVmByName('tst-empty-raw-1');
        oVmRaw2    = self.getVmByName('tst-empty-raw-2');

        # Reset their teleportation related configuration.
        fRc = True;
        #for oVM in (oVmHwVirt1, oVmHwVirt2, oVmRaw1, oVmRaw2):
        for oVM in (oVmRaw1, oVmRaw2):
            if not self.test1ResetVmConfig(oVM): fRc = False;

        # Do the testing (don't both with fRc on the subtests).
        if fRc:
            self.test1Sub1(oVmRaw1);
            self.test1Sub2(oVmRaw2);
            self.test1Sub3(oVmRaw2);
            self.test1Sub4(oVmRaw2);
            self.processPendingEvents();
            self.test1Sub5(oVmRaw1, oVmRaw2);
            self.test1Sub6(oVmRaw1, oVmRaw2);
            self.test1Sub7(oVmRaw1, oVmRaw2);
        else:
            reporter.testFailure('Failed to reset the VM configs')
        return reporter.testDone()[1] == 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
    def testSnapshotTreeDepth(self):
        """
        Test snapshot tree depth.
        """
        reporter.testStart('snapshotTreeDepth')

        try:
            oVM = self.createTestVM('test-snap', 1, None, 4)
            assert oVM is not None

            # modify the VM config, create and attach empty HDD
            oSession = self.openSession(oVM)
            sHddPath = os.path.join(self.sScratchPath, 'TestSnapEmpty.vdi')
            fRc = True
            fRc = fRc and oSession.createAndAttachHd(sHddPath, cb=1024*1024, sController='SATA Controller', fImmutable=False)
            fRc = fRc and oSession.saveSettings()

            # take 250 snapshots (snapshot tree depth limit)
            for i in range(1, 251):
                fRc = fRc and oSession.takeSnapshot('Snapshot ' + str(i))
            fRc = oSession.close() and fRc

            # unregister and re-register to test loading of settings
            sSettingsFile = oVM.settingsFilePath
            reporter.log('unregistering VM')
            oVM.unregister(vboxcon.CleanupMode_DetachAllReturnNone)
            oVBox = self.oVBoxMgr.getVirtualBox()
            reporter.log('opening VM %s, testing config reading' % (sSettingsFile))
            oVM = oVBox.openMachine(sSettingsFile)

            assert fRc is True
        except:
            reporter.errorXcpt()

        return reporter.testDone()[1] == 0
Example #6
0
    def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor):
        """
        Runs the given benchmark on the test host.
        """
        # Create a basic config
        dCfg = {
            'RecordSize':  '64k',
            'TestsetSize': '100m',
            'QueueDepth':  '32',
            'FilePath': sMountpoint,
            'TargetOs': sTargetOs
        };

        oTst = None;
        if sBenchmark == 'iozone':
            oTst = IozoneTest(oExecutor, dCfg);
        elif sBenchmark == 'fio':
            oTst = FioTest(oExecutor, dCfg); # pylint: disable=R0204

        if oTst is not None:
            reporter.testStart(sBenchmark);
            fRc = oTst.prepare();
            if fRc:
                fRc = oTst.run();
                if fRc:
                    fRc = oTst.reportResult();
                else:
                    reporter.testFailure('Running the testcase failed');
            else:
                reporter.testFailure('Preparing the testcase failed');

        oTst.cleanup();
        reporter.testDone();

        return fRc;
    def getNextTestCfg(self, fSkippedLast = False):
        """
        Returns the next not blacklisted test config or an empty list if
        there is no test left.
        """
        asTestCfgCur = self.getCurrentTestCfg();

        asTestCfg = self.advanceTestCfg();
        while len(asTestCfg) > 0 and self.isTestCfgBlacklisted(asTestCfg):
            asTestCfg = self.advanceTestCfg();

        # Compare the current and next config and close the approriate test
        # categories.
        reporter.testDone(fSkippedLast);
        if len(asTestCfg) > 0:
            idxSame = 0;
            while asTestCfgCur[idxSame] == asTestCfg[idxSame]:
                idxSame += 1;

            for i in range(idxSame, len(asTestCfg) - 1):
                reporter.testDone();

            for i in range(idxSame, len(asTestCfg)):
                reporter.testStart('%s' % (self.getTestIdString(asTestCfg[i], i)));

        else:
            # No more tests, mark all tests as done
            for i in range(0, len(asTestCfgCur) - 1):
                reporter.testDone();

        return asTestCfg;
    def _installVBox(self):
        """
        Download / copy the build files into the scratch area and install them.
        """
        reporter.testStart('Installing VirtualBox');
        reporter.log('CWD=%s' % (os.getcwd(),)); # curious

        #
        # Download the build files.
        #
        for i in range(len(self._asBuildUrls)):
            if webutils.downloadFile(self._asBuildUrls[i], self._asBuildFiles[i],
                                     self.sBuildPath, reporter.log, reporter.log) is not True:
                reporter.testDone(fSkipped = True);
                return None; # Failed to get binaries, probably deleted. Skip the test run.

        #
        # Unpack anything we know what is and append it to the build files
        # list.  This allows us to use VBoxAll*.tar.gz files.
        #
        for sFile in list(self._asBuildFiles):
            if self._maybeUnpackArchive(sFile, fNonFatal = True) is not True:
                reporter.testDone(fSkipped = True);
                return None; # Failed to unpack. Probably local error, like busy
                             # DLLs on windows, no reason for failing the build.

        #
        # Go to system specific installation code.
        #
        sHost = utils.getHostOs()
        if   sHost == 'darwin':     fRc = self._installVBoxOnDarwin();
        elif sHost == 'linux':      fRc = self._installVBoxOnLinux();
        elif sHost == 'solaris':    fRc = self._installVBoxOnSolaris();
        elif sHost == 'win':        fRc = self._installVBoxOnWindows();
        else:
            reporter.error('Unsupported host "%s".' % (sHost,));
        if fRc is False:
            reporter.testFailure('Installation error.');
        elif fRc is not True:
            reporter.log('Seems installation was skipped. Old version lurking behind? Not the fault of this build/test run!');

        #
        # Install the extension pack.
        #
        if fRc is True  and  self._fAutoInstallPuelExtPack:
            fRc = self._installExtPack();
            if fRc is False:
                reporter.testFailure('Extension pack installation error.');

        # Some debugging...
        try:
            cMbFreeSpace = utils.getDiskUsage(self.sScratchPath);
            reporter.log('Disk usage after VBox install: %d MB available at %s' % (cMbFreeSpace, self.sScratchPath,));
        except:
            reporter.logXcpt('Unable to get disk free space. Ignored. Continuing.');

        reporter.testDone(fRc is None);
        return fRc;
 def testAutostartForOneVM(self, sVmName):
     """
     Runs one VM thru the various configurations.
     """
     reporter.testStart(sVmName);
     fRc = True;
     self.testAutostartOneCfg(sVmName);
     reporter.testDone();
     return fRc;
 def test1Sub7(self, oVmSrc, oVmDst):
     """
     Test the password check.
     """
     reporter.testStart('Bad password')
     if    self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False) \
       and self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True):
         # Start the target VM.
         oSessionDst, oProgressDst = self.startVmEx(
             oVmDst, fWait=False)
         if oSessionDst is not None:
             if oProgressDst.waitForOperation(iOperation=-3) == 0:
                 # Start the source VM.
                 oSessionSrc = self.startVm(oVmSrc)
                 if oSessionSrc is not None:
                     tsPasswords = (
                         'password-bad',
                         'passwor',
                         'pass',
                         'p',
                         '',
                         'Password',
                     )
                     for sPassword in tsPasswords:
                         reporter.testStart(sPassword)
                         oProgressSrc = oSessionSrc.teleport(
                             'localhost', 6502, sPassword)
                         if oProgressSrc:
                             oProgressSrc.wait()
                             reporter.log(
                                 'src: %s' % oProgressSrc.stringifyResult())
                             if oProgressSrc.isSuccess():
                                 reporter.testFailure(
                                     'IConsole::teleport succeeded with bad password "%s"'
                                     % sPassword)
                             elif oProgressSrc.getErrInfoResultCode(
                             ) != vbox.ComError.E_FAIL:
                                 reporter.testFailure('IConsole::teleport returns %s instead of E_FAIL' \
                                                      % (vbox.ComError.toString(oProgressSrc.getErrInfoResultCode()),))
                             elif oProgressSrc.getErrInfoText(
                             ) != 'Invalid password':
                                 reporter.testFailure('IConsole::teleport returns "%s" instead of "Invalid password"' \
                                                      % (oProgressSrc.getErrInfoText(),))
                             elif oProgressDst.isCompleted():
                                 reporter.testFailure('Destination completed unexpectedly after bad password "%s"' \
                                                      % sPassword)
                         else:
                             reporter.testFailure(
                                 'IConsole::teleport failed with password "%s"'
                                 % sPassword)
                         if reporter.testDone()[1] != 0:
                             break
                     self.terminateVmBySession(oSessionSrc, oProgressSrc)
             self.terminateVmBySession(oSessionDst, oProgressDst)
     else:
         reporter.testFailure('reconfig failed')
     return reporter.testDone()[1] == 0
    def test1RunTestProgs(self, oSession, oTxsSession, fRc, sTestName):
        """
        Runs all the test programs on the test machine.
        """
        reporter.testStart(sTestName);

        # Prepare test disk, just create filesystem without partition
        reporter.testStart('mkfs.ext4');
        fRc = self.txsRunTest(oTxsSession, 'Create FS', 60000,
                              '/sbin/mkfs.ext4',
                              ('mkfs.ext4', '-F', '/dev/vboxtest'));
        reporter.testDone();

        reporter.testStart('mount');
        fRc = self.txsRunTest(oTxsSession, 'Mount FS', 30000,
                              '/bin/mount',
                              ('mount', '/dev/vboxtest', '/mnt'));
        reporter.testDone();

        reporter.testStart('iozone');
        if fRc and 'iozone' in self.asTests:
            oStdOut = IozoneStdOutWrapper();
            fRc = self.txsRunTestRedirectStd(oTxsSession, '2G', 3600000,
                                             '/usr/bin/iozone',
                                             ('iozone', '-r', '64k', '-s', '2g', '-t', '1', '-T', '-I',
                                              '-H', '32','-F', '/mnt/iozone'),
                                             (), '', '/dev/null', oStdOut, '/dev/null', '/dev/null');
            if fRc is True:
                reporter.log("Initial writer: " + str(oStdOut.getInitWriter()));
                reporter.log("Rewriter:       " + str(oStdOut.getRewriter()));
                reporter.log("Initial reader: " + str(oStdOut.getReader()));
                reporter.log("Re-reader:      " + str(oStdOut.getRereader()));
                reporter.log("Reverse reader: " + str(oStdOut.getReverseReader()));
                reporter.log("Stride reader:  " + str(oStdOut.getStrideReader()));
                reporter.log("Random reader:  " + str(oStdOut.getRandomReader()));
                reporter.log("Mixed Workload: " + str(oStdOut.getMixedWorkload()));
                reporter.log("Random writer:  " + str(oStdOut.getRandomWriter()));
                reporter.log("pwrite Writer:  " + str(oStdOut.getPWrite()));
                reporter.log("pread Reader:   " + str(oStdOut.getPRead()));
            reporter.testDone();
        else:
            reporter.testDone(fSkipped = True);

        reporter.testStart('fio');
        if fRc and 'fio' in self.asTests:
            oFioWrapper = FioWrapper('64k', '2g', '32', '/mnt');
            fRc = self.txsUploadString(oSession, oTxsSession, oFioWrapper.getConfig(), '${SCRATCH}/aio-test');
            fRc = fRc and self.txsRunTestRedirectStd(oTxsSession, '2G', 3600000,
                                                     '/usr/bin/fio', ('fio', '${SCRATCH}/aio-test'),
                                                     (), '', '/dev/null', oFioWrapper, '/dev/null', '/dev/null');
        else:
            reporter.testDone(fSkipped = True);

        reporter.testDone(not fRc);
        return fRc;
    def test1UploadFile(self, oSession, oTxsSession):
        """
        Uploads a test file to the test machine.
        """
        reporter.testStart('Upload file');

        fRc = self.txsUploadString(oSession, oTxsSession, self.sRndData, '${SCRATCH}/' + str(uuid.uuid4()), \
                                   cMsTimeout = 3600 * 1000);

        reporter.testDone(not fRc);
        return fRc;
    def doTest(self, oSession):
        oConsole = oSession.console
        oGuest = oConsole.guest

        sOSTypeId = oGuest.OSTypeId.lower()
        if sOSTypeId.find("win") == -1 :
            reporter.log("Only Windows guests are currently supported")
            reporter.testDone()
            return True

        oGuestSession = oGuest.createSession("Administrator", "password", "", "Audio Validation Kit")
        guestSessionWaitResult = oGuestSession.waitFor(self.oVBoxMgr.constants.GuestSessionWaitResult_Start, 2000)
        reporter.log("guestSessionWaitResult = %d" % guestSessionWaitResult)

        for duration in range(3, 6):
            reporter.testStart("Checking for duration of " + str(duration) + " seconds")
            sPathToPlayer = "D:\\win\\" + ("amd64" if (sOSTypeId.find('_64') >= 0) else "x86") + "\\ntPlayToneWaveX.exe"
            oProcess = oGuestSession.processCreate(sPathToPlayer,  ["xxx0", "--total-duration-in-secs", str(duration)], [], [], 0)
            processWaitResult = oProcess.waitFor(self.oVBoxMgr.constants.ProcessWaitForFlag_Start, 1000)
            reporter.log("Started: pid %d, waitResult %d" % (oProcess.PID, processWaitResult))

            processWaitResult = oProcess.waitFor(self.oVBoxMgr.constants.ProcessWaitForFlag_Terminate, 2 * duration * 1000)
            reporter.log("Terminated: pid %d, waitResult %d" % (oProcess.PID, processWaitResult))
            time.sleep(1) # Give audio backend sometime to save a stream to .wav file

            absFileName = self.seekLatestAudioFileName(oGuestSession, duration)

            if absFileName is None:
                reporter.testFailure("Unable to find audio file")
                continue

            reporter.log("Checking audio file '" + absFileName + "'")

            diff = self.checkGuestHostTimings(absFileName + ".timing")
            if diff is not None:
                if diff > 0.0:      # Guest sends data quicker than a host can play
                    if diff > 0.01: # 1% is probably good threshold here
                        reporter.testFailure("Guest sends audio buffers too quickly")
                else:
                    diff = -diff;   # Much worse case: guest sends data very slow, host feels starvation
                    if diff > 0.005: # 0.5% is probably good threshold here
                        reporter.testFailure("Guest sends audio buffers too slowly")

                reporter.testDone()
            else:
                reporter.testFailure("Unable to parse a file with timings")

        oGuestSession.close()

        del oGuest
        del oConsole

        return True
    def test1OneVM(self, sVmName, asSkipNicTypes=(), asSupVirtModes=None, rSupCpus=range(1, 256)):
        """
        Runs one VM thru the various configurations.
        """
        if asSupVirtModes is None:
            asSupVirtModes = self.asVirtModes

        reporter.testStart(sVmName)
        fRc = True
        for sNicType in self.asNicTypes:
            if sNicType in asSkipNicTypes:
                continue
            reporter.testStart(sNicType)

            if sNicType == "E1000":
                eNicType = vboxcon.NetworkAdapterType_I82545EM
            elif sNicType == "PCNet":
                eNicType = vboxcon.NetworkAdapterType_Am79C973
            elif sNicType == "Virtio":
                eNicType = vboxcon.NetworkAdapterType_Virtio
            else:
                eNicType = None

            for cCpus in self.acCpus:
                if cCpus == 1:
                    reporter.testStart("1 cpu")
                else:
                    reporter.testStart("%u cpus" % (cCpus))

                for sVirtMode in self.asVirtModes:
                    if sVirtMode == "raw" and cCpus > 1:
                        continue
                    if cCpus not in rSupCpus:
                        continue
                    if sVirtMode not in asSupVirtModes:
                        continue
                    hsVirtModeDesc = {}
                    hsVirtModeDesc["raw"] = "Raw-mode"
                    hsVirtModeDesc["hwvirt"] = "HwVirt"
                    hsVirtModeDesc["hwvirt-np"] = "NestedPaging"
                    reporter.testStart(hsVirtModeDesc[sVirtMode])

                    fHwVirt = sVirtMode != "raw"
                    fNestedPaging = sVirtMode == "hwvirt-np"
                    fRc = self.test1OneCfg(sVmName, eNicType, cCpus, fHwVirt, fNestedPaging) and fRc and True
                    # pychecker hack.

                    reporter.testDone()
                reporter.testDone()
            reporter.testDone()
        reporter.testDone()
        return fRc
 def test1Sub1DoTeleport(self, oSession, sHostname, uPort, sPassword, cMsMaxDowntime, hrcExpected, sTestName):
     """ Do a bad IConsole::teleport call and check the result."""
     reporter.testStart(sTestName);
     fRc = False;
     try:
         oProgress = oSession.o.console.teleport(sHostname, uPort, sPassword, cMsMaxDowntime);
     except vbox.ComException, oXcpt:
         if vbox.ComError.equal(oXcpt, hrcExpected):
             fRc = True;
         else:
             reporter.testFailure('hresult %s, expected %s' \
                                  % (vbox.ComError.toString(oXcpt.hresult),
                                     vbox.ComError.toString(hrcExpected)));
Example #16
0
    def test1(self):
        """
        Executes test #1 - Negative API testing.

        ASSUMES that the VMs are
        """
        reporter.testStart('Test 1');
        oVM = self.getVmByName('tst-bs-pae');

        for cCpus in self.acCpus:
            if cCpus == 1:  reporter.testStart('1 cpu');
            else:           reporter.testStart('%u cpus' % (cCpus));

            for sVirtMode in self.asVirtModes:
                if sVirtMode == 'raw' and cCpus > 1:
                    continue;

                hsVirtModeDesc = {};
                hsVirtModeDesc['raw']       = 'Raw-mode';
                hsVirtModeDesc['hwvirt']    = 'HwVirt';
                hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
                reporter.testStart(hsVirtModeDesc[sVirtMode]);

                fHwVirt       = sVirtMode != 'raw';
                fNestedPaging = sVirtMode == 'hwvirt-np';
                self.test1OneCfg(oVM, cCpus, fHwVirt, fNestedPaging);

                reporter.testDone();
            reporter.testDone();

        return reporter.testDone()[1] == 0;
Example #17
0
    def test1(self):
        """
        Executes test #1 - Negative API testing.

        ASSUMES that the VMs are
        """
        reporter.testStart("Test 1")
        oVM = self.getVmByName("tst-bs-pae")

        for cCpus in self.acCpus:
            if cCpus == 1:
                reporter.testStart("1 cpu")
            else:
                reporter.testStart("%u cpus" % (cCpus))

            for sVirtMode in self.asVirtModes:
                if sVirtMode == "raw" and cCpus > 1:
                    continue

                hsVirtModeDesc = {}
                hsVirtModeDesc["raw"] = "Raw-mode"
                hsVirtModeDesc["hwvirt"] = "HwVirt"
                hsVirtModeDesc["hwvirt-np"] = "NestedPaging"
                reporter.testStart(hsVirtModeDesc[sVirtMode])

                fHwVirt = sVirtMode != "raw"
                fNestedPaging = sVirtMode == "hwvirt-np"
                self.test1OneCfg(oVM, cCpus, fHwVirt, fNestedPaging)

                reporter.testDone()
            reporter.testDone()

        return reporter.testDone()[1] == 0
    def test2OneVM(self, sVmBaseName, asSupVirtModes = None, rSupCpus = range(1, 256)):
        """
        Runs one VM (a pair really) thru the various configurations.
        """
        if asSupVirtModes is None:
            asSupVirtModes = self.asVirtModes;

        reporter.testStart(sVmBaseName);
        for cCpus in self.acCpus:
            if cCpus == 1:  reporter.testStart('1 cpu');
            else:           reporter.testStart('%u cpus' % (cCpus));

            for sVirtMode in self.asVirtModes:
                if sVirtMode == 'raw' and cCpus > 1:
                    continue;
                if cCpus not in rSupCpus:
                    continue;
                if sVirtMode not in asSupVirtModes:
                    continue;
                hsVirtModeDesc = {};
                hsVirtModeDesc['raw']       = 'Raw-mode';
                hsVirtModeDesc['hwvirt']    = 'HwVirt';
                hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
                reporter.testStart(hsVirtModeDesc[sVirtMode]);

                fHwVirt       = sVirtMode != 'raw';
                fNestedPaging = sVirtMode == 'hwvirt-np';
                self.test2OneCfg(sVmBaseName, cCpus, fHwVirt, fNestedPaging);

                reporter.testDone();
            reporter.testDone();
        return reporter.testDone()[1] == 0;
Example #19
0
    def test1OneVM(self, sVmName, asSkipNicTypes = (), asSupVirtModes = None, rSupCpus = range(1, 256)):
        """
        Runs one VM thru the various configurations.
        """
        if asSupVirtModes is None:
            asSupVirtModes = self.asVirtModes;

        reporter.testStart(sVmName);
        fRc = True;
        for sNicType in self.asNicTypes:
            if sNicType in asSkipNicTypes:
                continue;
            reporter.testStart(sNicType);

            if sNicType == 'E1000':
                eNicType = vboxcon.NetworkAdapterType_I82545EM;
            elif sNicType == 'PCNet':
                eNicType = vboxcon.NetworkAdapterType_Am79C973;
            elif sNicType == 'Virtio':
                eNicType = vboxcon.NetworkAdapterType_Virtio;
            else:
                eNicType = None;

            for cCpus in self.acCpus:
                if cCpus == 1:  reporter.testStart('1 cpu');
                else:           reporter.testStart('%u cpus' % (cCpus));

                for sVirtMode in self.asVirtModes:
                    if sVirtMode == 'raw' and cCpus > 1:
                        continue;
                    if cCpus not in rSupCpus:
                        continue;
                    if sVirtMode not in asSupVirtModes:
                        continue;
                    hsVirtModeDesc = {};
                    hsVirtModeDesc['raw']       = 'Raw-mode';
                    hsVirtModeDesc['hwvirt']    = 'HwVirt';
                    hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
                    reporter.testStart(hsVirtModeDesc[sVirtMode]);

                    fHwVirt       = sVirtMode != 'raw';
                    fNestedPaging = sVirtMode == 'hwvirt-np';
                    fRc = self.test1OneCfg(sVmName, eNicType, cCpus, fHwVirt, fNestedPaging)  and  fRc and True; # pychecker hack.

                    reporter.testDone();
                reporter.testDone();
            reporter.testDone();
        reporter.testDone();
        return fRc;
    def testOneVmConfig(self, oVM, oTestVm):
        """
        Runs the specified VM thru test #1.
        """

        for sUart in self.asUarts:
            reporter.testStart(sUart);
            # Reconfigure the VM
            fRc = True;
            oSession = self.openSession(oVM);
            if oSession is not None:
                fRc = oSession.enableSerialPort(0);

                fRc = fRc and oSession.setExtraData("VBoxInternal/Devices/serial/0/Config/UartType", "string:" + sUart);
                fRc = fRc and oSession.saveSettings();
                fRc = oSession.close() and fRc;
                oSession = None;
            else:
                fRc = False;

            if fRc is True:
                self.logVmInfo(oVM);
                oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = True);
                if oSession is not None:
                    self.addTask(oTxsSession);

                    for sMode in self.asSerialModes:
                        reporter.testStart(sMode);
                        fRc = self.setupSerialMode(oSession, oTestVm, sMode);
                        if fRc:
                            for sTest in self.asSerialTests:
                                # Skip tests which don't work with the current mode.
                                if self.isModeCompatibleWithTest(sMode, sTest):
                                    if sTest == 'Write':
                                        fRc = self.testWrite(oSession, oTxsSession, oTestVm, sMode);
                                    if sTest == 'ReadWrite':
                                        fRc = self.testReadWrite(oSession, oTxsSession, oTestVm);
                            if self.oLoopback is not None:
                                self.oLoopback.shutdown();
                                self.oLoopback = None;

                        reporter.testDone();

                    self.removeTask(oTxsSession);
                    self.terminateVmBySession(oSession);
            reporter.testDone();

        return fRc;
 def test1Sub4(self, oVM):
     """
     Test that we can start and cancel a teleportation target.
     (No source VM trying to connect here.)
     xTracker: #4965
     """
     reporter.testStart('openRemoteSession cancel');
     for cSecsX2 in range(0, 10):
         if self.test1ResetVmConfig(oVM, fTeleporterEnabled = True):
             oSession, oProgress = self.startVmEx(oVM, fWait = False);
             if oSession is not None:
                 self.sleep(cSecsX2 / 2);
                 oProgress.cancel();
                 oProgress.wait();
                 self.terminateVmBySession(oSession, oProgress);
         else:
             reporter.testFailure('reconfig failed');
     return reporter.testDone()[1] == 0;
Example #22
0
    def testInstallAdditions(self, oSession, oTxsSession, oTestVm):
        """
        Tests installing the guest additions
        """
        if oTestVm.isWindows():
            (fRc, oTxsSession) = self.testWindowsInstallAdditions(oSession, oTxsSession, oTestVm)
        else:
            reporter.error(
                "Guest Additions installation not implemented for %s yet! (%s)" % (oTestVm.sKind, oTestVm.sVmName)
            )
            fRc = False

        #
        # Verify installation of Guest Additions using commmon bits.
        #
        if fRc is True:
            #
            # Wait for the GAs to come up.
            #

            ## @todo need to signed up for a OnAdditionsStateChanged and wait runlevel to
            #  at least reach Userland.

            #
            # Check if the additions are operational.
            #
            try:
                oGuest = oSession.o.console.guest
            except:
                reporter.errorXcpt("Getting IGuest failed.")
                return (False, oTxsSession)

            # Check the additionsVersion attribute. It must not be empty.
            reporter.testStart("IGuest::additionsVersion")
            fRc = self.testIGuest_additionsVersion(oGuest)
            reporter.testDone()

            reporter.testStart("IGuest::additionsRunLevel")
            self.testIGuest_additionsRunLevel(oGuest, oTestVm)
            reporter.testDone()

            ## @todo test IAdditionsFacilities.

        return (fRc, oTxsSession)
    def testIt(self):
        """
        Execute the sub-testcase.
        """
        fRc = True;

        # Import a set of simple OVAs.
        # Note! Manifests generated by ovftool 4.0.0 does not include the ovf, while the ones b 4.1.0 does.
        for sOva in (
            # t1 is a plain VM without any disks, ovftool 4.0 export from fusion
            'tdAppliance1-t1.ova',
            # t2 is a plain VM with one disk. Both 4.0 and 4.1.0 exports.
            'tdAppliance1-t2.ova',
            'tdAppliance1-t2-ovftool-4.1.0.ova',
            # t3 is a VM with one gzipped disk and selecting SHA256 on the ovftool cmdline (--compress=9 --shaAlgorithm=sha256).
            'tdAppliance1-t3.ova',
            'tdAppliance1-t3-ovftool-4.1.0.ova',
            # t4 is a VM with with two gzipped disk, SHA256 and a (self) signed manifest (--privateKey=./tdAppliance1-t4.pem).
            'tdAppliance1-t4.ova',
            'tdAppliance1-t4-ovftool-4.1.0.ova',
            # t5 is a VM with with one gzipped disk, SHA1 and a manifest signed by a valid (2016) DigiCert code signing cert.
            'tdAppliance1-t5.ova',
            'tdAppliance1-t5-ovftool-4.1.0.ova',
            # t6 is a VM with with one gzipped disk, SHA1 and a manifest signed by a certificate issued by the t4 certificate,
            # thus it should be impossible to establish a trusted path to a root CA.
            'tdAppliance1-t6.ova',
            'tdAppliance1-t6-ovftool-4.1.0.ova',
            # t7 is based on tdAppliance1-t2-ovftool-4.1.0.ova and has modified to have an invalid InstanceID as well as an
            # extra readme file.  It was tarred up using bsdtar 2.4.12 on windows, so it uses a slightly different tar format and
            # have different file attributes.
            'tdAppliance1-t7-bad-instance.ova',
            ):
            reporter.testStart(sOva);
            try:
                fRc = self.testImportOva(os.path.join(g_ksValidationKitDir, 'tests', 'api', sOva)) and fRc;
                fRc = self.testImportOvaAsOvf(os.path.join(g_ksValidationKitDir, 'tests', 'api', sOva)) and fRc;
            except:
                reporter.errorXcpt();
                fRc = False;
            fRc = reporter.testDone() and fRc;

        ## @todo more stuff
        return fRc;
Example #24
0
    def testEventQueueWaiting(self):
        """
        Test event queue waiting.
        """
        reporter.testStart('waitForEvents');

        # Check return values and such.
        for cMsTimeout in (0, 1, 2, 3, 256, 1000, 0):
            iLoop = 0;
            while True:
                try:
                    rc = self.oVBoxMgr.waitForEvents(cMsTimeout);
                except:
                    reporter.errorXcpt();
                    break;
                if not isinstance(rc, types.IntType):
                    reporter.error('waitForEvents returns non-integer type');
                    break;
                if rc == 1:
                    break;
                if rc != 0:
                    reporter.error('waitForEvents returns "%s", expected 0 or 1' % (rc,));
                    break;
                iLoop += 1;
                if iLoop > 10240:
                    reporter.error('waitForEvents returns 0 (success) %u times. '
                                   'Expected 1 (timeout/interrupt) after a call or two.'
                                   % (iLoop,));
                    break;
            if reporter.testErrorCount() != 0:
                break;

        # Check that we get an exception when trying to call the method from
        # a different thread.
        reporter.log('If running a debug build, you will see an ignored assertion now. Please ignore it.')
        sVBoxAssertSaved = os.environ.get('VBOX_ASSERT', 'breakpoint');
        os.environ['VBOX_ASSERT'] = 'ignore';
        oThread = threading.Thread(target=self.testEventQueueWaitingThreadProc);
        oThread.start();
        oThread.join();
        os.environ['VBOX_ASSERT'] = sVBoxAssertSaved;

        return reporter.testDone()[1] == 0;
    def test1Sub1(self, oVM):
        """ Test simple IConsole::teleport() failure paths. """
        reporter.testStart('IConsole::teleport');
        oSession = self.startVm(oVM);
        if oSession:
            self.test1Sub1DoTeleport(oSession, 'localhost', 65536, 'password', 10000,
                                     vbox.ComError.E_INVALIDARG, 'Bad port value 65536');
            self.test1Sub1DoTeleport(oSession, 'localhost',     0, 'password', 10000,
                                     vbox.ComError.E_INVALIDARG, 'Bad port value 0');
            self.test1Sub1DoTeleport(oSession, 'localhost',  5000, 'password', 0,
                                     vbox.ComError.E_INVALIDARG, 'Bad max downtime');
            self.test1Sub1DoTeleport(oSession, '',           5000, 'password', 10000,
                                     vbox.ComError.E_INVALIDARG, 'No hostname');
            self.test1Sub1DoTeleport(oSession, 'no.such.hostname.should.ever.exist.duh', 5000, 'password', 0,
                                     vbox.ComError.E_INVALIDARG, 'Non-existing host');

            self.terminateVmBySession(oSession)
        else:
            reporter.testFailure('startVm');
        return reporter.testDone()[1] == 0;
    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
    def testMediumTreeDepth(self):
        """
        Test medium tree depth.
        """
        reporter.testStart('mediumTreeDepth')

        try:
            oVM = self.createTestVM('test-medium', 1, None, 4)
            assert oVM is not None

            # create chain with 300 disk images (medium tree depth limit)
            fRc = True
            oSession = self.openSession(oVM)
            for i in range(1, 301):
                sHddPath = os.path.join(self.sScratchPath, 'Test' + str(i) + '.vdi')
                if i is 1:
                    oHd = oSession.createBaseHd(sHddPath, cb=1024*1024)
                else:
                    oHd = oSession.createDiffHd(oHd, sHddPath)
                if oHd is None:
                    fRc = False
                    break

            # modify the VM config, attach HDD
            fRc = fRc and oSession.attachHd(sHddPath, sController='SATA Controller', fImmutable=False, fForceResource=False)
            fRc = fRc and oSession.saveSettings()
            fRc = oSession.close() and fRc

            # unregister and re-register to test loading of settings
            sSettingsFile = oVM.settingsFilePath
            reporter.log('unregistering VM')
            oVM.unregister(vboxcon.CleanupMode_DetachAllReturnNone)
            oVBox = self.oVBoxMgr.getVirtualBox()
            reporter.log('opening VM %s, testing config reading' % (sSettingsFile))
            oVM = oVBox.openMachine(sSettingsFile)

            assert fRc is True
        except:
            reporter.errorXcpt()

        return reporter.testDone()[1] == 0
    def testWrite(self, oSession, oTxsSession, oTestVm, sMode):
        """
        Does a simple write test verifying the output.
        """
        _ = oSession;

        reporter.testStart('Write');
        tupCmdLine = ('SerialTest', '--tests', 'write', '--txbytes', '1048576');
        if self.fVerboseTest:
            tupCmdLine += ('--verbose',);
        if oTestVm.isWindows():
            tupCmdLine += ('--device', r'\\.\COM1',);
        elif oTestVm.isLinux():
            tupCmdLine += ('--device', r'/dev/ttyS0',);

        fRc = self.txsRunTest(oTxsSession, 'SerialTest', 3600 * 1000, \
            '${CDROM}/${OS/ARCH}/SerialTest${EXESUFF}', tupCmdLine);
        if not fRc:
            reporter.testFailure('Running serial test utility failed');
        elif sMode == 'RawFile':
            # Open serial port and verify
            cLast = 0;
            try:
                oFile = open(self.sLocation, 'rb');
                sFmt = '=I';
                cBytes = 4;
                for i in xrange(1048576 // 4):
                    _ = i;
                    sData = oFile.read(cBytes);
                    tupUnpacked = struct.unpack(sFmt, sData);
                    cLast = cLast + 1;
                    if tupUnpacked[0] != cLast:
                        reporter.testFailure('Corruption detected, expected counter value %s, got %s'
                                             % (cLast + 1, tupUnpacked[0]));
                        break;
                oFile.close();
            except:
                reporter.logXcpt();
                reporter.testFailure('Verifying the written data failed');
        reporter.testDone();
        return fRc;
Example #29
0
    def test1(self):
        """
        Executes test #1.
        """

        fRc = True;
        oDiskCfg = self.kdStorageCfgs.get(socket.gethostname().lower());

        # Test the host first if requested
        if oDiskCfg is not None:
            lstBinaryPaths = ['/bin', '/sbin', '/usr/bin', '/usr/sbin', \
                              '/opt/csw/bin', '/usr/ccs/bin', '/usr/sfw/bin'];
            oExecutor = remoteexecutor.RemoteExecutor(None, lstBinaryPaths, self.sScratchPath);
            self.oStorCfg = storagecfg.StorageCfg(oExecutor, utils.getHostOs(), oDiskCfg);

            if self.fTestHost:
                reporter.testStart('Host');
                if self.fUseScratch:
                    sMountPoint = self.sScratchPath;
                else:
                    sMountPoint = self.prepareStorage(self.oStorCfg);
                if sMountPoint is not None:
                    self.testBenchmarks(utils.getHostOs(), sMountPoint, oExecutor);
                    self.cleanupStorage(self.oStorCfg);
                else:
                    reporter.testFailure('Failed to prepare host storage');
                    fRc = False;
                reporter.testDone();
            else:
                # Loop thru the test VMs.
                for sVM in self.asTestVMs:
                    # run test on the VM.
                    if not self.testBenchmarkOneVM(sVM):
                        fRc = False;
                    else:
                        fRc = True;
        else:
            fRc = False;

        return fRc;
    def test1OneVM(self, sVmName):
        """
        Runs one VM thru the various configurations.
        """
        reporter.testStart(sVmName);
        fRc = True;
        for sStorageCtrl in self.asStorageCtrls:
            reporter.testStart(sStorageCtrl);

            if sStorageCtrl == 'AHCI':
                eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
            elif sStorageCtrl == 'IDE':
                eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
            elif sStorageCtrl == 'LsiLogicSAS':
                eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
            elif sStorageCtrl == 'LsiLogic':
                eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
            elif sStorageCtrl == 'BusLogic':
                eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
            else:
                eStorageCtrl = None;

            for sDiskFormat in self.asDiskFormats:
                reporter.testStart('%s' % (sDiskFormat));
                self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat);
                reporter.testDone();
            reporter.testDone();
        reporter.testDone();
        return fRc;
Example #31
0
    def testVMMove(self):
        """
        Test machine moving.
        """
        reporter.testStart('machine moving')

        if not self.oTstDrv.importVBoxApi():
            return False

        fSupported = self.checkAPIVersion()

        if fSupported is False:
            reporter.log('API version %s is too old. Just skip this test.' %
                         (self.oTstDrv.fpApiVer))
            return reporter.testDone()[1] == 0
        else:
            reporter.log('API version is "%s".' % (self.oTstDrv.fpApiVer))

        # Scenarios
        # 1. All disks attached to VM are located outside the VM's folder.
        #    There are no any snapshots and logs.
        #    In this case only VM setting file should be moved (.vbox file)
        #
        # 2. All disks attached to VM are located inside the VM's folder.
        #    There are no any snapshots and logs.
        #
        # 3. There are snapshots.
        #
        # 4. There are one or more save state files in the snapshots folder
        #    and some files in the logs folder.
        #
        # 5. There is an ISO image (.iso) attached to the VM.
        #
        # 6. There is a floppy image (.img) attached to the VM.
        #
        # 7. There are shareable disk and immutable disk attached to the VM.

        try:
            # Create test machine.
            oMachine = self.createTestMachine()
            if oMachine is None:
                reporter.error('Failed to create test machine')

            # Create temporary subdirectory in the current working directory.
            sOrigLoc = self.oTstDrv.sScratchPath
            sBaseLoc = os.path.join(sOrigLoc, 'moveFolder')
            os.mkdir(sBaseLoc, 0o775)

            # lock machine
            # get session machine
            oSession = self.oTstDrv.openSession(oMachine)
            fRc = True

            sNewLoc = sBaseLoc + os.sep

            dsReferenceFiles = defaultdict(set)

            #
            # 1. case:
            #
            # All disks attached to VM are located outside the VM's folder.
            # There are no any snapshots and logs.
            # In this case only VM setting file should be moved (.vbox file)
            #
            for s in self.asImagesNames:
                reporter.log('"%s"' % (s, ))
                dsReferenceFiles['StandardImage'].add(os.path.join(
                    sOrigLoc, s))

            sSettingFile = os.path.join(
                sNewLoc, os.path.join(oMachine.name, oMachine.name + '.vbox'))
            dsReferenceFiles['SettingsFile'].add(sSettingFile)

            fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine)

            if fRc is True:
                fRc = self.checkLocation(oSession.o.machine, dsReferenceFiles)
                if fRc is False:
                    reporter.testFailure(
                        '!!!!!!!!!!!!!!!!!! 1st scenario: Check locations failed... !!!!!!!!!!!!!!!!!!'
                    )
                    return reporter.testDone()[1] == 0
            else:
                reporter.testFailure(
                    '!!!!!!!!!!!!!!!!!! 1st scenario: Move VM failed... !!!!!!!!!!!!!!!!!!'
                )
                return reporter.testDone()[1] == 0

            fRc = oSession.saveSettings()
            if fRc is False:
                reporter.testFailure(
                    '1st scenario: Couldn\'t save machine settings')

            #
            # 2. case:
            #
            # All disks attached to VM are located inside the VM's folder.
            # There are no any snapshots and logs.
            #
            sOldLoc = sNewLoc + oMachine.name + os.sep
            sNewLoc = os.path.join(sOrigLoc, 'moveFolder_2d_scenario')
            os.mkdir(sNewLoc, 0o775)

            fRc = self.__testScenario_2(oSession, oMachine, sNewLoc, sOldLoc)
            if fRc is False:
                return reporter.testDone()[1] == 0

            #
            # 3. case:
            #
            # There are snapshots.
            #
            sOldLoc = sNewLoc + oMachine.name + os.sep
            sNewLoc = os.path.join(sOrigLoc, 'moveFolder_3d_scenario')
            os.mkdir(sNewLoc, 0o775)

            fRc = self.__testScenario_3(oSession, oMachine, sNewLoc)
            if fRc is False:
                return reporter.testDone()[1] == 0

            #
            # 4. case:
            #
            # There are one or more save state files in the snapshots folder
            # and some files in the logs folder.
            # Here we run VM, next stop it in the "save" state.
            # And next move VM
            #
            sOldLoc = sNewLoc + oMachine.name + os.sep
            sNewLoc = os.path.join(sOrigLoc, 'moveFolder_4th_scenario')
            os.mkdir(sNewLoc, 0o775)

            # Close Session object because after starting VM we get new instance of session
            fRc = oSession.close() and fRc
            if fRc is False:
                reporter.log('Couldn\'t close machine session')

            del oSession

            fRc = self.__testScenario_4(oMachine, sNewLoc)
            if fRc is False:
                return reporter.testDone()[1] == 0

            #
            # 5. case:
            #
            # There is an ISO image (.iso) attached to the VM.
            # Prerequisites - there is IDE Controller and there are no any images attached to it.
            #
            sOldLoc = sNewLoc + os.sep + oMachine.name
            sNewLoc = os.path.join(sOrigLoc, 'moveFolder_5th_scenario')
            os.mkdir(sNewLoc, 0o775)
            fRc = self.__testScenario_5(oMachine, sNewLoc, sOldLoc)
            if fRc is False:
                return reporter.testDone()[1] == 0

            #
            # 6. case:
            #
            # There is a floppy image (.img) attached to the VM.
            # Prerequisites - there is Floppy Controller and there are no any images attached to it.
            #
            sOldLoc = sNewLoc + os.sep + oMachine.name
            sNewLoc = os.path.join(sOrigLoc, 'moveFolder_6th_scenario')
            os.mkdir(sNewLoc, 0o775)
            fRc = self.__testScenario_6(oMachine, sNewLoc, sOldLoc)
            if fRc is False:
                return reporter.testDone()[1] == 0


#           #
#           # 7. case:
#           #
#           # There are shareable disk and immutable disk attached to the VM.
#           #
#           fRc = fRc and oSession.saveSettings()
#           if fRc is False:
#               reporter.log('Couldn\'t save machine settings')
#

            assert fRc is True
        except:
            reporter.errorXcpt()

        return reporter.testDone()[1] == 0
Example #32
0
    def testOneCfg(
            self,
            sVmName,
            eStorageController,
            sHostIoCache,
            sDiskFormat,  # pylint: disable=R0913,R0915
            sDiskVariant,
            sDiskPath,
            cCpus,
            sIoTest,
            sVirtMode,
            sTestSet):
        """
        Runs the specified VM thru test #1.

        Returns a success indicator on the general test execution. This is not
        the actual test result.
        """
        oVM = self.getVmByName(sVmName)

        dTestSet = self.kdTestSets.get(sTestSet)
        cbDisk = dTestSet.get('DiskSizeGb') * 1024 * 1024 * 1024
        fHwVirt = sVirtMode != 'raw'
        fNestedPaging = sVirtMode == 'hwvirt-np'

        fRc = True
        if sDiskFormat == 'iSCSI':
            sDiskPath = self.asIscsiTargets[0]
        elif self.fUseScratch:
            sDiskPath = self.sScratchPath
        else:
            # If requested recreate the storage space to start with a clean config
            # for benchmarks
            if self.fRecreateStorCfg:
                sMountPoint = self.prepareStorage(self.oStorCfg)
                if sMountPoint is not None:
                    # Create a directory where every normal user can write to.
                    self.oStorCfg.mkDirOnVolume(sMountPoint, 'test', 0777)
                    sDiskPath = sMountPoint + '/test'
                else:
                    fRc = False
                    reporter.testFailure('Failed to prepare storage for VM')

        if not fRc:
            return fRc

        lstDisks = []
        # List of disks we have to delete afterwards.

        for iDiffLvl in range(self.cDiffLvls + 1):

            if iDiffLvl == 0:
                reporter.testStart('Base')
            else:
                reporter.testStart('Diff %u' % (iDiffLvl))

            # Reconfigure the VM
            oSession = self.openSession(oVM)
            if oSession is not None:
                # Attach HD
                fRc = oSession.ensureControllerAttached(
                    _ControllerTypeToName(eStorageController))
                fRc = fRc and oSession.setStorageControllerType(
                    eStorageController,
                    _ControllerTypeToName(eStorageController))

                if sHostIoCache == 'hostiocache':
                    fRc = fRc and oSession.setStorageControllerHostIoCache(
                        _ControllerTypeToName(eStorageController), True)
                elif sHostIoCache == 'no-hostiocache':
                    fRc = fRc and oSession.setStorageControllerHostIoCache(
                        _ControllerTypeToName(eStorageController), False)

                iDevice = 0
                if eStorageController == vboxcon.StorageControllerType_PIIX3 or \
                   eStorageController == vboxcon.StorageControllerType_PIIX4:
                    iDevice = 1
                    # Master is for the OS.

                oHdParent = None
                if iDiffLvl > 0:
                    oHdParent = lstDisks[0]
                oHd = self.createHd(oSession, sDiskFormat, sDiskVariant,
                                    iDiffLvl, oHdParent, sDiskPath, cbDisk)
                if oHd is not None:
                    lstDisks.insert(0, oHd)
                    try:
                        if oSession.fpApiVer >= 4.0:
                            oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
                                                            0, iDevice, vboxcon.DeviceType_HardDisk, oHd)
                        else:
                            oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
                                                            0, iDevice, vboxcon.DeviceType_HardDisk, oHd.id)
                    except:
                        reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
                                           % (_ControllerTypeToName(eStorageController), 1, 0, oHd.id, oSession.sName) )
                        fRc = False
                    else:
                        reporter.log('attached "%s" to %s' %
                                     (sDiskPath, oSession.sName))
                else:
                    fRc = False
                fRc = fRc and oSession.enableVirtEx(fHwVirt)
                fRc = fRc and oSession.enableNestedPaging(fNestedPaging)
                fRc = fRc and oSession.setCpuCount(cCpus)
                fRc = fRc and oSession.saveSettings()
                fRc = oSession.close() and fRc and True
                # pychecker hack.
                oSession = None
            else:
                fRc = False

            # Start up.
            if fRc is True:
                self.logVmInfo(oVM)
                oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(
                    sVmName, fCdWait=False, fNatForwardingForTxs=True)
                if oSession is not None:
                    self.addTask(oSession)

                    # Fudge factor - Allow the guest to finish starting up.
                    self.sleep(5)

                    # Prepare the storage on the guest
                    lstBinaryPaths = [
                        '/bin', '/sbin', '/usr/bin', '/usr/sbin'
                    ]
                    oExecVm = remoteexecutor.RemoteExecutor(
                        oTxsSession, lstBinaryPaths, '${SCRATCH}')
                    oStorCfgVm = storagecfg.StorageCfg(oExecVm, 'linux', self.getGuestDisk(oSession, oTxsSession, \
                                                                                           eStorageController))

                    sMountPoint = self.prepareStorage(oStorCfgVm)
                    if sMountPoint is not None:
                        self.testBenchmark('linux', sIoTest, sMountPoint,
                                           oExecVm, dTestSet)
                        self.cleanupStorage(oStorCfgVm)
                    else:
                        reporter.testFailure(
                            'Failed to prepare storage for the guest benchmark'
                        )

                    # cleanup.
                    self.removeTask(oTxsSession)
                    self.terminateVmBySession(oSession)
                else:
                    fRc = False

                # Remove disk
                oSession = self.openSession(oVM)
                if oSession is not None:
                    try:
                        oSession.o.machine.detachDevice(
                            _ControllerTypeToName(eStorageController), 0,
                            iDevice)

                        # Remove storage controller if it is not an IDE controller.
                        if     eStorageController is not vboxcon.StorageControllerType_PIIX3 \
                           and eStorageController is not vboxcon.StorageControllerType_PIIX4:
                            oSession.o.machine.removeStorageController(
                                _ControllerTypeToName(eStorageController))

                        oSession.saveSettings()
                        oSession.saveSettings()
                        oSession.close()
                        oSession = None
                    except:
                        reporter.errorXcpt(
                            'failed to detach/delete disk %s from storage controller'
                            % (sDiskPath))
                else:
                    fRc = False

            reporter.testDone()

        # Delete all disks
        for oHd in lstDisks:
            self.oVBox.deleteHdByMedium(oHd)

        # Cleanup storage area
        if sDiskFormat != 'iSCSI' and not self.fUseScratch and self.fRecreateStorCfg:
            self.cleanupStorage(self.oStorCfg)

        return fRc
Example #33
0
    def testIt(self, oTestVm, oSession, oTxsSession):
        """
        Executes the test.

        Returns fRc, oTxsSession.  The latter may have changed.
        """
        reporter.log("Active tests: %s" % (self.asTests, ))

        #
        # Skip the test if before 6.0
        #
        if self.oTstDrv.fpApiVer < 6.0:
            reporter.log('Requires 6.0 or later (for now)')
            return (None, oTxsSession)

        # Guess a free mount point inside the guest.
        if oTestVm.isWindows() or oTestVm.isOS2():
            self.sGuestSlash = '\\'
        else:
            self.sGuestSlash = '/'

        #
        # Create the host directory to share. Empty except for a 'candle.dir' subdir
        # that we use to check that it mounted correctly.
        #
        sShareName1 = 'shfl1'
        sShareHostPath1 = os.path.join(self.oTstDrv.sScratchPath, sShareName1)
        reporter.log2('Creating shared host folder "%s"...' %
                      (sShareHostPath1, ))
        if os.path.exists(sShareHostPath1):
            try:
                shutil.rmtree(sShareHostPath1)
            except:
                return (reporter.errorXcpt('shutil.rmtree(%s)' %
                                           (sShareHostPath1, )), oTxsSession)
        try:
            os.mkdir(sShareHostPath1)
        except:
            return (reporter.errorXcpt('os.mkdir(%s)' % (sShareHostPath1, )),
                    oTxsSession)
        try:
            os.mkdir(os.path.join(sShareHostPath1, 'candle.dir'))
        except:
            return (reporter.errorXcpt('os.mkdir(%s)' % (sShareHostPath1, )),
                    oTxsSession)

        # Guess a free mount point inside the guest.
        if oTestVm.isWindows() or oTestVm.isOS2():
            sMountPoint1 = 'V:'
        else:
            sMountPoint1 = '/mnt/' + sShareName1

        fRc = self.mountShare(oSession, oTxsSession, sShareName1,
                              sShareHostPath1, sMountPoint1)
        if fRc is not True:
            return (False, oTxsSession)
            # skip the remainder if we cannot auto mount the folder.

        #
        # Run FsPerf inside the guest.
        #
        fSkip = 'fsperf' not in self.asTests
        if fSkip is False:
            cMbFree = utils.getDiskUsage(sShareHostPath1)
            if cMbFree >= 16:
                reporter.log2('Free space: %u MBs' % (cMbFree, ))
            else:
                reporter.log('Skipping FsPerf because only %u MB free on %s' %
                             (
                                 cMbFree,
                                 sShareHostPath1,
                             ))
                fSkip = True
        if fSkip is False:
            # Common arguments:
            asArgs = [
                'FsPerf', '-d',
                sMountPoint1 + self.sGuestSlash + 'fstestdir-1', '-s8'
            ]

            # Skip part of mmap on older windows systems without CcCoherencyFlushAndPurgeCache (>= w7).
            reporter.log2('oTestVm.sGuestOsType=%s' % (oTestVm.sGuestOsType, ))
            if   oTestVm.getNonCanonicalGuestOsType() \
              in [ 'WindowsNT3x', 'WindowsNT4', 'Windows2000', 'WindowsXP', 'WindowsXP_64', 'Windows2003',
                   'Windows2003_64', 'WindowsVista', 'WindowsVista_64', 'Windows2008', 'Windows2008_64']:
                asArgs.append('--no-mmap-coherency')

            # Configure I/O block sizes according to guest memory size:
            cbMbRam = 128
            try:
                cbMbRam = oSession.o.machine.memorySize
            except:
                reporter.errorXcpt()
            reporter.log2('cbMbRam=%s' % (cbMbRam, ))
            asArgs.append('--set-block-size=1')
            asArgs.append('--add-block-size=512')
            asArgs.append('--add-block-size=4096')
            asArgs.append('--add-block-size=16384')
            asArgs.append('--add-block-size=65536')
            asArgs.append('--add-block-size=1048576')
            #   1 MiB
            if cbMbRam >= 512:
                asArgs.append('--add-block-size=33554432')
                #  32 MiB
            if cbMbRam >= 768:
                asArgs.append('--add-block-size=134217728')
                # 128 MiB

            # Putting lots (10000) of files in a single directory causes issues on OS X
            # (HFS+ presumably, though could be slow disks) and some linuxes (slow disks,
            # maybe ext2/3?).  So, generally reduce the file count to 4096 everywhere
            # since we're not here to test the host file systems, and 3072 on macs.
            if utils.getHostOs() in [
                    'darwin',
            ]:
                asArgs.append('--many-files=3072')
            elif utils.getHostOs() in [
                    'linux',
            ]:
                asArgs.append('--many-files=4096')

            # Add the extra arguments from the command line and kick it off:
            asArgs.extend(self.asExtraArgs)

            # Run FsPerf:
            reporter.log2('Starting guest FsPerf (%s)...' % (asArgs, ))
            sFsPerfPath = self._locateGstFsPerf(oTxsSession)

            ## @todo For some odd reason the combined GA/VaKit .ISO (by IPRT/fs/isomakercmd)
            #        sometimes (?) contains FsPerf as non-executable (-r--r--r-- 1 root root) on Linux.
            #
            #        So work around this for now by copying the desired FsPerf binary to the temp directory,
            #        make it executable and execute it from there.
            fISOMakerCmdIsBuggy = oTestVm.isLinux()
            if fISOMakerCmdIsBuggy:
                sFsPerfPathTemp = oTestVm.pathJoin(
                    self.oTstDrv.getGuestTempDir(oTestVm), 'FsPerf${EXESUFF}')
                if oTestVm.isWindows() \
                or oTestVm.isOS2():
                    sCopy = self.oTstDrv.getGuestSystemShell()
                    sCopyArgs = (sCopy, "/C", "copy", "/Y", sFsPerfPath,
                                 sFsPerfPathTemp)
                else:
                    sCopy = oTestVm.pathJoin(
                        self.oTstDrv.getGuestSystemDir(oTestVm), 'cp')
                    sCopyArgs = (sCopy, "-a", "-v", sFsPerfPath,
                                 sFsPerfPathTemp)
                fRc = self.oTstDrv.txsRunTest(oTxsSession,
                                              'Copying FsPerf',
                                              60 * 1000,
                                              sCopy,
                                              sCopyArgs,
                                              fCheckSessionStatus=True)
                fRc = fRc and oTxsSession.syncChMod(sFsPerfPathTemp, 0o755)
                if fRc:
                    sFsPerfPath = sFsPerfPathTemp

            fRc = self.oTstDrv.txsRunTest(oTxsSession,
                                          'Running FsPerf',
                                          90 * 60 * 1000,
                                          sFsPerfPath,
                                          asArgs,
                                          fCheckSessionStatus=True)
            reporter.log2('FsPerf -> %s' % (fRc, ))
            if fRc:
                # Do a bit of diagnosis to find out why this failed.
                if     not oTestVm.isWindows() \
                   and not oTestVm.isOS2():
                    sCmdLs = oTestVm.pathJoin(
                        self.oTstDrv.getGuestSystemDir(oTestVm), 'ls')
                    oTxsSession.syncExec(sCmdLs, (sCmdLs, "-al", sFsPerfPath),
                                         fIgnoreErrors=True)
                    oTxsSession.syncExec(sCmdLs, (sCmdLs, "-al", "-R", "/opt"),
                                         fIgnoreErrors=True)
                    oTxsSession.syncExec(sCmdLs,
                                         (sCmdLs, "-al", "-R", "/media/cdrom"),
                                         fIgnoreErrors=True)

            sTestDir = os.path.join(sShareHostPath1, 'fstestdir-1')
            if os.path.exists(sTestDir):
                fRc = reporter.errorXcpt('test directory lingers: %s' %
                                         (sTestDir, ))
                try:
                    shutil.rmtree(sTestDir)
                except:
                    fRc = reporter.errorXcpt('shutil.rmtree(%s)' %
                                             (sTestDir, ))
        else:
            reporter.testStart('FsPerf')
            reporter.testDone(fSkip or fRc is None)

        #
        # Check if auto-unmounting works.
        #
        if fRc is True:
            fRc = self.unmountShare(oSession, oTxsSession, sShareName1,
                                    sMountPoint1)

        ## @todo Add tests for multiple automount shares, random unmounting, reboot test.

        return (fRc, oTxsSession)
Example #34
0
    def test1RunTestProgs(self, oSession, oTxsSession, fRc, sTestName,
                          sGuestFs):
        """
        Runs all the test programs on the test machine.
        """
        _ = oSession

        reporter.testStart(sTestName)

        sMkfsCmd = 'mkfs.' + sGuestFs

        # Prepare test disks, just create filesystem without partition
        reporter.testStart('Preparation')
        fRc = fRc and self.txsRunTest(oTxsSession, 'Create FS 1', 60000, \
                                      '/sbin/' + sMkfsCmd,
                                      (sMkfsCmd, '/dev/sdb'))

        fRc = fRc and self.txsRunTest(oTxsSession, 'Create FS 2', 60000, \
                                      '/sbin/' + sMkfsCmd,
                                      (sMkfsCmd, '/dev/sdc'))

        # Create test and scratch directory
        fRc = fRc and self.txsRunTest(oTxsSession, 'Create /mnt/test', 10000, \
                                      '/bin/mkdir',
                                      ('mkdir', '/mnt/test'))

        fRc = fRc and self.txsRunTest(oTxsSession, 'Create /mnt/scratch', 10000, \
                                      '/bin/mkdir',
                                      ('mkdir', '/mnt/scratch'))

        # Mount test and scratch directory.
        fRc = fRc and self.txsRunTest(oTxsSession, 'Mount /mnt/test', 10000, \
                                      '/bin/mount',
                                      ('mount', '/dev/sdb','/mnt/test'))

        fRc = fRc and self.txsRunTest(oTxsSession, 'Mount /mnt/scratch', 10000, \
                                      '/bin/mount',
                                      ('mount', '/dev/sdc','/mnt/scratch'))

        fRc = fRc and self.txsRunTest(oTxsSession, 'Copying xfstests', 10000, \
                                      '/bin/cp',
                                      ('cp', '-r','${CDROM}/${OS.ARCH}/xfstests', '/tmp'))

        reporter.testDone()

        # Run xfstests (this sh + cd crap is required because the cwd for the script must be in the root
        # of the xfstests directory...)
        reporter.testStart('xfstests')
        if fRc and 'xfstests' in self.asTests:
            fRc = self.txsRunTest(
                oTxsSession, 'xfstests', 3600000, '/bin/sh',
                ('sh', '-c', '(cd /tmp/xfstests && ./check -g auto)'),
                ('TEST_DIR=/mnt/test', 'TEST_DEV=/dev/sdb',
                 'SCRATCH_MNT=/mnt/scratch', 'SCRATCH_DEV=/dev/sdc',
                 'FSTYP=' + sGuestFs))
            reporter.testDone()
        else:
            reporter.testDone(fSkipped=True)

        reporter.testDone(not fRc)
        return fRc
Example #35
0
    def testMediumMove(self):
        """
        Test medium moving.
        """
        reporter.testStart('medium moving')

        try:  ## @todo r=bird: Bad 'ing style.
            oVM = self.oTstDrv.createTestVM('test-medium-move', 1, None, 4)
            assert oVM is not None

            # create hard disk images, one for each file-based backend, using the first applicable extension
            fRc = True
            oSession = self.oTstDrv.openSession(oVM)
            aoDskFmts = self.oTstDrv.oVBoxMgr.getArray(
                self.oTstDrv.oVBox.systemProperties, 'mediumFormats')
            asFiles = []
            for oDskFmt in aoDskFmts:
                aoDskFmtCaps = self.oTstDrv.oVBoxMgr.getArray(
                    oDskFmt, 'capabilities')
                if vboxcon.MediumFormatCapabilities_File not in aoDskFmtCaps \
                    or vboxcon.MediumFormatCapabilities_CreateDynamic not in aoDskFmtCaps:
                    continue
                (asExts, aTypes) = oDskFmt.describeFileExtensions()
                for i in range(0, len(asExts)):  #pylint: disable=consider-using-enumerate
                    if aTypes[i] is vboxcon.DeviceType_HardDisk:
                        sExt = '.' + asExts[i]
                        break
                if sExt is None:
                    fRc = False
                    break
                sFile = 'Test' + str(len(asFiles)) + sExt
                sHddPath = os.path.join(self.oTstDrv.sScratchPath, sFile)
                oHd = oSession.createBaseHd(sHddPath,
                                            sFmt=oDskFmt.id,
                                            cb=1024 * 1024)
                if oHd is None:
                    fRc = False
                    break

                # attach HDD, IDE controller exists by default, but we use SATA just in case
                sController = 'SATA Controller'
                fRc = fRc and oSession.attachHd(sHddPath,
                                                sController,
                                                iPort=len(asFiles),
                                                fImmutable=False,
                                                fForceResource=False)
                if fRc:
                    asFiles.append(sFile)

            fRc = fRc and oSession.saveSettings()

            #create temporary subdirectory in the current working directory
            sOrigLoc = self.oTstDrv.sScratchPath
            sNewLoc = os.path.join(sOrigLoc, 'newLocation')
            os.mkdir(sNewLoc, 0o775)

            aoMediumAttachments = oVM.getMediumAttachmentsOfController(
                sController)
            #case 1. Only path without file name, with trailing separator
            fRc = self.moveTo(sNewLoc + os.sep, aoMediumAttachments) and fRc
            fRc = self.checkLocation(sNewLoc, aoMediumAttachments,
                                     asFiles) and fRc

            #case 2. Only path without file name, without trailing separator
            fRc = self.moveTo(sOrigLoc, aoMediumAttachments) and fRc
            fRc = self.checkLocation(sOrigLoc, aoMediumAttachments,
                                     asFiles) and fRc

            #case 3. Path with file name
            #The case supposes that user has passed a destination path with a file name but hasn't added an extension/suffix
            #to this destination file. User supposes that the extension would be added automatically and to be the same as
            #for the original file. Difficult case, apparently this case should follow mv(1) logic
            #and the file name is processed as folder name (aka mv(1) logic).
            #Be discussed.
            fRc = self.moveTo(os.path.join(sNewLoc, 'newName'),
                              aoMediumAttachments) and fRc
            asNewFiles = ['newName' + os.path.splitext(s)[1] for s in asFiles]
            fRc = self.checkLocation(os.path.join(sNewLoc, 'newName'),
                                     aoMediumAttachments, asFiles) and fRc

            #after the case the destination path must be corrected
            sNewLoc = os.path.join(sNewLoc, 'newName')

            #case 4. Only file name
            fRc = self.moveTo('onlyMediumName', aoMediumAttachments) and fRc
            asNewFiles = [
                'onlyMediumName' + os.path.splitext(s)[1] for s in asFiles
            ]
            if self.oTstDrv.fpApiVer >= 5.3:
                fRc = self.checkLocation(sNewLoc, aoMediumAttachments,
                                         asNewFiles) and fRc
            else:
                fRc = self.checkLocation(
                    sNewLoc, aoMediumAttachments,
                    [s.replace('.hdd', '.parallels')
                     for s in asNewFiles]) and fRc

            #case 5. Move all files from a snapshot
            fRc = fRc and oSession.takeSnapshot('Snapshot1')
            if fRc:
                aoMediumAttachments = oVM.getMediumAttachmentsOfController(
                    sController)
                asSnapFiles = [
                    os.path.basename(o.medium.name)
                    for o in aoMediumAttachments
                ]
                fRc = self.moveTo(sOrigLoc, aoMediumAttachments) and fRc
                fRc = self.checkLocation(sOrigLoc, aoMediumAttachments,
                                         asSnapFiles) and fRc

            fRc = oSession.close() and fRc
        except:
            reporter.errorXcpt()

        return reporter.testDone()[1] == 0
Example #36
0
    def test1RunTestProgs(self, oSession, oTxsSession, fRc, sTestName):
        """
        Runs all the test programs on the test machine.
        """
        reporter.testStart(sTestName)

        # Prepare test disk, just create filesystem without partition
        reporter.testStart('mkfs.ext4')
        fRc = self.txsRunTest(oTxsSession, 'Create FS', 60000,
                              '/sbin/mkfs.ext4',
                              ('mkfs.ext4', '-F', '/dev/vboxtest'))
        reporter.testDone()

        reporter.testStart('mount')
        fRc = self.txsRunTest(oTxsSession, 'Mount FS', 30000, '/bin/mount',
                              ('mount', '/dev/vboxtest', '/mnt'))
        reporter.testDone()

        reporter.testStart('iozone')
        if fRc and 'iozone' in self.asTests:
            oStdOut = IozoneStdOutWrapper()
            fRc = self.txsRunTestRedirectStd(
                oTxsSession, '2G', 3600000, '/usr/bin/iozone',
                ('iozone', '-r', '64k', '-s', '2g', '-t', '1', '-T', '-I',
                 '-H', '32', '-F', '/mnt/iozone'), (), '', '/dev/null',
                oStdOut, '/dev/null', '/dev/null')
            if fRc is True:
                reporter.log("Initial writer: " + str(oStdOut.getInitWriter()))
                reporter.log("Rewriter:       " + str(oStdOut.getRewriter()))
                reporter.log("Initial reader: " + str(oStdOut.getReader()))
                reporter.log("Re-reader:      " + str(oStdOut.getRereader()))
                reporter.log("Reverse reader: " +
                             str(oStdOut.getReverseReader()))
                reporter.log("Stride reader:  " +
                             str(oStdOut.getStrideReader()))
                reporter.log("Random reader:  " +
                             str(oStdOut.getRandomReader()))
                reporter.log("Mixed Workload: " +
                             str(oStdOut.getMixedWorkload()))
                reporter.log("Random writer:  " +
                             str(oStdOut.getRandomWriter()))
                reporter.log("pwrite Writer:  " + str(oStdOut.getPWrite()))
                reporter.log("pread Reader:   " + str(oStdOut.getPRead()))
            reporter.testDone()
        else:
            reporter.testDone(fSkipped=True)

        reporter.testStart('fio')
        if fRc and 'fio' in self.asTests:
            oFioWrapper = FioWrapper('64k', '2g', '32', '/mnt')
            fRc = self.txsUploadString(oSession, oTxsSession,
                                       oFioWrapper.getConfig(),
                                       '${SCRATCH}/aio-test')
            fRc = fRc and self.txsRunTestRedirectStd(
                oTxsSession, '2G', 3600000, '/usr/bin/fio',
                ('fio', '${SCRATCH}/aio-test'),
                (), '', '/dev/null', oFioWrapper, '/dev/null', '/dev/null')
        else:
            reporter.testDone(fSkipped=True)

        reporter.testDone(not fRc)
        return fRc
Example #37
0
    def runTests(self, oTestVm, oSession, oTxsSession, sDesc, sTag, asTests):
        """
        Runs one or more tests using VKAT on the host, which in turn will
        communicate with VKAT running on the guest and the Validation Kit
        audio driver ATS (Audio Testing Service).
        """
        _ = oTestVm, oSession, oTxsSession

        sPathTemp = self.sScratchPath
        sPathAudioOut = os.path.join(sPathTemp, 'vkat-host-out-%s' % (sTag))
        sPathAudioTemp = os.path.join(sPathTemp, 'vkat-host-temp-%s' % (sTag))

        reporter.log('Host audio test temp path is \"%s\"' % (sPathAudioOut))
        reporter.log('Host audio test output path is \"%s\"' %
                     (sPathAudioTemp))
        reporter.log('Host audio test tag is \"%s\"' % (sTag))

        reporter.testStart(sDesc)

        sVkatExe = self.getBinTool('vkat')

        reporter.log('Using VKAT on host at: \"%s\"' % (sVkatExe))

        # Build the base command line, exclude all tests by default.
        asArgs = [ sVkatExe, 'test', '--mode', 'host', '--probe-backends', \
                             '--tempdir', sPathAudioTemp, '--outdir', sPathAudioOut, '-a', \
                             '--tag', sTag, \
                             '--no-verify' ]
        # We do the verification separately in the step below.

        for _ in range(1, reporter.getVerbosity()
                       ):  # Verbosity always is initialized at 1.
            asArgs.extend(['-v'])

        if self.asVkatTestArgs:
            asArgs += self.asVkatTestArgs

        # ... and extend it with wanted tests.
        asArgs.extend(asTests)

        #
        # Let VKAT on the host run synchronously.
        #
        fRc = self.executeHst("VKAT Host", asArgs)

        reporter.testDone()

        if fRc:
            #
            # When running the test(s) above were successful, do the verification step next.
            # This gives us a bit more fine-grained test results in the test manager.
            #
            reporter.testStart('Verifying audio data')

            sNameSetHst = '%s-host.tar.gz' % (sTag)
            sPathSetHst = os.path.join(sPathAudioOut, sNameSetHst)
            sNameSetGst = '%s-guest.tar.gz' % (sTag)
            sPathSetGst = os.path.join(sPathAudioOut, sNameSetGst)

            asArgs = [sVkatExe, 'verify', sPathSetHst, sPathSetGst]

            for _ in range(1, reporter.getVerbosity()
                           ):  # Verbosity always is initialized at 1.
                asArgs.extend(['-v'])

            if self.asVkatVerifyArgs:
                asArgs += self.asVkatVerifyArgs

            fRc = self.executeHst("VKAT Host Verify", asArgs)
            if fRc:
                reporter.log("Verification audio data successful")
            else:
                #
                # Add the test sets to the test manager for later (manual) diagnosis.
                #
                reporter.addLogFile(sPathSetGst, 'misc/other',
                                    'Guest audio test set')
                reporter.addLogFile(sPathSetHst, 'misc/other',
                                    'Host audio test set')

                reporter.error("Verification of audio data failed")

            reporter.testDone()

        return fRc
Example #38
0
    def testRunUnitTestsSet(self, sTestCasePattern, sTestCaseSubDir):
        """
        Run subset of the unit tests set.
        """

        # Open /dev/null for use as stdin further down.
        try:
            oDevNull = open(os.path.devnull, 'w+')
        except:
            oDevNull = None

        # Determin the host OS specific exclusion lists.
        dTestCasesBuggyForHostOs = self.kdTestCasesBuggyPerOs.get(
            utils.getHostOs(), [])
        dTestCasesBuggyForHostOs.update(
            self.kdTestCasesBuggyPerOs.get(utils.getHostOsDotArch(), []))

        #
        # Process the file list and run everything looking like a testcase.
        #
        for sFilename in sorted(
                os.listdir(
                    os.path.join(self.sUnitTestsPathBase, sTestCaseSubDir))):
            # Separate base and suffix and morph the base into something we
            # can use for reporting and array lookups.
            sName, sSuffix = os.path.splitext(sFilename)
            if sTestCaseSubDir != '.':
                sName = sTestCaseSubDir + '/' + sName

            # Basic exclusion.
            if   not re.match(sTestCasePattern, sFilename) \
              or sSuffix in self.kasSuffixBlackList:
                reporter.log('"%s" is not a test case.' % (sFilename, ))
                continue

            # Check if the testcase is black listed or buggy before executing it.
            if self._isExcluded(sName, self.kdTestCasesBlackList):
                # (No testStart/Done or accounting here!)
                reporter.log('%s: SKIPPED (blacklisted)' % (sName, ))

            elif self._isExcluded(sName, self.kdTestCasesBuggy):
                reporter.testStart(sName)
                reporter.log('%s: Skipping, buggy in general.' % (sName, ))
                reporter.testDone(fSkipped=True)
                self.cSkipped += 1

            elif self._isExcluded(sName, dTestCasesBuggyForHostOs):
                reporter.testStart(sName)
                reporter.log('%s: Skipping, buggy on %s.' % (
                    sName,
                    utils.getHostOs(),
                ))
                reporter.testDone(fSkipped=True)
                self.cSkipped += 1

            else:
                sFullPath = os.path.normpath(
                    os.path.join(self.sUnitTestsPathBase,
                                 os.path.join(sTestCaseSubDir, sFilename)))
                reporter.testStart(sName)
                try:
                    fSkipped = self._executeTestCase(sName, sFullPath,
                                                     sTestCaseSubDir, oDevNull)
                except:
                    reporter.errorXcpt('!*!')
                    self.cFailed += 1
                    fSkipped = False
                reporter.testDone(fSkipped)
Example #39
0
    def _installVBox(self):
        """
        Download / copy the build files into the scratch area and install them.
        """
        reporter.testStart('Installing VirtualBox')
        reporter.log('CWD=%s' % (os.getcwd(), ))
        # curious

        #
        # Download the build files.
        #
        for i in range(len(self._asBuildUrls)):
            if webutils.downloadFile(self._asBuildUrls[i],
                                     self._asBuildFiles[i], self.sBuildPath,
                                     reporter.log, reporter.log) is not True:
                reporter.testDone(fSkipped=True)
                return None
                # Failed to get binaries, probably deleted. Skip the test run.

        #
        # Unpack anything we know what is and append it to the build files
        # list.  This allows us to use VBoxAll*.tar.gz files.
        #
        for sFile in list(self._asBuildFiles):
            if self._maybeUnpackArchive(sFile, fNonFatal=True) is not True:
                reporter.testDone(fSkipped=True)
                return None
                # Failed to unpack. Probably local error, like busy
                # DLLs on windows, no reason for failing the build.

        #
        # Go to system specific installation code.
        #
        sHost = utils.getHostOs()
        if sHost == 'darwin': fRc = self._installVBoxOnDarwin()
        elif sHost == 'linux': fRc = self._installVBoxOnLinux()
        elif sHost == 'solaris': fRc = self._installVBoxOnSolaris()
        elif sHost == 'win': fRc = self._installVBoxOnWindows()
        else:
            reporter.error('Unsupported host "%s".' % (sHost, ))
        if fRc is False:
            reporter.testFailure('Installation error.')
        elif fRc is not True:
            reporter.log(
                'Seems installation was skipped. Old version lurking behind? Not the fault of this build/test run!'
            )

        #
        # Install the extension pack.
        #
        if fRc is True and self._fAutoInstallPuelExtPack:
            fRc = self._installExtPack()
            if fRc is False:
                reporter.testFailure('Extension pack installation error.')

        # Some debugging...
        try:
            cMbFreeSpace = utils.getDiskUsage(self.sScratchPath)
            reporter.log(
                'Disk usage after VBox install: %d MB available at %s' % (
                    cMbFreeSpace,
                    self.sScratchPath,
                ))
        except:
            reporter.logXcpt(
                'Unable to get disk free space. Ignored. Continuing.')

        reporter.testDone(fRc is None)
        return fRc
Example #40
0
    def actionExecute(self):
        reporter.testStart('reporter.testXXXX API');
        reporter.testValue('value-name1', 123456789, 'ms');

        reporter.testStart('subtest');
        reporter.testValue('value-name2',  11223344, 'times');
        reporter.testDone();

        reporter.testStart('subtest2');
        reporter.testValue('value-name3',  39, 'sec');
        reporter.testValue('value-name4',  42, 'ns');
        reporter.testDone();

        reporter.testStart('subtest3');
        reporter.testDone(fSkipped = True);

        # No spaces in XML.
        reporter.testStart('subtest4');
        oSubXmlFile = reporter.FileWrapperTestPipe();
        oSubXmlFile.write('<?xml version="1.0" encoding="UTF-8" ?>');
        oSubXmlFile.write('<Test timestamp="%s" name="foobar1">' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('<Test timestamp="%s" name="sub1">' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('<Passed timestamp="%s"/>' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('</Test>');
        oSubXmlFile.write('<End timestamp="%s" errors="0"/>' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('</Test>');
        oSubXmlFile.close();
        oSubXmlFile = None;
        reporter.testDone();

        # Spaces + funny line endings.
        reporter.testStart('subtest5');
        oSubXmlFile = reporter.FileWrapperTestPipe();
        oSubXmlFile.write('<?xml version="1.0" encoding="UTF-8" ?>\r\n');
        oSubXmlFile.write('<Test timestamp="%s" name="foobar2">\n\n\t\n\r\n' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('<Test timestamp="%s" name="sub2">' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('  <Passed timestamp="%s"/>\n' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('  </Test>\n');
        oSubXmlFile.write('  <End timestamp="%s" errors="0"/>\r' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('</Test>');
        oSubXmlFile.close();
        reporter.testDone();

        # A few long log times for WUI log testing.
        reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
                     'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
                     'asdlkfj  aljkasdflkj alkjdsf lakjsdf');
        reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
                     'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
                     'asdlkfj  aljkasdflkj alkjdsf lakjsdf');
        reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
                     'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
                     'asdlkfj  aljkasdflkj alkjdsf lakjsdf');

        # Upload a file.
        reporter.addLogFile(__file__, sKind = 'log/release/vm');

        reporter.testDone();
        return True;
Example #41
0
    def test1OneVM(self, sVmName):
        """
        Runs one VM thru the various configurations.
        """
        reporter.testStart(sVmName)
        fRc = True
        for sStorageCtrl in self.asStorageCtrls:
            reporter.testStart(sStorageCtrl)

            if sStorageCtrl == 'AHCI':
                eStorageCtrl = vboxcon.StorageControllerType_IntelAhci
            elif sStorageCtrl == 'IDE':
                eStorageCtrl = vboxcon.StorageControllerType_PIIX4
            elif sStorageCtrl == 'LsiLogicSAS':
                eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas
            elif sStorageCtrl == 'LsiLogic':
                eStorageCtrl = vboxcon.StorageControllerType_LsiLogic
            elif sStorageCtrl == 'BusLogic':
                eStorageCtrl = vboxcon.StorageControllerType_BusLogic
            else:
                eStorageCtrl = None

            for sDiskFormat in self.asDiskFormats:
                reporter.testStart('%s' % (sDiskFormat, ))

                asPaths = self.asDirs

                for sDir in asPaths:
                    reporter.testStart('%s' % (sDir, ))

                    sPathDisk1 = sDir + "/disk1.disk"
                    sPathDisk2 = sDir + "/disk2.disk"

                    for sGuestFs in self.asGuestFs:
                        reporter.testStart('%s' % (sGuestFs, ))

                        for cCpus in self.acCpus:
                            if cCpus == 1: reporter.testStart('1 cpu')
                            else: reporter.testStart('%u cpus' % (cCpus, ))

                            for sVirtMode in self.asVirtModes:
                                if sVirtMode == 'raw' and cCpus > 1:
                                    continue
                                hsVirtModeDesc = {}
                                hsVirtModeDesc['raw'] = 'Raw-mode'
                                hsVirtModeDesc['hwvirt'] = 'HwVirt'
                                hsVirtModeDesc['hwvirt-np'] = 'NestedPaging'
                                reporter.testStart(hsVirtModeDesc[sVirtMode])

                                fHwVirt = sVirtMode != 'raw'
                                fNestedPaging = sVirtMode == 'hwvirt-np'
                                fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPathDisk1, sPathDisk2, \
                                                       sGuestFs, cCpus, fHwVirt, fNestedPaging) and  fRc and True
                                reporter.testDone()
                            reporter.testDone()
                        reporter.testDone()
                    reporter.testDone()
                reporter.testDone()
            reporter.testDone()
        reporter.testDone()
        return fRc
Example #42
0
    def test1RunTestProgs(self, oTxsSession, fRc, sTestName, sAddr):
        """
        Runs all the test programs against one 'server' machine.
        """
        reporter.testStart(sTestName)

        reporter.testStart('TCP latency')
        if fRc and 'tcp-latency' in self.asTests and sAddr is not None:
            for cbPkt in self.acbLatencyPkts:
                fRc = self.txsRunTest(
                    oTxsSession, '%u bytes' % (cbPkt),
                    self.cSecsRun * 1000 * 4,
                    '${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}',
                    ('NetPerf', '--client', sAddr, '--interval', self.cSecsRun,
                     '--len', cbPkt, '--mode', 'latency'))
                if not fRc:
                    break
            reporter.testDone()
        else:
            reporter.testDone(fSkipped=True)

        reporter.testStart('TCP throughput')
        if fRc and 'tcp-throughput' in self.asTests and sAddr is not None:
            for cbPkt in self.acbThroughputPkts:
                fRc = self.txsRunTest(
                    oTxsSession, '%u bytes' % (cbPkt),
                    self.cSecsRun * 2 * 1000 * 4,
                    '${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}',
                    ('NetPerf', '--client', sAddr, '--interval', self.cSecsRun,
                     '--len', cbPkt, '--mode', 'throughput'))
                if not fRc:
                    break
            reporter.testDone()
        else:
            reporter.testDone(fSkipped=True)

        reporter.testStart('UDP latency')
        if fRc and 'udp-latency' in self.asTests and sAddr is not None:
            ## @todo Netperf w/UDP.
            reporter.testDone(fSkipped=True)
        else:
            reporter.testDone(fSkipped=True)

        reporter.testStart('UDP throughput')
        if fRc and 'udp-throughput' in self.asTests and sAddr is not None:
            ## @todo Netperf w/UDP.
            reporter.testDone(fSkipped=True)
        else:
            reporter.testDone(fSkipped=True)

        reporter.testStart('tbench')
        if fRc and 'tbench' in self.asTests and sAddr is not None:
            ## @todo tbench.
            reporter.testDone(fSkipped=True)
        else:
            reporter.testDone(fSkipped=True)

        reporter.testDone(not fRc)
        return fRc
Example #43
0
    def testMediumTreeDepth(self):
        """
        Test medium tree depth.
        """
        reporter.testStart('mediumTreeDepth')

        try:
            oVBox = self.oTstDrv.oVBoxMgr.getVirtualBox()
            oVM = self.oTstDrv.createTestVM('test-medium', 1, None, 4)
            assert oVM is not None

            # create chain with 300 disk images (medium tree depth limit)
            fRc = True
            oSession = self.oTstDrv.openSession(oVM)
            cImages = 38  #00
            for i in range(1, cImages + 1):
                sHddPath = os.path.join(self.oTstDrv.sScratchPath,
                                        'Test' + str(i) + '.vdi')
                if i == 1:
                    oHd = oSession.createBaseHd(sHddPath, cb=1024 * 1024)
                else:
                    oHd = oSession.createDiffHd(oHd, sHddPath)
                if oHd is None:
                    fRc = False
                    break

            # modify the VM config, attach HDD
            fRc = fRc and oSession.attachHd(sHddPath,
                                            sController='SATA Controller',
                                            fImmutable=False,
                                            fForceResource=False)
            fRc = fRc and oSession.saveSettings()
            fRc = oSession.close() and fRc
            ## @todo r=klaus: count known hard disk images, should be cImages

            # unregister, making sure the images are closed
            sSettingsFile = oVM.settingsFilePath
            fDetachAll = random.choice([False, True])
            if fDetachAll:
                reporter.log('unregistering VM, DetachAll style')
            else:
                reporter.log('unregistering VM, UnregisterOnly style')
            self.oTstDrv.forgetTestMachine(oVM)
            if fDetachAll:
                aoHDs = oVM.unregister(
                    vboxcon.CleanupMode_DetachAllReturnHardDisksOnly)
                for oHD in aoHDs:
                    oHD.close()
                aoHDs = None
            else:
                oVM.unregister(vboxcon.CleanupMode_UnregisterOnly)
            oVM = None

            # If there is no base image (expected) then there are no leftover
            # child images either. Can be changed later once the todos above
            # and below are resolved.
            cBaseImages = len(
                self.oTstDrv.oVBoxMgr.getArray(oVBox, 'hardDisks'))
            reporter.log('API reports %i base images' % (cBaseImages))
            fRc = fRc and cBaseImages == 0

            # re-register to test loading of settings
            reporter.log('opening VM %s, testing config reading' %
                         (sSettingsFile))
            oVM = oVBox.openMachine(sSettingsFile)
            ## @todo r=klaus: count known hard disk images, should be cImages

            reporter.log('unregistering VM')
            oVM.unregister(vboxcon.CleanupMode_UnregisterOnly)
            oVM = None

            cBaseImages = len(
                self.oTstDrv.oVBoxMgr.getArray(oVBox, 'hardDisks'))
            reporter.log('API reports %i base images' % (cBaseImages))
            fRc = fRc and cBaseImages == 0

            assert fRc is True
        except:
            reporter.errorXcpt()

        return reporter.testDone()[1] == 0
Example #44
0
    def testEventQueueInterrupt(self):
        """
        Test interrupting an event queue wait.
        """
        reporter.testStart('interruptWait');

        # interrupt ourselves first and check the return value.
        for i in range(0, 10):
            try:
                rc = self.oTstDrv.oVBoxMgr.interruptWaitEvents();
            except:
                reporter.errorXcpt();
                break;
            if rc is not True:
                reporter.error('interruptWaitEvents returned "%s" expected True' % (rc,));
                break

        if reporter.testErrorCount() == 0:
            #
            # Interrupt a waitForEvents call.
            #
            # This test ASSUMES that no other events are posted to the thread's
            # event queue once we've drained it.  Also ASSUMES the box is
            # relatively fast and not too busy because we're timing sensitive.
            #
            for i in range(0, 4):
                # Try quiesce the event queue.
                for _ in range(1, 100):
                    self.oTstDrv.oVBoxMgr.waitForEvents(0);

                # Create a thread that will interrupt us in 2 seconds.
                try:
                    oThread = threading.Thread(target=self.interruptWaitEventsThreadProc);
                    oThread.setDaemon(False);
                except:
                    reporter.errorXcpt();
                    break;

                cMsTimeout = 20000;
                if i == 2:
                    cMsTimeout = -1;
                elif i == 3:
                    cMsTimeout = -999999;

                # Do the wait.
                oThread.start();
                msNow = base.timestampMilli();
                try:
                    rc = self.oTstDrv.oVBoxMgr.waitForEvents(cMsTimeout);
                except:
                    reporter.errorXcpt();
                else:
                    msElapsed = base.timestampMilli() - msNow;

                    # Check the return code and elapsed time.
                    if not isinstance(rc, int):
                        reporter.error('waitForEvents returns non-integer type after %u ms, expected 1' % (msElapsed,));
                    elif rc != 1:
                        reporter.error('waitForEvents returned "%s" after %u ms, expected 1' % (rc, msElapsed));
                    if msElapsed > 15000:
                        reporter.error('waitForEvents after %u ms, expected just above 2-3 seconds' % (msElapsed,));
                    elif msElapsed < 100:
                        reporter.error('waitForEvents after %u ms, expected more than 100 ms.' % (msElapsed,));

                oThread.join();
                oThread = None;
                if reporter.testErrorCount() != 0:
                    break;
                reporter.log('Iteration %u was successful...' % (i + 1,));
        return reporter.testDone()[1] == 0;
Example #45
0
    def testSnapshotTreeDepth(self):
        """
        Test snapshot tree depth.
        """
        reporter.testStart('snapshotTreeDepth')

        try:
            oVBox = self.oTstDrv.oVBoxMgr.getVirtualBox()
            oVM = self.oTstDrv.createTestVM('test-snap', 1, None, 4)
            assert oVM is not None

            # modify the VM config, create and attach empty HDD
            oSession = self.oTstDrv.openSession(oVM)
            sHddPath = os.path.join(self.oTstDrv.sScratchPath,
                                    'TestSnapEmpty.vdi')
            fRc = True
            fRc = fRc and oSession.createAndAttachHd(
                sHddPath,
                cb=1024 * 1024,
                sController='SATA Controller',
                fImmutable=False)
            fRc = fRc and oSession.saveSettings()

            # take 250 snapshots (snapshot tree depth limit)
            cSnapshots = 13  #00
            for i in range(1, cSnapshots + 1):
                fRc = fRc and oSession.takeSnapshot('Snapshot ' + str(i))
            fRc = oSession.close() and fRc
            oSession = None
            reporter.log('API reports %i snapshots' % (oVM.snapshotCount))
            fRc = fRc and oVM.snapshotCount == cSnapshots

            assert fRc is True

            # unregister, making sure the images are closed
            sSettingsFile = oVM.settingsFilePath
            fDetachAll = random.choice([False, True])
            if fDetachAll:
                reporter.log('unregistering VM, DetachAll style')
            else:
                reporter.log('unregistering VM, UnregisterOnly style')
            self.oTstDrv.forgetTestMachine(oVM)
            if fDetachAll:
                aoHDs = oVM.unregister(
                    vboxcon.CleanupMode_DetachAllReturnHardDisksOnly)
                for oHD in aoHDs:
                    oHD.close()
                aoHDs = None
            else:
                oVM.unregister(vboxcon.CleanupMode_UnregisterOnly)
            oVM = None

            # If there is no base image (expected) then there are no leftover
            # child images either. Can be changed later once the todos above
            # and below are resolved.
            cBaseImages = len(
                self.oTstDrv.oVBoxMgr.getArray(oVBox, 'hardDisks'))
            reporter.log('API reports %i base images' % (cBaseImages))
            fRc = fRc and cBaseImages == 0

            # re-register to test loading of settings
            reporter.log('opening VM %s, testing config reading' %
                         (sSettingsFile))
            oVM = oVBox.openMachine(sSettingsFile)
            reporter.log('API reports %i snapshots' % (oVM.snapshotCount))
            fRc = fRc and oVM.snapshotCount == cSnapshots

            reporter.log('unregistering VM')
            oVM.unregister(vboxcon.CleanupMode_UnregisterOnly)
            oVM = None

            cBaseImages = len(
                self.oTstDrv.oVBoxMgr.getArray(oVBox, 'hardDisks'))
            reporter.log('API reports %i base images' % (cBaseImages))
            fRc = fRc and cBaseImages == 0

            assert fRc is True
        except:
            reporter.errorXcpt()

        return reporter.testDone()[1] == 0
Example #46
0
    def testOneVmConfig(self, oVM, oTestVm):
        """
        Runs tests using one specific VM config.
        """

        self.logVmInfo(oVM)

        reporter.testStart("Audio Testing")

        fSkip = False

        if  oTestVm.isWindows() \
        and oTestVm.sKind in ('WindowsNT4', 'Windows2000'): # Too old for DirectSound and WASAPI backends.
            reporter.log(
                'Audio testing skipped, not implemented/available for that OS yet.'
            )
            fSkip = True

        if  not fSkip \
        and self.fpApiVer < 7.0:
            reporter.log('Audio testing for non-trunk builds skipped.')
            fSkip = True

        if not fSkip:
            sVkatExe = self.getBinTool('vkat')
            asArgs = [sVkatExe, 'enum', '--probe-backends']
            fRc = self.executeHst("VKAT Host Audio Probing", asArgs)
            if not fRc:
                # Not fatal, as VBox then should fall back to the NULL audio backend (also worth having as a test case).
                reporter.log(
                    'Warning: Backend probing on host failed, no audio available (pure server installation?)'
                )

        if fSkip:
            reporter.testDone(fSkipped=True)
            return True

        # Reconfigure the VM.
        oSession = self.openSession(oVM)
        if oSession is not None:
            # Set extra data.
            for sExtraData in self.asOptExtraData:
                sKey, sValue = sExtraData.split(':')
                reporter.log('Set extradata: %s => %s' % (sKey, sValue))
                fRc = oSession.setExtraData(sKey, sValue) and fRc

            # Make sure that the VM's audio adapter is configured the way we need it to.
            if self.fpApiVer >= 4.0:
                enmAudioControllerType = None
                reporter.log('Configuring audio controller type ...')
                if self.sAudioControllerType is None:
                    oOsType = oSession.getOsType()
                    enmAudioControllerType = oOsType.recommendedAudioController
                else:
                    if self.sAudioControllerType == 'HDA':
                        enmAudioControllerType = vboxcon.AudioControllerType_HDA
                    elif self.sAudioControllerType == 'AC97':
                        enmAudioControllerType = vboxcon.AudioControllerType_AC97
                    elif self.sAudioControllerType == 'SB16':
                        enmAudioControllerType = vboxcon.AudioControllerType_SB16
                    assert enmAudioControllerType is not None

                reporter.log(
                    'Setting user-defined audio controller type to %d' %
                    (enmAudioControllerType))
                oSession.setupAudio(enmAudioControllerType,
                                    fEnable=True,
                                    fEnableIn=True,
                                    fEnableOut=True)

            # Save the settings.
            fRc = fRc and oSession.saveSettings()
            fRc = oSession.close() and fRc

        reporter.testStart('Waiting for TXS')
        oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(
            oTestVm.sVmName,
            fCdWait=True,
            cMsTimeout=3 * 60 * 1000,
            sFileCdWait='${OS/ARCH}/vkat${EXESUFF}')
        reporter.testDone()

        reporter.log(
            'Waiting for any OS startup sounds getting played (to skip those) ...'
        )
        time.sleep(90)

        if oSession is not None:
            self.addTask(oTxsSession)

            fRc = self.doTest(oTestVm, oSession, oTxsSession)

            # Cleanup.
            self.removeTask(oTxsSession)
            self.terminateVmBySession(oSession)

        reporter.testDone()
        return fRc
Example #47
0
    def testMediumMove(self):
        """
        Test medium moving.
        """
        reporter.testStart('medium moving')

        try:
            oVM = self.createTestVM('test-medium-move', 1, None, 4)
            assert oVM is not None

            # create virtual disk image vdi
            fRc = True
            c = 0
            oSession = self.openSession(oVM)
            for i in self.suffixes:
                sHddPath = os.path.join(self.sScratchPath, 'Test' + str(c) + i)
                oHd = oSession.createBaseHd(sHddPath, cb=1024 * 1024)
                if oHd is None:
                    fRc = False
                    break

                # attach HDD, IDE controller exists by default, but we use SATA just in case
                sController = 'SATA Controller'
                fRc = fRc and oSession.attachHd(sHddPath,
                                                sController,
                                                iPort=c,
                                                iDevice=0,
                                                fImmutable=False,
                                                fForceResource=False)
                fRc = fRc and oSession.saveSettings()

            #create temporary subdirectory in the current working directory
            sOrigLoc = self.sScratchPath
            sNewLoc = os.path.join(sOrigLoc, 'newLocation/')

            os.makedirs(sNewLoc, 0775)

            aListOfAttach = oVM.getMediumAttachmentsOfController(sController)
            #case 1. Only path without file name
            sLocation = sNewLoc
            self.setLocation(sLocation, aListOfAttach)

            #case 2. Only path without file name without '\' or '/' at the end
            sLocation = sOrigLoc
            self.setLocation(sLocation, aListOfAttach)

            #case 3. Path with file name
            sLocation = sNewLoc + 'newName.vdi'
            self.setLocation(sLocation, aListOfAttach)

            #case 4. Only file name
            sLocation = 'onlyMediumName'
            self.setLocation(sLocation, aListOfAttach)

            #case 5. Move snapshot
            fRc = fRc and oSession.takeSnapshot('Snapshot1')
            sLocation = sOrigLoc
            #get fresh attachments after snapshot
            aListOfAttach = oVM.getMediumAttachmentsOfController(sController)
            self.setLocation(sLocation, aListOfAttach)

            fRc = oSession.close() and fRc

            assert fRc is True
        except:
            reporter.errorXcpt()

        return reporter.testDone()[1] == 0
Example #48
0
    def actionExecute(self, oTestDrv, fnCallback):  # pylint: disable=R0914
        """
        For base.TestDriver.actionExecute.  Calls the callback function for
        each of the VMs and basic configuration variations (virt-mode and cpu
        count).

        Returns True if all fnCallback calls returned True, otherwise False.

        The callback can return True, False or None. The latter is for when the
        test is skipped.  (True is for success, False is for failure.)
        """

        self._removeUnsupportedVirtModes(oTestDrv)
        cMaxCpus = oTestDrv.getHostCpuCount()

        #
        # The test loop.
        #
        fRc = True
        for oTestVm in self.aoTestVms:
            if oTestVm.fSkip and self.fIgnoreSkippedVm:
                reporter.log2('Ignoring VM %s (fSkip = True).' %
                              (oTestVm.sVmName, ))
                continue
            reporter.testStart(oTestVm.sVmName)
            if oTestVm.fSkip:
                reporter.testDone(fSkipped=True)
                continue

            # Intersect the supported modes and the ones being testing.
            asVirtModesSup = [
                sMode for sMode in oTestVm.asVirtModesSup
                if sMode in self.asVirtModes
            ]

            # Ditto for CPUs.
            acCpusSup = [
                cCpus for cCpus in oTestVm.acCpusSup if cCpus in self.acCpus
            ]

            # Ditto for paravirtualization modes, except if not specified we got a less obvious default.
            if self.asParavirtModes is not None and oTestDrv.fpApiVer >= 5.0:
                asParavirtModes = [
                    sPvMode for sPvMode in oTestVm.asParavirtModesSup
                    if sPvMode in self.asParavirtModes
                ]
                assert None not in asParavirtModes
            elif oTestDrv.fpApiVer >= 5.0:
                asParavirtModes = (oTestVm.asParavirtModesSup[0], )
                assert asParavirtModes[0] is not None
            else:
                asParavirtModes = (None, )

            for cCpus in acCpusSup:
                if cCpus == 1:
                    reporter.testStart('1 cpu')
                else:
                    reporter.testStart('%u cpus' % (cCpus))
                    if cCpus > cMaxCpus:
                        reporter.testDone(fSkipped=True)
                        continue

                cTests = 0
                for sVirtMode in asVirtModesSup:
                    if sVirtMode == 'raw' and cCpus > 1:
                        continue
                    reporter.testStart('%s' % (g_dsVirtModeDescs[sVirtMode], ))
                    cStartTests = cTests

                    for sParavirtMode in asParavirtModes:
                        if sParavirtMode is not None:
                            assert oTestDrv.fpApiVer >= 5.0
                            reporter.testStart('%s' % (sParavirtMode, ))

                        # Reconfigure the VM.
                        try:
                            (rc2, oVM) = oTestVm.getReconfiguredVm(
                                oTestDrv,
                                cCpus,
                                sVirtMode,
                                sParavirtMode=sParavirtMode)
                        except KeyboardInterrupt:
                            raise
                        except:
                            reporter.errorXcpt(cFrames=9)
                            rc2 = False
                        if rc2 is True:
                            # Do the testing.
                            try:
                                rc2 = fnCallback(oVM, oTestVm)
                            except KeyboardInterrupt:
                                raise
                            except:
                                reporter.errorXcpt(cFrames=9)
                                rc2 = False
                            if rc2 is False:
                                reporter.maybeErr(
                                    reporter.testErrorCount() == 0,
                                    'fnCallback failed')
                        elif rc2 is False:
                            reporter.log('getReconfiguredVm failed')
                        if rc2 is False:
                            fRc = False

                        cTests = cTests + (rc2 is not None)
                        if sParavirtMode is not None:
                            reporter.testDone(fSkipped=(rc2 is None))

                    reporter.testDone(fSkipped=cTests == cStartTests)

                reporter.testDone(fSkipped=cTests == 0)

            _, cErrors = reporter.testDone()
            if cErrors > 0:
                fRc = False
        return fRc
Example #49
0
    def testWindowsInstallAdditions(self, oSession, oTxsSession, oTestVm):
        """
        Installs the Windows guest additions using the test execution service.
        Since this involves rebooting the guest, we will have to create a new TXS session.
        """

        # Set system-wide env vars to enable release logging on some applications.
        self.setGuestEnvVar(oSession, oTxsSession, oTestVm, 'VBOXTRAY_RELEASE_LOG', 'all.e.l.l2.l3.f');
        self.setGuestEnvVar(oSession, oTxsSession, oTestVm, 'VBOXTRAY_RELEASE_LOG_FLAGS', 'time thread group append');
        self.setGuestEnvVar(oSession, oTxsSession, oTestVm, 'VBOXTRAY_RELEASE_LOG_DEST',
                            ('file=%s' % (self.getGuestVBoxTrayClientLogFile(oTestVm),)));

        #
        # Install the public signing key.
        #
        if oTestVm.sKind not in ('WindowsNT4', 'Windows2000', 'WindowsXP', 'Windows2003'):
            fRc = self.txsRunTest(oTxsSession, 'VBoxCertUtil.exe', 1 * 60 * 1000,
                                   '${CDROM}/%s/cert/VBoxCertUtil.exe' % self.sGstPathGaPrefix,
                                  ('${CDROM}/%s/cert/VBoxCertUtil.exe' % self.sGstPathGaPrefix, 'add-trusted-publisher',
                                   '${CDROM}/%s/cert/vbox-sha1.cer'    % self.sGstPathGaPrefix),
                                  fCheckSessionStatus = True);
            if not fRc:
                reporter.error('Error installing SHA1 certificate');
            else:
                fRc = self.txsRunTest(oTxsSession, 'VBoxCertUtil.exe', 1 * 60 * 1000,
                                       '${CDROM}/%s/cert/VBoxCertUtil.exe' % self.sGstPathGaPrefix,
                                      ('${CDROM}/%s/cert/VBoxCertUtil.exe' % self.sGstPathGaPrefix, 'add-trusted-publisher',
                                       '${CDROM}/%s/cert/vbox-sha256.cer'  % self.sGstPathGaPrefix), fCheckSessionStatus = True);
                if not fRc:
                    reporter.error('Error installing SHA256 certificate');

        #
        # Delete relevant log files.
        #
        # Note! On some guests the files in question still can be locked by the OS, so ignore
        #       deletion errors from the guest side (e.g. sharing violations) and just continue.
        #
        sWinDir = self.getGuestWinDir(oTestVm);
        aasLogFiles = [
            ( oTestVm.pathJoin(sWinDir, 'setupapi.log'), 'ga-setupapi-%s.log' % (oTestVm.sVmName,), ),
            ( oTestVm.pathJoin(sWinDir, 'setupact.log'), 'ga-setupact-%s.log' % (oTestVm.sVmName,), ),
            ( oTestVm.pathJoin(sWinDir, 'setuperr.log'), 'ga-setuperr-%s.log' % (oTestVm.sVmName,), ),
        ];

        # Apply The SetupAPI logging level so that we also get the (most verbose) setupapi.dev.log file.
        ## @todo !!! HACK ALERT !!! Add the value directly into the testing source image. Later.
        sRegExe = oTestVm.pathJoin(self.getGuestSystemDir(oTestVm), 'reg.exe');
        fHaveSetupApiDevLog = self.txsRunTest(oTxsSession, 'Enabling setupapi.dev.log', 30 * 1000,
                                              sRegExe,
                                              (sRegExe, 'add',
                                               '"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup"',
                                               '/v', 'LogLevel', '/t', 'REG_DWORD', '/d', '0xFF'),
                                               fCheckSessionStatus = True);

        for sGstFile, _ in aasLogFiles:
            self.txsRmFile(oSession, oTxsSession, sGstFile, 10 * 1000, fIgnoreErrors = True);

        #
        # The actual install.
        # Enable installing the optional auto-logon modules (VBoxGINA/VBoxCredProv).
        # Also tell the installer to produce the appropriate log files.
        #
        fRc = self.txsRunTest(oTxsSession, 'VBoxWindowsAdditions.exe', 5 * 60 * 1000,
                               '${CDROM}/%s/VBoxWindowsAdditions.exe' % self.sGstPathGaPrefix,
                              ('${CDROM}/%s/VBoxWindowsAdditions.exe' % self.sGstPathGaPrefix, '/S', '/l', '/with_autologon'),
                              fCheckSessionStatus = True);

        # Add the Windows Guest Additions installer files to the files we want to download
        # from the guest. Note: There won't be a install_ui.log because of the silent installation.
        sGuestAddsDir = 'C:\\Program Files\\Oracle\\VirtualBox Guest Additions\\';
        aasLogFiles.append((sGuestAddsDir + 'install.log',           'ga-install-%s.log' % (oTestVm.sVmName,),));
        aasLogFiles.append((sGuestAddsDir + 'install_drivers.log',   'ga-install_drivers-%s.log' % (oTestVm.sVmName,),));
        aasLogFiles.append(('C:\\Windows\\setupapi.log',             'ga-setupapi-%s.log' % (oTestVm.sVmName,),));

        # Note: setupapi.dev.log only is available since Windows 2000.
        if fHaveSetupApiDevLog:
            aasLogFiles.append(('C:\\Windows\\setupapi.dev.log',     'ga-setupapi.dev-%s.log' % (oTestVm.sVmName,),));

        #
        # Download log files.
        # Ignore errors as all files above might not be present (or in different locations)
        # on different Windows guests.
        #
        self.txsDownloadFiles(oSession, oTxsSession, aasLogFiles, fIgnoreErrors = True);

        #
        # Reboot the VM and reconnect the TXS session.
        #
        if fRc:
            reporter.testStart('Rebooting guest w/ updated Guest Additions active');
            (fRc, oTxsSession) = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, cMsTimeout = 15 * 60 * 1000);
            if fRc:
                pass;
            else:
                reporter.testFailure('Rebooting and reconnecting to TXS service failed');
            reporter.testDone();
        else:
            reporter.error('Error installing Windows Guest Additions (installer returned with exit code <> 0)')

        return (fRc, oTxsSession);
Example #50
0
    def actionExecute(self, oTestDrv, fnCallback): # pylint: disable=R0914
        """
        For base.TestDriver.actionExecute.  Calls the callback function for
        each of the VMs and basic configuration variations (virt-mode and cpu
        count).

        Returns True if all fnCallback calls returned True, otherwise False.

        The callback can return True, False or None. The latter is for when the
        test is skipped.  (True is for success, False is for failure.)
        """

        self._removeUnsupportedVirtModes(oTestDrv);
        cMaxCpus = oTestDrv.getHostCpuCount();

        #
        # The test loop.
        #
        fRc = True;
        for oTestVm in self.aoTestVms:
            if oTestVm.fSkip and self.fIgnoreSkippedVm:
                reporter.log2('Ignoring VM %s (fSkip = True).' % (oTestVm.sVmName,));
                continue;
            reporter.testStart(oTestVm.sVmName);
            if oTestVm.fSkip:
                reporter.testDone(fSkipped = True);
                continue;

            # Intersect the supported modes and the ones being testing.
            asVirtModesSup = [sMode for sMode in oTestVm.asVirtModesSup if sMode in self.asVirtModes];

            # Ditto for CPUs.
            acCpusSup      = [cCpus for cCpus in oTestVm.acCpusSup      if cCpus in self.acCpus];

            for cCpus in acCpusSup:
                if cCpus == 1:
                    reporter.testStart('1 cpu');
                else:
                    reporter.testStart('%u cpus' % (cCpus));
                    if cCpus > cMaxCpus:
                        reporter.testDone(fSkipped = True);
                        continue;

                cTests = 0;
                for sVirtMode in asVirtModesSup:
                    if sVirtMode == 'raw' and cCpus > 1:
                        continue;

                    for sParavirtMode in oTestVm.asParavirtModes:

                        reporter.testStart("%s/%s" % (g_dsVirtModeDescs[sVirtMode], sParavirtMode if sParavirtMode is not None else "[paravirtualisation provider not set]")); # pylint: disable=C0301

                        # Reconfigure the VM.
                        try:
                            (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode=sParavirtMode);
                        except KeyboardInterrupt:
                            raise;
                        except:
                            reporter.errorXcpt(cFrames = 9);
                            rc2 = False;
                        if rc2 is True:
                            try:
                                rc2 = fnCallback(oVM, oTestVm);
                            except KeyboardInterrupt:
                                raise;
                            except:
                                reporter.errorXcpt(cFrames = 9);
                                rc2 = False;
                            if rc2 is False:
                                reporter.maybeErr(reporter.testErrorCount() == 0, 'fnCallback failed');
                        elif rc2 is False:
                            reporter.log('getReconfiguredVm failed');
                        if rc2 is False:
                            fRc = False;

                        cTests = cTests + (rc2 is not None);
                        reporter.testDone(fSkipped = (rc2 is None));

                reporter.testDone(fSkipped = cTests == 0);

            _, cErrors = reporter.testDone();
            if cErrors > 0:
                fRc = False;
        return fRc;
Example #51
0
    def testInstallAdditions(self, oSession, oTxsSession, oTestVm):
        """
        Tests installing the guest additions
        """
        if oTestVm.isWindows():
            (fRc, oTxsSession) = self.testWindowsInstallAdditions(oSession, oTxsSession, oTestVm);
        elif oTestVm.isLinux():
            (fRc, oTxsSession) = self.testLinuxInstallAdditions(oSession, oTxsSession, oTestVm);
        else:
            reporter.error('Guest Additions installation not implemented for %s yet! (%s)' %
                           (oTestVm.sKind, oTestVm.sVmName,));
            fRc = False;

        #
        # Verify installation of Guest Additions using commmon bits.
        #
        if fRc:
            #
            # Check if the additions are operational.
            #
            try:    oGuest = oSession.o.console.guest;
            except:
                reporter.errorXcpt('Getting IGuest failed.');
                return (False, oTxsSession);

            # Wait for the GAs to come up.
            reporter.testStart('IGuest::additionsRunLevel');
            fRc = self.testIGuest_additionsRunLevel(oSession, oTestVm, oGuest);
            reporter.testDone();

            # Check the additionsVersion attribute. It must not be empty.
            reporter.testStart('IGuest::additionsVersion');
            fRc = self.testIGuest_additionsVersion(oGuest) and fRc;
            reporter.testDone();

            # Check Guest Additions facilities
            reporter.testStart('IGuest::getFacilityStatus');
            fRc = self.testIGuest_getFacilityStatus(oTestVm, oGuest) and fRc;
            reporter.testDone();

            # Do a bit of diagnosis on error.
            if not fRc:
                if oTestVm.isLinux():
                    reporter.log('Boot log:');
                    sCmdJournalCtl = oTestVm.pathJoin(self.getGuestSystemDir(oTestVm), 'journalctl');
                    oTxsSession.syncExec(sCmdJournalCtl, (sCmdJournalCtl, '-b'), fIgnoreErrors = True);
                    reporter.log('Loaded processes:');
                    sCmdPs = oTestVm.pathJoin(self.getGuestSystemDir(oTestVm), 'ps');
                    oTxsSession.syncExec(sCmdPs, (sCmdPs, '-a', '-u', '-x'), fIgnoreErrors = True);
                    reporter.log('Kernel messages:');
                    sCmdDmesg = oTestVm.pathJoin(self.getGuestSystemDir(oTestVm), 'dmesg');
                    oTxsSession.syncExec(sCmdDmesg, (sCmdDmesg), fIgnoreErrors = True);
                    reporter.log('Loaded modules:');
                    sCmdLsMod = oTestVm.pathJoin(self.getGuestSystemAdminDir(oTestVm), 'lsmod');
                    oTxsSession.syncExec(sCmdLsMod, (sCmdLsMod), fIgnoreErrors = True);
                elif oTestVm.isWindows() or oTestVm.isOS2():
                    sShell    = self.getGuestSystemShell(oTestVm);
                    sShellOpt = '/C' if oTestVm.isWindows() or oTestVm.isOS2() else '-c';
                    reporter.log('Loaded processes:');
                    oTxsSession.syncExec(sShell, (sShell, sShellOpt, "tasklist.exe", "/FO", "CSV"), fIgnoreErrors = True);
                    reporter.log('Listing autostart entries:');
                    oTxsSession.syncExec(sShell, (sShell, sShellOpt, "wmic.exe", "startup", "get"), fIgnoreErrors = True);
                    reporter.log('Listing autostart entries:');
                    oTxsSession.syncExec(sShell, (sShell, sShellOpt, "dir",
                                                  oTestVm.pathJoin(self.getGuestSystemDir(oTestVm), 'VBox*')),
                                         fIgnoreErrors = True);
                    reporter.log('Downloading logs ...');
                    self.txsDownloadFiles(oSession, oTxsSession,
                              [ ( self.getGuestVBoxTrayClientLogFile(oTestVm),
                                  'ga-vboxtrayclient-%s.log' % (oTestVm.sVmName,),),
                                ( "C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Dr Watson\\drwtsn32.log",
                                  'ga-drwatson-%s.log' % (oTestVm.sVmName,), ),
                              ],
                                fIgnoreErrors = True);

        return (fRc, oTxsSession);
Example #52
0
    def doTest(self, oSession):
        oConsole = oSession.console
        oGuest = oConsole.guest

        sOSTypeId = oGuest.OSTypeId.lower()
        if sOSTypeId.find("win") == -1:
            reporter.log("Only Windows guests are currently supported")
            reporter.testDone()
            return True

        oGuestSession = oGuest.createSession("Administrator", "password", "",
                                             "Audio Validation Kit")
        guestSessionWaitResult = oGuestSession.waitFor(
            self.oVBoxMgr.constants.GuestSessionWaitResult_Start, 2000)
        reporter.log("guestSessionWaitResult = %d" % guestSessionWaitResult)

        for duration in range(3, 6):
            reporter.testStart("Checking for duration of " + str(duration) +
                               " seconds")
            sPathToPlayer = "D:\\win\\" + ("amd64" if
                                           (sOSTypeId.find('_64') >= 0) else
                                           "x86") + "\\ntPlayToneWaveX.exe"
            oProcess = oGuestSession.processCreate(
                sPathToPlayer,
                ["xxx0", "--total-duration-in-secs",
                 str(duration)], [], [], 0)
            processWaitResult = oProcess.waitFor(
                self.oVBoxMgr.constants.ProcessWaitForFlag_Start, 1000)
            reporter.log("Started: pid %d, waitResult %d" %
                         (oProcess.PID, processWaitResult))

            processWaitResult = oProcess.waitFor(
                self.oVBoxMgr.constants.ProcessWaitForFlag_Terminate,
                2 * duration * 1000)
            reporter.log("Terminated: pid %d, waitResult %d" %
                         (oProcess.PID, processWaitResult))
            time.sleep(
                1)  # Give audio backend sometime to save a stream to .wav file

            absFileName = self.seekLatestAudioFileName(oGuestSession, duration)

            if absFileName is None:
                reporter.testFailure("Unable to find audio file")
                continue

            reporter.log("Checking audio file '" + absFileName + "'")

            diff = self.checkGuestHostTimings(absFileName + ".timing")
            if diff is not None:
                if diff > 0.0:  # Guest sends data quicker than a host can play
                    if diff > 0.01:  # 1% is probably good threshold here
                        reporter.testFailure(
                            "Guest sends audio buffers too quickly")
                else:
                    diff = -diff
                    # Much worse case: guest sends data very slow, host feels starvation
                    if diff > 0.005:  # 0.5% is probably good threshold here
                        reporter.testFailure(
                            "Guest sends audio buffers too slowly")

                reporter.testDone()
            else:
                reporter.testFailure("Unable to parse a file with timings")

        oGuestSession.close()

        del oGuest
        del oConsole

        return True
Example #53
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;

        self.logVmInfo(oVM);

        # We skip Linux Guest Additions testing for VBox < 6.1 for now.
        fVersionIgnored = oTestVm.isLinux() and self.fpApiVer < 6.1;

        if fVersionIgnored:
            reporter.log('Skipping testing for "%s" because VBox version %s is ignored' % (oTestVm.sKind, self.fpApiVer,));
            fRc = True;
        else:
            reporter.testStart('Waiting for TXS');
            if oTestVm.isWindows():
                self.sFileCdWait = ('%s/VBoxWindowsAdditions.exe' % (self.sGstPathGaPrefix,));
            elif oTestVm.isLinux():
                self.sFileCdWait = ('%s/VBoxLinuxAdditions.run' % (self.sGstPathGaPrefix,));

            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = True,
                                                                      cMsCdWait = 5 * 60 * 1000,
                                                                      sFileCdWait = self.sFileCdWait);
            reporter.testDone();

            # Certain Linux guests don't behave accordingly so that detecting the CD isn't working properly.
            # So reboot those guests in the hope that it works finally.
            ### @todo Needs investigation; probably only udev or something is broken there (?).
            if oTestVm.isLinux():
                reporter.testStart('Rebooting and reconnecting to TXS');
                fRc, oTxsSession = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, fCdWait = True,
                                                                    cMsCdWait = 5 * 60 * 1000,
                                                                    sFileCdWait = self.sFileCdWait);
                reporter.testDone();

            if oSession is not None:
                self.addTask(oTxsSession);
                # Do the testing.
                fSkip = 'install' not in self.asTests;
                reporter.testStart('Install');
                if not fSkip:
                    fRc, oTxsSession = self.testInstallAdditions(oSession, oTxsSession, oTestVm);
                reporter.testDone(fSkip);

                if  not fSkip \
                and not fRc:
                    reporter.log('Skipping following tests as Guest Additions were not installed successfully');
                else:
                    fSkip = 'guestprops' not in self.asTests;
                    reporter.testStart('Guest Properties');
                    if not fSkip:
                        fRc = self.testGuestProperties(oSession, oTxsSession, oTestVm) and fRc;
                    reporter.testDone(fSkip);

                    fSkip = 'guestcontrol' not in self.asTests;
                    reporter.testStart('Guest Control');
                    if not fSkip:
                        fRc, oTxsSession = self.aoSubTstDrvs[0].testIt(oTestVm, oSession, oTxsSession);
                    reporter.testDone(fSkip);

                    fSkip = 'sharedfolders' not in self.asTests;
                    reporter.testStart('Shared Folders');
                    if not fSkip:
                        fRc, oTxsSession = self.aoSubTstDrvs[1].testIt(oTestVm, oSession, oTxsSession);
                    reporter.testDone(fSkip or fRc is None);

                ## @todo Save and restore test.

                ## @todo Reset tests.

                ## @todo Final test: Uninstallation.

                # Cleanup.
                self.removeTask(oTxsSession);
                self.terminateVmBySession(oSession);

        return fRc;
 def actionExecute(self):
     # Too many immediate sub-tests.
     if self.sOptWhich == 'immediate-sub-tests':
         reporter.testStart('Too many immediate sub-tests (negative)');
         for i in range(1024):
             reporter.testStart('subsub%d' % i);
             reporter.testDone();
     # Too many sub-tests in total.
     elif self.sOptWhich == 'total-sub-tests':
         reporter.testStart('Too many sub-tests (negative)');
         # 32 * 256 = 2^(5+8) = 2^13 = 8192.
         for i in range(32):
             reporter.testStart('subsub%d' % i);
             for j in range(256):
                 reporter.testStart('subsubsub%d' % j);
                 reporter.testDone();
             reporter.testDone();
     # Too many immediate values.
     elif self.sOptWhich == 'immediate-values':
         reporter.testStart('Too many immediate values (negative)');
         for i in range(512):
             reporter.testValue('value%d' % i, i, 'times');
     # Too many values in total.
     elif self.sOptWhich == 'total-values':
         reporter.testStart('Too many sub-tests (negative)');
         for i in range(256):
             reporter.testStart('subsub%d' % i);
             for j in range(64):
                 reporter.testValue('value%d' % j, i * 10000 + j, 'times');
             reporter.testDone();
     # Too many failure reasons (only immediate since the limit is extremely low).
     elif self.sOptWhich == 'immediate-messages':
         reporter.testStart('Too many immediate messages (negative)');
         for i in range(16):
             reporter.testFailure('Detail %d' % i);
     else:
         reporter.testStart('Unknown test %s' % (self.sOptWhich,));
         reporter.error('Invalid test selected: %s' % (self.sOptWhich,));
     reporter.testDone();
     return True;
    def testIt(self, oTestVm, oSession, oTxsSession):
        """
        Executes the test.

        Returns fRc, oTxsSession.  The latter may have changed.
        """
        reporter.log("Active tests: %s" % (self.asTests, ))

        #
        # Skip the test if before 6.0
        #
        if self.oTstDrv.fpApiVer < 6.0:
            reporter.log('Requires 6.0 or later (for now)')
            return (None, oTxsSession)

        #
        # Create the host directory to share. Empty except for a 'candle.dir' subdir
        # that we use to check that it mounted correctly.
        #
        sSharedFolder1 = os.path.join(self.oTstDrv.sScratchPath, 'shfl1')
        reporter.log2('Creating shared host folder "%s"...' %
                      (sSharedFolder1, ))
        if os.path.exists(sSharedFolder1):
            try:
                shutil.rmtree(sSharedFolder1)
            except:
                return (reporter.errorXcpt('shutil.rmtree(%s)' %
                                           (sSharedFolder1, )), oTxsSession)
        try:
            os.mkdir(sSharedFolder1)
        except:
            return (reporter.errorXcpt('os.mkdir(%s)' % (sSharedFolder1, )),
                    oTxsSession)
        try:
            os.mkdir(os.path.join(sSharedFolder1, 'candle.dir'))
        except:
            return (reporter.errorXcpt('os.mkdir(%s)' % (sSharedFolder1, )),
                    oTxsSession)

        # Guess a free mount point inside the guest.
        if oTestVm.isWindows() or oTestVm.isOS2():
            sMountPoint1 = 'V:'
            sGuestSlash = '\\'
        else:
            sMountPoint1 = '/mnt/shfl1'
            sGuestSlash = '/'

        #
        # Automount a shared folder in the guest.
        #
        reporter.testStart('Automount')

        reporter.log2('Creating shared folder shfl1...')
        try:
            oConsole = oSession.o.console
            oConsole.createSharedFolder('shfl1', sSharedFolder1, True, True,
                                        sMountPoint1)
        except:
            reporter.errorXcpt('createSharedFolder(shfl1,%s,True,True,%s)' %
                               (sSharedFolder1, sMountPoint1))
            reporter.testDone()
            return (False, oTxsSession)

        # Check whether we can see the shared folder now.  Retry for 30 seconds.
        msStart = base.timestampMilli()
        while True:
            fRc = oTxsSession.syncIsDir(sMountPoint1 + sGuestSlash +
                                        'candle.dir')
            reporter.log2('candle.dir check -> %s' % (fRc, ))
            if fRc is not False:
                break
            if base.timestampMilli() - msStart > 30000:
                reporter.error('Shared folder mounting timed out!')
                break
            self.oTstDrv.sleep(1)

        reporter.testDone()
        if fRc is not True:
            return (False, oTxsSession)
            # skip the remainder if we cannot auto mount the folder.

        #
        # Run FsPerf inside the guest.
        #
        fSkip = 'fsperf' not in self.asTests
        if fSkip is False:
            cMbFree = utils.getDiskUsage(sSharedFolder1)
            if cMbFree >= 16:
                reporter.log2('Free space: %u MBs' % (cMbFree, ))
            else:
                reporter.log('Skipping FsPerf because only %u MB free on %s' %
                             (
                                 cMbFree,
                                 sSharedFolder1,
                             ))
                fSkip = True
        if fSkip is False:
            # Common arguments:
            asArgs = [
                'FsPerf', '-d', sMountPoint1 + sGuestSlash + 'fstestdir-1',
                '-s8'
            ]

            # Skip part of mmap on older windows systems without CcCoherencyFlushAndPurgeCache (>= w7).
            reporter.log2('oTestVm.sGuestOsType=%s' % (oTestVm.sGuestOsType, ))
            if   oTestVm.getNonCanonicalGuestOsType() \
              in [ 'WindowsNT3x', 'WindowsNT4', 'Windows2000', 'WindowsXP', 'WindowsXP_64', 'Windows2003',
                   'Windows2003_64', 'WindowsVista', 'WindowsVista_64', 'Windows2008', 'Windows2008_64']:
                asArgs.append('--no-mmap-coherency')

            # Configure I/O block sizes according to guest memory size:
            cbMbRam = 128
            try:
                cbMbRam = oSession.o.machine.memorySize
            except:
                reporter.errorXcpt()
            reporter.log2('cbMbRam=%s' % (cbMbRam, ))
            asArgs.append('--set-block-size=1')
            asArgs.append('--add-block-size=512')
            asArgs.append('--add-block-size=4096')
            asArgs.append('--add-block-size=16384')
            asArgs.append('--add-block-size=65536')
            asArgs.append('--add-block-size=1048576')
            #   1 MiB
            if cbMbRam >= 512:
                asArgs.append('--add-block-size=33554432')
                #  32 MiB
            if cbMbRam >= 768:
                asArgs.append('--add-block-size=134217728')
                # 128 MiB

            # Putting lots (10000) of files in a single directory causes issues on OS X
            # (HFS+ presumably, though could be slow disks) and some linuxes (slow disks,
            # maybe ext2/3?).  So, generally reduce the file count to 4096 everywhere
            # since we're not here to test the host file systems, and 3072 on macs.
            if utils.getHostOs() in [
                    'darwin',
            ]:
                asArgs.append('--many-files=3072')
            elif utils.getHostOs() in [
                    'linux',
            ]:
                asArgs.append('--many-files=4096')

            # Add the extra arguments from the command line and kick it off:
            asArgs.extend(self.asExtraArgs)

            # Run FsPerf:
            reporter.log2('Starting guest FsPerf (%s)...' % (asArgs, ))
            sFsPerfPath = self._locateGstFsPerf(oTxsSession)
            fRc = self.oTstDrv.txsRunTest(oTxsSession, 'FsPerf',
                                          30 * 60 * 1000, sFsPerfPath, asArgs)
            reporter.log2('FsPerf -> %s' % (fRc, ))

            sTestDir = os.path.join(sSharedFolder1, 'fstestdir-1')
            if os.path.exists(sTestDir):
                fRc = reporter.errorXcpt('test directory lingers: %s' %
                                         (sTestDir, ))
                try:
                    shutil.rmtree(sTestDir)
                except:
                    fRc = reporter.errorXcpt('shutil.rmtree(%s)' %
                                             (sTestDir, ))
        else:
            reporter.testStart('FsPerf')
            reporter.testDone(fSkip or fRc is None)

        return (fRc, oTxsSession)
Example #56
0
    def test1OneVM(self, sVmName):
        """
        Runs one VM thru the various configurations.
        """
        reporter.testStart(sVmName);
        fRc = True;
        for sStorageCtrl in self.asStorageCtrls:
            reporter.testStart(sStorageCtrl);

            if sStorageCtrl == 'AHCI':
                eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
            elif sStorageCtrl == 'IDE':
                eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
            elif sStorageCtrl == 'LsiLogicSAS':
                eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
            elif sStorageCtrl == 'LsiLogic':
                eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
            elif sStorageCtrl == 'BusLogic':
                eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
            else:
                eStorageCtrl = None;

            for sDiskFormat in self.asDiskFormats:
                reporter.testStart('%s' % (sDiskFormat));

                if sDiskFormat == "iSCSI":
                    asPaths = self.asIscsiTargets;
                else:
                    asPaths = self.asDirs;

                for sDir in asPaths:
                    reporter.testStart('%s' % (sDir));

                    if sDiskFormat == "iSCSI":
                        sPath = sDir;
                    else:
                        sPath = sDir + "/test.disk";

                    for cCpus in self.acCpus:
                        if cCpus == 1:  reporter.testStart('1 cpu');
                        else:           reporter.testStart('%u cpus' % (cCpus));

                        for sVirtMode in self.asVirtModes:
                            if sVirtMode == 'raw' and cCpus > 1:
                                continue;
                            hsVirtModeDesc = {};
                            hsVirtModeDesc['raw']       = 'Raw-mode';
                            hsVirtModeDesc['hwvirt']    = 'HwVirt';
                            hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
                            reporter.testStart(hsVirtModeDesc[sVirtMode]);

                            fHwVirt       = sVirtMode != 'raw';
                            fNestedPaging = sVirtMode == 'hwvirt-np';
                            fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPath, \
                                                   cCpus, fHwVirt, fNestedPaging)  and  fRc and True; # pychecker hack.
                            reporter.testDone();

                        reporter.testDone();
                    reporter.testDone();
                reporter.testDone();
            reporter.testDone();
        reporter.testDone();
        return fRc;
    def test1Sub6(self, oVmSrc, oVmDst):
        """
        Misconfigure the target VM and check that teleportation fails with the
        same status and message on both ends.
        xTracker: #4813
        """
        reporter.testStart('Misconfiguration & error message')
        if    self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False) \
          and self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True):
            # Give the source a bit more RAM.
            oSession = self.openSession(oVmSrc)
            if oSession is not None:
                try:
                    cbMB = oVmSrc.memorySize + 4
                except:
                    cbMB = 1
                    fRc = False
                fRc = oSession.setRamSize(cbMB)
                if not oSession.saveSettings(): fRc = False
                if not oSession.close(): fRc = False
                oSession = None
            else:
                fRc = False
            if fRc:
                # Start the target VM.
                oSessionDst, oProgressDst = self.startVmEx(oVmDst, fWait=False)
                if oSessionDst is not None:
                    if oProgressDst.waitForOperation(iOperation=-3) == 0:
                        # Start the source VM.
                        oSessionSrc = self.startVm(oVmSrc)
                        if oSessionSrc is not None:
                            # Try teleport.
                            oProgressSrc = oSessionSrc.teleport(
                                'localhost', 6502, 'password')
                            if oProgressSrc:
                                oProgressSrc.wait()
                                oProgressDst.wait()

                                reporter.log('src: %s' %
                                             oProgressSrc.stringifyResult())
                                reporter.log('dst: %s' %
                                             oProgressDst.stringifyResult())

                                # Make sure it failed.
                                if oProgressSrc.isSuccess(
                                ) and oProgressDst.isSuccess():
                                    reporter.testFailure(
                                        'The teleporation did not fail as expected'
                                    )

                                # Compare the results.
                                if oProgressSrc.getResult(
                                ) != oProgressDst.getResult():
                                    reporter.testFailure('Result differs - src=%s dst=%s' \
                                                         % (vbox.ComError.toString(oProgressSrc.getResult()),\
                                                            vbox.ComError.toString(oProgressDst.getResult())))
                                elif oProgressSrc.getErrInfoResultCode(
                                ) != oProgressDst.getErrInfoResultCode():
                                    reporter.testFailure('ErrorInfo::resultCode differs - src=%s dst=%s' \
                                                         % (vbox.ComError.toString(oProgressSrc.getErrInfoResultCode()),\
                                                            vbox.ComError.toString(oProgressDst.getErrInfoResultCode())))
                                elif oProgressSrc.getErrInfoText(
                                ) != oProgressDst.getErrInfoText():
                                    reporter.testFailure('ErrorInfo::text differs - src="%s" dst="%s"' \
                                                         % (oProgressSrc.getErrInfoText(), oProgressDst.getErrInfoText()))

                            self.terminateVmBySession(oSessionSrc,
                                                      oProgressSrc)
                    self.terminateVmBySession(oSessionDst, oProgressDst)
                    self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled=False)
                    self.test1ResetVmConfig(oVmDst, fTeleporterEnabled=True)
            else:
                reporter.testFailure('reconfig #2 failed')
        else:
            reporter.testFailure('reconfig #1 failed')
        return reporter.testDone()[1] == 0
Example #58
0
    def actionExecute(self):
        """
        Execute the testcase itself.
        """
        #self.logVmInfo(self.oVM)

        reporter.testStart('SHUTDOWN GUEST')

        cIter = 0
        fRc = True

        if (self.fExtraVm is True):
            oExtraSession, oExtraTxsSession = self.startVmAndConnectToTxsViaTcp(
                self.sExtraVmName,
                fCdWait=False,
                cMsTimeout=self.kcMsVmStartLimit)
            if oExtraSession is None or oExtraTxsSession is None:
                reporter.error('Unable to start extra VM.')
                if (self.fLocalCatch is True):
                    self._waitKeyboardInterrupt()
                reporter.testDone()
                return False

        while (cIter < self.cShutdownIters):

            cIter += 1

            reporter.log("Starting iteration #%d." % cIter)

            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(
                self.sVmName, fCdWait=False, cMsTimeout=self.kcMsVmStartLimit)
            if oSession is not None and oTxsSession is not None:
                # Wait until guest reported success
                reporter.log(
                    'Guest started. Connection to TXS service established.')

                if (self.fSuspendHost is True):
                    reporter.log("Disconnect form TXS.")
                    fRc = fRc and self.txsDisconnect(oSession, oTxsSession)
                    if (fRc is not True):
                        reporter.log("Disconnect form TXS failed.")
                    else:
                        reporter.log(
                            'Put host to sleep and resume it automatically after %d seconds.'
                            % self.cSecSuspendTime)
                        fRc = fRc and self._SuspendResume(self.cSecSuspendTime)
                        if (fRc is True):
                            reporter.log("Sleep/resume success.")
                        else:
                            reporter.log("Sleep/resume failed.")
                        reporter.log("Re-connect to TXS in 10 seconds.")
                        self.sleep(10)
                        (fRc, oTxsSession) = self.txsDoConnectViaTcp(
                            oSession, 2 * 60 * 10000)
                        if (fRc is not True):
                            reporter.log("Re-connect to TXS failed.")

                if (fRc is True):
                    reporter.log('Attempt to shutdown guest.')
                    fRc = fRc and oTxsSession.syncShutdown(cMsTimeout=(4 * 60 *
                                                                       1000))
                    if (fRc is True):
                        reporter.log('Shutdown request issued successfully.')
                        self.waitOnDirectSessionClose(self.oVM,
                                                      self.kcMsVmShutdownLimit)
                        reporter.log('Shutdown %s.' %
                                     ('success' if fRc is True else 'failed'))
                    else:
                        reporter.error('Shutdown request failed.')

                    # Do not terminate failing VM in order to catch it.
                    if (fRc is not True and self.fLocalCatch is True):
                        self._waitKeyboardInterrupt()
                        break

                    fRc = fRc and self.terminateVmBySession(oSession)
                    reporter.log('VM terminated.')

            else:
                reporter.error('Guest did not start (iteration %d of %d)' %
                               (cIter, self.cShutdownIters))
                fRc = False

            # Stop if fail
            if (fRc is not True):
                break

        # Local catch at the end.
        if (self.fLocalCatch is True):
            reporter.log("Test completed. Waiting for user to press CTRL+C.")
            self._waitKeyboardInterrupt()

        if (self.fExtraVm is True):
            fRc = fRc and self.terminateVmBySession(oExtraSession)

        reporter.testDone()
        return fRc is True
    def test1Sub2(self, oVM):
        """
        Test the attributes, making sure that we get exceptions on bad values.
        """
        reporter.testStart('IMachine::teleport*')

        # Save the original teleporter attributes for the discard test.
        try:
            sOrgAddress = oVM.teleporterAddress
            uOrgPort = oVM.teleporterPort
            sOrgPassword = oVM.teleporterPassword
            fOrgEnabled = oVM.teleporterEnabled
        except:
            reporter.testFailureXcpt()
        else:
            # Open a session and start messing with the properties.
            oSession = self.openSession(oVM)
            if oSession is not None:
                # Anything goes for the address.
                reporter.testStart('teleporterAddress')
                self.test1Sub2SetAddress(oSession, '')
                self.test1Sub2SetAddress(oSession, '1')
                self.test1Sub2SetAddress(oSession, 'Anything goes! ^&$@!$%^')
                reporter.testDone()

                # The port is restricted to {0..65535}.
                reporter.testStart('teleporterPort')
                for uPort in range(0, 1000) + range(16000, 17000) + range(
                        32000, 33000) + range(65000, 65536):
                    if not self.test1Sub2SetPort(oSession, uPort):
                        break
                self.processPendingEvents()
                reporter.testDone()

                reporter.testStart('teleporterPort negative')
                self.test1Sub2SetPort(oSession, 65536, True)
                self.test1Sub2SetPort(oSession, 999999, True)
                reporter.testDone()

                # Anything goes for the password.
                reporter.testStart('teleporterPassword')
                self.test1Sub2SetPassword(oSession, 'password')
                self.test1Sub2SetPassword(oSession, '')
                self.test1Sub2SetPassword(oSession, '1')
                self.test1Sub2SetPassword(oSession, 'Anything goes! ^&$@!$%^')
                reporter.testDone()

                # Just test that it works.
                reporter.testStart('teleporterEnabled')
                self.test1Sub2SetEnabled(oSession, True)
                self.test1Sub2SetEnabled(oSession, True)
                self.test1Sub2SetEnabled(oSession, False)
                self.test1Sub2SetEnabled(oSession, False)
                reporter.testDone()

                # Finally, discard the changes, close the session and check
                # that we're back to the originals.
                if not oSession.discardSettings(True):
                    reporter.testFailure(
                        'Failed to discard settings & close the session')
            else:
                reporter.testFailure('Failed to open VM session')
            try:
                if oVM.teleporterAddress != sOrgAddress:
                    reporter.testFailure(
                        'Rollback failed for teleporterAddress')
                if oVM.teleporterPort != uOrgPort:
                    reporter.testFailure('Rollback failed for teleporterPort')
                if oVM.teleporterPassword != sOrgPassword:
                    reporter.testFailure(
                        'Rollback failed for teleporterPassword')
                if oVM.teleporterEnabled != fOrgEnabled:
                    reporter.testFailure(
                        'Rollback failed for teleporterEnabled')
            except:
                reporter.testFailureXcpt()
        return reporter.testDone()[1] != 0
Example #60
0
    def testAutostartRunProgs(self, oSession, oTxsSession, sVmName):
        """
        Test VirtualBoxs autostart feature in a VM.
        """
        reporter.testStart('Autostart ' + sVmName)

        oGuestOsHlp = None  # type: tdAutostartOs
        if sVmName == self.ksOsLinux:
            oGuestOsHlp = tdAutostartOsLinux(self, self.sTestBuildDir)
        elif sVmName == self.ksOsSolaris:
            oGuestOsHlp = tdAutostartOsSolaris(self, self.sTestBuildDir)
            # annoying - pylint: disable=redefined-variable-type
        elif sVmName == self.ksOsDarwin:
            oGuestOsHlp = tdAutostartOsDarwin(self.sTestBuildDir)
        elif sVmName == self.ksOsWindows:
            oGuestOsHlp = tdAutostartOsWin(self.sTestBuildDir)

        sTestUserAllow = 'test1'
        sTestUserDeny = 'test2'
        sTestVmName = 'TestVM'

        if oGuestOsHlp is not None:
            # Create two new users
            fRc = oGuestOsHlp.createUser(oTxsSession, sTestUserAllow)
            fRc = fRc and oGuestOsHlp.createUser(oTxsSession, sTestUserDeny)
            if fRc is True:
                # Install VBox first
                fRc = oGuestOsHlp.installVirtualBox(oSession, oTxsSession)
                if fRc is True:
                    fRc = oGuestOsHlp.configureAutostart(
                        oSession, oTxsSession, 'allow', (sTestUserAllow, ),
                        (sTestUserDeny, ))
                    if fRc is True:
                        # Create a VM with autostart enabled in the guest for both users
                        fRc = oGuestOsHlp.createTestVM(oSession, oTxsSession,
                                                       sTestUserAllow,
                                                       sTestVmName)
                        fRc = fRc and oGuestOsHlp.createTestVM(
                            oSession, oTxsSession, sTestUserDeny, sTestVmName)
                        if fRc is True:
                            # Reboot the guest
                            (fRc, oTxsSession) = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, cMsTimeout = 3 * 60000, \
                                                                                  fNatForwardingForTxs = True)
                            if fRc is True:
                                # Fudge factor - Allow the guest to finish starting up.
                                self.sleep(5)
                                fRc = oGuestOsHlp.checkForRunningVM(
                                    oSession, oTxsSession, sTestUserAllow,
                                    sTestVmName)
                                if fRc is False:
                                    reporter.error(
                                        'Test VM is not running inside the guest for allowed user'
                                    )

                                fRc = oGuestOsHlp.checkForRunningVM(
                                    oSession, oTxsSession, sTestUserDeny,
                                    sTestVmName)
                                if fRc is True:
                                    reporter.error(
                                        'Test VM is running inside the guest for denied user'
                                    )
                            else:
                                reporter.log('Rebooting the guest failed')
                        else:
                            reporter.log('Creating test VM failed')
                    else:
                        reporter.log(
                            'Configuring autostart in the guest failed')
                else:
                    reporter.log('Installing VirtualBox in the guest failed')
            else:
                reporter.log('Creating test users failed')
        else:
            reporter.log('Guest OS helper not created for VM %s' % (sVmName))
            fRc = False

        reporter.testDone(not fRc)
        return fRc