aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qmp-event.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-03-17 12:54:35 +0100
committerMarkus Armbruster <armbru@redhat.com>2020-03-17 19:58:34 +0100
commit11deae8cd2ce1e1f4240ec7d880940f25ebd65b1 (patch)
treeb87517e1a9e7d77c5b0b3fd1d9223f0cc66ad992 /tests/test-qmp-event.c
parent052be50cf4621583bb2c33bdcd0f89b4ae873382 (diff)
tests/test-qmp-event: Check event is actually emitted
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200317115459.31821-11-armbru@redhat.com>
Diffstat (limited to 'tests/test-qmp-event.c')
-rw-r--r--tests/test-qmp-event.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c
index d64066139c..7dd0053190 100644
--- a/tests/test-qmp-event.c
+++ b/tests/test-qmp-event.c
@@ -26,6 +26,7 @@
typedef struct TestEventData {
QDict *expect;
+ bool emitted;
} TestEventData;
TestEventData *test_event_data;
@@ -52,7 +53,7 @@ void test_qapi_event_emit(test_QAPIEvent event, QDict *d)
qdict_del(d, "timestamp");
g_assert(qobject_is_equal(QOBJECT(d), QOBJECT(test_event_data->expect)));
-
+ test_event_data->emitted = true;
}
static void event_prepare(TestEventData *data,
@@ -87,6 +88,7 @@ static void test_event_a(TestEventData *data,
{
data->expect = qdict_from_jsonf_nofail("{ 'event': 'EVENT_A' }");
qapi_event_send_event_a();
+ g_assert(data->emitted);
qobject_unref(data->expect);
}
@@ -95,6 +97,7 @@ static void test_event_b(TestEventData *data,
{
data->expect = qdict_from_jsonf_nofail("{ 'event': 'EVENT_B' }");
qapi_event_send_event_b();
+ g_assert(data->emitted);
qobject_unref(data->expect);
}
@@ -107,6 +110,7 @@ static void test_event_c(TestEventData *data,
"{ 'event': 'EVENT_C', 'data': {"
" 'a': 1, 'b': { 'integer': 2, 'string': 'test1' }, 'c': 'test2' } }");
qapi_event_send_event_c(true, 1, true, &b, "test2");
+ g_assert(data->emitted);
qobject_unref(data->expect);
}
@@ -132,6 +136,7 @@ static void test_event_d(TestEventData *data,
" 'string': 'test2', 'enum2': 'value2' },"
" 'b': 'test3', 'enum3': 'value3' } }");
qapi_event_send_event_d(&a, "test3", false, NULL, true, ENUM_ONE_VALUE3);
+ g_assert(data->emitted);
qobject_unref(data->expect);
}