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

Python reporter.logXcpt函数代码示例

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

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



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

示例1: processCheckPidAndName

def processCheckPidAndName(uPid, sName):
    """ The Windows version of base.processCheckPidAndName """
    fRc = processExists(uPid)
    if fRc is True:
        try:
            from win32com.client import GetObject

            # pylint: disable=F0401
            oWmi = GetObject("winmgmts:")
            aoProcesses = oWmi.InstancesOf("Win32_Process")
            for oProcess in aoProcesses:
                if long(oProcess.Properties_("ProcessId").Value) == uPid:
                    sCurName = oProcess.Properties_("Name").Value
                    reporter.log2("uPid=%s sName=%s sCurName=%s" % (uPid, sName, sCurName))
                    sName = sName.lower()
                    sCurName = sCurName.lower()
                    if os.path.basename(sName) == sName:
                        sCurName = os.path.basename(sCurName)

                    if sCurName == sName or sCurName + ".exe" == sName or sCurName == sName + ".exe":
                        fRc = True
                    break
        except:
            reporter.logXcpt("uPid=%s sName=%s" % (uPid, sName))
    return fRc
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:25,代码来源:winbase.py


示例2: 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


示例3: resizeMedium

    def resizeMedium(self, oMedium, cbNewSize):
        if oMedium.deviceType is not vboxcon.DeviceType_HardDisk:
            return False;

        if oMedium.type is not vboxcon.MediumType_Normal:
            return False;

        #currently only VDI can be resizable. Medium variant is not checked, because testcase creates disks itself
        oMediumFormat = oMedium.mediumFormat;
        if oMediumFormat.id != 'VDI':
            return False;

        cbCurrSize = oMedium.logicalSize;
        # currently reduce is not supported
        if cbNewSize < cbCurrSize:
            return False;

        try:
            oProgressCom = oMedium.resize(cbNewSize);
            oProgress = vboxwrappers.ProgressWrapper(oProgressCom, self.oVBoxMgr, self.oVBox.oTstDrv,
                                                     'Resize medium %s' % (oMedium.name));
            oProgress.wait(cMsTimeout = 60 * 1000);
            oProgress.logResult();
        except:
            reporter.logXcpt('IMedium::resize failed on %s' % (oMedium.name));
            return False;

        return True;
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:28,代码来源:tdStorageSnapshotMerging1.py


示例4: 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


示例5: processCheckPidAndName

def processCheckPidAndName(uPid, sName):
    """ The Windows version of base.processCheckPidAndName """
    fRc = processExists(uPid);
    if fRc is True:
        try:
            from win32com.client import GetObject; # pylint: disable=F0401
            oWmi = GetObject('winmgmts:');
            aoProcesses = oWmi.InstancesOf('Win32_Process');
            for oProcess in aoProcesses:
                if long(oProcess.Properties_("ProcessId").Value) == uPid:
                    sCurName = oProcess.Properties_("Name").Value;
                    reporter.log2('uPid=%s sName=%s sCurName=%s' % (uPid, sName, sCurName));
                    sName    = sName.lower();
                    sCurName = sCurName.lower();
                    if os.path.basename(sName) == sName:
                        sCurName = os.path.basename(sCurName);

                    if  sCurName == sName \
                    or sCurName + '.exe' == sName \
                    or sCurName == sName  + '.exe':
                        fRc = True;
                    break;
        except:
            reporter.logXcpt('uPid=%s sName=%s' % (uPid, sName));
    return fRc;
开发者ID:miguelinux,项目名称:vbox,代码行数:25,代码来源:winbase.py


示例6: _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


示例7: postThreadMesssageClose

def postThreadMesssageClose(uTid):
    """ Posts a WM_CLOSE message to the specified thread."""
    fRc = False;
    try:
        win32api.PostThreadMessage(uTid, win32con.WM_CLOSE, 0, 0);                                  # pylint: disable=no-member
        fRc = True;
    except:
        reporter.logXcpt('uTid=%s' % (uTid,));
    return fRc;
开发者ID:miguelinux,项目名称:vbox,代码行数:9,代码来源:winbase.py


示例8: postThreadMesssageQuit

def postThreadMesssageQuit(uTid):
    """ Posts a WM_QUIT message to the specified thread."""
    fRc = False;
    try:
        win32api.PostThreadMessage(uTid, win32con.WM_QUIT, 0x40010004, 0); # DBG_TERMINATE_PROCESS  # pylint: disable=no-member
        fRc = True;
    except:
        reporter.logXcpt('uTid=%s' % (uTid,));
    return fRc;
开发者ID:miguelinux,项目名称:vbox,代码行数:9,代码来源:winbase.py


示例9: postThreadMesssageClose

def postThreadMesssageClose(uTid):
    """ Posts a WM_CLOSE message to the specified thread."""
    fRc = False
    try:
        win32api.PostThreadMessage(uTid, win32con.WM_CLOSE, 0, 0)
        fRc = True
    except:
        reporter.logXcpt("uTid=%s" % (uTid,))
    return fRc
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:9,代码来源:winbase.py


示例10: processTerminateByHandle

def processTerminateByHandle(hProcess):
    """
    Terminates the process.
    """
    try:
        win32api.TerminateProcess(hProcess, 0x40010004); # DBG_TERMINATE_PROCESS                    # pylint: disable=no-member
    except:
        reporter.logXcpt('hProcess=%s %#x' % (hProcess, hProcess,));
        return False;
    return True;
开发者ID:miguelinux,项目名称:vbox,代码行数:10,代码来源:winbase.py


示例11: postThreadMesssageQuit

def postThreadMesssageQuit(uTid):
    """ Posts a WM_QUIT message to the specified thread."""
    fRc = False
    try:
        win32api.PostThreadMessage(uTid, win32con.WM_QUIT, 0x40010004, 0)
        # DBG_TERMINATE_PROCESS
        fRc = True
    except:
        reporter.logXcpt("uTid=%s" % (uTid,))
    return fRc
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:10,代码来源:winbase.py


示例12: processPollByHandle

def processPollByHandle(hProcess):
    """
    Polls the process handle to see if it has finished (True) or not (False).
    """
    try:
        dwWait = win32event.WaitForSingleObject(hProcess, 0)
    except:
        reporter.logXcpt("hProcess=%s %#x" % (hProcess, hProcess))
        return True
    return dwWait != win32con.WAIT_TIMEOUT
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:10,代码来源:winbase.py


示例13: processPollByHandle

def processPollByHandle(hProcess):
    """
    Polls the process handle to see if it has finished (True) or not (False).
    """
    try:
        dwWait = win32event.WaitForSingleObject(hProcess, 0);                                       # pylint: disable=no-member
    except:
        reporter.logXcpt('hProcess=%s %#x' % (hProcess, hProcess,));
        return True;
    return dwWait != win32con.WAIT_TIMEOUT; #0x102; #
开发者ID:miguelinux,项目名称:vbox,代码行数:10,代码来源:winbase.py


示例14: processExists

def processExists(uPid):
    """ The Windows version of base.processExists """
    fRc = False;
    try:
        hProcess = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, False, uPid);
    except:
        reporter.logXcpt('uPid=%s' % (uPid,));
    else:
        win32api.CloseHandle(hProcess)
        fRc = True;
    return fRc;
开发者ID:swimming198243,项目名称:virtualbox,代码行数:11,代码来源:winbase.py


示例15: processTerminateByHandle

def processTerminateByHandle(hProcess):
    """
    Terminates the process.
    """
    try:
        win32api.TerminateProcess(hProcess, 0x40010004)
        # DBG_TERMINATE_PROCESS
    except:
        reporter.logXcpt("hProcess=%s %#x" % (hProcess, hProcess))
        return False
    return True
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:11,代码来源:winbase.py


示例16: _uninstallVBoxOnWindows

    def _uninstallVBoxOnWindows(self):
        """
        Uninstalls VBox on Windows, all installations we find to be on the safe side...
        """

        import win32com.client; # pylint: disable=F0401
        win32com.client.gencache.EnsureModule('{000C1092-0000-0000-C000-000000000046}', 1033, 1, 0);
        oInstaller = win32com.client.Dispatch('WindowsInstaller.Installer',
                                              resultCLSID = '{000C1090-0000-0000-C000-000000000046}')

        # Search installed products for VirtualBox.
        asProdCodes = [];
        for sProdCode in oInstaller.Products:
            try:
                sProdName = oInstaller.ProductInfo(sProdCode, "ProductName");
            except:
                reporter.logXcpt();
                continue;
            #reporter.log('Info: %s=%s' % (sProdCode, sProdName));
            if  sProdName.startswith('Oracle VM VirtualBox') \
             or sProdName.startswith('Sun VirtualBox'):
                asProdCodes.append([sProdCode, sProdName]);

        # Before we start uninstalling anything, just ruthlessly kill any
        # msiexec process we might find hanging around.
        cKilled = 0;
        for oProcess in utils.processListAll():
            sBase = oProcess.getBaseImageNameNoExeSuff();
            if sBase is not None and sBase.lower() in [ 'msiexec', ]:
                reporter.log('Killing MSI process: %s (%s)' % (oProcess.iPid, sBase));
                utils.processKill(oProcess.iPid);
                cKilled += 1;
        if cKilled > 0:
            time.sleep(16); # fudge.

        # Do the uninstalling.
        fRc = True;
        sLogFile = os.path.join(self.sScratchPath, 'VBoxUninstallLog.txt');
        for sProdCode, sProdName in asProdCodes:
            reporter.log('Uninstalling %s (%s)...' % (sProdName, sProdCode));
            fRc2, iRc = self._sudoExecuteSync(['msiexec', '/uninstall', sProdCode, '/quiet', '/passive', '/norestart',
                                               '/L*v', '%s' % (sLogFile), ]);
            if fRc2 is False:
                if iRc == 3010: # ERROR_SUCCESS_REBOOT_REQUIRED
                    reporter.log('Note: Uninstaller required a reboot to complete uninstallation');
                    # Optional, don't fail.
                else:
                    fRc = False;
            reporter.addLogFile(sLogFile, 'log/uninstaller', "Verbose MSI uninstallation log file");

        self._waitForTestManagerConnectivity(30);
        if fRc is False and os.path.isfile(sLogFile):
            reporter.addLogFile(sLogFile, 'log/uninstaller');
        return fRc;
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:54,代码来源:vboxinstaller.py


示例17: test2Teleport

    def test2Teleport(self, oVmSrc, oSessionSrc, oVmDst):
        """
        Attempts a teleportation.

        Returns the input parameters for the next test2Teleport call (source
        and destiation are switched around).  The input session is closed and
        removed from the task list, while the return session is in the list.
        """

        # Enable the teleporter of the VM.
        oSession = self.openSession(oVmDst)
        fRc = oSession is not None
        if fRc:
            fRc = oSession.enableTeleporter()
            fRc = fRc and oSession.saveSettings()
            fRc = oSession.close() and fRc and True
            # pychecker hack.
        if fRc:
            # Start the destination VM.
            oSessionDst, oProgressDst = self.startVmEx(
                oVmDst, fWait=False)
            if oSessionDst is not None:
                if oProgressDst.waitForOperation(iOperation=-3) == 0:

                    # Do the teleportation.
                    try:
                        uDstPort = oVmDst.teleporterPort
                    except:
                        reporter.logXcpt()
                        uDstPort = 6502
                    oProgressSrc = oSessionSrc.teleport(
                        'localhost', uDstPort, 'password', 1024)
                    if oProgressSrc is not None:
                        oProgressSrc.wait()
                        if oProgressSrc.isSuccess():
                            oProgressDst.wait()
                        if oProgressSrc.isSuccess() and oProgressDst.isSuccess(
                        ):

                            # Terminate the source VM.
                            self.terminateVmBySession(oSessionSrc,
                                                      oProgressSrc)

                            # Return with the source and destination swapped.
                            self.addTask(oSessionDst)
                            return oVmDst, oSessionDst, oVmSrc

                        # Failure / bail out.
                        oProgressSrc.logResult()
                oProgressDst.logResult()
                self.terminateVmBySession(oSessionDst, oProgressDst)
        return oVmSrc, oSessionSrc, oVmDst
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:52,代码来源:tdTeleportLocal1.py


示例18: _darwinMountDmg

    def _darwinMountDmg(self, sDmg):
        """
        Mount the DMG at the default mount point.
        """
        self._darwinUnmountDmg(fIgnoreError = True)

        sMountPath = self._darwinDmgPath();
        if not os.path.exists(sMountPath):
            try:
                os.mkdir(sMountPath, 0755);
            except:
                reporter.logXcpt();
                return False;

        return self._executeSync(['hdiutil', 'attach', '-readonly', '-mount', 'required', '-mountpoint', sMountPath, sDmg, ]);
开发者ID:zBMNForks,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:15,代码来源:vboxinstaller.py


示例19: processTerminate

def processTerminate(uPid):
    """ The Windows version of base.processTerminate """
    fRc = False;
    try:
        hProcess = win32api.OpenProcess(win32con.PROCESS_TERMINATE, False, uPid);
    except:
        reporter.logXcpt('uPid=%s' % (uPid,));
    else:
        try:
            win32process.TerminateProcess(hProcess, 0x40010004); # DBG_TERMINATE_PROCESS
            fRc = True;
        except:
            reporter.logXcpt('uPid=%s' % (uPid,));
        win32api.CloseHandle(hProcess)
    return fRc;
开发者ID:swimming198243,项目名称:virtualbox,代码行数:15,代码来源:winbase.py


示例20: processInterrupt

def processInterrupt(uPid):
    """
    The Windows version of base.processInterrupt

    Note! This doesn't work terribly well with a lot of processes.
    """
    try:
        win32console.GenerateConsoleCtrlEvent(win32con.CTRL_BREAK_EVENT, uPid);
        #GenerateConsoleCtrlEvent = ctypes.windll.kernel32.GenerateConsoleCtrlEvent
        #rc = GenerateConsoleCtrlEvent(1, uPid);
        #reporter.log('GenerateConsoleCtrlEvent -> %s' % (rc,));
        fRc = True;
    except:
        reporter.logXcpt('uPid=%s' % (uPid,));
        fRc = False;
    return fRc;
开发者ID:swimming198243,项目名称:virtualbox,代码行数:16,代码来源:winbase.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python reporter.testDone函数代码示例发布时间:2022-05-27
下一篇:
Python reporter.log函数代码示例发布时间: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