test_glxinfo.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import os
  2. import infra.basetest
  3. GLXINFO_TIMEOUT = 120
  4. class TestGlxinfo(infra.basetest.BRTest):
  5. config = \
  6. """
  7. BR2_x86_core2=y
  8. BR2_TOOLCHAIN_EXTERNAL=y
  9. BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
  10. BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_CORE2_GLIBC_STABLE=y
  11. BR2_LINUX_KERNEL=y
  12. BR2_LINUX_KERNEL_CUSTOM_VERSION=y
  13. BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.26"
  14. BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
  15. BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86/linux.config"
  16. BR2_PACKAGE_MESA3D_DEMOS=y
  17. BR2_PACKAGE_MESA3D=y
  18. BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SOFTPIPE=y
  19. BR2_PACKAGE_MESA3D_OPENGL_EGL=y
  20. BR2_PACKAGE_MESA3D_OPENGL_GLX=y
  21. BR2_PACKAGE_XORG7=y
  22. BR2_PACKAGE_XSERVER_XORG_SERVER=y
  23. BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
  24. BR2_TARGET_ROOTFS_EXT2=y
  25. # BR2_TARGET_ROOTFS_TAR is not set
  26. BR2_ROOTFS_OVERLAY="{}"
  27. """.format(
  28. infra.filepath("tests/package/test_glxinfo/rootfs-overlay"))
  29. def wait_for_xserver(self):
  30. # xserver takes some time to start up
  31. # The test case fail here if for some reason xserver is not properly installed
  32. _, _ = self.emulator.run('while [ ! -e /var/run/xorg.pid ]; do sleep 1; done', 120)
  33. def login(self):
  34. img = os.path.join(self.builddir, "images", "rootfs.ext2")
  35. kern = os.path.join(self.builddir, "images", "bzImage")
  36. # glxinfo overallocate memory and the minimum that seemed to work was 512MB
  37. self.emulator.boot(arch="i386",
  38. kernel=kern,
  39. kernel_cmdline=["root=/dev/vda console=ttyS0"],
  40. options=["-M", "pc", "-cpu", "core2duo", "-m", "512",
  41. "-drive", "file={},if=virtio,format=raw".format(img)])
  42. self.emulator.login()
  43. def test_run(self):
  44. self.login()
  45. self.wait_for_xserver()
  46. # The test case verifies that the xserver with GLX is working
  47. cmd = "glxinfo -B -display :0"
  48. output, exit_code = self.emulator.run(cmd, GLXINFO_TIMEOUT)
  49. self.assertEqual(exit_code, 0)
  50. for line in output:
  51. self.assertNotIn("Error", line)
  52. # Error case: "Error: couldn't find RGB GLX visual or fbconfig"