diff mbox series

[05/13] tests/qtest: s390x: fix operation in a build without any boards or devices

Message ID 20240509170044.190795-6-pbonzini@redhat.com (mailing list archive)
State New
Headers show
Series fix --without-default-devices build and (mostly) tests | expand

Commit Message

Paolo Bonzini May 9, 2024, 5 p.m. UTC
Do the bare minimum to ensure that at least a vanilla
--without-default-devices build works for all targets except i386,
x86_64 and ppc64.  In particular this fixes s390x-softmmu; i386 and
x86_64 have about a dozen failing tests that do not pass -M and therefore
require a default machine type; ppc64 has the same issue, though only
with numa-test.

If we can for now ignore the cases where boards and devices are picked
by hand, drive_del-test however can be fixed easily; almost all tests
check for the virtio-blk or virtio-scsi device that they use, and are
already skipped.  Only one didn't get the memo; plus another one does
not need a machine at all and can be run with -M none.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qtest/drive_del-test.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Thomas Huth May 10, 2024, 5:13 a.m. UTC | #1
On 09/05/2024 19.00, Paolo Bonzini wrote:
> Do the bare minimum to ensure that at least a vanilla
> --without-default-devices build works for all targets except i386,
> x86_64 and ppc64.  In particular this fixes s390x-softmmu; i386 and
> x86_64 have about a dozen failing tests that do not pass -M and therefore
> require a default machine type; ppc64 has the same issue, though only
> with numa-test.
> 
> If we can for now ignore the cases where boards and devices are picked
> by hand, drive_del-test however can be fixed easily; almost all tests
> check for the virtio-blk or virtio-scsi device that they use, and are
> already skipped.  Only one didn't get the memo; plus another one does
> not need a machine at all and can be run with -M none.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   tests/qtest/drive_del-test.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
> index 8a6f3ac963d..7b67a4bbee4 100644
> --- a/tests/qtest/drive_del-test.c
> +++ b/tests/qtest/drive_del-test.c
> @@ -173,7 +173,7 @@ static void test_drive_without_dev(void)
>       QTestState *qts;
>   
>       /* Start with an empty drive */
> -    qts = qtest_init("-drive if=none,id=drive0");
> +    qts = qtest_init("-drive if=none,id=drive0 -M none");
>   
>       /* Delete the drive */
>       drive_del(qts);
> @@ -192,6 +192,11 @@ static void test_after_failed_device_add(void)
>       QDict *response;
>       QTestState *qts;
>   
> +    if (!has_device_builtin("virtio-blk")) {
> +        g_test_skip("Device virtio-blk is not available");
> +        return;
> +    }
> +
>       snprintf(driver, sizeof(driver), "virtio-blk-%s",
>                qvirtio_get_dev_type());
>   

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
index 8a6f3ac963d..7b67a4bbee4 100644
--- a/tests/qtest/drive_del-test.c
+++ b/tests/qtest/drive_del-test.c
@@ -173,7 +173,7 @@  static void test_drive_without_dev(void)
     QTestState *qts;
 
     /* Start with an empty drive */
-    qts = qtest_init("-drive if=none,id=drive0");
+    qts = qtest_init("-drive if=none,id=drive0 -M none");
 
     /* Delete the drive */
     drive_del(qts);
@@ -192,6 +192,11 @@  static void test_after_failed_device_add(void)
     QDict *response;
     QTestState *qts;
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     snprintf(driver, sizeof(driver), "virtio-blk-%s",
              qvirtio_get_dev_type());