[lldb/test] Add events listener helper function to lldbtest
authorMed Ismail Bennani <medismail.bennani@gmail.com>
Wed, 23 Mar 2022 19:29:47 +0000 (12:29 -0700)
committerMed Ismail Bennani <medismail.bennani@gmail.com>
Wed, 23 Mar 2022 19:30:09 +0000 (12:30 -0700)
commit9216baf87d887b75d114e9621cf2ccfa0f19a386
tree6b9cfe0192a5062262c3b5c05882b1531aaf8ca5
parent52f323d0f1a45001c9be65ac42a48d902b903752
[lldb/test] Add events listener helper function to lldbtest

This patch introduces 2 new lldb utility functions:
- lldbutil.start_listening_from: This can be called in the test setup to
  create a listener and set it up for a specific event mask and add it
  to the user-provided broadcaster's list.
- lldbutil.fetch_next_event: This will use fetch a single event from the
  provided istener and return it if it matches the provided broadcaster.

The motivation behind this is to easily test new kinds of events
(i.e. Swift type-system progress events). However, this patch also
updates `TestProgressReporting.py` and `TestDiagnosticReporting.py`
to make use of these new helper functions.

Differential Revision: https://reviews.llvm.org/D122193

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
lldb/packages/Python/lldbsuite/test/lldbutil.py
lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py
lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py