[Lldb-commits] [PATCH] D149175: [lldb/test] Update lldbutil.fetch_next_event to match broadcaster class
    Med Ismail Bennani via Phabricator via lldb-commits 
    lldb-commits at lists.llvm.org
       
    Tue Apr 25 11:26:26 PDT 2023
    
    
  
mib updated this revision to Diff 516854.
mib marked 2 inline comments as done.
mib edited the summary of this revision.
mib added a comment.
Address @bulbazord comments.
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149175/new/
https://reviews.llvm.org/D149175
Files:
  lldb/packages/Python/lldbsuite/test/lldbutil.py
Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -1202,18 +1202,25 @@
     broadcaster.AddListener(listener, event_mask)
     return listener
 
-def fetch_next_event(test, listener, broadcaster, timeout=10):
+def fetch_next_event(test, listener, broadcaster, match_class=False, timeout=10):
     """Fetch one event from the listener and return it if it matches the provided broadcaster.
+    If `match_class` is set to True, this will match an event with an entire broadcaster class.
     Fails otherwise."""
 
     event = lldb.SBEvent()
 
     if listener.WaitForEvent(timeout, event):
-        if event.BroadcasterMatchesRef(broadcaster):
-            return event
+        if match_class:
+            if event.GetBroadcasterClass() == broadcaster:
+                return event
+        else:
+            if event.BroadcasterMatchesRef(broadcaster):
+                return event
 
+        stream = lldb.SBStream()
+        event.GetDescription(stream)
         test.fail("received event '%s' from unexpected broadcaster '%s'." %
-                  (event.GetDescription(), event.GetBroadcaster().GetName()))
+                  (stream.GetData(), event.GetBroadcaster().GetName()))
 
     test.fail("couldn't fetch an event before reaching the timeout.")
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149175.516854.patch
Type: text/x-patch
Size: 1445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230425/b7849d1b/attachment.bin>
    
    
More information about the lldb-commits
mailing list