qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] tests/unit/test-qmp-event: Simplify event emission check


From: Thomas Huth
Subject: Re: [PATCH 2/3] tests/unit/test-qmp-event: Simplify event emission check
Date: Wed, 22 Nov 2023 09:07:24 +0100
User-agent: Mozilla Thunderbird

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 <armbru@redhat.com>
---
  tests/unit/test-qmp-event.c | 30 ++++++++++--------------------
  1 file changed, 10 insertions(+), 20 deletions(-)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]