[PATCH 09/12] tests/qtest: Do not include hexloader-test if loader device is not present

Fabiano Rosas posted 12 patches 3 years ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Alexander Bulekov <alxndr@bu.edu>, Bandan Das <bsd@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Darren Kenny <darren.kenny@oracle.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Fam Zheng <fam@euphon.net>, Su Hang <suhang16@mails.ucas.ac.cn>, Amit Shah <amit@kernel.org>
There is a newer version of this series
[PATCH 09/12] tests/qtest: Do not include hexloader-test if loader device is not present
Posted by Fabiano Rosas 3 years ago
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/hexloader-test.c | 5 +++++
 tests/qtest/meson.build      | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/hexloader-test.c b/tests/qtest/hexloader-test.c
index 3023548041..3ab464f438 100644
--- a/tests/qtest/hexloader-test.c
+++ b/tests/qtest/hexloader-test.c
@@ -22,6 +22,11 @@ static void hex_loader_test(void)
     unsigned int i;
     const unsigned int base_addr = 0x00010000;
 
+    if (!qtest_has_device("loader")) {
+        g_test_skip("Device 'loader' not available");
+        return;
+    }
+
     QTestState *s = qtest_initf(
         "-M vexpress-a9 -device loader,file=tests/data/hex-loader/test.hex");
 
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 431b623df9..a930706a43 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 = \
-- 
2.35.3
Re: [PATCH 09/12] tests/qtest: Do not include hexloader-test if loader device is not present
Posted by Thomas Huth 3 years ago
On 06/02/2023 16.04, Fabiano Rosas wrote:
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/qtest/hexloader-test.c | 5 +++++
>   tests/qtest/meson.build      | 4 ++--
>   2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qtest/hexloader-test.c b/tests/qtest/hexloader-test.c
> index 3023548041..3ab464f438 100644
> --- a/tests/qtest/hexloader-test.c
> +++ b/tests/qtest/hexloader-test.c
> @@ -22,6 +22,11 @@ static void hex_loader_test(void)
>       unsigned int i;
>       const unsigned int base_addr = 0x00010000;
>   
> +    if (!qtest_has_device("loader")) {
> +        g_test_skip("Device 'loader' not available");
> +        return;
> +    }
> +
>       QTestState *s = qtest_initf(
>           "-M vexpress-a9 -device loader,file=tests/data/hex-loader/test.hex");
>   
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index 431b623df9..a930706a43 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']

In this case, I think the change to meson.build should be enough, since 
there is no machine that does "select GENERIC_LOADER" in the Kconfig files 
... or do I miss something again?

  Thomas