On 22/11/2023 08.24, Markus Armbruster wrote:
The generated qapi_event_send_FOO() call an event emitter function.
It's test_qapi_event_emit() in this test.  It compares the actual
event to the expected event, and sets a flag to record it was called.
The test functions set expected data and clear the flag before calling
qapi_event_send_FOO(), and check the flag afterwards.

Make test_qapi_event_emit() consume expected data, and the test
functions check it was consumed.  Delete the flag.  This is simpler.
It also catches extraneous calls of test_qapi_event_emit().  Catching
that is not worthwhile, but since the cost is negative...

Signed-off-by: Markus Armbruster <arm...@redhat.com>
---
  tests/unit/test-qmp-event.c | 30 ++++++++++--------------------
  1 file changed, 10 insertions(+), 20 deletions(-)

Good idea!
Reviewed-by: Thomas Huth <th...@redhat.com>



Reply via email to