本文整理汇总了Python中mozcrash.check_for_java_exception函数的典型用法代码示例。如果您正苦于以下问题:Python check_for_java_exception函数的具体用法?Python check_for_java_exception怎么用?Python check_for_java_exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_for_java_exception函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_for_crashes
def check_for_crashes(self):
if self.logcat:
if mozcrash.check_for_java_exception(self.logcat, self.test_name):
return True
symbols_path = self.options.symbols_path
try:
dump_dir = tempfile.mkdtemp()
remote_dir = posixpath.join(self.remote_profile, 'minidumps')
if not self.dm.dirExists(remote_dir):
# If crash reporting is enabled (MOZ_CRASHREPORTER=1), the
# minidumps directory is automatically created when the app
# (first) starts, so its lack of presence is a hint that
# something went wrong.
print "Automation Error: No crash directory (%s) found on remote device" % \
remote_dir
# Whilst no crash was found, the run should still display as a failure
return True
self.dm.getDirectory(remote_dir, dump_dir)
crashed = mozcrash.log_crashes(self.log, dump_dir, symbols_path, test=self.test_name)
finally:
try:
shutil.rmtree(dump_dir)
except:
self.log.warn("unable to remove directory: %s" % dump_dir)
return crashed
示例2: checkForCrashes
def checkForCrashes(self, directory, symbolsPath):
self.checkForANRs()
logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters)
javaException = mozcrash.check_for_java_exception(logcat)
if javaException:
return True
# If crash reporting is disabled (MOZ_CRASHREPORTER!=1), we can't say
# anything.
if not self.CRASHREPORTER:
return False
try:
dumpDir = tempfile.mkdtemp()
remoteCrashDir = self._remoteProfile + '/minidumps/'
if not self._devicemanager.dirExists(remoteCrashDir):
# If crash reporting is enabled (MOZ_CRASHREPORTER=1), the
# minidumps directory is automatically created when Fennec
# (first) starts, so its lack of presence is a hint that
# something went wrong.
print "Automation Error: No crash directory (%s) found on remote device" % remoteCrashDir
# Whilst no crash was found, the run should still display as a failure
return True
self._devicemanager.getDirectory(remoteCrashDir, dumpDir)
crashed = Automation.checkForCrashes(self, dumpDir, symbolsPath)
finally:
try:
shutil.rmtree(dumpDir)
except:
print "WARNING: unable to remove directory: %s" % dumpDir
return crashed
示例3: test_unchecked_exception
def test_unchecked_exception(self):
"""
Test for an exception which should not be caught
"""
passable_log = list(self.test_log)
passable_log[0] = "01-30 20:15:41.937 E/GeckoAppShell( 1703): >>> NOT-SO-BAD EXCEPTION FROM THREAD 9 (\"GeckoBackgroundThread\")"
self.assert_(not mozcrash.check_for_java_exception(passable_log))
示例4: test_fatal_exception
def test_fatal_exception(self):
"""
Test for an exception which should be caught
"""
fatal_log = list(self.test_log)
fatal_log[0] = "01-30 20:15:41.937 E/GeckoAppShell( 1703): >>> FATAL EXCEPTION FROM THREAD 9 (\"GeckoBackgroundThread\")"
self.assert_(mozcrash.check_for_java_exception(fatal_log))
示例5: cleanupAndCheckForCrashes
def cleanupAndCheckForCrashes(self, browser_config, profile_dir, test_name):
"""cleanup browser processes and process crashes if found"""
# cleanup processes
self._ffprocess.cleanupProcesses(browser_config['process'],
browser_config['child_process'],
browser_config['browser_wait'])
# find stackwalk binary
if platform.system() in ('Windows', 'Microsoft'):
stackwalkpaths = ['win32', 'minidump_stackwalk.exe']
elif platform.system() == 'Linux':
# are we 64 bit?
if '64' in platform.architecture()[0]:
stackwalkpaths = ['linux64', 'minidump_stackwalk']
else:
stackwalkpaths = ['linux', 'minidump_stackwalk']
elif platform.system() == 'Darwin':
stackwalkpaths = ['osx', 'minidump_stackwalk']
else:
# no minidump_stackwalk available for your platform
return
stackwalkbin = os.path.join(os.path.dirname(__file__), 'breakpad', *stackwalkpaths)
assert os.path.exists(stackwalkbin), "minidump_stackwalk binary not found: %s" % stackwalkbin
if browser_config['remote'] is True:
# favour using Java exceptions in the logcat over minidumps
if os.path.exists('logcat.log'):
with open('logcat.log') as f:
logcat = f.read().split('\r')
found = mozcrash.check_for_java_exception(logcat)
remoteminidumpdir = profile_dir + '/minidumps/'
if not found:
# check for minidumps
minidumpdir = tempfile.mkdtemp()
try:
if self._ffprocess.testAgent.dirExists(remoteminidumpdir):
self._ffprocess.testAgent.getDirectory(remoteminidumpdir, minidumpdir)
except mozdevice.DMError:
print "Remote Device Error: Error getting crash minidumps from device"
raise
found = mozcrash.check_for_crashes(minidumpdir,
browser_config['symbols_path'],
stackwalk_binary=stackwalkbin,
test_name=test_name)
self._hostproc.removeDirectory(minidumpdir)
# cleanup dumps on remote
self._ffprocess.testAgent.removeDir(remoteminidumpdir)
else:
# check for minidumps
minidumpdir = os.path.join(profile_dir, 'minidumps')
found = mozcrash.check_for_crashes(minidumpdir,
browser_config['symbols_path'],
stackwalk_binary=stackwalkbin,
test_name=test_name)
if found:
raise talosCrash("Found crashes after test run, terminating test")
示例6: test_truncated_exception
def test_truncated_exception(self):
"""
Test for an exception which should be caught which
was truncated
"""
truncated_log = list(self.test_log)
truncated_log[0], truncated_log[1] = truncated_log[1], truncated_log[0]
self.assert_(mozcrash.check_for_java_exception(truncated_log))
示例7: test_unchecked_exception
def test_unchecked_exception(self):
"""
Test for an exception which should not be caught
"""
passable_log = list(self.test_log)
passable_log[
0
] = '01-30 20:15:41.937 E/GoannaAppShell( 1703): >>> NOT-SO-BAD EXCEPTION FROM THREAD 9 ("GoannaBackgroundThread")'
self.assert_(not mozcrash.check_for_java_exception(passable_log, quiet=True))
示例8: test_fatal_exception
def test_fatal_exception(self):
"""
Test for an exception which should be caught
"""
fatal_log = list(self.test_log)
fatal_log[
0
] = '01-30 20:15:41.937 E/GoannaAppShell( 1703): >>> FATAL EXCEPTION FROM THREAD 9 ("GoannaBackgroundThread")'
self.assert_(mozcrash.check_for_java_exception(fatal_log, quiet=True))
示例9: checkForCrashes
def checkForCrashes(self, directory, symbolsPath):
self.checkForANRs()
self.checkForTombstones()
logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters)
javaException = mozcrash.check_for_java_exception(logcat)
if javaException:
return True
# No crash reporting
return False
示例10: checkForCrashes
def checkForCrashes(self, directory, symbolsPath):
self.checkForANRs()
self.checkForTombstones()
logcat = self._device.get_logcat(
filter_out_regexps=fennecLogcatFilters)
javaException = mozcrash.check_for_java_exception(
logcat, test_name=self.lastTestSeen)
if javaException:
return True
# If crash reporting is disabled (MOZ_CRASHREPORTER!=1), we can't say
# anything.
if not self.CRASHREPORTER:
return False
try:
dumpDir = tempfile.mkdtemp()
remoteCrashDir = posixpath.join(self._remoteProfile, 'minidumps')
if not self._device.is_dir(remoteCrashDir):
# If crash reporting is enabled (MOZ_CRASHREPORTER=1), the
# minidumps directory is automatically created when Fennec
# (first) starts, so its lack of presence is a hint that
# something went wrong.
print("Automation Error: No crash directory (%s) found on remote device" %
remoteCrashDir)
return True
self._device.pull(remoteCrashDir, dumpDir)
logger = get_default_logger()
crashed = mozcrash.log_crashes(
logger, dumpDir, symbolsPath, test=self.lastTestSeen)
finally:
try:
shutil.rmtree(dumpDir)
except Exception as e:
print("WARNING: unable to remove directory %s: %s" % (
dumpDir, str(e)))
return crashed
示例11: test_uncaught_exception
def test_uncaught_exception(self):
"""
Test for an exception which should be caught
"""
self.assert_(mozcrash.check_for_java_exception(self.test_log))