diff mbox series

[03/12] tests/qtest: Add dependence on PCIE_ROOT for virtio-net-failover.c

Message ID 20230206150416.4604-4-farosas@suse.de
State New
Headers show
Series qtests vs. default devices | expand

Commit Message

Fabiano Rosas Feb. 6, 2023, 3:04 p.m. UTC
This test depends on the presence of the pcie-root-port device. Add a
build time dependency and a runtime check.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/meson.build           | 3 ++-
 tests/qtest/virtio-net-failover.c | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Thomas Huth Feb. 7, 2023, 1:22 p.m. UTC | #1
On 06/02/2023 16.04, Fabiano Rosas wrote:
> This test depends on the presence of the pcie-root-port device. Add a
> build time dependency and a runtime check.
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/meson.build           | 3 ++-
>   tests/qtest/virtio-net-failover.c | 5 +++++
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index e97616d327..431b623df9 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_ROOT') and                                       \

CONFIG_PCIE_ROOT looks wrong ... hw/pci-bridge/meson.build uses 
CONFIG_PCIE_PORT instead, so I assume this is a typo?

Also, do we really need a run-time check if we already have a build-time check?

  Thomas
Fabiano Rosas Feb. 7, 2023, 3:02 p.m. UTC | #2
Thomas Huth <thuth@redhat.com> writes:

> On 06/02/2023 16.04, Fabiano Rosas wrote:
>> This test depends on the presence of the pcie-root-port device. Add a
>> build time dependency and a runtime check.
>> 
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>>   tests/qtest/meson.build           | 3 ++-
>>   tests/qtest/virtio-net-failover.c | 5 +++++
>>   2 files changed, 7 insertions(+), 1 deletion(-)
>> 
>> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
>> index e97616d327..431b623df9 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_ROOT') and                                       \
>
> CONFIG_PCIE_ROOT looks wrong ... hw/pci-bridge/meson.build uses 
> CONFIG_PCIE_PORT instead, so I assume this is a typo?
>
> Also, do we really need a run-time check if we already have a build-time check?

I guess not. It seems it was the typo that made it necessary. I'll fix
it.
diff mbox series

Patch

diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index e97616d327..431b623df9 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_ROOT') 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'] : []) +                                          \
diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c
index 4a809590bf..9ca52cb026 100644
--- a/tests/qtest/virtio-net-failover.c
+++ b/tests/qtest/virtio-net-failover.c
@@ -1835,6 +1835,11 @@  int main(int argc, char **argv)
     gchar *tmpfile;
     int ret;
 
+    if (!qtest_has_device("pcie-root-port") ||
+        !qtest_has_device("virtio-net")) {
+        return 0;
+    }
+
     g_test_init(&argc, &argv, NULL);
 
     ret = g_file_open_tmp("failover_test_migrate-XXXXXX", &tmpfile, NULL);