2019-04-11 17:58:04 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
import infra.basetest
|
|
|
|
|
|
|
|
GLXINFO_TIMEOUT = 120
|
|
|
|
|
|
|
|
|
|
|
|
class TestGlxinfo(infra.basetest.BRTest):
|
|
|
|
config = \
|
|
|
|
"""
|
|
|
|
BR2_x86_core2=y
|
|
|
|
BR2_TOOLCHAIN_EXTERNAL=y
|
2023-06-11 13:57:48 +02:00
|
|
|
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
|
|
|
|
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_CORE2_GLIBC_STABLE=y
|
2019-04-11 17:58:04 +02:00
|
|
|
BR2_LINUX_KERNEL=y
|
|
|
|
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
2023-06-11 13:57:47 +02:00
|
|
|
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.26"
|
2019-04-11 17:58:04 +02:00
|
|
|
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
|
2021-05-13 16:11:48 +02:00
|
|
|
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
|
2020-02-13 22:40:45 +01:00
|
|
|
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
|
2019-04-11 17:58:04 +02:00
|
|
|
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
|
2021-05-13 16:11:49 +02:00
|
|
|
BR2_ROOTFS_OVERLAY="{}"
|
|
|
|
""".format(
|
|
|
|
infra.filepath("tests/package/test_glxinfo/rootfs-overlay"))
|
2019-04-11 17:58:04 +02:00
|
|
|
|
|
|
|
def wait_for_xserver(self):
|
|
|
|
# xserver takes some time to start up
|
|
|
|
# The test case fail here if for some reason xserver is not properly installed
|
|
|
|
_, _ = self.emulator.run('while [ ! -e /var/run/xorg.pid ]; do sleep 1; done', 120)
|
|
|
|
|
|
|
|
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"],
|
2024-02-06 13:49:47 +01:00
|
|
|
options=["-M", "pc", "-cpu", "core2duo", "-m", "512",
|
|
|
|
"-drive", "file={},if=virtio,format=raw".format(img)])
|
2019-04-11 17:58:04 +02:00
|
|
|
self.emulator.login()
|
|
|
|
|
|
|
|
def test_run(self):
|
|
|
|
self.login()
|
|
|
|
self.wait_for_xserver()
|
|
|
|
|
|
|
|
# The test case verifies that the xserver with GLX is working
|
|
|
|
cmd = "glxinfo -B -display :0"
|
|
|
|
output, exit_code = self.emulator.run(cmd, GLXINFO_TIMEOUT)
|
|
|
|
self.assertEqual(exit_code, 0)
|
|
|
|
for line in output:
|
|
|
|
self.assertNotIn("Error", line)
|
|
|
|
# Error case: "Error: couldn't find RGB GLX visual or fbconfig"
|