test_glxinfo.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_SWRAST=y
  19. BR2_PACKAGE_MESA3D_OPENGL_GLX=y
  20. BR2_PACKAGE_XORG7=y
  21. BR2_PACKAGE_XSERVER_XORG_SERVER=y
  22. BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
  23. BR2_TARGET_ROOTFS_EXT2=y
  24. # BR2_TARGET_ROOTFS_TAR is not set
  25. BR2_ROOTFS_OVERLAY="{}"
  26. """.format(
  27. infra.filepath("tests/package/test_glxinfo/rootfs-overlay"))
  28. def wait_for_xserver(self):
  29. # xserver takes some time to start up
  30. # The test case fail here if for some reason xserver is not properly installed
  31. _, _ = self.emulator.run('while [ ! -e /var/run/xorg.pid ]; do sleep 1; done', 120)
  32. def login(self):
  33. img = os.path.join(self.builddir, "images", "rootfs.ext2")
  34. kern = os.path.join(self.builddir, "images", "bzImage")
  35. # glxinfo overallocate memory and the minimum that seemed to work was 512MB
  36. self.emulator.boot(arch="i386",
  37. kernel=kern,
  38. kernel_cmdline=["root=/dev/vda console=ttyS0"],
  39. options=["-M", "pc", "-cpu", "core2duo", "-m", "512",
  40. "-drive", "file={},if=virtio,format=raw".format(img)])
  41. self.emulator.login()
  42. def test_run(self):
  43. self.login()
  44. self.wait_for_xserver()
  45. # The test case verifies that the xserver with GLX is working
  46. cmd = "glxinfo -B -display :0"
  47. output, exit_code = self.emulator.run(cmd, GLXINFO_TIMEOUT)
  48. self.assertEqual(exit_code, 0)
  49. for line in output:
  50. self.assertNotIn("Error", line)
  51. # Error case: "Error: couldn't find RGB GLX visual or fbconfig"