qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Fabiano Rosas <farosas@suse.de>, qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 07/12] tests/qtest: drive_del-test: Skip tests that require missing devices
Date: Tue, 7 Feb 2023 15:20:04 +0100	[thread overview]
Message-ID: <2d31e4e9-b5b5-fe98-417d-73920ef2b9e7@redhat.com> (raw)
In-Reply-To: <20230206150416.4604-8-farosas@suse.de>

On 06/02/2023 16.04, Fabiano Rosas wrote:
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/drive_del-test.c | 70 ++++++++++++++++++++++++++++++++++++
>   1 file changed, 70 insertions(+)
> 
> diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
> index 9a750395a9..6fa96fa94a 100644
> --- a/tests/qtest/drive_del-test.c
> +++ b/tests/qtest/drive_del-test.c
> @@ -16,6 +16,21 @@
>   #include "qapi/qmp/qdict.h"
>   #include "qapi/qmp/qlist.h"
>   
> +static const char *qvirtio_get_dev_type(void);
> +
> +/*
> + * This covers the possible absence of a device due to QEMU build
> + * options.
> + */
> +static bool look_for_device_builtin(const char *prefix, const char *suffix)
> +{
> +    gchar *device = g_strdup_printf("%s-%s", prefix, suffix);
> +    bool rc = qtest_has_device(device);
> +
> +    g_free(device);
> +    return rc;
> +}

I think I'd rather merge the above code into the has_device_builtin() 
function below ... or is there a reason for keeping this separate?

>   static bool look_for_drive0(QTestState *qts, const char *command, const char *key)
>   {
>       QDict *response;
> @@ -40,6 +55,11 @@ static bool look_for_drive0(QTestState *qts, const char *command, const char *ke
>       return found;
>   }
>   
> +static bool has_device_builtin(const char *dev)
> +{
> +    return look_for_device_builtin(dev, qvirtio_get_dev_type());
> +}
> +
>   static bool has_drive(QTestState *qts)
>   {
>       return look_for_drive0(qts, "query-block", "device");
> @@ -208,6 +228,11 @@ static void test_drive_del_device_del(void)
>   {
>       QTestState *qts;
>   
> +    if (!has_device_builtin("virtio-scsi")) {
> +        g_test_skip(NULL);

Having a short message for the skip would be nice.

> +        return;
> +    }

  Thomas



  reply	other threads:[~2023-02-07 14:20 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 15:04 [PATCH 00/12] qtests vs. default devices Fabiano Rosas
2023-02-06 15:04 ` [PATCH 01/12] tests/qtest: Skip PXE tests for missing devices Fabiano Rosas
2023-02-07 13:14   ` Thomas Huth
2023-02-06 15:04 ` [PATCH 02/12] tests/qtest: Do not run lsi53c895a test if device is not present Fabiano Rosas
2023-02-06 15:31   ` Philippe Mathieu-Daudé
2023-02-06 17:46     ` Fabiano Rosas
2023-02-06 18:52       ` Philippe Mathieu-Daudé
2023-02-07 13:12   ` Thomas Huth
2023-02-07 14:02     ` Fabiano Rosas
2023-02-07 14:12       ` Thomas Huth
2023-02-06 15:04 ` [PATCH 03/12] tests/qtest: Add dependence on PCIE_ROOT for virtio-net-failover.c Fabiano Rosas
2023-02-07 13:22   ` Thomas Huth
2023-02-07 15:02     ` Fabiano Rosas
2023-02-06 15:04 ` [PATCH 04/12] tests/qtest: Skip virtio-serial-console tests if device not present Fabiano Rosas
2023-02-07 13:25   ` Thomas Huth
2023-02-07 15:35     ` Laurent Vivier
2023-02-07 13:37   ` Thomas Huth
2023-02-06 15:04 ` [PATCH 05/12] tests/qtest: hd-geo-test: Check for missing devices Fabiano Rosas
2023-02-07 13:52   ` Thomas Huth
2023-02-06 15:04 ` [PATCH 06/12] tests/qtest: Skip unplug tests that use " Fabiano Rosas
2023-02-07 13:59   ` Thomas Huth
2023-02-07 14:17     ` Fabiano Rosas
2023-02-07 14:22       ` Thomas Huth
2023-02-06 15:04 ` [PATCH 07/12] tests/qtest: drive_del-test: Skip tests that require " Fabiano Rosas
2023-02-07 14:20   ` Thomas Huth [this message]
2023-02-07 14:32     ` Fabiano Rosas
2023-02-06 15:04 ` [PATCH 08/12] tests/qtest: Check for devices in bios-tables-test Fabiano Rosas
2023-02-06 15:21   ` Michael S. Tsirkin
2023-02-06 15:04 ` [PATCH 09/12] tests/qtest: Do not include hexloader-test if loader device is not present Fabiano Rosas
2023-02-07 14:30   ` Thomas Huth
2023-02-06 15:04 ` [PATCH 10/12] tests/qemu-iotests: Require virtio-scsi-pci Fabiano Rosas
2023-02-07 14:32   ` Thomas Huth
2023-02-06 15:04 ` [PATCH 11/12] tests/qtest: bios-tables-test: Skip if missing configs Fabiano Rosas
2023-02-07 14:35   ` Thomas Huth
2023-02-07 14:42     ` Michael S. Tsirkin
2023-02-08 10:52       ` Igor Mammedov
2023-02-08 14:25         ` Michael S. Tsirkin
2023-02-06 15:04 ` [PATCH 12/12] [NOT FOR MERGE] tests/qtest: Introduce qtest_validate_args Fabiano Rosas
2023-02-07 14:55   ` Thomas Huth
2023-02-07 15:35     ` Fabiano Rosas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d31e4e9-b5b5-fe98-417d-73920ef2b9e7@redhat.com \
    --to=thuth@redhat.com \
    --cc=farosas@suse.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).