Files
clang-p2996/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py
Jonas Devlieghere 2238dcc393 [NFC][Py Reformat] Reformat python files in lldb
This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black` (23.1.0).

If you end up having problems merging this commit because you have made
changes to a python file, the best way to handle that is to run `git
checkout --ours <yourfile>` and then reformat it with black.

RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Differential revision: https://reviews.llvm.org/D151460
2023-05-25 12:54:09 -07:00

39 lines
1.3 KiB
Python

"""
Test that we are able to broadcast and receive diagnostic events from lldb
"""
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
class TestDiagnosticReporting(TestBase):
def setUp(self):
TestBase.setUp(self)
self.broadcaster = self.dbg.GetBroadcaster()
self.listener = lldbutil.start_listening_from(
self.broadcaster,
lldb.SBDebugger.eBroadcastBitWarning | lldb.SBDebugger.eBroadcastBitError,
)
def test_dwarf_symbol_loading_diagnostic_report(self):
"""Test that we are able to fetch diagnostic events"""
self.yaml2obj("minidump.yaml", self.getBuildArtifact("minidump.core"))
self.dbg.CreateTarget(None)
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore(self.getBuildArtifact("minidump.core"))
event = lldbutil.fetch_next_event(self, self.listener, self.broadcaster)
diagnostic_data = lldb.SBDebugger.GetDiagnosticFromEvent(event)
self.assertEquals(
diagnostic_data.GetValueForKey("type").GetStringValue(100), "warning"
)
self.assertEquals(
diagnostic_data.GetValueForKey("message").GetStringValue(100),
"unable to retrieve process ID from minidump file, setting process ID to 1",
)