test_mesa3d.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import os
  2. import infra.basetest
  3. RUSTICL_TIMEOUT = 180
  4. class TestMesa3DRusticl(infra.basetest.BRTest):
  5. config = """
  6. BR2_aarch64=y
  7. BR2_TOOLCHAIN_EXTERNAL=y
  8. BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
  9. BR2_LINUX_KERNEL=y
  10. BR2_LINUX_KERNEL_CUSTOM_VERSION=y
  11. BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.31"
  12. BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
  13. BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
  14. BR2_PACKAGE_MESA3D=y
  15. BR2_PACKAGE_MESA3D_LLVM=y
  16. BR2_PACKAGE_MESA3D_OPENCL=y
  17. BR2_PACKAGE_MESA3D_RUSTICL=y
  18. BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_LLVMPIPE=y
  19. BR2_PACKAGE_CLINFO=y
  20. BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
  21. BR2_TARGET_ROOTFS_EXT2=y
  22. BR2_TARGET_ROOTFS_EXT2_SIZE="1024M"
  23. # BR2_TARGET_ROOTFS_TAR is not set
  24. """
  25. def login(self):
  26. img = os.path.join(self.builddir, "images", "rootfs.ext2")
  27. kern = os.path.join(self.builddir, "images", "Image")
  28. self.emulator.boot(
  29. arch="aarch64",
  30. kernel=kern,
  31. kernel_cmdline=["root=/dev/vda console=ttyAMA0"],
  32. options=[
  33. "-M", "virt",
  34. "-cpu", "cortex-a57",
  35. "-m", "512",
  36. "-drive", f"file={img},if=virtio,format=raw"
  37. ]
  38. )
  39. self.emulator.login()
  40. def test_run(self):
  41. self.login()
  42. # check the output exit code
  43. output, exit_code = self.emulator.run("RUSTICL_ENABLE=llvmpipe clinfo", RUSTICL_TIMEOUT)
  44. self.assertEqual(exit_code, 0)
  45. # also check if platform name is rusticl and device name is llvmpipe
  46. self.assertRegex("\n".join(output), r"Platform Name\s+rusticl")
  47. self.assertRegex("\n".join(output), r"Device Name\s+llvmpipe")