mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 978066 - [mozcrash] Mozcrash check_for_java_exception function should take quiet parameter; r=wlach
This commit is contained in:
parent
dfb5c2e301
commit
bb9160e97c
@ -161,7 +161,7 @@ def check_for_crashes(dump_directory, symbols_path,
|
||||
return True
|
||||
|
||||
|
||||
def check_for_java_exception(logcat):
|
||||
def check_for_java_exception(logcat, quiet=False):
|
||||
"""
|
||||
Print a summary of a fatal Java exception, if present in the provided
|
||||
logcat output.
|
||||
@ -171,6 +171,9 @@ def check_for_java_exception(logcat):
|
||||
|
||||
`logcat` should be a list of strings.
|
||||
|
||||
If `quiet` is set, no PROCESS-CRASH message will be printed to stdout if a
|
||||
crash is detected.
|
||||
|
||||
Returns True if a fatal Java exception was found, False otherwise.
|
||||
"""
|
||||
found_exception = False
|
||||
@ -194,6 +197,7 @@ def check_for_java_exception(logcat):
|
||||
m = logre.search(logcat[i+2])
|
||||
if m and m.group(1):
|
||||
exception_location = m.group(1)
|
||||
if not quiet:
|
||||
print "PROCESS-CRASH | java-exception | %s %s" % (exception_type, exception_location)
|
||||
else:
|
||||
print "Automation Error: Logcat is truncated!"
|
||||
|
@ -187,7 +187,7 @@ class TestJavaException(unittest.TestCase):
|
||||
"""
|
||||
Test for an exception which should be caught
|
||||
"""
|
||||
self.assert_(mozcrash.check_for_java_exception(self.test_log))
|
||||
self.assert_(mozcrash.check_for_java_exception(self.test_log, quiet=True))
|
||||
|
||||
def test_fatal_exception(self):
|
||||
"""
|
||||
@ -195,7 +195,7 @@ class TestJavaException(unittest.TestCase):
|
||||
"""
|
||||
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))
|
||||
self.assert_(mozcrash.check_for_java_exception(fatal_log, quiet=True))
|
||||
|
||||
def test_truncated_exception(self):
|
||||
"""
|
||||
@ -204,7 +204,7 @@ class TestJavaException(unittest.TestCase):
|
||||
"""
|
||||
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))
|
||||
self.assert_(mozcrash.check_for_java_exception(truncated_log, quiet=True))
|
||||
|
||||
def test_unchecked_exception(self):
|
||||
"""
|
||||
@ -212,7 +212,7 @@ class TestJavaException(unittest.TestCase):
|
||||
"""
|
||||
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))
|
||||
self.assert_(not mozcrash.check_for_java_exception(passable_log, quiet=True))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user