On Thu, 31 Aug 2017 16:40:08 +0200
Thomas Huth <th...@redhat.com> wrote:

> We can use the drive_del test on s390x, too, to check that adding and
> deleting also works fine with the virtio-ccw bus. But we have to make
> sure that we use the devices with the "-ccw" suffix instead of the
> "-pci" suffix for the virtio-ccw transport on s390x. Introduce a helper
> function called qvirtio_get_dev_type() that returns the correct string
> for the current architecture.
> 
> Signed-off-by: Thomas Huth <th...@redhat.com>
> ---
>  I'm just sending a patch for this test now to get some feedback whether
>  I'm on the right track now. If this approach with qvirtio_get_dev_type()
>  gets accepted, I'll continue converting the other virtio tests, too.

Looks good.

> 
>  tests/Makefile.include |  3 ++-
>  tests/drive_del-test.c | 25 ++++++++++++++++---------
>  tests/libqos/virtio.c  | 17 +++++++++++++++++
>  tests/libqos/virtio.h  |  3 +++
>  4 files changed, 38 insertions(+), 10 deletions(-)
> 

> diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
> index 9880a69..0879a62 100644
> --- a/tests/libqos/virtio.c
> +++ b/tests/libqos/virtio.c
> @@ -339,3 +339,20 @@ void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t 
> idx)
>      /* vq->avail->used_event */
>      writew(vq->avail + 4 + (2 * vq->size), idx);
>  }
> +
> +/*
> + * qvirtio_get_dev_type:
> + * Returns: the preferred virtio bus/device type for the current 
> architecture.
> + */
> +const char *qvirtio_get_dev_type(void)
> +{
> +    const char *arch = qtest_get_arch();
> +
> +    if (g_str_equal(arch, "arm") || g_str_equal(arch, "aarch64")) {
> +        return "device";  /* for virtio-mmio */

Would not mind a comment from someone familiar with virtio-mmio, though.

> +    } else if (g_str_equal(arch, "s390x")) {
> +        return "ccw";
> +    } else {
> +        return "pci";
> +    }
> +}

I'll take this, unless someone complains.

Reply via email to