本文整理汇总了Python中testdriver.reporter.logXcpt函数的典型用法代码示例。如果您正苦于以下问题:Python logXcpt函数的具体用法?Python logXcpt怎么用?Python logXcpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logXcpt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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;
示例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;
示例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;
示例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;
示例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;
示例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;
示例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;
示例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
示例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;
示例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
示例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
示例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; #
示例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;
示例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