qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 01/12] tests/qtest: Skip PXE tests for missing devices
       [not found] <20230208194700.11035-1-farosas@suse.de>
@ 2023-02-08 19:46 ` Fabiano Rosas
  2023-02-08 19:46 ` [PATCH v2 02/12] tests/qtest: Do not run lsi53c895a test if device is not present Fabiano Rosas
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Fabiano Rosas @ 2023-02-08 19:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Laurent Vivier, Paolo Bonzini

Check if the devices we're trying to add are present in the QEMU
binary. They could have been removed from the build via Kconfig or the
--without-default-devices option.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/qtest/pxe-test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c
index 52f0b5c67c..62b6eef464 100644
--- a/tests/qtest/pxe-test.c
+++ b/tests/qtest/pxe-test.c
@@ -108,6 +108,10 @@ static void test_batch(const testdef_t *tests, bool ipv6)
         const testdef_t *test = &tests[i];
         char *testname;
 
+        if (!qtest_has_device(test->model)) {
+            continue;
+        }
+
         testname = g_strdup_printf("pxe/ipv4/%s/%s",
                                    test->machine, test->model);
         qtest_add_data_func(testname, test, test_pxe_ipv4);
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 02/12] tests/qtest: Do not run lsi53c895a test if device is not present
       [not found] <20230208194700.11035-1-farosas@suse.de>
  2023-02-08 19:46 ` [PATCH v2 01/12] tests/qtest: Skip PXE tests for missing devices Fabiano Rosas
@ 2023-02-08 19:46 ` Fabiano Rosas
  2023-02-08 19:46 ` [PATCH v2 08/12] tests/qtest: drive_del-test: Skip tests that require missing devices Fabiano Rosas
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Fabiano Rosas @ 2023-02-08 19:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Alexander Bulekov, Paolo Bonzini, Bandan Das,
	Stefan Hajnoczi, Darren Kenny, Qiuhao Li, Fam Zheng,
	Laurent Vivier

The tests are built once for all the targets, so as long as one QEMU
binary is built with CONFIG_LSI_SCSI_PCI=y, this test will
run. However some binaries might not include the device. So check this
again in runtime.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 tests/qtest/fuzz-lsi53c895a-test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/qtest/fuzz-lsi53c895a-test.c b/tests/qtest/fuzz-lsi53c895a-test.c
index 392a7ae7ed..a9254b455d 100644
--- a/tests/qtest/fuzz-lsi53c895a-test.c
+++ b/tests/qtest/fuzz-lsi53c895a-test.c
@@ -112,6 +112,10 @@ static void test_lsi_do_dma_empty_queue(void)
 
 int main(int argc, char **argv)
 {
+    if (!qtest_has_device("lsi53c895a")) {
+        return 0;
+    }
+
     g_test_init(&argc, &argv, NULL);
 
     qtest_add_func("fuzz/lsi53c895a/lsi_do_dma_empty_queue",
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 08/12] tests/qtest: drive_del-test: Skip tests that require missing devices
       [not found] <20230208194700.11035-1-farosas@suse.de>
  2023-02-08 19:46 ` [PATCH v2 01/12] tests/qtest: Skip PXE tests for missing devices Fabiano Rosas
  2023-02-08 19:46 ` [PATCH v2 02/12] tests/qtest: Do not run lsi53c895a test if device is not present Fabiano Rosas
@ 2023-02-08 19:46 ` Fabiano Rosas
  2023-02-09  8:12   ` Thomas Huth
       [not found] ` <20230208194700.11035-4-farosas@suse.de>
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 9+ messages in thread
From: Fabiano Rosas @ 2023-02-08 19:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Laurent Vivier, Paolo Bonzini

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/drive_del-test.c | 65 ++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
index 9a750395a9..8a6f3ac963 100644
--- a/tests/qtest/drive_del-test.c
+++ b/tests/qtest/drive_del-test.c
@@ -16,6 +16,8 @@
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qlist.h"
 
+static const char *qvirtio_get_dev_type(void);
+
 static bool look_for_drive0(QTestState *qts, const char *command, const char *key)
 {
     QDict *response;
@@ -40,6 +42,19 @@ static bool look_for_drive0(QTestState *qts, const char *command, const char *ke
     return found;
 }
 
+/*
+ * This covers the possible absence of a device due to QEMU build
+ * options.
+ */
+static bool has_device_builtin(const char *dev)
+{
+    gchar *device = g_strdup_printf("%s-%s", dev, qvirtio_get_dev_type());
+    bool rc = qtest_has_device(device);
+
+    g_free(device);
+    return rc;
+}
+
 static bool has_drive(QTestState *qts)
 {
     return look_for_drive0(qts, "query-block", "device");
@@ -208,6 +223,11 @@ static void test_drive_del_device_del(void)
 {
     QTestState *qts;
 
+    if (!has_device_builtin("virtio-scsi")) {
+        g_test_skip("Device virtio-scsi is not available");
+        return;
+    }
+
     /* Start with a drive used by a device that unplugs instantaneously */
     qts = qtest_initf("-drive if=none,id=drive0,file=null-co://,"
                       "file.read-zeroes=on,format=raw"
@@ -232,6 +252,11 @@ static void test_cli_device_del(void)
     const char *arch = qtest_get_arch();
     const char *machine_addition = "";
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         machine_addition = "-machine pc";
     }
@@ -256,6 +281,11 @@ static void test_cli_device_del_q35(void)
 {
     QTestState *qts;
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     /*
      * -drive/-device and device_del.  Start with a drive used by a
      * device that unplugs after reset.
@@ -277,6 +307,11 @@ static void test_empty_device_del(void)
 {
     QTestState *qts;
 
+    if (!has_device_builtin("virtio-scsi")) {
+        g_test_skip("Device virtio-scsi is not available");
+        return;
+    }
+
     /* device_del with no drive plugged.  */
     qts = qtest_initf("-device virtio-scsi-%s -device scsi-cd,id=dev0",
                       qvirtio_get_dev_type());
@@ -291,6 +326,11 @@ static void test_device_add_and_del(void)
     const char *arch = qtest_get_arch();
     const char *machine_addition = "";
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         machine_addition = "-machine pc";
     }
@@ -330,6 +370,11 @@ static void test_device_add_and_del_q35(void)
 {
     QTestState *qts;
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     /*
      * -drive/device_add and device_del.  Start with a drive used by a
      * device that unplugs after reset.
@@ -352,6 +397,11 @@ static void test_drive_add_device_add_and_del(void)
     const char *arch = qtest_get_arch();
     const char *machine_addition = "";
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         machine_addition = "-machine pc";
     }
@@ -374,6 +424,11 @@ static void test_drive_add_device_add_and_del_q35(void)
 {
     QTestState *qts;
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     qts = qtest_init("-machine q35 -device pcie-root-port,id=p1 "
                      "-device pcie-pci-bridge,bus=p1,id=b1");
 
@@ -395,6 +450,11 @@ static void test_blockdev_add_device_add_and_del(void)
     const char *arch = qtest_get_arch();
     const char *machine_addition = "";
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         machine_addition = "-machine pc";
     }
@@ -417,6 +477,11 @@ static void test_blockdev_add_device_add_and_del_q35(void)
 {
     QTestState *qts;
 
+    if (!has_device_builtin("virtio-blk")) {
+        g_test_skip("Device virtio-blk is not available");
+        return;
+    }
+
     qts = qtest_init("-machine q35 -device pcie-root-port,id=p1 "
                      "-device pcie-pci-bridge,bus=p1,id=b1");
 
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 03/12] tests/qtest: Add dependence on PCIE_PORT for virtio-net-failover.c
       [not found] ` <20230208194700.11035-4-farosas@suse.de>
@ 2023-02-09  8:00   ` Thomas Huth
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-02-09  8:00 UTC (permalink / raw)
  To: Fabiano Rosas, qemu-devel; +Cc: Laurent Vivier, Paolo Bonzini

On 08/02/2023 20.46, Fabiano Rosas wrote:
> This test depends on the presence of the pcie-root-port device. Add a
> build time dependency.
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/meson.build | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index e97616d327..5c8b031ce0 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -73,7 +73,8 @@ qtests_i386 = \
>     (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) +                 \
>     (config_host.has_key('CONFIG_POSIX') and                                                  \
>      config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) +                   \
> -  (config_all_devices.has_key('CONFIG_VIRTIO_NET') and                                      \
> +  (config_all_devices.has_key('CONFIG_PCIE_PORT') and                                       \
> +   config_all_devices.has_key('CONFIG_VIRTIO_NET') and                                      \
>      config_all_devices.has_key('CONFIG_Q35') and                                             \
>      config_all_devices.has_key('CONFIG_VIRTIO_PCI') and                                      \
>      slirp.found() ? ['virtio-net-failover'] : []) +                                          \

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 04/12] tests/qtest: Don't build virtio-serial-test.c if device not present
       [not found] ` <20230208194700.11035-5-farosas@suse.de>
@ 2023-02-09  8:06   ` Thomas Huth
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-02-09  8:06 UTC (permalink / raw)
  To: Fabiano Rosas, qemu-devel; +Cc: Laurent Vivier, Paolo Bonzini

On 08/02/2023 20.46, Fabiano Rosas wrote:
> The virtconsole device might not be present in the QEMU build that is
> being tested.
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/meson.build | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index 5c8b031ce0..eccdfca235 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -255,10 +255,14 @@ qos_test_ss.add(
>     'virtio-net-test.c',
>     'virtio-rng-test.c',
>     'virtio-scsi-test.c',
> -  'virtio-serial-test.c',
>     'virtio-iommu-test.c',
>     'vmxnet3-test.c',
>   )
> +
> +qos_test_ss.add(
> +  (config_all_devices.has_key('CONFIG_VIRTIO_SERIAL') ? ['virtio-serial-test.c'] : [])
> +)

The check below uses "if config ..." instead ... so for consistency, I think 
it would be nicer to do:

if config_all_devices.has_key('CONFIG_VIRTIO_SERIAL')
     qos_test_ss.add(files('virtio-serial-test.c'))
endif

  Thomas


>   if config_host.has_key('CONFIG_POSIX')
>     qos_test_ss.add(files('e1000e-test.c'))
>   endif



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 06/12] test/qtest: Fix coding style in device-plug-test.c
       [not found] ` <20230208194700.11035-7-farosas@suse.de>
@ 2023-02-09  8:08   ` Thomas Huth
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-02-09  8:08 UTC (permalink / raw)
  To: Fabiano Rosas, qemu-devel; +Cc: Laurent Vivier, Paolo Bonzini

On 08/02/2023 20.46, Fabiano Rosas wrote:
> We should not mix declarations and statements in QEMU code.
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/device-plug-test.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 07/12] tests/qtest: Skip unplug tests that use missing devices
       [not found] ` <20230208194700.11035-8-farosas@suse.de>
@ 2023-02-09  8:11   ` Thomas Huth
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-02-09  8:11 UTC (permalink / raw)
  To: Fabiano Rosas, qemu-devel; +Cc: Laurent Vivier, Paolo Bonzini

On 08/02/2023 20.46, Fabiano Rosas wrote:
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/device-plug-test.c | 33 +++++++++++++++++++++++++++------
>   1 file changed, 27 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
> index 4f92617335..01cecd6e20 100644
> --- a/tests/qtest/device-plug-test.c
> +++ b/tests/qtest/device-plug-test.c
> @@ -68,6 +68,11 @@ static void test_pci_unplug_request(void)
>       const char *arch = qtest_get_arch();
>       const char *machine_addition = "";

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 08/12] tests/qtest: drive_del-test: Skip tests that require missing devices
  2023-02-08 19:46 ` [PATCH v2 08/12] tests/qtest: drive_del-test: Skip tests that require missing devices Fabiano Rosas
@ 2023-02-09  8:12   ` Thomas Huth
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-02-09  8:12 UTC (permalink / raw)
  To: Fabiano Rosas, qemu-devel; +Cc: Laurent Vivier, Paolo Bonzini

On 08/02/2023 20.46, Fabiano Rosas wrote:
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/drive_del-test.c | 65 ++++++++++++++++++++++++++++++++++++
>   1 file changed, 65 insertions(+)
> 
> diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
> index 9a750395a9..8a6f3ac963 100644
> --- a/tests/qtest/drive_del-test.c
> +++ b/tests/qtest/drive_del-test.c
> @@ -16,6 +16,8 @@
>   #include "qapi/qmp/qdict.h"
>   #include "qapi/qmp/qlist.h"

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 10/12] tests/qtest: Do not include hexloader-test if loader device is not present
       [not found] ` <20230208194700.11035-11-farosas@suse.de>
@ 2023-02-09  8:46   ` Thomas Huth
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-02-09  8:46 UTC (permalink / raw)
  To: Fabiano Rosas, qemu-devel; +Cc: Laurent Vivier, Paolo Bonzini

On 08/02/2023 20.46, Fabiano Rosas wrote:
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/meson.build | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index eccdfca235..c6dba4f87e 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -197,11 +197,11 @@ qtests_arm = \
>     (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) +         \
>     (config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \
>     (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
> +  (config_all_devices.has_key('CONFIG_GENERIC_LOADER') ? ['hexloader-test'] : []) + \
>     ['arm-cpu-features',
>      'microbit-test',
>      'test-arm-mptimer',
> -   'boot-serial-test',
> -   'hexloader-test']
> +   'boot-serial-test']
>   
>   # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
>   qtests_aarch64 = \

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-02-09  8:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230208194700.11035-1-farosas@suse.de>
2023-02-08 19:46 ` [PATCH v2 01/12] tests/qtest: Skip PXE tests for missing devices Fabiano Rosas
2023-02-08 19:46 ` [PATCH v2 02/12] tests/qtest: Do not run lsi53c895a test if device is not present Fabiano Rosas
2023-02-08 19:46 ` [PATCH v2 08/12] tests/qtest: drive_del-test: Skip tests that require missing devices Fabiano Rosas
2023-02-09  8:12   ` Thomas Huth
     [not found] ` <20230208194700.11035-4-farosas@suse.de>
2023-02-09  8:00   ` [PATCH v2 03/12] tests/qtest: Add dependence on PCIE_PORT for virtio-net-failover.c Thomas Huth
     [not found] ` <20230208194700.11035-5-farosas@suse.de>
2023-02-09  8:06   ` [PATCH v2 04/12] tests/qtest: Don't build virtio-serial-test.c if device not present Thomas Huth
     [not found] ` <20230208194700.11035-7-farosas@suse.de>
2023-02-09  8:08   ` [PATCH v2 06/12] test/qtest: Fix coding style in device-plug-test.c Thomas Huth
     [not found] ` <20230208194700.11035-8-farosas@suse.de>
2023-02-09  8:11   ` [PATCH v2 07/12] tests/qtest: Skip unplug tests that use missing devices Thomas Huth
     [not found] ` <20230208194700.11035-11-farosas@suse.de>
2023-02-09  8:46   ` [PATCH v2 10/12] tests/qtest: Do not include hexloader-test if loader device is not present Thomas Huth

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).