test_glxinfo.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_CUSTOM=y
  10. BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
  11. BR2_TOOLCHAIN_EXTERNAL_URL="http://toolchains.bootlin.com/downloads/releases/toolchains/x86-core2/tarballs/x86-core2--glibc--bleeding-edge-2018.11-1.tar.bz2"
  12. BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
  13. BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
  14. # BR2_TOOLCHAIN_EXTERNAL_LOCALE is not set
  15. BR2_TOOLCHAIN_EXTERNAL_CXX=y
  16. BR2_TOOLCHAIN_EXTERNAL_HAS_SSP=y
  17. BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG=y
  18. BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS=y
  19. BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_NPTL=y
  20. BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
  21. BR2_LINUX_KERNEL=y
  22. BR2_LINUX_KERNEL_CUSTOM_VERSION=y
  23. BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7"
  24. BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
  25. BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86/linux.config"
  26. BR2_PACKAGE_MESA3D_DEMOS=y
  27. BR2_PACKAGE_MESA3D=y
  28. BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
  29. BR2_PACKAGE_MESA3D_DRI_DRIVER_SWRAST=y
  30. BR2_PACKAGE_XORG7=y
  31. BR2_PACKAGE_XSERVER_XORG_SERVER=y
  32. BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
  33. BR2_TARGET_ROOTFS_EXT2=y
  34. # BR2_TARGET_ROOTFS_TAR is not set
  35. """
  36. def wait_for_xserver(self):
  37. # xserver takes some time to start up
  38. # The test case fail here if for some reason xserver is not properly installed
  39. _, _ = self.emulator.run('while [ ! -e /var/run/xorg.pid ]; do sleep 1; done', 120)
  40. def login(self):
  41. img = os.path.join(self.builddir, "images", "rootfs.ext2")
  42. kern = os.path.join(self.builddir, "images", "bzImage")
  43. # glxinfo overallocate memory and the minimum that seemed to work was 512MB
  44. self.emulator.boot(arch="i386",
  45. kernel=kern,
  46. kernel_cmdline=["root=/dev/vda console=ttyS0"],
  47. options=["-M", "pc", "-m", "512", "-drive", "file={},if=virtio,format=raw".format(img)])
  48. self.emulator.login()
  49. def test_run(self):
  50. self.login()
  51. self.wait_for_xserver()
  52. # The test case verifies that the xserver with GLX is working
  53. cmd = "glxinfo -B -display :0"
  54. output, exit_code = self.emulator.run(cmd, GLXINFO_TIMEOUT)
  55. self.assertEqual(exit_code, 0)
  56. for line in output:
  57. self.assertNotIn("Error", line)
  58. # Error case: "Error: couldn't find RGB GLX visual or fbconfig"