[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/38] device-plug-test: use qtest_qmp to send the device_del comm
From: |
Paolo Bonzini |
Subject: |
[PULL 24/38] device-plug-test: use qtest_qmp to send the device_del command |
Date: |
Mon, 12 Oct 2020 16:33:29 -0400 |
Simplify the code now that events are buffered. There is no need
anymore to separate sending the command and retrieving the response.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qtest/device-plug-test.c | 32 +++++++++-----------------------
1 file changed, 9 insertions(+), 23 deletions(-)
diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index a2247856be..559d47727a 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -15,26 +15,17 @@
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"
-static void device_del_start(QTestState *qtest, const char *id)
+static void device_del(QTestState *qtest, const char *id)
{
- qtest_qmp_send(qtest,
- "{'execute': 'device_del', 'arguments': { 'id': %s } }",
id);
-}
+ QDict *resp;
-static void device_del_finish(QTestState *qtest)
-{
- QDict *resp = qtest_qmp_receive_dict(qtest);
+ resp = qtest_qmp(qtest,
+ "{'execute': 'device_del', 'arguments': { 'id': %s } }",
id);
g_assert(qdict_haskey(resp, "return"));
qobject_unref(resp);
}
-static void device_del_request(QTestState *qtest, const char *id)
-{
- device_del_start(qtest, id);
- device_del_finish(qtest);
-}
-
static void system_reset(QTestState *qtest)
{
QDict *resp;
@@ -79,7 +70,7 @@ static void test_pci_unplug_request(void)
* be processed. However during system reset, the removal will be
* handled, removing the device.
*/
- device_del_request(qtest, "dev0");
+ device_del(qtest, "dev0");
system_reset(qtest);
wait_device_deleted_event(qtest, "dev0");
@@ -90,13 +81,8 @@ static void test_ccw_unplug(void)
{
QTestState *qtest = qtest_initf("-device virtio-balloon-ccw,id=dev0");
- /*
- * The DEVICE_DELETED events will be sent before the command
- * completes.
- */
- device_del_start(qtest, "dev0");
+ device_del(qtest, "dev0");
wait_device_deleted_event(qtest, "dev0");
- device_del_finish(qtest);
qtest_quit(qtest);
}
@@ -109,7 +95,7 @@ static void test_spapr_cpu_unplug_request(void)
"-device
power9_v2.0-spapr-cpu-core,core-id=1,id=dev0");
/* similar to test_pci_unplug_request */
- device_del_request(qtest, "dev0");
+ device_del(qtest, "dev0");
system_reset(qtest);
wait_device_deleted_event(qtest, "dev0");
@@ -125,7 +111,7 @@ static void test_spapr_memory_unplug_request(void)
"-device pc-dimm,id=dev0,memdev=mem0");
/* similar to test_pci_unplug_request */
- device_del_request(qtest, "dev0");
+ device_del(qtest, "dev0");
system_reset(qtest);
wait_device_deleted_event(qtest, "dev0");
@@ -139,7 +125,7 @@ static void test_spapr_phb_unplug_request(void)
qtest = qtest_initf("-device spapr-pci-host-bridge,index=1,id=dev0");
/* similar to test_pci_unplug_request */
- device_del_request(qtest, "dev0");
+ device_del(qtest, "dev0");
system_reset(qtest);
wait_device_deleted_event(qtest, "dev0");
--
2.26.2
- [PULL 12/38] exec: split out non-softmmu-specific parts, (continued)
- [PULL 12/38] exec: split out non-softmmu-specific parts, Paolo Bonzini, 2020/10/12
- [PULL 11/38] softmmu: move more files to softmmu/, Paolo Bonzini, 2020/10/12
- [PULL 17/38] qtest: unify extra_qtest_srcs and extra_qtest_deps, Paolo Bonzini, 2020/10/12
- [PULL 15/38] docs/devel/qtest: Include protocol spec in document, Paolo Bonzini, 2020/10/12
- [PULL 18/38] docs/devel: update instruction on how to add new unit tests, Paolo Bonzini, 2020/10/12
- [PULL 29/38] scsi/scsi_bus: switch search direction in scsi_device_find, Paolo Bonzini, 2020/10/12
- [PULL 26/38] qtest: check that drives are really appearing and disappearing, Paolo Bonzini, 2020/10/12
- [PULL 22/38] qtest: Reintroduce qtest_qmp_receive with QMP event buffering, Paolo Bonzini, 2020/10/12
- [PULL 23/38] qtest: remove qtest_qmp_receive_success, Paolo Bonzini, 2020/10/12
- [PULL 19/38] build-sys: fix git version from -version, Paolo Bonzini, 2020/10/12
- [PULL 24/38] device-plug-test: use qtest_qmp to send the device_del command,
Paolo Bonzini <=
- [PULL 25/38] qtest: switch users back to qtest_qmp_receive, Paolo Bonzini, 2020/10/12
- [PULL 20/38] meson.build: Re-enable KVM support for MIPS, Paolo Bonzini, 2020/10/12
- [PULL 21/38] qtest: rename qtest_qmp_receive to qtest_qmp_receive_dict, Paolo Bonzini, 2020/10/12
- [PULL 14/38] docs: Move QTest documentation to its own document, Paolo Bonzini, 2020/10/12
- [PULL 28/38] qdev: add "check if address free" callback for buses, Paolo Bonzini, 2020/10/12
- [PULL 16/38] docs/devel/qtest: Include libqtest API reference, Paolo Bonzini, 2020/10/12
- [PULL 33/38] device-core: use atomic_set on .realized property, Paolo Bonzini, 2020/10/12
- [PULL 32/38] scsi: switch to bus->check_address, Paolo Bonzini, 2020/10/12
- [PULL 13/38] qom: fix objects with improper parent type, Paolo Bonzini, 2020/10/12
- [PULL 38/38] meson: identify more sections of meson.build, Paolo Bonzini, 2020/10/12