summaryrefslogtreecommitdiffstats
path: root/tests/qtest/device-plug-test.c
diff options
context:
space:
mode:
authorMichael Labiuk2022-09-30 00:35:39 +0200
committerThomas Huth2022-10-11 14:06:48 +0200
commitea42a6c405269229d0923719854637425be07b31 (patch)
treed66e522890e732d53375aee299b1411260ce88c3 /tests/qtest/device-plug-test.c
parenttests/migration: remove the unused local variable (diff)
downloadqemu-ea42a6c405269229d0923719854637425be07b31.tar.gz
qemu-ea42a6c405269229d0923719854637425be07b31.tar.xz
qemu-ea42a6c405269229d0923719854637425be07b31.zip
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/device-plug-test.c')
-rw-r--r--tests/qtest/device-plug-test.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index e595b45b66..3841de1b8c 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -15,17 +15,6 @@
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"
-static void device_del(QTestState *qtest, const char *id)
-{
- QDict *resp;
-
- resp = qtest_qmp(qtest,
- "{'execute': 'device_del', 'arguments': { 'id': %s } }", id);
-
- g_assert(qdict_haskey(resp, "return"));
- qobject_unref(resp);
-}
-
static void system_reset(QTestState *qtest)
{
QDict *resp;
@@ -68,7 +57,7 @@ static void process_device_remove(QTestState *qtest, const char *id)
* be processed. However during system reset, the removal will be
* handled, removing the device.
*/
- device_del(qtest, id);
+ qtest_qmp_device_del_send(qtest, id);
system_reset(qtest);
wait_device_deleted_event(qtest, id);
}
@@ -112,7 +101,7 @@ static void test_ccw_unplug(void)
{
QTestState *qtest = qtest_initf("-device virtio-balloon-ccw,id=dev0");
- device_del(qtest, "dev0");
+ qtest_qmp_device_del_send(qtest, "dev0");
wait_device_deleted_event(qtest, "dev0");
qtest_quit(qtest);