aboutsummaryrefslogtreecommitdiff
path: root/tests/virtio-scsi-test.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2019-05-18 10:23:24 +0200
committerThomas Huth <thuth@redhat.com>2019-08-15 19:23:59 +0200
commit1999a70a05ad603d1c76e0a7d230bcfed0d626ac (patch)
tree967aed417b9d954d6b7436dc19b2e22dfce8a3b4 /tests/virtio-scsi-test.c
parentca1ef1e62e581f61c40f8be49d222007739691c4 (diff)
tests/libqos: Make generic virtio code independent from global_qtest
The libqos library functions should never depend on global_qtest, since these functions might be used in tests that track multiple test states. Pass around a pointer to the QTestState instead. Message-Id: <20190814195920.32023-1-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/virtio-scsi-test.c')
-rw-r--r--tests/virtio-scsi-test.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c
index ae6698ddb4..6393272149 100644
--- a/tests/virtio-scsi-test.c
+++ b/tests/virtio-scsi-test.c
@@ -72,6 +72,7 @@ static uint8_t virtio_scsi_do_command(QVirtioSCSIQueues *vs,
uint64_t req_addr, resp_addr, data_in_addr = 0, data_out_addr = 0;
uint8_t response;
uint32_t free_head;
+ QTestState *qts = global_qtest;
vq = vs->vq[2];
@@ -83,24 +84,24 @@ static uint8_t virtio_scsi_do_command(QVirtioSCSIQueues *vs,
/* Add request header */
req_addr = qvirtio_scsi_alloc(vs, sizeof(req), &req);
- free_head = qvirtqueue_add(vq, req_addr, sizeof(req), false, true);
+ free_head = qvirtqueue_add(qts, vq, req_addr, sizeof(req), false, true);
if (data_out_len) {
data_out_addr = qvirtio_scsi_alloc(vs, data_out_len, data_out);
- qvirtqueue_add(vq, data_out_addr, data_out_len, false, true);
+ qvirtqueue_add(qts, vq, data_out_addr, data_out_len, false, true);
}
/* Add response header */
resp_addr = qvirtio_scsi_alloc(vs, sizeof(resp), &resp);
- qvirtqueue_add(vq, resp_addr, sizeof(resp), true, !!data_in_len);
+ qvirtqueue_add(qts, vq, resp_addr, sizeof(resp), true, !!data_in_len);
if (data_in_len) {
data_in_addr = qvirtio_scsi_alloc(vs, data_in_len, data_in);
- qvirtqueue_add(vq, data_in_addr, data_in_len, true, false);
+ qvirtqueue_add(qts, vq, data_in_addr, data_in_len, true, false);
}
- qvirtqueue_kick(vs->dev, vq, free_head);
- qvirtio_wait_used_elem(vs->dev, vq, free_head, NULL,
+ qvirtqueue_kick(qts, vs->dev, vq, free_head);
+ qvirtio_wait_used_elem(qts, vs->dev, vq, free_head, NULL,
QVIRTIO_SCSI_TIMEOUT_US);
response = readb(resp_addr +