当前位置: 首页>>代码示例>>Python>>正文


Python reporter.testFailure函数代码示例

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


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


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