diff options
author | Michael Labiuk <michael.labiuk@virtuozzo.com> | 2022-09-30 01:35:39 +0300 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2022-10-11 14:06:48 +0200 |
commit | ea42a6c405269229d0923719854637425be07b31 (patch) | |
tree | d66e522890e732d53375aee299b1411260ce88c3 /tests/qtest/libqtest.c | |
parent | 770beadb984d630a89b5a7327925a4cfba4488d5 (diff) |
tests/x86: add helper qtest_qmp_device_del_send()
Move sending 'device_del' command to separate function.
Function can be used in case of addition action is needed to start
actual removing device after sending command.
Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com>
Message-Id: <20220929223547.1429580-2-michael.labiuk@virtuozzo.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
[thuth: Fixed typo]
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qtest/libqtest.c')
-rw-r--r-- | tests/qtest/libqtest.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 4f4b2d6477..7b6152807b 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1371,15 +1371,19 @@ void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd) * * {"return": {}} */ -void qtest_qmp_device_del(QTestState *qts, const char *id) +void qtest_qmp_device_del_send(QTestState *qts, const char *id) { - QDict *rsp; - - rsp = qtest_qmp(qts, "{'execute': 'device_del', 'arguments': {'id': %s}}", - id); - + QDict *rsp = qtest_qmp(qts, "{'execute': 'device_del', " + "'arguments': {'id': %s}}", id); + g_assert(rsp); g_assert(qdict_haskey(rsp, "return")); + g_assert(!qdict_haskey(rsp, "error")); qobject_unref(rsp); +} + +void qtest_qmp_device_del(QTestState *qts, const char *id) +{ + qtest_qmp_device_del_send(qts, id); qtest_qmp_eventwait(qts, "DEVICE_DELETED"); } |