Fix wrong parsing of faulthandler logs.
This commit is contained in:
parent
a41331a402
commit
14f2420500
@ -60,7 +60,7 @@ def parse_fatal_stacktrace(text):
|
||||
# We got some invalid text.
|
||||
return ('', '')
|
||||
else:
|
||||
return (m.group(1), m.group(2))
|
||||
return (m.group(1), m.group(3))
|
||||
|
||||
|
||||
def get_fatal_crash_dialog(debug, data):
|
||||
|
@ -40,6 +40,13 @@ Current thread 0x00007f09b538d700 (most recent call first):
|
||||
File "filename", line 88 in func
|
||||
"""
|
||||
|
||||
VALID_CRASH_TEXT_THREAD = """
|
||||
Fatal Python error: Segmentation fault
|
||||
_
|
||||
Thread 0x00007fa135ac7700 (most recent call first):
|
||||
File "", line 1 in testfunc
|
||||
"""
|
||||
|
||||
INVALID_CRASH_TEXT = """
|
||||
Hello world!
|
||||
"""
|
||||
@ -56,6 +63,13 @@ class ParseFatalStacktraceTests(unittest.TestCase):
|
||||
self.assertEqual(typ, "Segmentation fault")
|
||||
self.assertEqual(func, 'testfunc')
|
||||
|
||||
def test_valid_text_thread(self):
|
||||
"""Test parse_fatal_stacktrace with a valid text #2."""
|
||||
text = VALID_CRASH_TEXT_THREAD.strip().replace('_', ' ')
|
||||
typ, func = crashdialog.parse_fatal_stacktrace(text)
|
||||
self.assertEqual(typ, "Segmentation fault")
|
||||
self.assertEqual(func, 'testfunc')
|
||||
|
||||
def test_valid_text_empty(self):
|
||||
"""Test parse_fatal_stacktrace with a valid text but empty function."""
|
||||
text = VALID_CRASH_TEXT_EMPTY.strip().replace('_', ' ')
|
||||
|
Loading…
Reference in New Issue
Block a user