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


Python reporter.log函数代码示例

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


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

示例1: testIGuest_additionsVersion

    def testIGuest_additionsVersion(self, oGuest):
        """
        Returns False if no version string could be obtained, otherwise True
        even though errors are logged.
        """
        try:
            sVer = oGuest.additionsVersion
        except:
            reporter.errorXcpt("Getting the additions version failed.")
            return False
        reporter.log('IGuest::additionsVersion="%s"' % (sVer,))

        if sVer.strip() == "":
            reporter.error("IGuest::additionsVersion is empty.")
            return False

        if sVer != sVer.strip():
            reporter.error('IGuest::additionsVersion is contains spaces: "%s".' % (sVer,))

        asBits = sVer.split(".")
        if len(asBits) < 3:
            reporter.error(
                'IGuest::additionsVersion does not contain at least tree dot separated fields: "%s" (%d).'
                % (sVer, len(asBits))
            )

        ## @todo verify the format.
        return True
开发者ID:svn2github,项目名称:virtualbox,代码行数:28,代码来源:tdAddBasic1.py

示例2: moveVMToLocation

    def moveVMToLocation(self, sLocation, oVM):
        """
        Document me here, not with hashes above.
        """
        fRc = True
        try:

            ## @todo r=bird: Too much unncessary crap inside try clause.  Only oVM.moveTo needs to be here.
            ##               Though, you could make an argument for oVM.name too, perhaps.

            # move machine
            reporter.log('Moving machine "%s" to the "%s"' % (oVM.name, sLocation))
            sType = 'basic'
            oProgress = vboxwrappers.ProgressWrapper(oVM.moveTo(sLocation, sType), self.oTstDrv.oVBoxMgr, self.oTstDrv,
                                                     'moving machine "%s"' % (oVM.name,))

        except:
            return reporter.errorXcpt('Machine::moveTo("%s") for machine "%s" failed' % (sLocation, oVM.name,))

        oProgress.wait()
        if oProgress.logResult() is False:
            fRc = False
            reporter.log('Progress object returned False')
        else:
            fRc = True

        return fRc
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:27,代码来源:tdMoveVM1.py

示例3: logMemoryStats

def logMemoryStats():
    """
    Logs windows memory stats.
    """
    class MemoryStatusEx(ctypes.Structure):
        """ MEMORYSTATUSEX """
        kaFields = [
            ( 'dwLength',                    ctypes.c_ulong ),
            ( 'dwMemoryLoad',                ctypes.c_ulong ),
            ( 'ullTotalPhys',                ctypes.c_ulonglong ),
            ( 'ullAvailPhys',                ctypes.c_ulonglong ),
            ( 'ullTotalPageFile',            ctypes.c_ulonglong ),
            ( 'ullAvailPageFile',            ctypes.c_ulonglong ),
            ( 'ullTotalVirtual',             ctypes.c_ulonglong ),
            ( 'ullAvailVirtual',             ctypes.c_ulonglong ),
            ( 'ullAvailExtendedVirtual',     ctypes.c_ulonglong ),
        ];
        _fields_ = kaFields; # pylint: disable=invalid-name

        def __init__(self):
            super(MemoryStatusEx, self).__init__();
            self.dwLength = ctypes.sizeof(self);

    try:
        oStats = MemoryStatusEx();
        ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(oStats));
    except:
        reporter.logXcpt();
        return False;

    reporter.log('Memory statistics:');
    for sField, _ in MemoryStatusEx.kaFields:
        reporter.log('  %32s: %s' % (sField, getattr(oStats, sField)));
    return True;
开发者ID:miguelinux,项目名称:vbox,代码行数:34,代码来源:winbase.py

示例4: impersonate

    def impersonate(self, sImpersonation):
        """
        Impersonate a given device.
        """

        # Clear any previous impersonation
        self._clearImpersonation();
        self.sImpersonation = sImpersonation;

        if sImpersonation == g_ksGadgetImpersonationInvalid:
            return False;
        elif sImpersonation == g_ksGadgetImpersonationTest:
            return self._loadModule('g_zero');
        elif sImpersonation == g_ksGadgetImpersonationMsd:
            # @todo: Not complete
            return self._loadModule('g_mass_storage');
        elif sImpersonation == g_ksGadgetImpersonationWebcam:
            # @todo: Not complete
            return self._loadModule('g_webcam');
        elif sImpersonation == g_ksGadgetImpersonationEther:
            return self._loadModule('g_ether');
        else:
            reporter.log('Invalid impersonation');

        return False;
开发者ID:swimming198243,项目名称:virtualbox,代码行数:25,代码来源:usbgadget.py

示例5: parseOption

 def parseOption(self, asArgs, iArg):  # pylint: disable=R0912,R0915
     if asArgs[iArg] == "--test-build-dir":
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption('The "--test-build-dir" takes a path argument')
         self.sTestBuildDir = asArgs[iArg]
     elif asArgs[iArg] == "--test-vms":
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption('The "--test-vms" takes colon separated list')
         self.asTestVMs = asArgs[iArg].split(":")
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption(
                     'The "--test-vms" value "%s" is not valid; valid values are: %s'
                     % (s, " ".join(self.asTestVMsDef))
                 )
     elif asArgs[iArg] == "--skip-vms":
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption('The "--skip-vms" takes colon separated list')
         self.asSkipVMs = asArgs[iArg].split(":")
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s))
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
开发者ID:miguelinux,项目名称:vbox,代码行数:28,代码来源:tdAutostart1.py

示例6: _sudoExecuteSync

    def _sudoExecuteSync(self, asArgs, sInput):
        """
        Executes a sudo child process synchronously.
        Returns a tuple [True, 0] if the process executed successfully
        and returned 0, otherwise [False, rc] is returned.
        """
        reporter.log('Executing [sudo]: %s' % (asArgs, ));
        reporter.flushall();
        fRc = True;
        sOutput = '';
        sError = '';
        try:
            oProcess = utils.sudoProcessPopen(asArgs, stdout=subprocess.PIPE, stdin=subprocess.PIPE,
                                              stderr=subprocess.PIPE, shell = False, close_fds = False);

            sOutput, sError = oProcess.communicate(sInput);
            iExitCode  = oProcess.poll();

            if iExitCode is not 0:
                fRc = False;
        except:
            reporter.errorXcpt();
            fRc = False;
        reporter.log('Exit code [sudo]: %s (%s)' % (fRc, asArgs));
        return (fRc, str(sOutput), str(sError));
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:25,代码来源:remoteexecutor.py

示例7: installVirtualBox

    def installVirtualBox(self, oSession, oTxsSession):
        """
        Install VirtualBox in the guest.
        """
        fRc = False;

        if self.sTestBuild is not None:
            reporter.log('Testing build: %s' % (self.sTestBuild));
            sTestBuildFilename = os.path.basename(self.sTestBuild);

            # Construct the .pkg filename from the tar.gz name.
            oMatch = re.search(r'\d+.\d+.\d+-SunOS-r\d+', sTestBuildFilename);
            if oMatch is not None:
                sPkgFilename = 'VirtualBox-' + oMatch.group() + '.pkg';

                reporter.log('Extracted package filename: %s' % (sPkgFilename));

                fRc = self.oTestDriver.txsUploadFile(oSession, oTxsSession, self.sTestBuild, \
                                                     '${SCRATCH}/' + sTestBuildFilename, \
                                                     cMsTimeout = 120 * 1000);
                fRc = fRc and self.oTestDriver.txsUnpackFile(oSession, oTxsSession, \
                                                             '${SCRATCH}/' + sTestBuildFilename, \
                                                             '${SCRATCH}', cMsTimeout = 120 * 1000);
                fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Installing package', 240 * 1000, \
                                                          '/usr/sbin/pkgadd',
                                                          ('pkgadd', '-d', '${SCRATCH}/' + sPkgFilename, \
                                                           '-n', '-a', '${SCRATCH}/autoresponse', 'SUNWvbox'));
        return fRc;
开发者ID:swimming198243,项目名称:virtualbox,代码行数:28,代码来源:tdAutostart1.py

示例8: impersonate

    def impersonate(self, sImpersonation):
        """
        Impersonate a given device.
        """

        # Clear any previous impersonation
        self._clearImpersonation();
        self.sImpersonation = sImpersonation;

        if sImpersonation == 'Invalid':
            return False;
        elif sImpersonation == 'Test':
            return self._loadModule('g_zero');
        elif sImpersonation == 'Msd':
            # @todo: Not complete
            return self._loadModule('g_mass_storage');
        elif sImpersonation == 'Webcam':
            # @todo: Not complete
            return self._loadModule('g_webcam');
        elif sImpersonation == 'Network':
            return self._loadModule('g_ether');
        else:
            reporter.log('Invalid impersonation');

        return False;
开发者ID:mcenirm,项目名称:vbox,代码行数:25,代码来源:usbgadget.py

示例9: isHostCpuAffectedByUbuntuNewAmdBug

    def isHostCpuAffectedByUbuntuNewAmdBug(self, oTestDrv):
        """
        Checks if the host OS is affected by older ubuntu installers being very
        picky about which families of AMD CPUs it would run on.

        The installer checks for family 15, later 16, later 20, and in 11.10
        they remove the family check for AMD CPUs.
        """
        if not oTestDrv.isHostCpuAmd():
            return False;
        try:
            (uMaxExt, _, _, _) = oTestDrv.oVBox.host.getProcessorCPUIDLeaf(0, 0x80000000, 0);
            (uFamilyModel, _, _, _) = oTestDrv.oVBox.host.getProcessorCPUIDLeaf(0, 0x80000001, 0);
        except:
            reporter.logXcpt();
            return False;
        if uMaxExt < 0x80000001 or uMaxExt > 0x8000ffff:
            return False;

        uFamily = (uFamilyModel >> 8) & 0xf
        if uFamily == 0xf:
            uFamily = ((uFamilyModel >> 20) & 0x7f) + 0xf;
        ## @todo Break this down into which old ubuntu release supports exactly
        ##       which AMD family, if we care.
        if uFamily <= 15:
            return False;
        reporter.log('Skipping "%s" because host CPU is a family %u AMD, which may cause trouble for the guest OS installer.'
                     % (self.sVmName, uFamily,));
        return True;
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:29,代码来源:tdGuestOsInstTest1.py

示例10: installVirtualBox

    def installVirtualBox(self, oSession, oTxsSession):
        """
        Install VirtualBox in the guest.
        """
        fRc = False

        if self.sTestBuild is not None:
            reporter.log("Testing build: %s" % (self.sTestBuild))
            sTestBuildFilename = os.path.basename(self.sTestBuild)

            # Construct the .pkg filename from the tar.gz name.
            oMatch = re.search(r"\d+.\d+.\d+-SunOS-r\d+", sTestBuildFilename)
            if oMatch is not None:
                sPkgFilename = "VirtualBox-" + oMatch.group() + ".pkg"

                reporter.log("Extracted package filename: %s" % (sPkgFilename))

                fRc = self.oTestDriver.txsUploadFile(
                    oSession, oTxsSession, self.sTestBuild, "${SCRATCH}/" + sTestBuildFilename, cMsTimeout=120 * 1000
                )
                fRc = fRc and self.oTestDriver.txsUnpackFile(
                    oSession, oTxsSession, "${SCRATCH}/" + sTestBuildFilename, "${SCRATCH}", cMsTimeout=120 * 1000
                )
                fRc = fRc and self.oTestDriver.txsRunTest(
                    oTxsSession,
                    "Installing package",
                    240 * 1000,
                    "/usr/sbin/pkgadd",
                    ("pkgadd", "-d", "${SCRATCH}/" + sPkgFilename, "-n", "-a", "${SCRATCH}/autoresponse", "SUNWvbox"),
                )
        return fRc
开发者ID:miguelinux,项目名称:vbox,代码行数:31,代码来源:tdAutostart1.py

示例11: testOneVmConfig

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

示例12: parseOption

 def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
     if asArgs[iArg] == '--storage-ctrls':
         iArg += 1;
         if iArg >= len(asArgs):
             raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
         self.asStorageCtrls = asArgs[iArg].split(':');
     elif asArgs[iArg] == '--disk-formats':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
         self.asDiskFormats = asArgs[iArg].split(':');
     elif asArgs[iArg] == '--test-vms':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
         self.asTestVMs = asArgs[iArg].split(':');
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestVMsDef)));
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
         self.asSkipVMs = asArgs[iArg].split(':');
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg);
     return iArg + 1;
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:28,代码来源:tdStorageSnapshotMerging1.py

示例13: moveTo

    def moveTo(self, sLocation, aoMediumAttachments):
        for oAttachment in aoMediumAttachments:
            try:
                oMedium = oAttachment.medium
                reporter.log('Move medium "%s" to "%s"' % (oMedium.name, sLocation,))
            except:
                reporter.errorXcpt('failed to get the medium from the IMediumAttachment "%s"' % (oAttachment))

            if self.oTstDrv.fpApiVer >= 5.3 and self.oTstDrv.uRevision > 124748:
                try:
                    oProgress = vboxwrappers.ProgressWrapper(oMedium.moveTo(sLocation), self.oTstDrv.oVBoxMgr, self.oTstDrv,
                                                             'move "%s"' % (oMedium.name,));
                except:
                    return reporter.errorXcpt('Medium::moveTo("%s") for medium "%s" failed' % (sLocation, oMedium.name,));
            else:
                try:
                    oProgress = vboxwrappers.ProgressWrapper(oMedium.setLocation(sLocation), self.oTstDrv.oVBoxMgr, self.oTstDrv,
                                                             'move "%s"' % (oMedium.name,));
                except:
                    return reporter.errorXcpt('Medium::setLocation("%s") for medium "%s" failed' % (sLocation, oMedium.name,));


            oProgress.wait()
            if oProgress.logResult() is False:
                return False
        return True
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:26,代码来源:tdMoveMedium1.py

示例14: actionExecuteOnRunnigVM

    def actionExecuteOnRunnigVM(self):
        if not self.importVBoxApi():
            return False;

        oVirtualBox = self.oVBoxMgr.getVirtualBox()
        oMachine = oVirtualBox.findMachine(self.sVMname)

        if oMachine == None:
            reporter.log("Machine '%s' is unknown" % (oMachine.name))
            return False

        if oMachine.state != self.oVBoxMgr.constants.MachineState_Running:
            reporter.log("Machine '%s' is not Running" % (oMachine.name))
            return False

        oSession = self.oVBoxMgr.mgr.getSessionObject(oVirtualBox)
        oMachine.lockMachine(oSession, self.oVBoxMgr.constants.LockType_Shared)

        self.doTest(oSession);

        oSession.unlockMachine()

        del oSession
        del oMachine
        del oVirtualBox
        return True
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:26,代码来源:tdGuestHostTimings.py

示例15: _installExtPack

    def _installExtPack(self):
        """ Installs the extension pack. """
        sVBox = self._getVBoxInstallPath(fFailIfNotFound = True);
        if sVBox is None:
            return False;
        sExtPackDir = os.path.join(sVBox, 'ExtensionPacks');

        if self._uninstallAllExtPacks() is not True:
            return False;

        sExtPack = self._findFile('Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack');
        if sExtPack is None:
            sExtPack = self._findFile('Oracle_VM_VirtualBox_Extension_Pack.*.vbox-extpack');
        if sExtPack is None:
            return True;

        sDstDir = os.path.join(sExtPackDir, 'Oracle_VM_VirtualBox_Extension_Pack');
        reporter.log('Installing extension pack "%s" to "%s"...' % (sExtPack, sExtPackDir));
        fRc, _ = self._sudoExecuteSync([ self.getBinTool('vts_tar'),
                                         '--extract',
                                         '--verbose',
                                         '--gzip',
                                         '--file',                sExtPack,
                                         '--directory',           sDstDir,
                                         '--file-mode-and-mask',  '0644',
                                         '--file-mode-or-mask',   '0644',
                                         '--dir-mode-and-mask',   '0755',
                                         '--dir-mode-or-mask',    '0755',
                                         '--owner',               '0',
                                         '--group',               '0',
                                       ]);
        return fRc;
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:32,代码来源:vboxinstaller.py


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