All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [WIP] support/testing: add xserver + Mesa OpenGL (GLX) + glxinfo
@ 2019-01-07 23:50 Romain Naour
  2019-02-05  9:58 ` Peter Korsgaard
  0 siblings, 1 reply; 3+ messages in thread
From: Romain Naour @ 2019-01-07 23:50 UTC (permalink / raw)
  To: buildroot

This test allow to check if the xserver with GLX is working properly.
This is a basic test but it allow to trigger the current bug reported
by [1].

[1] https://bugs.buildroot.org/show_bug.cgi?id=11591

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/testing/tests/package/test_glxinfo.py | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 support/testing/tests/package/test_glxinfo.py

diff --git a/support/testing/tests/package/test_glxinfo.py b/support/testing/tests/package/test_glxinfo.py
new file mode 100644
index 0000000000..d5d08f7a47
--- /dev/null
+++ b/support/testing/tests/package/test_glxinfo.py
@@ -0,0 +1,57 @@
+import os
+
+import infra.basetest
+
+GLXINFO_TIMEOUT = 120
+
+class TestGlxinfo(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_x86_core2=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+        BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
+        BR2_TOOLCHAIN_EXTERNAL_URL="http://toolchains.bootlin.com/downloads/releases/toolchains/x86-core2/tarballs/x86-core2--glibc--bleeding-edge-2018.11-1.tar.bz2"
+        BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
+        BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
+        # BR2_TOOLCHAIN_EXTERNAL_LOCALE is not set
+        BR2_TOOLCHAIN_EXTERNAL_CXX=y
+        BR2_TOOLCHAIN_EXTERNAL_HAS_SSP=y
+        BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG=y
+        BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS=y
+        BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_NPTL=y
+        BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7"
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86/linux.config"
+        BR2_PACKAGE_MESA3D_DEMOS=y
+        BR2_PACKAGE_MESA3D=y
+        BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
+        BR2_PACKAGE_MESA3D_DRI_DRIVER_SWRAST=y
+        BR2_PACKAGE_XORG7=y
+        BR2_PACKAGE_XSERVER_XORG_SERVER=y
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
+        BR2_TARGET_ROOTFS_EXT2=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def login(self):
+        img = os.path.join(self.builddir, "images", "rootfs.ext2")
+        kern = os.path.join(self.builddir, "images", "bzImage")
+        # glxinfo overallocate memory and the minimum that seemed to work was 512MB
+        self.emulator.boot(arch="i386",
+                           kernel=kern,
+                           kernel_cmdline=["root=/dev/vda console=ttyS0"],
+                           options=["-M", "pc", "-m", "512", "-drive", "file={},if=virtio,format=raw".format(img)])
+        self.emulator.login()
+
+    def test_run(self):
+        self.login()
+
+        # The test case verifies that the xserver with GLX is working
+        cmd = "glxinfo -display :0 2>&1 >/dev/null | grep Error"
+        # Error case: "Error: couldn't find RGB GLX visual or fbconfig"
+        _, exit_code = self.emulator.run(cmd, GLXINFO_TIMEOUT)
+        self.assertEqual(exit_code, 1)
-- 
2.14.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [WIP] support/testing: add xserver + Mesa OpenGL (GLX) + glxinfo
  2019-01-07 23:50 [Buildroot] [WIP] support/testing: add xserver + Mesa OpenGL (GLX) + glxinfo Romain Naour
@ 2019-02-05  9:58 ` Peter Korsgaard
  2019-03-20 11:51   ` Romain Naour
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Korsgaard @ 2019-02-05  9:58 UTC (permalink / raw)
  To: buildroot

>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:

 > This test allow to check if the xserver with GLX is working properly.
 > This is a basic test but it allow to trigger the current bug reported
 > by [1].

 > [1] https://bugs.buildroot.org/show_bug.cgi?id=11591

 > Signed-off-by: Romain Naour <romain.naour@gmail.com>
 > Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
 > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > ---
 >  support/testing/tests/package/test_glxinfo.py | 57 +++++++++++++++++++++++++++
 >  1 file changed, 57 insertions(+)
 >  create mode 100644 support/testing/tests/package/test_glxinfo.py

..

 > +    def test_run(self):
 > +        self.login()
 > +

Dont we need to wait for the xserver to start?

 > +        # The test case verifies that the xserver with GLX is working
 > +        cmd = "glxinfo -display :0 2>&1 >/dev/null | grep Error"
 > +        # Error case: "Error: couldn't find RGB GLX visual or fbconfig"

Why the redirect / grep when you ignore the output in emulator.run()?

> +        _, exit_code = self.emulator.run(cmd, GLXINFO_TIMEOUT)
 > +        self.assertEqual(exit_code, 1)

So your expect glxinfo to fail?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [WIP] support/testing: add xserver + Mesa OpenGL (GLX) + glxinfo
  2019-02-05  9:58 ` Peter Korsgaard
@ 2019-03-20 11:51   ` Romain Naour
  0 siblings, 0 replies; 3+ messages in thread
From: Romain Naour @ 2019-03-20 11:51 UTC (permalink / raw)
  To: buildroot

Hi Peter,

Le 05/02/2019 ? 10:58, Peter Korsgaard a ?crit?:
>>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:
> 
>  > This test allow to check if the xserver with GLX is working properly.
>  > This is a basic test but it allow to trigger the current bug reported
>  > by [1].
> 
>  > [1] https://bugs.buildroot.org/show_bug.cgi?id=11591
> 
>  > Signed-off-by: Romain Naour <romain.naour@gmail.com>
>  > Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
>  > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>  > ---
>  >  support/testing/tests/package/test_glxinfo.py | 57 +++++++++++++++++++++++++++
>  >  1 file changed, 57 insertions(+)
>  >  create mode 100644 support/testing/tests/package/test_glxinfo.py
> 
> ..
> 
>  > +    def test_run(self):
>  > +        self.login()
>  > +
> 
> Dont we need to wait for the xserver to start?

The test succeed without wait_for_xserver.

I can add a function wait_for_xserver (like wait_for_dockerd function in
docker_compose test).

    def wait_for_xserver(self):
        # xserver takes some time to start up
        _, _ = self.emulator.run('while [ pidof Xorg >/dev/null 2>&1 ]; do sleep
1; done', 120)

> 
>  > +        # The test case verifies that the xserver with GLX is working
>  > +        cmd = "glxinfo -display :0 2>&1 >/dev/null | grep Error"
>  > +        # Error case: "Error: couldn't find RGB GLX visual or fbconfig"
> 
> Why the redirect / grep when you ignore the output in emulator.run()?

Actually the std outpout of glxinfo is redirected to /dev/null and the std error
is redirected to the std input of grep.

> 
>> +        _, exit_code = self.emulator.run(cmd, GLXINFO_TIMEOUT)
>  > +        self.assertEqual(exit_code, 1)>
> So your expect glxinfo to fail?
> 
So, we actually test the return code of grep command.

If grep doesn't find "Error" then the test is OK (grep return code is 1).
else grep find "Error" then the test is KO (grep return code is 0).

I agree, it's a bit tricky here...

Best regards,
Romain

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-20 11:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07 23:50 [Buildroot] [WIP] support/testing: add xserver + Mesa OpenGL (GLX) + glxinfo Romain Naour
2019-02-05  9:58 ` Peter Korsgaard
2019-03-20 11:51   ` Romain Naour

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.