[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 06/19] tests/test-qmp-event: Check event is actually emitted
From: |
Markus Armbruster |
Subject: |
[RFC PATCH 06/19] tests/test-qmp-event: Check event is actually emitted |
Date: |
Thu, 24 Oct 2019 14:34:45 +0200 |
Signed-off-by: Markus Armbruster <address@hidden>
---
tests/test-qmp-event.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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);
}
--
2.21.0
- [RFC PATCH 15/19] qapi: Mark deprecated QMP commands with feature 'deprecated', (continued)
- [RFC PATCH 15/19] qapi: Mark deprecated QMP commands with feature 'deprecated', Markus Armbruster, 2019/10/24
- [RFC PATCH 18/19] qapi: Include a warning in the response to a deprecated command, Markus Armbruster, 2019/10/24
- [RFC PATCH 19/19] qapi: Implement -compat deprecated-output=hide for events, Markus Armbruster, 2019/10/24
- [RFC PATCH 17/19] qapi: Implement -compat deprecated-input=crash for commands, Markus Armbruster, 2019/10/24
- [RFC PATCH 13/19] qapi: New special feature flag "deprecated", Markus Armbruster, 2019/10/24
- [RFC PATCH 05/19] tests/test-qmp-event: Use qobject_is_equal(), Markus Armbruster, 2019/10/24
- [RFC PATCH 14/19] qemu-options: New -compat to set policy for "funny" interfaces, Markus Armbruster, 2019/10/24
- [RFC PATCH 09/19] qapi: Inline do_qmp_dispatch() into qmp_dispatch(), Markus Armbruster, 2019/10/24
- [RFC PATCH 11/19] qapi: Simplify how qmp_dispatch() gets the request ID, Markus Armbruster, 2019/10/24
- [RFC PATCH 16/19] qapi: Implement -compat deprecated-input=reject for commands, Markus Armbruster, 2019/10/24
- [RFC PATCH 06/19] tests/test-qmp-event: Check event is actually emitted,
Markus Armbruster <=
- [RFC PATCH 10/19] qapi: Simplify how qmp_dispatch() deals with QCO_NO_SUCCESS_RESP, Markus Armbruster, 2019/10/24
- [RFC PATCH 08/19] qapi: Consistently put @features parameter right after @ifcond, Markus Armbruster, 2019/10/24
- [RFC PATCH 07/19] qapi: Add feature flags to remaining definitions, Markus Armbruster, 2019/10/24