[Lldb-commits] [PATCH] D121977: [lldb/test] Add events listener helper class to lldbtest

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 18 13:15:51 PDT 2022


JDevlieghere added inline comments.


================
Comment at: lldb/packages/Python/lldbsuite/test/eventlistener.py:19
+    eBroadcastBitStopListenerThread = (1 << 0)
+    fetched_events = []
+
----------------
Just `events` maybe?


================
Comment at: lldb/packages/Python/lldbsuite/test/eventlistener.py:22
+
+    def setUp(self, src_broadcaster, event_mask, event_data_extractor):
+        self.src_broadcaster = src_broadcaster
----------------
Could we avoid the arguments by making these two things properties of the test? I'm trying to avoid the:

```
TestBase.setUp(self) 
EventListener.setUp(self)
```
So that tests would have to set:

```
class TestDiagnosticReporting(EventListenerTest):
  event_mask = lldb.SBDebugger.eBroadcastBitWarning | lldb.SBDebugger.eBroadcastBitError
  event_extractor = lldb.SBDebugger.GetDiagnosticFromEvent
```

Presumable those two things don't need the debugger and I think we can avoid the `self.src_broadcaster` too (see below). 





================
Comment at: lldb/packages/Python/lldbsuite/test/eventlistener.py:23
+    def setUp(self, src_broadcaster, event_mask, event_data_extractor):
+        self.src_broadcaster = src_broadcaster
+        self.broadcaster = lldb.SBBroadcaster('lldb.test.broadcaster')
----------------
Would this always be ` self.dbg.GetBroadcaster()`? 


================
Comment at: lldb/packages/Python/lldbsuite/test/eventlistener.py:6
+
+class EventListener(TestBase):
+
----------------
`EventListenerTest`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121977/new/

https://reviews.llvm.org/D121977



More information about the lldb-commits mailing list