[PATCH 4/8] tests: Only run intel-hda-tests if machine type is compiled in

Juan Quintela posted 8 patches 3 years, 5 months ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>, Alexander Bulekov <alxndr@bu.edu>, Paolo Bonzini <pbonzini@redhat.com>, Bandan Das <bsd@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Thomas Huth <thuth@redhat.com>, Darren Kenny <darren.kenny@oracle.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Gerd Hoffmann <kraxel@redhat.com>, Laurent Vivier <lvivier@redhat.com>
[PATCH 4/8] tests: Only run intel-hda-tests if machine type is compiled in
Posted by Juan Quintela 3 years, 5 months ago
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 tests/qtest/intel-hda-test.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c
index a58c98e4d1..d4a8db6fd6 100644
--- a/tests/qtest/intel-hda-test.c
+++ b/tests/qtest/intel-hda-test.c
@@ -18,7 +18,7 @@
 /* Tests only initialization so far. TODO: Replace with functional tests */
 static void ich6_test(void)
 {
-    qtest_start("-device intel-hda,id=" HDA_ID CODEC_DEVICES);
+    qtest_start("-machine pc -device intel-hda,id=" HDA_ID CODEC_DEVICES);
     qtest_end();
 }
 
@@ -65,9 +65,12 @@ static void test_issue542_ich6(void)
 int main(int argc, char **argv)
 {
     g_test_init(&argc, &argv, NULL);
-    qtest_add_func("/intel-hda/ich6", ich6_test);
-    qtest_add_func("/intel-hda/ich9", ich9_test);
-    qtest_add_func("/intel-hda/fuzz/issue542", test_issue542_ich6);
-
+    if (qtest_has_machine("pc")) {
+        qtest_add_func("/intel-hda/ich6", ich6_test);
+    }
+    if (qtest_has_machine("q35")) {
+        qtest_add_func("/intel-hda/ich9", ich9_test);
+        qtest_add_func("/intel-hda/fuzz/issue542", test_issue542_ich6);
+    }
     return g_test_run();
 }
-- 
2.37.2
Re: [PATCH 4/8] tests: Only run intel-hda-tests if machine type is compiled in
Posted by Ani Sinha 3 years, 5 months ago

On Fri, 2 Sep 2022, Juan Quintela wrote:

Reviewed-by: Ani Sinha <ani@anisinha.ca>

> Signed-off-by: Juan Quintela <quintela@redhat.com>

> ---
>  tests/qtest/intel-hda-test.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c
> index a58c98e4d1..d4a8db6fd6 100644
> --- a/tests/qtest/intel-hda-test.c
> +++ b/tests/qtest/intel-hda-test.c
> @@ -18,7 +18,7 @@
>  /* Tests only initialization so far. TODO: Replace with functional tests */
>  static void ich6_test(void)
>  {
> -    qtest_start("-device intel-hda,id=" HDA_ID CODEC_DEVICES);
> +    qtest_start("-machine pc -device intel-hda,id=" HDA_ID CODEC_DEVICES);
>      qtest_end();
>  }
>
> @@ -65,9 +65,12 @@ static void test_issue542_ich6(void)
>  int main(int argc, char **argv)
>  {
>      g_test_init(&argc, &argv, NULL);
> -    qtest_add_func("/intel-hda/ich6", ich6_test);
> -    qtest_add_func("/intel-hda/ich9", ich9_test);
> -    qtest_add_func("/intel-hda/fuzz/issue542", test_issue542_ich6);
> -
> +    if (qtest_has_machine("pc")) {
> +        qtest_add_func("/intel-hda/ich6", ich6_test);
> +    }
> +    if (qtest_has_machine("q35")) {
> +        qtest_add_func("/intel-hda/ich9", ich9_test);
> +        qtest_add_func("/intel-hda/fuzz/issue542", test_issue542_ich6);
> +    }
>      return g_test_run();
>  }
> --
> 2.37.2
>
>
Re: [PATCH 4/8] tests: Only run intel-hda-tests if machine type is compiled in
Posted by Philippe Mathieu-Daudé via 3 years, 5 months ago
On 2/9/22 19:34, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>   tests/qtest/intel-hda-test.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c
> index a58c98e4d1..d4a8db6fd6 100644
> --- a/tests/qtest/intel-hda-test.c
> +++ b/tests/qtest/intel-hda-test.c
> @@ -18,7 +18,7 @@
>   /* Tests only initialization so far. TODO: Replace with functional tests */
>   static void ich6_test(void)
>   {
> -    qtest_start("-device intel-hda,id=" HDA_ID CODEC_DEVICES);
> +    qtest_start("-machine pc -device intel-hda,id=" HDA_ID CODEC_DEVICES);
>       qtest_end();
>   }
>   
> @@ -65,9 +65,12 @@ static void test_issue542_ich6(void)
>   int main(int argc, char **argv)
>   {
>       g_test_init(&argc, &argv, NULL);
> -    qtest_add_func("/intel-hda/ich6", ich6_test);
> -    qtest_add_func("/intel-hda/ich9", ich9_test);
> -    qtest_add_func("/intel-hda/fuzz/issue542", test_issue542_ich6);
> -
> +    if (qtest_has_machine("pc")) {
> +        qtest_add_func("/intel-hda/ich6", ich6_test);
> +    }
> +    if (qtest_has_machine("q35")) {
> +        qtest_add_func("/intel-hda/ich9", ich9_test);
> +        qtest_add_func("/intel-hda/fuzz/issue542", test_issue542_ich6);
> +    }
>       return g_test_run();
>   }

Generically, we should really test for available devices, not particular 
machines... As new machines using tested devices could be added.

Could qtest_has_device(TYPE_INTEL_HDA_GENERIC) work here?