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

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 21 14:24:05 PDT 2022


mib marked an inline comment as done.
mib added inline comments.


================
Comment at: lldb/packages/Python/lldbsuite/test/eventlistener.py:38-41
+        # Broadcast a eBroadcastBitStopListenerThread` event so the background
+        # thread stops listening to events, then join the background thread.
+        self.broadcaster.BroadcastEventByType(self.eBroadcastBitStopListenerThread)
+        self.listener_thread.join()
----------------
labath wrote:
> This cannot be done in the tearDown method (without extra synchronisation) as this is what guarantees that the events have been processed and can be read from the event array. This is what caused [[ https://lab.llvm.org/buildbot/#/builders/68/builds/29171 | TestDiagnosticReporting.py ]] to flake. If you want to do the shutdown in the tearDown method, then you'll need to introduce some other means of synchronising and ensuring that the event array can be accessed safely and contains all the things it is supposed to contain (e.g. through a new kind of a message).
I knew this was going to bite us eventually :/ Should we get back to the `start/stop` approach ?


================
Comment at: lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py:15
+    event_mask = lldb.SBDebugger.eBroadcastBitWarning | lldb.SBDebugger.eBroadcastBitError
+    event_data_extractor = lldb.SBDebugger.GetDiagnosticFromEvent
 
----------------
labath wrote:
> Why not just queue the events themselves and let the user do whatever it wants with them later?
We still need to setup the `event_mask` to filter out unwanted events from the source broadcaster.

We would have to set that up in the derived class `setUp` override.

@JDevlieghere do you have any other suggestion ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121977



More information about the lldb-commits mailing list