• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python reporter.testFailure函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中testdriver.reporter.testFailure函数的典型用法代码示例。如果您正苦于以下问题:Python testFailure函数的具体用法?Python testFailure怎么用?Python testFailure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了testFailure函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test1Sub2SetPort

    def test1Sub2SetPort(self, oSession, uPort, fInvalid = False):
        """ This can fail, thus fInvalid."""
        if not fInvalid:
            uOld = uPort;
        else:
            try:    uOld = oSession.o.machine.teleporterPort;
            except: return reporter.testFailureXcpt();

        try:
            oSession.o.machine.teleporterPort = uPort;
        except Exception as oXcpt:
            if not fInvalid or vbox.ComError.notEqual(oXcpt, vbox.ComError.E_INVALIDARG):
                return reporter.testFailureXcpt('machine.teleporterPort=%u' % (uPort,));
        else:
            if fInvalid:
                return reporter.testFailureXcpt('machine.teleporterPort=%u succeeded unexpectedly' % (uPort,));

        try:    uNew = oSession.o.machine.teleporterPort;
        except: return reporter.testFailureXcpt();
        if uNew != uOld:
            if not fInvalid:
                reporter.testFailure('machine.teleporterPort=%u but afterwards it is actually %u' % (uPort, uNew));
            else:
                reporter.testFailure('machine.teleporterPort is %u after failure, expected %u' % (uNew, uOld));
            return False;
        return True;
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:26,代码来源:tdTeleportLocal1.py


示例2: test1Sub5

    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;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:28,代码来源:tdTeleportLocal1.py


示例3: test1

    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;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:33,代码来源:tdTeleportLocal1.py


示例4: test1Sub3

    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;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:29,代码来源:tdTeleportLocal1.py


示例5: testBenchmark

    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;
开发者ID:miguelinux,项目名称:vbox,代码行数:35,代码来源:tdStorageBenchmark1.py


示例6: testBenchmark

    def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor, dTestSet, \
                      cMsTimeout = 3600000):
        """
        Runs the given benchmark on the test host.
        """

        dTestSet['FilePath'] = sMountpoint;
        dTestSet['TargetOs'] = sTargetOs;

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

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

        oTst.cleanup();

        return fRc;
开发者ID:svn2github,项目名称:virtualbox,代码行数:30,代码来源:tdStorageBenchmark1.py


示例7: test1OneCfg

    def test1OneCfg(self, oVM, cCpus, fHwVirt, fNestedPaging):
        """
        Runs the specified VM thru test #1.

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

        # Reconfigure the VM
        fRc = True
        oSession = self.openSession(oVM)
        if oSession is not None:
            fRc = fRc and oSession.enableVirtEx(fHwVirt)
            fRc = fRc and oSession.enableNestedPaging(fNestedPaging)
            fRc = fRc and oSession.setCpuCount(cCpus)
            fRc = fRc and oSession.setupBootLogo(True, 2500)
            # Race avoidance fudge.
            fRc = fRc and oSession.saveSettings()
            fRc = oSession.close() and fRc and True
            # pychecker hack.
            oSession = None
        else:
            fRc = False

        # Zap the state (used by the callback).
        self.fCallbackFired = False
        self.fCallbackSuccess = False

        # Start up.
        if fRc is True:
            self.logVmInfo(oVM)
            oSession = self.startVm(oVM)
            if oSession is not None:
                # Set up a callback for catching the runtime error. !Races the guest bootup!
                oConsoleCallbacks = oSession.registerDerivedEventHandler(tdCpuPae1ConsoleCallbacks, {"oTstDrv": self})

                fRc = False
                if oConsoleCallbacks is not None:
                    self.addTask(oSession)

                    # Wait for 30 seconds for something to finish.
                    tsStart = base.timestampMilli()
                    while base.timestampMilli() - tsStart < 30000:
                        oTask = self.waitForTasks(1000)
                        if oTask is not None:
                            break
                        if self.fCallbackFired:
                            break
                    if not self.fCallbackFired:
                        reporter.testFailure("the callback did not fire")
                    fRc = self.fCallbackSuccess

                    # cleanup.
                    oConsoleCallbacks.unregister()
                self.terminateVmBySession(oSession)  # , fRc);
            else:
                fRc = False
        return fRc
开发者ID:swimming198243,项目名称:virtualbox,代码行数:58,代码来源:tdCpuPae1.py


示例8: _installVBox

    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;
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:58,代码来源:vboxinstaller.py


示例9: actionExecute

    def actionExecute(self):

        # Testing PushHint/PopHint.
        reporter.testStart('Negative XML #1');
        oSubXmlFile = reporter.FileWrapperTestPipe();
        oSubXmlFile.write('<Test timestamp="%s" name="foobar3">\n\n\t\n\r\n' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('<Test timestamp="%s" name="sub3">' % (utils.getIsoTimestamp(),));
        oSubXmlFile.write('<Test timestamp="%s" name="subsub1">' % (utils.getIsoTimestamp(),));
        oSubXmlFile.close();
        reporter.testDone();

        # Missing end, like we had with IRPT at one time.
        reporter.testStart('Negative XML #2 (IPRT)');
        oSubXmlFile = reporter.FileWrapperTestPipe();
        oSubXmlFile.write("""
<?xml version="1.0" encoding="UTF-8" ?>
<Test timestamp="2013-05-29T08:59:05.930602000Z" name="tstRTGetOpt">
  <Test timestamp="2013-05-29T08:59:05.930656000Z" name="Basics">
    <Passed timestamp="2013-05-29T08:59:05.930756000Z"/>
  </Test>
  <Test timestamp="2013-05-29T08:59:05.930995000Z" name="RTGetOpt - IPv4">
    <Passed timestamp="2013-05-29T08:59:05.931036000Z"/>
  </Test>
  <Test timestamp="2013-05-29T08:59:05.931161000Z" name="RTGetOpt - MAC Address">
    <Passed timestamp="2013-05-29T08:59:05.931194000Z"/>
  </Test>
  <Test timestamp="2013-05-29T08:59:05.931313000Z" name="RTGetOpt - Option w/ Index">
    <Passed timestamp="2013-05-29T08:59:05.931357000Z"/>
  </Test>
  <Test timestamp="2013-05-29T08:59:05.931475000Z" name="RTGetOptFetchValue">
    <Passed timestamp="2013-05-29T08:59:05.931516000Z"/>
  </Test>
  <Test timestamp="2013-05-29T08:59:05.931640000Z" name="RTGetOpt - bool on/off">
    <Passed timestamp="2013-05-29T08:59:05.931687000Z"/>
  </Test>
  <Test timestamp="2013-05-29T08:59:05.931807000Z" name="Standard options">
    <Passed timestamp="2013-05-29T08:59:05.931843000Z"/>
  </Test>
  <Test timestamp="2013-05-29T08:59:05.931963000Z" name="Options first">
    <Passed timestamp="2013-05-29T08:59:05.932035000Z"/>
  </Test>
""");
        oSubXmlFile.close();
        oSubXmlFile = None;
        reporter.testDone();

        # The use of testFailure.
        reporter.testStart('Using testFailure()');
        reporter.testValue('value-name3',  12345678, 'times');
        reporter.testFailure('failure detail message');
        reporter.testDone();

        return True;
开发者ID:mcenirm,项目名称:vbox,代码行数:53,代码来源:tdSelfTest3.py


示例10: onRuntimeError

 def onRuntimeError(self, fFatal, sErrId, sMessage):
     """ Verify the error. """
     reporter.log('onRuntimeError: fFatal=%s sErrId="%s" sMessage="%s"' % (fFatal, sErrId, sMessage))
     if sErrId != "PAEmode":
         reporter.testFailure("sErrId=%s, expected PAEmode" % (sErrId,))
     elif fFatal is not True:
         reporter.testFailure("fFatal=%s, expected True" % (fFatal,))
     else:
         self.oTstDrv.fCallbackSuccess = True
     self.oTstDrv.fCallbackFired = True
     self.oVBoxMgr.interruptWaitEvents()
     return None
开发者ID:swimming198243,项目名称:virtualbox,代码行数:12,代码来源:tdCpuPae1.py


示例11: test1Sub1DoTeleport

 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)));
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:13,代码来源:tdTeleportLocal1.py


示例12: test1Sub2SetEnabled

 def test1Sub2SetEnabled(self, oSession, fEnabled):
     """ This should never fail."""
     try:
         oSession.o.machine.teleporterEnabled = fEnabled;
     except:
         reporter.testFailureXcpt('machine.teleporterEnabled=%s' % (fEnabled,));
         return False;
     try:
         fNew = oSession.o.machine.teleporterEnabled;
     except:
         reporter.testFailureXcpt();
         return False;
     if fNew != fEnabled:
         reporter.testFailure('machine.teleporterEnabled=%s but afterwards it is actually %s' % (fEnabled, fNew));
         return False;
     return True;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:16,代码来源:tdTeleportLocal1.py


示例13: test1Sub2SetPassword

 def test1Sub2SetPassword(self, oSession, sPassword):
     """ This should never fail."""
     try:
         oSession.o.machine.teleporterPassword = sPassword;
     except:
         reporter.testFailureXcpt('machine.teleporterPassword=%s' % (sPassword,));
         return False;
     try:
         sNew = oSession.o.machine.teleporterPassword;
     except:
         reporter.testFailureXcpt();
         return False;
     if sNew != sPassword:
         reporter.testFailure('machine.teleporterPassword="%s" but afterwards it is actually "%s"' % (sPassword, sNew));
         return False;
     return True;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:16,代码来源:tdTeleportLocal1.py


示例14: test1Sub2SetAddress

 def test1Sub2SetAddress(self, oSession, sAddress):
     """ This should never fail."""
     try:
         oSession.o.machine.teleporterAddress = sAddress;
     except:
         reporter.testFailureXcpt('machine.teleporterAddress=%s' % (sAddress,));
         return False;
     try:
         sNew = oSession.o.machine.teleporterAddress;
     except:
         reporter.testFailureXcpt();
         return False;
     if sNew != sAddress:
         reporter.testFailure('machine.teleporterAddress="%s" but afterwards it is actually "%s"' % (sAddress, sNew));
         return False;
     return True;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:16,代码来源:tdTeleportLocal1.py


示例15: __testScenario_6

    def __testScenario_6(self, oMachine, sNewLoc, sOldLoc):
        """
        There is a floppy image (.img) attached to the VM.
        Prerequisites - there is Floppy Controller and there are no any images attached to it.
        """

        fRc = True

        # Always clear before each scenario.
        dsReferenceFiles = defaultdict(set)

        # Create a new Session object.
        oSession = self.oTstDrv.openSession(oMachine)

        sFloppyLoc = self.asRsrcs[1] # '5.3/floppy/tdMoveVM1.img'
        sFloppyLoc = self.oTstDrv.getFullResourceName(sFloppyLoc)

        if not os.path.exists(sFloppyLoc):
            reporter.log('Floppy disk does not exist at "%s"' % (sFloppyLoc,))
            fRc = False

        # Copy floppy image from the common resource folder into machine folder.
        shutil.copy(sFloppyLoc, sOldLoc)

        # Attach floppy image.
        if fRc is True:
            # Set actual floppy location.
            sFloppyImageName = 'tdMoveVM1.img'
            sFloppyLoc = sOldLoc + os.sep + sFloppyImageName
            sController=self.dsKeys['FloppyImage']
            fRc = fRc and oSession.attachFloppy(sFloppyLoc, sController, 0, 0)
            dsReferenceFiles['FloppyImage'].add(os.path.join(os.path.join(sNewLoc, oMachine.name), sFloppyImageName))

        if fRc is True:
            fRc = self.moveVMToLocation(sNewLoc, oSession.o.machine)
            if fRc is True:
                fRc = self.checkLocation(oSession.o.machine, dsReferenceFiles)
                if fRc is False:
                    reporter.testFailure('!!!!!!!!!!!!!!!!!! 6th scenario: Check locations failed... !!!!!!!!!!!!!!!!!!')
            else:
                reporter.testFailure('!!!!!!!!!!!!!!!!!! 6th scenario: Move VM failed... !!!!!!!!!!!!!!!!!!')
        else:
            reporter.testFailure('!!!!!!!!!!!!!!!!!! 6th scenario: Attach floppy image failed... !!!!!!!!!!!!!!!!!!')

        # Detach floppy image.
        fRes = oSession.detachHd(sController, 0, 0)
        if fRes is False:
            reporter.log('6th scenario: Couldn\'t detach image from the controller %s port %s device %s' % (sController, 0, 0))

        fRes = oSession.saveSettings()
        if fRes is False:
            reporter.testFailure('6th scenario: Couldn\'t save machine settings')

        fRes = oSession.close()
        if fRes is False:
            reporter.log('6th scenario: Couldn\'t close machine session')
        return fRc
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:57,代码来源:tdMoveVM1.py


示例16: test1Sub4

 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;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:18,代码来源:tdTeleportLocal1.py


示例17: doTest

    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
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:53,代码来源:tdGuestHostTimings.py


示例18: testUsbCompliance

    def testUsbCompliance(self, oSession, oTxsSession, sUsbCtrl, sSpeed):
        """
        Test VirtualBoxs USB stack in a VM.
        """
        # Get configured USB test devices from hostname we are running on
        sGadgetHost, uGadgetPort = self.getGadgetParams(self.sHostname, sSpeed);

        oUsbGadget = usbgadget.UsbGadget();
        reporter.log('Connecting to UTS: ' + sGadgetHost);
        fRc = oUsbGadget.connectTo(30 * 1000, sGadgetHost, uPort = uGadgetPort);
        if fRc is True:
            reporter.log('Connect succeeded');
            self.oVBox.host.addUSBDeviceSource('USBIP', sGadgetHost, sGadgetHost + (':%s' % oUsbGadget.getUsbIpPort()), [], []);

            fSuperSpeed = False;
            if sSpeed == 'Super':
                fSuperSpeed = True;

            # Create test device gadget and a filter to attach the device automatically.
            fRc = oUsbGadget.impersonate(usbgadget.g_ksGadgetImpersonationTest, fSuperSpeed);
            if fRc is True:
                iBusId, _ = oUsbGadget.getGadgetBusAndDevId();
                fRc = oSession.addUsbDeviceFilter('Compliance device', sVendorId = '0525', sProductId = 'a4a0', \
                                                  sPort = format(iBusId, 'x'));
                if fRc is True:

                    # Wait a moment to let the USB device appear
                    self.sleep(3);

                    tupCmdLine = ('UsbTest', );
                    # Exclude a few tests which hang and cause a timeout, need investigation.
                    lstTestsExclude = self.kdUsbTestsDisabled.get(sSpeed);
                    for iTestExclude in lstTestsExclude:
                        tupCmdLine = tupCmdLine + ('--exclude', str(iTestExclude));

                    fRc = self.txsRunTest(oTxsSession, 'UsbTest', 3600 * 1000, \
                        '${CDROM}/${OS/ARCH}/UsbTest${EXESUFF}', tupCmdLine);
                    if not fRc:
                        reporter.testFailure('Running USB test utility failed');
                else:
                    reporter.testFailure('Failed to impersonate test device');

                oUsbGadget.disconnectFrom();
            else:
                reporter.testFailure('Failed to create USB device filter');

            self.oVBox.host.removeUSBDeviceSource(sGadgetHost);
        else:
            reporter.testFailure('Failed to connect to USB gadget');

        _ = sUsbCtrl;
        return fRc;
开发者ID:miguelinux,项目名称:vbox,代码行数:52,代码来源:tdUsb1.py


示例19: test1Sub1

    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;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:20,代码来源:tdTeleportLocal1.py


示例20: testUsbCompliance

    def testUsbCompliance(self, oSession, oTxsSession, sSpeed):
        """
        Test VirtualBoxs USB stack in a VM.
        """
        # Get configured USB test devices from hostname we are running on
        sGadgetHost, sGadgetType = self.getGadgetParams(self.sHostname, sSpeed);

        # Create device filter
        fRc = oSession.addUsbDeviceFilter('Compliance device', '0525', 'a4a0');
        if fRc is True:
            oUsbGadget = UsbGadget();
            fRc = oUsbGadget.connectTo(30 * 1000, sGadgetType, sGadgetHost);
            if fRc is True:
                fRc = oUsbGadget.impersonate('Test');
                if fRc is True:

                    # Wait a moment to let the USB device appear
                    self.sleep(3);

                    fRc = self.txsRunTest(oTxsSession, 'Compliance', 3600 * 1000, \
                        '${CDROM}/${OS/ARCH}/UsbTest${EXESUFF}', ('UsbTest', ));

                else:
                    reporter.testFailure('Failed to impersonate test device');

                oUsbGadget.disconnectFrom();
            else:
                reporter.testFailure('Failed to connect to USB gadget');
        else:
            reporter.testFailure('Failed to create USB device filter');

        return fRc;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:32,代码来源:tdUsb1.py



注:本文中的testdriver.reporter.testFailure函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python reporter.testStart函数代码示例发布时间:2022-05-27
下一篇:
Python reporter.testDone函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap