aboutsummaryrefslogtreecommitdiff
path: root/tests/virtio-ccw-test.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2019-07-22 17:10:55 +0200
committerThomas Huth <thuth@redhat.com>2019-08-15 19:24:10 +0200
commite5758de4e836c3b2edc2befd904651fc6967d74f (patch)
tree324827884570aa10cb22024f8735e43178e3a947 /tests/virtio-ccw-test.c
parent17de4741296af8ed3361b14feda130a7d7102987 (diff)
tests/libqtest: Make qtest_qmp_device_add/del independent from global_qtest
Generic library functions like qtest_qmp_device_add() and _del() should not depend on the global_qtest variable. Pass the test state via parameter instead. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20190813093047.27948-6-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/virtio-ccw-test.c')
-rw-r--r--tests/virtio-ccw-test.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/virtio-ccw-test.c b/tests/virtio-ccw-test.c
index 6be4e6aaf6..9f445ef4ad 100644
--- a/tests/virtio-ccw-test.c
+++ b/tests/virtio-ccw-test.c
@@ -45,10 +45,12 @@ static void virtio_serial_nop(void)
static void virtio_serial_hotplug(void)
{
- global_qtest = qtest_initf("-device virtio-serial-ccw");
- qtest_qmp_device_add("virtserialport", "hp-port", "{}");
- qtest_qmp_device_del("hp-port");
- qtest_end();
+ QTestState *qts = qtest_initf("-device virtio-serial-ccw");
+
+ qtest_qmp_device_add(qts, "virtserialport", "hp-port", "{}");
+ qtest_qmp_device_del(qts, "hp-port");
+
+ qtest_quit(qts);
}
static void virtio_blk_nop(void)
@@ -79,16 +81,16 @@ static void virtio_scsi_nop(void)
static void virtio_scsi_hotplug(void)
{
- global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
- "file.read-zeroes=on,format=raw "
+ QTestState *s = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
+ "file.read-zeroes=on,format=raw "
"-drive if=none,id=drv1,file=null-co://,"
"file.read-zeroes=on,format=raw "
"-device virtio-scsi-ccw "
"-device scsi-hd,drive=drv0");
- qtest_qmp_device_add("scsi-hd", "scsihd", "{'drive': 'drv1'}");
- qtest_qmp_device_del("scsihd");
+ qtest_qmp_device_add(s, "scsi-hd", "scsihd", "{'drive': 'drv1'}");
+ qtest_qmp_device_del(s, "scsihd");
- qtest_end();
+ qtest_quit(s);
}
int main(int argc, char **argv)