tests/virtio-scsi: add a virtio_error() IOThread test
Now that virtio_error() calls should work in an IOThread, add a virtio-scsi IOThread test cases that triggers virtio_error(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20250922220149.498967-6-stefanha@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
e06d96d5a9
commit
acaa3be3f7
1 changed files with 32 additions and 0 deletions
|
|
@ -311,6 +311,31 @@ fail:
|
|||
unlink(tmp_path);
|
||||
}
|
||||
|
||||
static void test_iothread_virtio_error(void *obj, void *data,
|
||||
QGuestAllocator *t_alloc)
|
||||
{
|
||||
QVirtioSCSIPCI *scsi_pci = obj;
|
||||
QVirtioSCSI *scsi = &scsi_pci->scsi;
|
||||
QVirtioSCSIQueues *vs;
|
||||
QVirtQueue *vq;
|
||||
|
||||
alloc = t_alloc;
|
||||
vs = qvirtio_scsi_init(scsi->vdev);
|
||||
vq = vs->vq[2];
|
||||
|
||||
/* Move avail.idx out of bounds to trigger virtio_error() */
|
||||
qvirtqueue_set_avail_idx(global_qtest, scsi->vdev, vq, vq->size * 2);
|
||||
scsi->vdev->bus->virtqueue_kick(scsi->vdev, vq);
|
||||
|
||||
/*
|
||||
* Reset the device out of the error state. If QEMU hangs or crashes then
|
||||
* this will fail.
|
||||
*/
|
||||
qvirtio_reset(scsi->vdev);
|
||||
|
||||
qvirtio_scsi_pci_free(vs);
|
||||
}
|
||||
|
||||
static void *virtio_scsi_hotplug_setup(GString *cmd_line, void *arg)
|
||||
{
|
||||
g_string_append(cmd_line,
|
||||
|
|
@ -383,6 +408,13 @@ static void register_virtio_scsi_test(void)
|
|||
};
|
||||
qos_add_test("iothread-attach-node", "virtio-scsi-pci",
|
||||
test_iothread_attach_node, &opts);
|
||||
|
||||
opts.before = virtio_scsi_setup_iothread;
|
||||
opts.edge = (QOSGraphEdgeOptions) {
|
||||
.extra_device_opts = "iothread=thread0",
|
||||
};
|
||||
qos_add_test("iothread-virtio-error", "virtio-scsi-pci",
|
||||
test_iothread_virtio_error, &opts);
|
||||
}
|
||||
|
||||
libqos_init(register_virtio_scsi_test);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue