diff mbox series

[05/18] tests/qtest: Specify audiodev= and -audiodev

Message ID 6e7f2808dd40679a415812767b88f2a411fc137f.1650874791.git.mkletzan@redhat.com (mailing list archive)
State New, archived
Headers show
Series RFC: Remove deprecated audio features | expand

Commit Message

Martin Kletzander April 25, 2022, 8:21 a.m. UTC
This will enable removing deprecated default audiodev support.

I did not figure out how to make the audiodev represented as an
interface node, so this is a workaround.  I am not sure what would be
the proper way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 tests/qtest/ac97-test.c                 |  3 ++-
 tests/qtest/es1370-test.c               |  3 ++-
 tests/qtest/fuzz/generic_fuzz_configs.h |  6 ++++--
 tests/qtest/intel-hda-test.c            | 15 ++++++++++-----
 4 files changed, 18 insertions(+), 9 deletions(-)

Comments

Daniel P. Berrangé April 25, 2022, 1:42 p.m. UTC | #1
On Mon, Apr 25, 2022 at 10:21:48AM +0200, Martin Kletzander wrote:
> This will enable removing deprecated default audiodev support.
> 
> I did not figure out how to make the audiodev represented as an
> interface node, so this is a workaround.  I am not sure what would be
> the proper way.

Not sure I understand what you mean by this 'interface node' reference ?

The code looks fine though

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

> 
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
>  tests/qtest/ac97-test.c                 |  3 ++-
>  tests/qtest/es1370-test.c               |  3 ++-
>  tests/qtest/fuzz/generic_fuzz_configs.h |  6 ++++--
>  tests/qtest/intel-hda-test.c            | 15 ++++++++++-----
>  4 files changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/qtest/ac97-test.c b/tests/qtest/ac97-test.c
> index e09f2495d24d..9711f1f6d966 100644
> --- a/tests/qtest/ac97-test.c
> +++ b/tests/qtest/ac97-test.c
> @@ -45,7 +45,8 @@ static void *ac97_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
>  static void ac97_register_nodes(void)
>  {
>      QOSGraphEdgeOptions opts = {
> -        .extra_device_opts = "addr=04.0",
> +        .extra_device_opts = "addr=04.0,audiodev=audio0",
> +        .before_cmd_line = "-audiodev driver=none,id=audio0",
>      };
>      add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
>  
> diff --git a/tests/qtest/es1370-test.c b/tests/qtest/es1370-test.c
> index 2fd7fd2d3d30..5facda8d0d8d 100644
> --- a/tests/qtest/es1370-test.c
> +++ b/tests/qtest/es1370-test.c
> @@ -46,7 +46,8 @@ static void *es1370_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
>  static void es1370_register_nodes(void)
>  {
>      QOSGraphEdgeOptions opts = {
> -        .extra_device_opts = "addr=04.0",
> +        .extra_device_opts = "addr=04.0,audiodev=audio0",
> +        .before_cmd_line = "-audiodev driver=none,id=audio0",
>      };
>      add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
>  
> diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/generic_fuzz_configs.h
> index 004c701915e1..84a93b3c350b 100644
> --- a/tests/qtest/fuzz/generic_fuzz_configs.h
> +++ b/tests/qtest/fuzz/generic_fuzz_configs.h
> @@ -101,8 +101,10 @@ const generic_fuzz_config predefined_configs[] = {
>      },{
>          .name = "intel-hda",
>          .args = "-machine q35 -nodefaults -device intel-hda,id=hda0 "
> -        "-device hda-output,bus=hda0.0 -device hda-micro,bus=hda0.0 "
> -        "-device hda-duplex,bus=hda0.0",
> +        "-audiodev driver=none,id=audio0",
> +        "-device hda-output,bus=hda0.0,audiodev=audio0 "
> +        "-device hda-micro,bus=hda0.0,audiodev=audio0 "
> +        "-device hda-duplex,bus=hda0.0,audiodev=audio0",
>          .objects = "intel-hda",
>      },{
>          .name = "ide-hd",
> diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c
> index a58c98e4d11b..39ced2bc6ac6 100644
> --- a/tests/qtest/intel-hda-test.c
> +++ b/tests/qtest/intel-hda-test.c
> @@ -11,20 +11,24 @@
>  #include "libqtest-single.h"
>  
>  #define HDA_ID "hda0"
> -#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \
> -                      " -device hda-micro,bus=" HDA_ID ".0" \
> -                      " -device hda-duplex,bus=" HDA_ID ".0"
> +#define AUDIODEV " -audiodev driver=none,id=audio0 "
> +#define AUDIODEV_REF "audiodev=audio0"
> +#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0," AUDIODEV_REF \
> +                      " -device hda-micro,bus=" HDA_ID ".0," AUDIODEV_REF \
> +                      " -device hda-duplex,bus=" HDA_ID ".0," AUDIODEV_REF
>  
>  /* 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(AUDIODEV "-device intel-hda,id=" HDA_ID CODEC_DEVICES);
>      qtest_end();
>  }
>  
>  static void ich9_test(void)
>  {
> -    qtest_start("-machine q35 -device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
> +    qtest_start("-machine q35"
> +                AUDIODEV
> +                "-device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
>                  HDA_ID CODEC_DEVICES);
>      qtest_end();
>  }
> @@ -39,6 +43,7 @@ static void test_issue542_ich6(void)
>      QTestState *s;
>  
>      s = qtest_init("-nographic -nodefaults -M pc-q35-6.2 "
> +                   AUDIODEV
>                     "-device intel-hda,id=" HDA_ID CODEC_DEVICES);
>  
>      qtest_outl(s, 0xcf8, 0x80000804);
> -- 
> 2.35.1
> 

With regards,
Daniel
Martin Kletzander April 29, 2022, 10:37 a.m. UTC | #2
On Mon, Apr 25, 2022 at 02:42:53PM +0100, Daniel P. Berrangé wrote:
>On Mon, Apr 25, 2022 at 10:21:48AM +0200, Martin Kletzander wrote:
>> This will enable removing deprecated default audiodev support.
>>
>> I did not figure out how to make the audiodev represented as an
>> interface node, so this is a workaround.  I am not sure what would be
>> the proper way.
>
>Not sure I understand what you mean by this 'interface node' reference ?
>

I meant a qos node, I though that would be the proper way, but since
audiodev is a backend and not a device I wasn't able to plug it in using
qos_node_consumes().  Maybe I was just trying too hard.

>The code looks fine though
>
>Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
>>
>> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
>> ---
>>  tests/qtest/ac97-test.c                 |  3 ++-
>>  tests/qtest/es1370-test.c               |  3 ++-
>>  tests/qtest/fuzz/generic_fuzz_configs.h |  6 ++++--
>>  tests/qtest/intel-hda-test.c            | 15 ++++++++++-----
>>  4 files changed, 18 insertions(+), 9 deletions(-)
>>
>> diff --git a/tests/qtest/ac97-test.c b/tests/qtest/ac97-test.c
>> index e09f2495d24d..9711f1f6d966 100644
>> --- a/tests/qtest/ac97-test.c
>> +++ b/tests/qtest/ac97-test.c
>> @@ -45,7 +45,8 @@ static void *ac97_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
>>  static void ac97_register_nodes(void)
>>  {
>>      QOSGraphEdgeOptions opts = {
>> -        .extra_device_opts = "addr=04.0",
>> +        .extra_device_opts = "addr=04.0,audiodev=audio0",
>> +        .before_cmd_line = "-audiodev driver=none,id=audio0",
>>      };
>>      add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
>>
>> diff --git a/tests/qtest/es1370-test.c b/tests/qtest/es1370-test.c
>> index 2fd7fd2d3d30..5facda8d0d8d 100644
>> --- a/tests/qtest/es1370-test.c
>> +++ b/tests/qtest/es1370-test.c
>> @@ -46,7 +46,8 @@ static void *es1370_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
>>  static void es1370_register_nodes(void)
>>  {
>>      QOSGraphEdgeOptions opts = {
>> -        .extra_device_opts = "addr=04.0",
>> +        .extra_device_opts = "addr=04.0,audiodev=audio0",
>> +        .before_cmd_line = "-audiodev driver=none,id=audio0",
>>      };
>>      add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
>>
>> diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/generic_fuzz_configs.h
>> index 004c701915e1..84a93b3c350b 100644
>> --- a/tests/qtest/fuzz/generic_fuzz_configs.h
>> +++ b/tests/qtest/fuzz/generic_fuzz_configs.h
>> @@ -101,8 +101,10 @@ const generic_fuzz_config predefined_configs[] = {
>>      },{
>>          .name = "intel-hda",
>>          .args = "-machine q35 -nodefaults -device intel-hda,id=hda0 "
>> -        "-device hda-output,bus=hda0.0 -device hda-micro,bus=hda0.0 "
>> -        "-device hda-duplex,bus=hda0.0",
>> +        "-audiodev driver=none,id=audio0",
>> +        "-device hda-output,bus=hda0.0,audiodev=audio0 "
>> +        "-device hda-micro,bus=hda0.0,audiodev=audio0 "
>> +        "-device hda-duplex,bus=hda0.0,audiodev=audio0",
>>          .objects = "intel-hda",
>>      },{
>>          .name = "ide-hd",
>> diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c
>> index a58c98e4d11b..39ced2bc6ac6 100644
>> --- a/tests/qtest/intel-hda-test.c
>> +++ b/tests/qtest/intel-hda-test.c
>> @@ -11,20 +11,24 @@
>>  #include "libqtest-single.h"
>>
>>  #define HDA_ID "hda0"
>> -#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \
>> -                      " -device hda-micro,bus=" HDA_ID ".0" \
>> -                      " -device hda-duplex,bus=" HDA_ID ".0"
>> +#define AUDIODEV " -audiodev driver=none,id=audio0 "
>> +#define AUDIODEV_REF "audiodev=audio0"
>> +#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0," AUDIODEV_REF \
>> +                      " -device hda-micro,bus=" HDA_ID ".0," AUDIODEV_REF \
>> +                      " -device hda-duplex,bus=" HDA_ID ".0," AUDIODEV_REF
>>
>>  /* 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(AUDIODEV "-device intel-hda,id=" HDA_ID CODEC_DEVICES);
>>      qtest_end();
>>  }
>>
>>  static void ich9_test(void)
>>  {
>> -    qtest_start("-machine q35 -device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
>> +    qtest_start("-machine q35"
>> +                AUDIODEV
>> +                "-device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
>>                  HDA_ID CODEC_DEVICES);
>>      qtest_end();
>>  }
>> @@ -39,6 +43,7 @@ static void test_issue542_ich6(void)
>>      QTestState *s;
>>
>>      s = qtest_init("-nographic -nodefaults -M pc-q35-6.2 "
>> +                   AUDIODEV
>>                     "-device intel-hda,id=" HDA_ID CODEC_DEVICES);
>>
>>      qtest_outl(s, 0xcf8, 0x80000804);
>> --
>> 2.35.1
>>
>
>With regards,
>Daniel
>-- 
>|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
>|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
>|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
>
diff mbox series

Patch

diff --git a/tests/qtest/ac97-test.c b/tests/qtest/ac97-test.c
index e09f2495d24d..9711f1f6d966 100644
--- a/tests/qtest/ac97-test.c
+++ b/tests/qtest/ac97-test.c
@@ -45,7 +45,8 @@  static void *ac97_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
 static void ac97_register_nodes(void)
 {
     QOSGraphEdgeOptions opts = {
-        .extra_device_opts = "addr=04.0",
+        .extra_device_opts = "addr=04.0,audiodev=audio0",
+        .before_cmd_line = "-audiodev driver=none,id=audio0",
     };
     add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
 
diff --git a/tests/qtest/es1370-test.c b/tests/qtest/es1370-test.c
index 2fd7fd2d3d30..5facda8d0d8d 100644
--- a/tests/qtest/es1370-test.c
+++ b/tests/qtest/es1370-test.c
@@ -46,7 +46,8 @@  static void *es1370_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
 static void es1370_register_nodes(void)
 {
     QOSGraphEdgeOptions opts = {
-        .extra_device_opts = "addr=04.0",
+        .extra_device_opts = "addr=04.0,audiodev=audio0",
+        .before_cmd_line = "-audiodev driver=none,id=audio0",
     };
     add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
 
diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/generic_fuzz_configs.h
index 004c701915e1..84a93b3c350b 100644
--- a/tests/qtest/fuzz/generic_fuzz_configs.h
+++ b/tests/qtest/fuzz/generic_fuzz_configs.h
@@ -101,8 +101,10 @@  const generic_fuzz_config predefined_configs[] = {
     },{
         .name = "intel-hda",
         .args = "-machine q35 -nodefaults -device intel-hda,id=hda0 "
-        "-device hda-output,bus=hda0.0 -device hda-micro,bus=hda0.0 "
-        "-device hda-duplex,bus=hda0.0",
+        "-audiodev driver=none,id=audio0",
+        "-device hda-output,bus=hda0.0,audiodev=audio0 "
+        "-device hda-micro,bus=hda0.0,audiodev=audio0 "
+        "-device hda-duplex,bus=hda0.0,audiodev=audio0",
         .objects = "intel-hda",
     },{
         .name = "ide-hd",
diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c
index a58c98e4d11b..39ced2bc6ac6 100644
--- a/tests/qtest/intel-hda-test.c
+++ b/tests/qtest/intel-hda-test.c
@@ -11,20 +11,24 @@ 
 #include "libqtest-single.h"
 
 #define HDA_ID "hda0"
-#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \
-                      " -device hda-micro,bus=" HDA_ID ".0" \
-                      " -device hda-duplex,bus=" HDA_ID ".0"
+#define AUDIODEV " -audiodev driver=none,id=audio0 "
+#define AUDIODEV_REF "audiodev=audio0"
+#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0," AUDIODEV_REF \
+                      " -device hda-micro,bus=" HDA_ID ".0," AUDIODEV_REF \
+                      " -device hda-duplex,bus=" HDA_ID ".0," AUDIODEV_REF
 
 /* 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(AUDIODEV "-device intel-hda,id=" HDA_ID CODEC_DEVICES);
     qtest_end();
 }
 
 static void ich9_test(void)
 {
-    qtest_start("-machine q35 -device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
+    qtest_start("-machine q35"
+                AUDIODEV
+                "-device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
                 HDA_ID CODEC_DEVICES);
     qtest_end();
 }
@@ -39,6 +43,7 @@  static void test_issue542_ich6(void)
     QTestState *s;
 
     s = qtest_init("-nographic -nodefaults -M pc-q35-6.2 "
+                   AUDIODEV
                    "-device intel-hda,id=" HDA_ID CODEC_DEVICES);
 
     qtest_outl(s, 0xcf8, 0x80000804);