diff mbox series

[v3,3/3] tests/qtest: Don't run cdrom boot tests if no accelerator is present

Message ID 20230508181611.2621-4-farosas@suse.de
State New
Headers show
Series target/arm: disable-tcg and without-default-devices fixes | expand

Commit Message

Fabiano Rosas May 8, 2023, 6:16 p.m. UTC
On a build configured with: --disable-tcg --enable-xen it is possible
to produce a QEMU binary with no TCG nor KVM support. Skip the cdrom
boot tests if that's the case.

Fixes: 0c1ae3ff9d ("tests/qtest: Fix tests when no KVM or TCG are present")
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/cdrom-test.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Thomas Huth May 9, 2023, 6:51 a.m. UTC | #1
On 08/05/2023 20.16, Fabiano Rosas wrote:
> On a build configured with: --disable-tcg --enable-xen it is possible
> to produce a QEMU binary with no TCG nor KVM support. Skip the cdrom
> boot tests if that's the case.
> 
> Fixes: 0c1ae3ff9d ("tests/qtest: Fix tests when no KVM or TCG are present")
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/cdrom-test.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
> index 26a2400181..31d3bacd8c 100644
> --- a/tests/qtest/cdrom-test.c
> +++ b/tests/qtest/cdrom-test.c
> @@ -130,6 +130,11 @@ static void test_cdboot(gconstpointer data)
>   
>   static void add_x86_tests(void)
>   {
> +    if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
> +        g_test_skip("No KVM or TCG accelerator available, skipping boot tests");
> +        return;
> +    }
> +
>       qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
>       qtest_add_data_func("cdrom/boot/virtio-scsi",
>                           "-device virtio-scsi -device scsi-cd,drive=cdr "
> @@ -176,6 +181,11 @@ static void add_x86_tests(void)
>   
>   static void add_s390x_tests(void)
>   {
> +    if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
> +        g_test_skip("No KVM or TCG accelerator available, skipping boot tests");
> +        return;
> +    }
> +
>       qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
>       qtest_add_data_func("cdrom/boot/virtio-scsi",
>                           "-device virtio-scsi -device scsi-cd,drive=cdr "

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

Patch

diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
index 26a2400181..31d3bacd8c 100644
--- a/tests/qtest/cdrom-test.c
+++ b/tests/qtest/cdrom-test.c
@@ -130,6 +130,11 @@  static void test_cdboot(gconstpointer data)
 
 static void add_x86_tests(void)
 {
+    if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
+        g_test_skip("No KVM or TCG accelerator available, skipping boot tests");
+        return;
+    }
+
     qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
     qtest_add_data_func("cdrom/boot/virtio-scsi",
                         "-device virtio-scsi -device scsi-cd,drive=cdr "
@@ -176,6 +181,11 @@  static void add_x86_tests(void)
 
 static void add_s390x_tests(void)
 {
+    if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
+        g_test_skip("No KVM or TCG accelerator available, skipping boot tests");
+        return;
+    }
+
     qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
     qtest_add_data_func("cdrom/boot/virtio-scsi",
                         "-device virtio-scsi -device scsi-cd,drive=cdr "