[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07/12] tests/qtest: drive_del-test: Skip tests that require m
From: |
Fabiano Rosas |
Subject: |
Re: [PATCH 07/12] tests/qtest: drive_del-test: Skip tests that require missing devices |
Date: |
Tue, 07 Feb 2023 11:32:21 -0300 |
Thomas Huth <thuth@redhat.com> writes:
> 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?
No reason, I'll merge them.
>> 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.
ok.
- Re: [PATCH 04/12] tests/qtest: Skip virtio-serial-console tests if device not present, (continued)
- [PATCH 07/12] tests/qtest: drive_del-test: Skip tests that require missing devices, Fabiano Rosas, 2023/02/06
- [PATCH 08/12] tests/qtest: Check for devices in bios-tables-test, Fabiano Rosas, 2023/02/06
- [PATCH 09/12] tests/qtest: Do not include hexloader-test if loader device is not present, Fabiano Rosas, 2023/02/06
- [PATCH 10/12] tests/qemu-iotests: Require virtio-scsi-pci, Fabiano Rosas, 2023/02/06
- [PATCH 11/12] tests/qtest: bios-tables-test: Skip if missing configs, Fabiano Rosas, 2023/02/06