[Qemu-devel] [PATCH for-4.0] tests/display-vga: Enable virtio-vga test

Thomas Huth posted 1 patch 5 years, 4 months ago
Test asan passed
Test checkpatch passed
Test docker-quick@centos7 passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1543492248-28356-1-git-send-email-thuth@redhat.com
tests/Makefile.include   |  5 +++++
tests/display-vga-test.c | 10 +++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
[Qemu-devel] [PATCH for-4.0] tests/display-vga: Enable virtio-vga test
Posted by Thomas Huth 5 years, 4 months ago
There are some "#ifdef CONFIG_VIRTIO_VGA" in the code here which
do not work as expected: CONFIG_VIRTIO_VGA is a Makefile switch,
but not a CPP macro, so the "guarded" code currently simply never
gets enabled.

So enable this code now unconditionally, with some runtime switches
for the architectures that have the VIRTIO_VGA device enabled by
default. Looking at the other if-statement in the main function here,
it also seems like this test was originally supposed to be running
on "mips" and "alpha", too, so enable it now for these architectures
in the Makefile, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 Yes, I know, this will likely also be done in a better way once
 "qgraph" gets merged ... but for the time being, it's a simple
 fix to get some more test coverage...

 tests/Makefile.include   |  5 +++++
 tests/display-vga-test.c | 10 +++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9b26116..9336029 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -222,18 +222,23 @@ check-qtest-x86_64-y += $(check-qtest-i386-y)
 check-qtest-x86_64-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF)
 
 check-qtest-alpha-y += tests/boot-serial-test$(EXESUF)
+check-qtest-alpha-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
 
 check-qtest-hppa-y += tests/boot-serial-test$(EXESUF)
+check-qtest-hppa-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
 
 check-qtest-m68k-y = tests/boot-serial-test$(EXESUF)
 
 check-qtest-microblaze-y += tests/boot-serial-test$(EXESUF)
 
 check-qtest-mips-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
+check-qtest-mips-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
 
 check-qtest-mips64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
+check-qtest-mips64-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
 
 check-qtest-mips64el-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
+check-qtest-mips64el-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
 
 check-qtest-moxie-y += tests/boot-serial-test$(EXESUF)
 
diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c
index 2d7d24e..bd176dc 100644
--- a/tests/display-vga-test.c
+++ b/tests/display-vga-test.c
@@ -40,13 +40,11 @@ static void pci_virtio_gpu(void)
     qtest_end();
 }
 
-#ifdef CONFIG_VIRTIO_VGA
 static void pci_virtio_vga(void)
 {
     qtest_start("-vga none -device virtio-vga");
     qtest_end();
 }
-#endif
 
 int main(int argc, char **argv)
 {
@@ -62,8 +60,10 @@ int main(int argc, char **argv)
     qtest_add_func("/display/pci/secondary", pci_secondary);
     qtest_add_func("/display/pci/multihead", pci_multihead);
     qtest_add_func("/display/pci/virtio-gpu", pci_virtio_gpu);
-#ifdef CONFIG_VIRTIO_VGA
-    qtest_add_func("/display/pci/virtio-vga", pci_virtio_vga);
-#endif
+    if (g_str_equal(arch, "i386") || g_str_equal(arch, "x86_64") ||
+        g_str_equal(arch, "hppa") || g_str_equal(arch, "ppc64")) {
+        qtest_add_func("/display/pci/virtio-vga", pci_virtio_vga);
+    }
+
     return g_test_run();
 }
-- 
1.8.3.1


Re: [Qemu-devel] [PATCH for-4.0] tests/display-vga: Enable virtio-vga test
Posted by Gerd Hoffmann 5 years, 4 months ago
On Thu, Nov 29, 2018 at 12:50:48PM +0100, Thomas Huth wrote:
> There are some "#ifdef CONFIG_VIRTIO_VGA" in the code here which
> do not work as expected: CONFIG_VIRTIO_VGA is a Makefile switch,
> but not a CPP macro, so the "guarded" code currently simply never
> gets enabled.
> 
> So enable this code now unconditionally, with some runtime switches
> for the architectures that have the VIRTIO_VGA device enabled by
> default. Looking at the other if-statement in the main function here,
> it also seems like this test was originally supposed to be running
> on "mips" and "alpha", too, so enable it now for these architectures
> in the Makefile, too.

Added to vga queue.

thanks,
  Gerd