diff mbox

[2/4] qtest: add display-vga-test to ppc64

Message ID 1481585316-31612-3-git-send-email-lvivier@redhat.com
State New
Headers show

Commit Message

Laurent Vivier Dec. 12, 2016, 11:28 p.m. UTC
Only enable for ppc64 in the Makefile, but added
code in the file to check cirrus card only on architectures
supporting it (alpha, mips, i386, x86_64).

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 tests/Makefile.include   | 1 +
 tests/display-vga-test.c | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Thomas Huth Dec. 13, 2016, 8:40 a.m. UTC | #1
On 13.12.2016 00:28, Laurent Vivier wrote:
> Only enable for ppc64 in the Makefile, but added
> code in the file to check cirrus card only on architectures
> supporting it (alpha, mips, i386, x86_64).
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  tests/Makefile.include   | 1 +
>  tests/display-vga-test.c | 7 ++++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index be6209d..b574964 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -286,6 +286,7 @@ check-qtest-ppc64-y += $(check-qtest-virtio-y)
>  check-qtest-ppc64-y += tests/test-netfilter$(EXESUF)
>  check-qtest-ppc64-y += tests/test-filter-mirror$(EXESUF)
>  check-qtest-ppc64-y += tests/test-filter-redirector$(EXESUF)
> +check-qtest-ppc64-y += tests/display-vga-test$(EXESUF)
>  
>  check-qtest-sh4-y = tests/endianness-test$(EXESUF)
>  
> diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c
> index 9146021..2d7d24e 100644
> --- a/tests/display-vga-test.c
> +++ b/tests/display-vga-test.c
> @@ -50,9 +50,14 @@ static void pci_virtio_vga(void)
>  
>  int main(int argc, char **argv)
>  {
> +    const char *arch = qtest_get_arch();
> +
>      g_test_init(&argc, &argv, NULL);
>  
> -    qtest_add_func("/display/pci/cirrus", pci_cirrus);
> +    if (strcmp(arch, "alpha") == 0 || strcmp(arch, "i386") == 0 ||
> +        strcmp(arch, "mips") == 0 || strcmp(arch, "x86_64") == 0) {
> +        qtest_add_func("/display/pci/cirrus", pci_cirrus);
> +    }
>      qtest_add_func("/display/pci/stdvga", pci_stdvga);
>      qtest_add_func("/display/pci/secondary", pci_secondary);
>      qtest_add_func("/display/pci/multihead", pci_multihead);

Alternatively, I think you could also check the result of
 qtest_hmp(global_qtest, "info qdm")
to see whether cirrus-vga is available ... but not sure, whether that's
really nicer, so:

Reviewed-by: Thomas Huth <thuth@redhat.com>
Laurent Vivier Dec. 13, 2016, 12:03 p.m. UTC | #2
On 13/12/2016 09:40, Thomas Huth wrote:
> On 13.12.2016 00:28, Laurent Vivier wrote:
>> Only enable for ppc64 in the Makefile, but added
>> code in the file to check cirrus card only on architectures
>> supporting it (alpha, mips, i386, x86_64).
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>>  tests/Makefile.include   | 1 +
>>  tests/display-vga-test.c | 7 ++++++-
>>  2 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>> index be6209d..b574964 100644
>> --- a/tests/Makefile.include
>> +++ b/tests/Makefile.include
>> @@ -286,6 +286,7 @@ check-qtest-ppc64-y += $(check-qtest-virtio-y)
>>  check-qtest-ppc64-y += tests/test-netfilter$(EXESUF)
>>  check-qtest-ppc64-y += tests/test-filter-mirror$(EXESUF)
>>  check-qtest-ppc64-y += tests/test-filter-redirector$(EXESUF)
>> +check-qtest-ppc64-y += tests/display-vga-test$(EXESUF)
>>  
>>  check-qtest-sh4-y = tests/endianness-test$(EXESUF)
>>  
>> diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c
>> index 9146021..2d7d24e 100644
>> --- a/tests/display-vga-test.c
>> +++ b/tests/display-vga-test.c
>> @@ -50,9 +50,14 @@ static void pci_virtio_vga(void)
>>  
>>  int main(int argc, char **argv)
>>  {
>> +    const char *arch = qtest_get_arch();
>> +
>>      g_test_init(&argc, &argv, NULL);
>>  
>> -    qtest_add_func("/display/pci/cirrus", pci_cirrus);
>> +    if (strcmp(arch, "alpha") == 0 || strcmp(arch, "i386") == 0 ||
>> +        strcmp(arch, "mips") == 0 || strcmp(arch, "x86_64") == 0) {
>> +        qtest_add_func("/display/pci/cirrus", pci_cirrus);
>> +    }
>>      qtest_add_func("/display/pci/stdvga", pci_stdvga);
>>      qtest_add_func("/display/pci/secondary", pci_secondary);
>>      qtest_add_func("/display/pci/multihead", pci_multihead);
> 
> Alternatively, I think you could also check the result of
>  qtest_hmp(global_qtest, "info qdm")
> to see whether cirrus-vga is available ... but not sure, whether that's
> really nicer, so:

I think it's too complicated for a so simple test (it only starts the
machine with "-device XXX")

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

Thanks,
Laurent
Greg Kurz Dec. 13, 2016, 12:16 p.m. UTC | #3
On Tue, 13 Dec 2016 00:28:34 +0100
Laurent Vivier <lvivier@redhat.com> wrote:

> Only enable for ppc64 in the Makefile, but added
> code in the file to check cirrus card only on architectures
> supporting it (alpha, mips, i386, x86_64).
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  tests/Makefile.include   | 1 +
>  tests/display-vga-test.c | 7 ++++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index be6209d..b574964 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -286,6 +286,7 @@ check-qtest-ppc64-y += $(check-qtest-virtio-y)
>  check-qtest-ppc64-y += tests/test-netfilter$(EXESUF)
>  check-qtest-ppc64-y += tests/test-filter-mirror$(EXESUF)
>  check-qtest-ppc64-y += tests/test-filter-redirector$(EXESUF)
> +check-qtest-ppc64-y += tests/display-vga-test$(EXESUF)
>  
>  check-qtest-sh4-y = tests/endianness-test$(EXESUF)
>  
> diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c
> index 9146021..2d7d24e 100644
> --- a/tests/display-vga-test.c
> +++ b/tests/display-vga-test.c
> @@ -50,9 +50,14 @@ static void pci_virtio_vga(void)
>  
>  int main(int argc, char **argv)
>  {
> +    const char *arch = qtest_get_arch();
> +
>      g_test_init(&argc, &argv, NULL);
>  
> -    qtest_add_func("/display/pci/cirrus", pci_cirrus);
> +    if (strcmp(arch, "alpha") == 0 || strcmp(arch, "i386") == 0 ||
> +        strcmp(arch, "mips") == 0 || strcmp(arch, "x86_64") == 0) {
> +        qtest_add_func("/display/pci/cirrus", pci_cirrus);
> +    }
>      qtest_add_func("/display/pci/stdvga", pci_stdvga);
>      qtest_add_func("/display/pci/secondary", pci_secondary);
>      qtest_add_func("/display/pci/multihead", pci_multihead);

Reviewed-by: Greg Kurz <groug@kaod.org>

TEST: tests/display-vga-test... (pid=1462)
  /ppc64/display/pci/stdvga:                                           OK
  /ppc64/display/pci/secondary:                                        OK
  /ppc64/display/pci/multihead:                                        OK
  /ppc64/display/pci/virtio-gpu:                                       OK
PASS: tests/display-vga-test

Tested-by: Greg Kurz <groug@kaod.org>
diff mbox

Patch

diff --git a/tests/Makefile.include b/tests/Makefile.include
index be6209d..b574964 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -286,6 +286,7 @@  check-qtest-ppc64-y += $(check-qtest-virtio-y)
 check-qtest-ppc64-y += tests/test-netfilter$(EXESUF)
 check-qtest-ppc64-y += tests/test-filter-mirror$(EXESUF)
 check-qtest-ppc64-y += tests/test-filter-redirector$(EXESUF)
+check-qtest-ppc64-y += tests/display-vga-test$(EXESUF)
 
 check-qtest-sh4-y = tests/endianness-test$(EXESUF)
 
diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c
index 9146021..2d7d24e 100644
--- a/tests/display-vga-test.c
+++ b/tests/display-vga-test.c
@@ -50,9 +50,14 @@  static void pci_virtio_vga(void)
 
 int main(int argc, char **argv)
 {
+    const char *arch = qtest_get_arch();
+
     g_test_init(&argc, &argv, NULL);
 
-    qtest_add_func("/display/pci/cirrus", pci_cirrus);
+    if (strcmp(arch, "alpha") == 0 || strcmp(arch, "i386") == 0 ||
+        strcmp(arch, "mips") == 0 || strcmp(arch, "x86_64") == 0) {
+        qtest_add_func("/display/pci/cirrus", pci_cirrus);
+    }
     qtest_add_func("/display/pci/stdvga", pci_stdvga);
     qtest_add_func("/display/pci/secondary", pci_secondary);
     qtest_add_func("/display/pci/multihead", pci_multihead);